.macro EXIT_
        mov    x0, 0          // Return code
        mov    x8, 93         // sys_exit
        svc    0x00000000
.endm

.macro GETCHAR
        str   x8, [sp, -16]!
        mov     x0, 0          // stdin
        ldr     x1, =in_ch     // Address
        mov     x2, 1          // length
        mov     x8, 63         // sys_read
        svc     0x00000000
        cmp     x0, 0          // returned size == 0
        bne     .L1
        mvn     x0, x0         // x0 = -1
        b       .L0
.L1:
        ldr     x1, =in_ch
        ldr     x0, [x1]       // return character in x0
.L0:
        ldr   x8, [sp], 16
.endm

.macro PUTCHAR
        str   x8, [sp, -16]!
        mov   x8, 64
        mov   x0, 1
        ldr   x1, =out_ch
        str   x2, [x1]
        mov   x2, 1
        svc   0x00000000
        ldr   x8, [sp], 16
.endm
