[BITS 16]
[section .text]

org 100h

	call _main

	ret

global _is_digit
global _strlen
global _atoi
global _scanf
global _print_short
global _printf
global _strcpy
global _main
global _putc
global _getch

[segment .text]

%include "io.asm"


%define _ret -2
%define _i -4
%define _n -6
%define _off -8
%define _num -20
%define temp1 -22
%define _str 4

_atoi:
	push bp
	mov bp,sp
	sub sp,word 20
	push word 0
	mov bx,word 4
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	push bx
	mov dx,word 10000
	pop di
	mov [di],dx
	mov ax,dx
	push word 0
	mov bx,word 3
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	push bx
	mov dx,word 1000
	pop di
	mov [di],dx
	mov ax,dx
	push word 0
	mov bx,word 2
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	push bx
	mov dx,word 100
	pop di
	mov [di],dx
	mov ax,dx
	push word 0
	mov bx,word 1
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	push bx
	mov dx,word 10
	pop di
	mov [di],dx
	mov ax,dx
	push word 0
	mov bx,word 0
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	push bx
	mov dx,word 1
	pop di
	mov [di],dx
	mov ax,dx
	mov [bp+_ret],word 0
	push word [bp+_str]
	call _strlen
	add sp,word 2
	mov [bp+_n],ax
	push word [bp+_n]
	mov bx,word 1
	pop dx
	sub dx,bx
	mov [bp+_off],dx
	mov [bp+_i],word 0
	push ax
.L9:	
	push word [bp+_i]
	mov bx,word [bp+_n]
	pop dx
	cmp dx,bx
	jl .L10
	mov ax,word 0
	jmp .L11
.L10:	
	mov ax,word 1
.L11:	
	cmp ax,word 0
	je .L8
	sub sp,word 2
	push word 0
	mov bx,word [bp+_i]
	pop dx
	add bx,dx
	push bx
	mov bx,[bp+_str]
	pop dx
	push bx
	add bx,dx
	mov al,[bx]
	cpush al
	pop word [bp+temp1]
	mov ax,'0'
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L13
	jmp .L12
.L13:	
	mov ax,'1'
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L14
	push word [bp+_ret]
	push 1
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L12
.L14:	
	mov ax,'2'
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L15
	push word [bp+_ret]
	push 2
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L12
.L15:	
	mov ax,'3'
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L16
	push word [bp+_ret]
	push 3
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L12
.L16:	
	mov ax,'4'
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L17
	push word [bp+_ret]
	push 4
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L12
.L17:	
	mov ax,'5'
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L18
	push word [bp+_ret]
	push 5
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L12
.L18:	
	mov ax,'6'
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L19
	push word [bp+_ret]
	push 6
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L12
.L19:	
	mov ax,'7'
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L20
	push word [bp+_ret]
	push 7
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L12
.L20:	
	mov ax,'8'
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L21
	push word [bp+_ret]
	push 8
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L12
.L21:	
	mov ax,'9'
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L22
	push word [bp+_ret]
	push 9
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L12
.L22:	
.L12:	
	inc word [bp+_i]
	mov ax,word [bp+_i]
	jmp .L9
.L8:	
	mov ax,word [bp+_ret]
	leave
	ret
%undef _ret
%undef _i
%undef _n
%undef _off
%undef _num
%undef temp1
%undef _str

%define _ch 4

_is_digit:
	push bp
	mov bp,sp
	push word [bp+_ch]
	mov bx,word '0'
	pop dx
	cmp dx,bx
	jge .L1
	push 0
	jmp .L2
.L1:	
	push 1
.L2:	
	push word [bp+_ch]
	mov bx,word '9'
	pop dx
	cmp dx,bx
	jle .L3
	push 0
	jmp .L4
.L3:	
	push 1
.L4:	
	pop bx
	pop ax
	and ax,bx
	cmp ax,word 0
	je .L5
	mov ax,word 1
	leave
	ret
	jmp .L0
.L5:	
.L0:	
	mov ax,word 0
	leave
	ret
%undef _ch

%define _number -2

_main:
	push bp
	mov bp,sp
	sub sp,word 2
	mov [bp+_number],word 0
	push C0
	call _printf
	add sp,word 2
	lea ax,[bp+_number]
	push ax
	push C1
	call _scanf
	add sp,word 4
	push C2
	call _printf
	add sp,word 2
	push word [bp+_number]
	push C3
	call _printf
	add sp,word 4
	mov ax,word 0
	leave
	ret
%undef _number

%define _ret -2
%define _n -4
%define _byte_array -14
%define _buffer -24
%define _index -26
%define _number 4

_print_short:
	push bp
	mov bp,sp
	sub sp,word 26
	mov [bp+_ret],word 0
	push word 0
	mov bx,word 0
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '0'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 1
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '1'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 2
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '2'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 3
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '3'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 4
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '4'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 5
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '5'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 6
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '6'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 7
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '7'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 8
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '8'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 9
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '9'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word [bp+_number]
	mov bx,word 0
	pop dx
	cmp dx,bx
	je .L49
	mov ax,word 0
	jmp .L50
.L49:	
	mov ax,word 1
.L50:	
	cmp ax,word 0
	je .L51
	push word '0'
	call _putc
	add sp,word 2
	jmp .L48
.L51:	
.L48:	
	mov [bp+_index],word 0
.L53:	
	mov ax,word [bp+_number]
	cmp ax,word 0
	je .L52
	push word [bp+_number]
	mov bx,word 10
	pop ax
	xor dx,dx
	idiv bx
	mov [bp+_n],dx
	push word [bp+_number]
	mov bx,word 10
	pop ax
	xor dx,dx
	idiv bx
	mov [bp+_number],ax
	push word 0
	mov bx,word [bp+_index]
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_buffer]
	pop dx
	add bx,dx
	push bx
	push word 0
	mov bx,word [bp+_n]
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	mov al,[bx]
	pop di
	mov [di],al
	cpush al
	pop ax
	inc word [bp+_index]
	mov ax,word [bp+_index]
	jmp .L53
.L52:	
	dec word [bp+_index]
	mov ax,word [bp+_index]
.L55:	
	push word [bp+_index]
	mov bx,word 0
	pop dx
	cmp dx,bx
	jge .L56
	mov ax,word 0
	jmp .L57
.L56:	
	mov ax,word 1
.L57:	
	cmp ax,word 0
	je .L54
	push word 0
	mov bx,word [bp+_index]
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_buffer]
	pop dx
	add bx,dx
	mov al,[bx]
	cpush al
	call _putc
	add sp,word 2
	dec word [bp+_index]
	mov ax,word [bp+_index]
	jmp .L55
.L54:	
	mov ax,word [bp+_ret]
	leave
	ret
%undef _ret
%undef _n
%undef _byte_array
%undef _buffer
%undef _index
%undef _number

%define _ptr -2
%define _ptr0 -4
%define _ptr1 -6
%define _i -8
%define _j -10
%define _ret -12
%define _fmt 4

_printf:
	push bp
	mov bp,sp
	sub sp,word 12
	mov [bp+_ret],word 0
	mov ax,word [bp+_fmt]
	mov [bp+_ptr],ax
	mov [bp+_i],word 2
.L59:	
	mov di,[bp+_ptr]
	mov al,[di]
	cmp al,byte 0
	je .L58
	mov di,[bp+_ptr]
	mov al,[di]
	cpush al
	mov bx,word '%'
	pop dx
	cmp dx,bx
	je .L61
	mov ax,word 0
	jmp .L62
.L61:	
	mov ax,word 1
.L62:	
	cmp ax,word 0
	je .L63
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
	mov di,[bp+_ptr]
	mov al,[di]
	cpush al
	mov bx,word '%'
	pop dx
	cmp dx,bx
	je .L65
	mov ax,word 0
	jmp .L66
.L65:	
	mov ax,word 1
.L66:	
	cmp ax,word 0
	je .L67
	push word '%'
	call _putc
	add sp,word 2
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
	jmp .L64
.L67:	
	mov di,[bp+_ptr]
	mov al,[di]
	cpush al
	mov bx,word 'x'
	pop dx
	cmp dx,bx
	je .L68
	mov ax,word 0
	jmp .L69
.L68:	
	mov ax,word 1
.L69:	
	cmp ax,word 0
	je .L70
	lea ax,[bp+_fmt]
	push ax
	mov bx,word [bp+_i]
	pop dx
	add dx,bx
	mov [bp+_ptr0],dx
	push bp
	mov ax,[bp+_ptr0]
	mov bp,ax
	mov dx,[bp]
	pop bp
	push dx
	call _tohex
	add sp,word 2
	push 2
	mov bx,[bp+_i]
	pop dx
	add bx,dx
	mov [bp+_i],bx
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
	jmp .L64
.L70:	
	mov di,[bp+_ptr]
	mov al,[di]
	cpush al
	mov bx,word 'd'
	pop dx
	cmp dx,bx
	je .L71
	mov ax,word 0
	jmp .L72
.L71:	
	mov ax,word 1
.L72:	
	cmp ax,word 0
	je .L73
	lea ax,[bp+_fmt]
	push ax
	mov bx,word [bp+_i]
	pop dx
	add dx,bx
	mov [bp+_ptr0],dx
	push bp
	mov ax,[bp+_ptr0]
	mov bp,ax
	mov dx,[bp]
	pop bp
	push dx
	call _print_short
	add sp,word 2
	push 2
	mov bx,[bp+_i]
	pop dx
	add bx,dx
	mov [bp+_i],bx
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
	jmp .L64
.L73:	
	mov di,[bp+_ptr]
	mov al,[di]
	cpush al
	mov bx,word 's'
	pop dx
	cmp dx,bx
	je .L74
	mov ax,word 0
	jmp .L75
.L74:	
	mov ax,word 1
.L75:	
	cmp ax,word 0
	je .L76
	lea ax,[bp+_fmt]
	push ax
	mov bx,word [bp+_i]
	pop dx
	add dx,bx
	mov [bp+_ptr0],dx
	push bp
	mov ax,[bp+_ptr0]
	mov bp,ax
	mov dx,[bp]
	pop bp
	mov [bp+_ptr1],dx
.L78:	
	mov di,[bp+_ptr1]
	mov al,[di]
	cmp al,byte 0
	je .L77
	mov di,[bp+_ptr1]
	mov al,[di]
	cpush al
	call _putc
	add sp,word 2
	inc word [bp+_ptr1]
	mov ax,word [bp+_ptr1]
	jmp .L78
.L77:	
	push 2
	mov bx,[bp+_i]
	pop dx
	add bx,dx
	mov [bp+_i],bx
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
	jmp .L64
.L76:	
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
.L64:	
	jmp .L60
.L63:	
	mov di,[bp+_ptr]
	mov al,[di]
	cpush al
	call _putc
	add sp,word 2
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
.L60:	
	jmp .L59
.L58:	
	mov ax,word 0
	leave
	ret
%undef _ptr
%undef _ptr0
%undef _ptr1
%undef _i
%undef _j
%undef _ret
%undef _fmt

%define _ptr -2
%define _p -4
%define _temp -6
%define _buffer -106
%define _offset -108
%define _ch -110
%define _count -112
%define _fmt 4

_scanf:
	push bp
	mov bp,sp
	sub sp,word 112
	mov [bp+_offset],word 0
	mov [bp+_count],word 2
	lea ax,[bp+_fmt]
	push ax
	mov bx,word [bp+_count]
	pop dx
	add dx,bx
	mov [bp+_ptr],dx
	mov ax,word [bp+_fmt]
	mov [bp+_p],ax
	push ax
.L24:	
	mov di,[bp+_p]
	mov al,[di]
	cmp al,byte 0
	je .L23
	mov di,[bp+_p]
	mov al,[di]
	cpush al
	mov bx,word '%'
	pop dx
	cmp dx,bx
	je .L26
	mov ax,word 0
	jmp .L27
.L26:	
	mov ax,word 1
.L27:	
	cmp ax,word 0
	je .L28
	inc word [bp+_p]
	mov ax,word [bp+_p]
	mov di,[bp+_p]
	mov al,[di]
	cpush al
	mov bx,word 'd'
	pop dx
	cmp dx,bx
	je .L30
	mov ax,word 0
	jmp .L31
.L30:	
	mov ax,word 1
.L31:	
	cmp ax,word 0
	je .L32
	push bp
	mov ax,[bp+_ptr]
	mov bp,ax
	mov dx,[bp]
	pop bp
	mov [bp+_temp],dx
	call _getch
	mov [bp+_ch],ax
	push word [bp+_ch]
	call _putc
	add sp,word 2
	mov [bp+_offset],word 0
.L34:	
	push word [bp+_ch]
	call _is_digit
	add sp,word 2
	push ax
	push word [bp+_ch]
	mov bx,word 13
	pop dx
	cmp dx,bx
	jne .L35
	push 0
	jmp .L36
.L35:	
	push 1
.L36:	
	push word [bp+_ch]
	mov bx,word 10
	pop dx
	cmp dx,bx
	jne .L37
	push 0
	jmp .L38
.L37:	
	push 1
.L38:	
	pop bx
	pop ax
	and ax,bx
	mov bx,ax
	pop ax
	and ax,bx
	cmp ax,word 0
	je .L33
	push word 0
	mov bx,word [bp+_offset]
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_buffer]
	pop dx
	add bx,dx
	push bx
	push word [bp+_ch]
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	inc word [bp+_offset]
	mov ax,word [bp+_offset]
	call _getch
	mov [bp+_ch],ax
	push word [bp+_ch]
	call _putc
	add sp,word 2
	jmp .L34
.L33:	
	push word 0
	mov bx,word [bp+_offset]
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_buffer]
	pop dx
	add bx,dx
	push bx
	push word 0
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	lea ax,[bp+_buffer]
	push ax
	call _atoi
	add sp,word 2
	mov di,[bp+_temp]
	mov [di],ax
	push word [bp+_count]
	mov bx,word 2
	pop dx
	add dx,bx
	mov [bp+_count],dx
	lea ax,[bp+_fmt]
	push ax
	mov bx,word [bp+_count]
	pop dx
	add dx,bx
	mov [bp+_ptr],dx
	jmp .L29
.L32:	
	mov di,[bp+_p]
	mov al,[di]
	cpush al
	mov bx,word 'f'
	pop dx
	cmp dx,bx
	je .L39
	mov ax,word 0
	jmp .L40
.L39:	
	mov ax,word 1
.L40:	
	cmp ax,word 0
	je .L41
	nop
	jmp .L29
.L41:	
	mov di,[bp+_p]
	mov al,[di]
	cpush al
	mov bx,word 's'
	pop dx
	cmp dx,bx
	je .L42
	mov ax,word 0
	jmp .L43
.L42:	
	mov ax,word 1
.L43:	
	cmp ax,word 0
	je .L44
	nop
	jmp .L29
.L44:	
	mov di,[bp+_p]
	mov al,[di]
	cpush al
	mov bx,word 'c'
	pop dx
	cmp dx,bx
	je .L45
	mov ax,word 0
	jmp .L46
.L45:	
	mov ax,word 1
.L46:	
	cmp ax,word 0
	je .L47
	nop
	jmp .L29
.L47:	
.L29:	
	jmp .L25
.L28:	
	nop
.L25:	
	inc word [bp+_p]
	mov ax,word [bp+_p]
	jmp .L24
.L23:	
	mov ax,word 0
	leave
	ret
%undef _ptr
%undef _p
%undef _temp
%undef _buffer
%undef _offset
%undef _ch
%undef _count
%undef _fmt

%define _a 4
%define _b 6

_strcpy:
	push bp
	mov bp,sp
.L80:	
	mov di,[bp+_b]
	mov al,[di]
	mov di,[bp+_a]
	mov [di],al
	cmp al,byte 0
	je .L79
	inc word [bp+_a]
	mov ax,word [bp+_a]
	inc word [bp+_b]
	mov ax,word [bp+_b]
	jmp .L80
.L79:	
	leave
	ret

%undef _a
%undef _b

%define _n -2
%define _ptr 4

_strlen:
	push bp
	mov bp,sp
	sub sp,word 2
	mov [bp+_n],word 0
.L7:	
	mov di,[bp+_ptr]
	mov al,[di]
	cmp al,byte 0
	je .L6
	inc word [bp+_n]
	mov ax,word [bp+_n]
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
	jmp .L7
.L6:	
	mov ax,word [bp+_n]
	leave
	ret
%undef _n
%undef _ptr



[section .data]

hex db "0x0000",10,13,0
hexc db "0123456789ABCDEF"
C100: db 'OPEN NEXT...',13,10,0
C101: db 'READ NEXT...',13,10,0
C102: db 'CLOSE NEXT...',13,10,0
filename: db 'hello16',0
C0: db 'input number> ',0
C1: db '%d',0
C2: db 13,10,0
C3: db 'number == %d',13,10,0

[section .bss]

file: resw 1
buffer: resw 1
temp_word: resd 1
the_ch: resw 1
answer: resb 20
