[BITS 16]
[org 0]
[section .text]

start:
	mov ax,cs
	mov ds,ax
	mov es,ax

	mov ah,03
	mov bh,0
	int 10h

	call _main

	jmp 0x1000:0

global _main
global _printf

[segment .text]

%include "io.asm"


%define temp1 -2

_main:
	push bp
	mov bp,sp
	sub sp,word 2
	push 10
	pop word [bp+temp1]
	mov ax,word 1
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L1
	push C0
	call _printf
	add sp,word 2
	jmp .L0
.L1:	
	mov ax,word 2
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L2
	push C1
	call _printf
	add sp,word 2
	jmp .L0
.L2:	
	mov ax,word 3
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L3
	push C2
	call _printf
	add sp,word 2
	jmp .L0
.L3:	
	mov ax,word 4
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L4
	push C3
	call _printf
	add sp,word 2
	jmp .L0
.L4:	
	mov ax,word 5
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L5
	push C4
	call _printf
	add sp,word 2
	jmp .L0
.L5:	
	mov ax,word 6
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L6
	push C5
	call _printf
	add sp,word 2
	jmp .L0
.L6:	
	mov ax,word 7
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L7
	push C6
	call _printf
	add sp,word 2
	jmp .L0
.L7:	
	mov ax,word 8
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L8
	push C7
	call _printf
	add sp,word 2
	jmp .L0
.L8:	
	mov ax,word 9
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L9
	push C8
	call _printf
	add sp,word 2
	jmp .L0
.L9:	
	mov ax,word 10
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L10
	push C9
	call _printf
	add sp,word 2
	jmp .L0
.L10:	
	push C10
	call _printf
	add sp,word 2
.L0:	
	mov ax,word 0
	leave
	ret
%undef temp1



[section .data]

C0: db 'case 1',10,0
C1: db 'case 2',10,0
C2: db 'case 3',10,0
C3: db 'case 4',10,0
C4: db 'case 5',10,0
C5: db 'case 6',10,0
C6: db 'case 7',10,0
C7: db 'case 8',10,0
C8: db 'case 9',10,0
C9: db 'case 10',10,0
C10: db 'default',10,0

[section .bss]

answer: resb 20
