1 1.1 christos # FIXME: wip, copied from ../testutils.inc 2 1.1 christos # r0-r3 are used as tmps, consider them call clobbered by these macros. 3 1.1 christos # This uses the angel rom monitor calls. 4 1.1 christos # ??? How do we use the \@ facility of .macros ??? 5 1.1 christos # @ is the comment char! 6 1.1 christos 7 1.1 christos .macro a_mvi_h_gr reg, val 8 1.1 christos ldr \reg,[pc] 9 1.1 christos b . + 8 10 1.1 christos .word \val 11 1.1 christos .endm 12 1.1 christos 13 1.1 christos .macro mvaddr_h_gr reg, addr 14 1.1 christos ldr \reg,[pc] 15 1.1 christos b . + 8 16 1.1 christos .word \val 17 1.1 christos .endm 18 1.1 christos 19 1.1 christos .macro start 20 1.1 christos .data 21 1.1 christos failmsg: 22 1.1 christos .asciz "fail\n" 23 1.1 christos passmsg: 24 1.1 christos .asciz "pass\n" 25 1.1 christos .text 26 1.1 christos 27 1.1 christos do_pass: 28 1.1 christos ldr r1, passmsg_addr 29 1.1 christos mov r0, #4 30 1.1 christos swi #0x123456 31 1.1 christos exit 0 32 1.1 christos passmsg_addr: 33 1.1 christos .word passmsg 34 1.1 christos 35 1.1 christos do_fail: 36 1.1 christos ldr r1, failmsg_addr 37 1.1 christos mov r0, #4 38 1.1 christos swi #0x123456 39 1.1 christos exit 1 40 1.1 christos failmsg_addr: 41 1.1 christos .word failmsg 42 1.1 christos 43 1.1 christos .global _start 44 1.1 christos _start: 45 1.1 christos .endm 46 1.1 christos 47 1.1 christos # *** Other macros know pass/fail are 4 bytes in size! Yuck. 48 1.1 christos 49 1.1 christos .macro pass 50 1.1 christos b do_pass 51 1.1 christos .endm 52 1.1 christos 53 1.1 christos .macro fail 54 1.1 christos b do_fail 55 1.1 christos .endm 56 1.1 christos 57 1.1 christos .macro exit rc 58 1.1 christos mov r1, #\rc 59 1.1 christos mov r0, #0x2a @ decimal 42 60 1.1 christos swi #1 61 1.1 christos # If that returns, punt with a sigill. 62 1.1 christos stc 0,cr0,[r0] 63 1.1 christos .endm 64 1.1 christos 65 1.1 christos # Other macros know this only clobbers r0. 66 1.1 christos .macro test_h_gr reg, val 67 1.1 christos mvaddr_h_gr r0, \val 68 1.1 christos cmp \reg, r0 69 1.1 christos beq . + 8 70 1.1 christos fail 71 1.1 christos .endm 72 1.1 christos 73 1.1 christos .macro mvi_h_cc c, n, v, z 74 1.1 christos ldi8 r0, 0 75 1.1 christos ldi8 r1, 1 76 1.1 christos .if xxx 77 1.1 christos cmp r0, r1 78 1.1 christos .else 79 1.1 christos cmp r1, r0 80 1.1 christos .endif 81 1.1 christos .endm 82 1.1 christos 83 1.1 christos .macro test_h_cc c, n, v, z 84 1.1 christos .if xxx 85 1.1 christos bc . + 8 86 1.1 christos fail 87 1.1 christos .else 88 1.1 christos bnc . + 8 89 1.1 christos fail 90 1.1 christos .endif 91 1.1 christos .endm 92