%define SYS_EXIT 1
%define SYS_READ 3
%define SYS_WRITE 4
%define STDIN 0
%define STDOUT 1
%define _START _start

%macro EXIT_ 0
        mov eax, SYS_EXIT
      	xor ebx, ebx ; return code of 0
       	int 0x80
%endmacro

%macro GETCHAR 0
        mov  ecx, val
        mov  eax, SYS_READ
        mov  ebx, STDIN
        mov  edx, 1
        int  0x80
        test eax, eax
        jne  L0
        mov  ebx, 1
        mov  edx, eof_reached
        mov  [edx], ebx
        mov  eax, -1
        ret
L0:
        mov  eax, [ecx]
        and  eax, 255 ; mask out char value
%endmacro

%macro PUTCHAR 0
         mov  eax, SYS_WRITE
         mov  ebx, STDOUT
         mov  ecx, edi ; address of byte to write
         mov  edx, 1
         int  0x80
%endmacro

