1# MACRO: exit 2 .macro exit nr 3 ori r5, r0, \nr; 4 # Trap function 1: exit(). 5 ori r4, r0, 1; 6 syscall; 7 .endm 8 9# MACRO: pass 10# Write 'pass' to stdout and quit 11 .macro pass 12 # Trap function 5: write(). 13 ori r4, r0, 5; 14 # Use stdout. 15 ori r5, r0, 1; 16 # Point to the string. 17 lui r6, %hi(1f); 18 ori r6, r6, %lo(1f); 19 # Number of bytes to write. 20 ori r7, r0, 5; 21 # Trigger OS trap. 22 syscall; 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 5: write(). 32 ori r4, r0, 5; 33 # Use stdout. 34 ori r5, r0, 1; 35 # Point to the string. 36 lui r6, %hi(1f); 37 ori r6, r6, %lo(1f); 38 # Number of bytes to write. 39 ori r7, r0, 5; 40 # Trigger OS trap. 41 syscall; 42 exit 0 43 .data 44 1: .asciz "fail\n" 45 .endm 46 47# MACRO: start 48# All assembler tests should start with a call to "start" 49 .macro start 50 .text 51.global _start 52_start: 53 .endm 54