Advertisement
MadCortez

Untitled

Mar 15th, 2021
1,621
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.  
  7. mov dx, str1
  8.  
  9. int 21h
  10.  
  11. ;output task
  12.  
  13. mov ah,9h
  14.  
  15. mov dx, str2
  16.  
  17. int 21h
  18.  
  19. ;output task
  20.  
  21. mov ah,9h
  22.  
  23. mov dx, str3
  24.  
  25. int 21h
  26.  
  27. ;input string
  28.  
  29. mov ah,0Ah
  30.  
  31. mov dx, my_str
  32.  
  33. int 21h
  34.  
  35. ;new line break
  36.  
  37. mov ah,9h
  38.  
  39. mov dx, new_line
  40.  
  41. int 21h
  42.  
  43. ;swap 4 and 6
  44.  
  45. mov bp, my_str+2 ;address 1st
  46.  
  47. mov cl,[bp+3] ;4th element
  48.  
  49. mov ch, [bp+5] ;6th element
  50.  
  51. xchg ch,cl ;swap
  52.  
  53. mov [bp+5],ch
  54.  
  55. mov [bp+3],cl
  56.  
  57. ;9rd - 1th
  58.  
  59. mov ch, [bp+8]
  60.  
  61. sub ch, [bp]
  62.  
  63. ;3rd - (9rd - 1th)
  64.  
  65. mov cl, [bp+2]
  66.  
  67. sub cl, ch
  68.  
  69. mov [bp+4], cl
  70.  
  71. ;output result
  72.  
  73. mov ah,9h
  74.  
  75. mov dx, bp
  76.  
  77. int 21h
  78.  
  79. ;waiting to press
  80.  
  81. mov ah, 8h
  82.  
  83. int 21h
  84.  
  85. ret
  86.  
  87. str1 db "This program swaps the 4s and 6s characters of the string. ",$0d,$0a, "$"
  88.  
  89. str2 db "Performs arithmetic operations: S3 - (S9 - S1). Result is written to S5. ",$0d,$0a, "$"
  90.  
  91. str3 db "Input string (max. 10 elements)", $0d, $0a, "$"
  92.  
  93. my_str db 11,0,11 dup('$')
  94.  
  95. new_line db $0d, $0A, "$"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement