1# MACRO: exit 2 .macro exit nr 3 li a0, \nr 4 # The exit utility function. 5 li a7, 93; 6 # Trigger OS trap. 7 ecall; 8 .endm 9 10# MACRO: pass 11# Write 'pass' to stdout and quit. 12 .macro pass 13 # syscall write(). 14 li a7, 64; 15 # Use stdout. 16 li a0, 1; 17 # Point to the string. 18 lla a1, 1f; 19 # Number of bytes to write. 20 li a2, 5; 21 # Trigger OS trap. 22 ecall; 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 # syscall write(). 32 li a7, 64; 33 # Use stdout. 34 li a0, 1; 35 # Point to the string. 36 lla a1, 1f; 37 # Number of bytes to write. 38 li a2, 5; 39 # Trigger OS trap. 40 ecall; 41 exit 0; 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