
.macro EXIT_
        li a0, 0 # return code 0
        li a7, 93 # sys_exit
        ecall # system call
.endm

.macro GETCHAR
        li   a0, 0 # stdin
        lui  a1, %hi(in_ch)
        addi a1, a1, %lo(in_ch)
        li   a2, 1 # read one character
        li a7, 63 # sys_read
        ecall # system call
.endm

.macro PUTCHAR
        li   a0, 1 # stdout
        lui a1, %hi(out_ch)
        addi a1, a1, %lo(out_ch)
        li a2, 1 # read one character
        li a3, 0
        li a7, 64 # sys_write
        ecall # system call
.endm
