peon125

Untitled

Dec 10th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. section .text
  2.  
  3. org 100h
  4. start:
  5.  
  6. mov si, 0h
  7. mov cx, 0h
  8. mov ah, 09h
  9. mov dx, v_give_a_string
  10. int 21h
  11. giveagain:
  12. call p_giving_a_string
  13. cmp al, 65
  14. jb j_error_or_ending
  15. jae j_check_whether_its_a_letter
  16.  
  17. koniec:
  18. mov ax, 4c00h
  19. int 21h
  20.  
  21. j_deleting_stack:
  22. pop bx
  23. cmp bx, 0
  24. je start
  25. jne j_deleting_stack
  26.  
  27. j_error_or_ending:
  28. cmp al, 13
  29. je j_change_cases
  30. jne j_error
  31.  
  32. j_check_whether_its_a_letter:
  33. cmp al, 90
  34. jbe j_its_a_letter
  35. cmp al, 122
  36. ja j_error
  37. cmp al, 97
  38. jb j_error
  39.  
  40. j_its_a_letter:
  41. push ax
  42. jmp giveagain
  43.  
  44. j_error:
  45. mov ah, 09h
  46. mov dx, v_thats_an_error_dude
  47. int 21h
  48. jmp j_deleting_stack
  49.  
  50. j_change_cases:
  51. xor ax, ax
  52. mov ax, 2
  53. mul cx
  54. ;mov bx, ax
  55. mov ax, [bp + si]
  56. add si, 2
  57. cmp si, cx
  58. jae koniec
  59. cmp ax, 0
  60. je koniec
  61. ;mov bl, al
  62. cmp ax, 95
  63. jb j_uppercase
  64. ja j_lowercase
  65. ;je j_error
  66.  
  67. j_uppercase:
  68. sub ax, 5
  69. mov ah, 02h
  70. mov dx, ax
  71. int 21h
  72. jmp j_change_cases
  73.  
  74. j_lowercase:
  75. sub ax, 32
  76. mov ah, 02h
  77. mov dx, ax
  78. int 21h
  79. jmp j_change_cases
  80.  
  81. p_giving_a_string:
  82. mov ah, 01h
  83. int 21h
  84. inc cx
  85. ret
  86.  
  87. section .data
  88. v_give_a_string db 10, "give me a string: $", 10
  89. v_thats_an_error_dude db 10, "thats not what we wanted. try again sweetie $", 10
Advertisement
Add Comment
Please, Sign In to add comment