Home | History | Annotate | Line # | Download | only in arm
      1 # output(): Hello, world.\n
      2 # mach(): all
      3 
      4 # This is a test for movw & movt instructions.
      5 # It emits hello world if movw & movt works appropriately.
      6 
      7 	.macro invalid
      8 # This is "undefined" but it's not properly decoded yet.
      9 	.word 0x07ffffff
     10 # This is stc which isn't recognized yet.
     11 	stc 0,cr0,[r0]
     12 	.endm
     13 
     14 	.global _start
     15 _start:
     16 # Run some simple insns to confirm the engine is at least working.
     17 	nop
     18 
     19 # Skip over output text.
     20 
     21 	bl skip_output
     22 
     23 hello_text:
     24 	.asciz "Hello, world.\n"
     25 
     26 	.p2align 2
     27 skip_output:
     28 	movw r4, #:lower16:hello_text
     29 	movt r4, #:upper16:hello_text
     30 
     31 output_next:
     32 # Output a character
     33 	mov r0,#3
     34 	mov r1,r4
     35 	swi #0x123456
     36 
     37 # Load next character, see if done.
     38 	add r4,r4,#1
     39 	sub r3,r3,r3
     40 	ldrb r5,[r4,r3]
     41 	teq r5,#0
     42 	bne output_next
     43 
     44 done:
     45 	mov r0,#0x18
     46 	ldr r1,exit_code
     47 	swi #0x123456
     48 
     49 # If that fails, try to die with an invalid insn.
     50 	invalid
     51 
     52 exit_code:
     53 	.word 0x20026
     54