1 # MACRO: exit 2 .macro exit nr 3 movi r2, \nr 4 # The exit utility function. 5 .byte 0x00 6 # The debug insn class. 7 .byte 0x50 8 .endm 9 10 # MACRO: pass 11 # Write 'pass' to stdout and quit 12 .macro pass 13 # Trap function 4: write(). 14 movi r1, 4; 15 # Use stdout. 16 movi r2, 1; 17 # Point to the string. 18 lrw r3, 1f; 19 # Number of bytes to write. 20 movi r4, 5; 21 # Trigger OS trap. 22 trap 1; 23 exit 0 24 .data 25 1: .asciz "pass\n" 26 .endm 27 28 # MACRO: fail 29 # Write 'fail' to stdout and quit 30 .macro fail 31 # Trap function 4: write(). 32 movi r1, 4; 33 # Use stdout. 34 movi r2, 1; 35 # Point to the string. 36 lrw r3, 1f; 37 # Number of bytes to write. 38 movi r4, 5; 39 # Trigger OS trap. 40 trap 1; 41 exit 1 42 .data 43 1: .asciz "fail\n" 44 .endm 45 46 # MACRO: start 47 # All assembler tests should start with a call to "start" 48 .macro start 49 .text 50 .global _start 51 _start: 52 .endm 53