Advertisement
labib24

Untitled

May 12th, 2023
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. org 100h
  4.  
  5.  
  6. jmp start  
  7.            
  8.  
  9.  
  10. string db 20, 22 dup('?')
  11. new_line db 0Dh,0Ah, '$'                ; print new line
  12.  
  13. start:
  14.  
  15.  
  16. lea dx, string
  17.  
  18. mov ah, 0ah
  19. int 21h
  20.  
  21. mov bx, dx
  22. mov ah, 0
  23. mov al, ds:[bx+1]
  24. add bx, ax                              ; point to end of string.
  25.  
  26. mov byte ptr [bx+2], '$'
  27.  
  28. lea dx, new_line
  29. mov ah, 09h
  30. int 21h
  31.  
  32.  
  33. lea bx, string
  34.  
  35. mov ch, 0
  36. mov cl, [bx+1]                          ; get string size.
  37.  
  38. jcxz null                               ; is string is empty?
  39.  
  40. add bx, 2
  41.  
  42.                    
  43. upper_case:
  44.  
  45.                                          ; check if it's a lower case letter:
  46. cmp byte ptr [bx], 'a'
  47. jb ok
  48. cmp byte ptr [bx], 'z'
  49. ja ok
  50.  
  51.                                          ; convert to uppercase:
  52.  
  53. and byte ptr [bx], 11011111b
  54.  
  55. ok:
  56. inc bx                                    ; next char.
  57. loop upper_case
  58.  
  59.  
  60.  
  61. lea dx, string+2
  62. mov ah, 09h
  63. int 21h
  64.  
  65.  
  66. mov ah, 0
  67. int 16h
  68.  
  69.  
  70. null:
  71. ret  
  72.  
  73.  
  74.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement