1# MACRO: exit 2 .macro exit nr 3 mov \nr, d1; 4 # Trap function 1: exit(). 5 mov 1, d0; 6 syscall; 7 .endm 8 9# MACRO: pass 10# Write 'pass' to stdout and quit 11 .macro pass 12 # Trap function 5: write(). 13 mov 5, d0; 14 # Use stdout. 15 mov 1, d1; 16 # Point to the string. 17 mov 1f, a0; 18 mov a0, (12, sp); 19 # Number of bytes to write. 20 mov 5, d3; 21 mov d3, (16, sp); 22 # Trigger OS trap. 23 syscall; 24 exit 0 25 .data 26 1: .asciz "pass\n" 27 .endm 28 29# MACRO: fail 30# Write 'fail' to stdout and quit 31 .macro fail 32 # Trap function 5: write(). 33 mov 5, d0; 34 # Use stdout. 35 mov 1, d1; 36 # Point to the string. 37 mov 1f, a0; 38 mov a0, (12, sp); 39 # Number of bytes to write. 40 mov 5, d3; 41 mov d3, (16, sp); 42 # Trigger OS trap. 43 syscall; 44 exit 0 45 .data 46 1: .asciz "fail\n" 47 .endm 48 49# MACRO: start 50# All assembler tests should start with a call to "start" 51 .macro start 52 .data 53.global _stack 54_stack: 55 .rept 8 56 .long 0 57 .endr 58 .text 59.global _start 60_start: 61 mov _stack, a0; 62 mov a0, sp; 63 .endm 64