Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. global  main
  2. extern  printf
  3. extern  scanf
  4.  
  5. section .data
  6.  
  7. napis3: db 'trzy',10,0
  8. napis5: db 'piec',10,0
  9. napis6: db 'szesc',10,0
  10. napis9: db 'dziewiec',10,0
  11. napisd: db 'blad',10,0
  12.  
  13. format: db '%ld',0
  14.  
  15. tablica_skokow: dq c3,def,c5,c6,def,def,c9,end_while
  16.  
  17. section .bss
  18.  
  19. liczba: resq 1
  20.  
  21. section .text
  22.  
  23. main:
  24. mov rax,0
  25. mov rdi,format
  26. mov rsi,liczba
  27. call scanf
  28. cmp rax,0
  29. jz end_while
  30. mov rsi,[liczba]
  31. cmp rsi,3
  32. jb def
  33. cmp rsi,10
  34. ja def
  35.                 ;sub rsi,3
  36. jmp [tablica_skokow+8*rsi-24]  ;24 pomijamy pierwsze 3 bajty bo sa def
  37.  
  38. c3:
  39. mov rdi,napis3
  40. jmp end_switch
  41. c5:
  42. mov rdi,napis5
  43. jmp end_switch
  44. c6:
  45. mov rdi,napis6
  46. jmp end_switch
  47. c9:
  48. mov rdi,napis9
  49. jmp end_switch
  50. def:
  51. mov rdi,napisd
  52. jmp end_switch
  53. end_switch:
  54. mov rax,0
  55. call printf
  56. jmp main
  57.  
  58. end_while:
  59.  
  60. mov rax,1
  61. mov rbx,0
  62. int 80h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement