        SYS_EXIT = 1
        SYS_READ = 3
        SYS_WRITE = 4
        STDIN = 0
        STDOUT = 1

.macro EXIT_
        mov $SYS_EXIT, %eax
      	xor %ebx, %ebx # return code of 0
       	int $0x80
.endm

.macro GETCHAR
        mov  $val, %ecx
        mov  $SYS_READ, %eax
        mov  $STDIN, %ebx
        mov  $1, %edx
        int  $0x80
        test %eax, %eax
        jne  L0
        mov  $-1, %eax
        ret
L0:
        mov  (%ecx), %eax
        and  $255, %eax # mask out char value
.endm

.macro PUTCHAR
         mov  $SYS_WRITE, %eax
         mov  $STDOUT, %ebx
         mov  %edi, %ecx # address of byte to write
         mov  $1, %edx
         int  $0x80
.endm
