Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global main
- extern printf
- extern scanf
- section .data
- napis3: db 'trzy',10,0
- napis5: db 'piec',10,0
- napis6: db 'szesc',10,0
- napis9: db 'dziewiec',10,0
- napisd: db 'blad',10,0
- format: db '%ld',0
- tablica_skokow: dq c3,def,c5,c6,def,def,c9,end_while
- section .bss
- liczba: resq 1
- section .text
- main:
- mov rax,0
- mov rdi,format
- mov rsi,liczba
- call scanf
- cmp rax,0
- jz end_while
- mov rsi,[liczba]
- cmp rsi,3
- jb def
- cmp rsi,10
- ja def
- ;sub rsi,3
- jmp [tablica_skokow+8*rsi-24] ;24 pomijamy pierwsze 3 bajty bo sa def
- c3:
- mov rdi,napis3
- jmp end_switch
- c5:
- mov rdi,napis5
- jmp end_switch
- c6:
- mov rdi,napis6
- jmp end_switch
- c9:
- mov rdi,napis9
- jmp end_switch
- def:
- mov rdi,napisd
- jmp end_switch
- end_switch:
- mov rax,0
- call printf
- jmp main
- end_while:
- mov rax,1
- mov rbx,0
- int 80h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement