; Nazev prikladu: Opakovani - volani funkce konstrukce switch
; Pokud zadate cislovku od 1 do 3, tak se vam vypise slovni nazev, jinak neurceno
; Pokud pouzivate SASM musite vstupy napsat predem a oddelit entrem
; Autor: Tomas Goldmann

%include "rw32-2017.inc"

section .data

str1x db "Jedna",10,0
str2x db "Dva",10,0
str3x db "Tri",10,0
str_default db "Neurceno",10,0

section .bss
str1 resb 10

section .text

funkce:
push ebp
mov ebp,esp
sub esp, 16

mov eax, '1'
mov [ebp-4],eax
mov eax, '2'
mov [ebp-8],eax
mov eax, '3'
mov [ebp-12],eax


mov ebx, [ebp+8]
mov al,[ebx]


case1:
    mov ebx,[ebp-4]
    cmp al,bl
    jne case2
    mov esi, str1x
    call WriteString
    jmp vreak
case2:   
    cmp al,'2'
    jne case3
    mov esi, str2x
    call WriteString
    jmp vreak
case3:
    cmp al,'3'
    jne default_
    mov esi, str3x
    call WriteString
    jmp vreak
default_:
    mov esi, str_default
    call WriteString
    
vreak:


mov esp,ebp
pop ebp
ret 4



main:
    mov ebp, esp
    
    mov edi, str1
    mov ebx,1
    call ReadString
    
    push edi ;ukazatel na retezec
    call funkce

    xor eax, eax
    ret