Advertisement
madopew

5_1

Apr 2nd, 2020
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     org 100h
  2.  
  3.     NL_ equ 0dh, 0ah
  4.  
  5. start:
  6.     mov ah, 9 ;output - helloStr
  7.     mov dx, helloStr_
  8.     int 21h
  9.  
  10.     mov ah, 0ah ;input - string
  11.     mov dx, buffStr_
  12.     int 21h
  13.  
  14.     mov ah, 2 ;output - new line
  15.     mov dx, 0d0ah
  16.     int 21h
  17.  
  18.     cld ;direction - forward (df = 0)
  19.     mov si, buffStr_ ;SOURCE address...
  20.     add si, 12 ;first two bytes MAX_LEN and LEN + tenth symbol = +12
  21.     mov di, destStr_ ;DESTINATION address
  22.     mov cx, 6 ;10 11 12 13 14 15 - 6 symbols
  23.     rep movsb ;repeat movsb (movs byte), until cx = 0
  24.  
  25.     mov ah, 9 ;output - resultStr
  26.     mov dx, resultStr_
  27.     int 21h
  28.  
  29.     mov dx, destStr_ ;output - copied string
  30.     int 21h
  31.  
  32.     mov dx, byeStr_ ;output - byeStr
  33.     int 21h
  34.  
  35.     mov ah, 7 ;wait for input
  36.     int 21h
  37.     ret
  38.  
  39. helloStr_ db "This program transfers bytes 10 to 15", NL_, "Input string with length of 16:", NL_ , "$"
  40. buffStr_ db 17, 0, 17 dup (?)
  41. destStr_ db "******$"
  42. resultStr_ db "Result string:", NL_, "$"
  43. byeStr_ db NL_, "The program has now terminated.$"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement