Advertisement
MadCortez

Untitled

Mar 15th, 2021
1,746
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. org 100h
  2.  
  3. ;output task
  4.  
  5. mov ah, 9h
  6. mov dx, str1
  7. int 21h
  8.  
  9. ;output task
  10.  
  11. mov ah,9h
  12. mov dx, str2
  13. int 21h
  14.  
  15. ;output task
  16.  
  17. mov ah,9h
  18. mov dx, str3
  19. int 21h
  20.  
  21. ;input string
  22.  
  23. mov ah,0Ah
  24. mov dx, my_str
  25. int 21h
  26.  
  27. ;new line break
  28.  
  29. mov ah,9h
  30. mov dx, new_line
  31. int 21h
  32.  
  33. ;swap 4 and 6
  34.  
  35. mov bp, my_str+2 ;address 1st
  36. mov cl,[bp+3] ;4th element
  37. mov ch, [bp+5] ;6th element
  38. xchg ch,cl ;swap
  39. mov [bp+5],ch
  40. mov [bp+3],cl
  41.  
  42. ;9rd - 1th
  43.  
  44. mov ch, [bp+8]
  45. sub ch, [bp]
  46.  
  47. ;3rd - (9rd - 1th)
  48.  
  49. mov cl, [bp+2]
  50. sub cl, ch
  51. mov [bp+4], cl
  52.  
  53. ;output result
  54.  
  55. mov ah,9h
  56. mov dx, bp
  57. int 21h
  58.  
  59. ;waiting to press
  60.  
  61. mov ah, 8h
  62. int 21h
  63. ret
  64.  
  65. str1       db "This program swaps the 4s and 6s characters of the string. ",$0d,$0a, "$"
  66. str2       db "Performs arithmetic operations: S3 - (S9 - S1). Result is written to S5. ",$0d,$0a, "$"
  67. str3       db "Input string (max. 10 elements)", $0d, $0a, "$"
  68. my_str     db 11,0,11 dup('$')
  69. new_line   db $0d, $0A, "$"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement