theinhumaneme

STRING COPY

Oct 28th, 2021
965
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ASSUME CS:CODE,DS:DATA,ES:EXTRA
  2. CODE SEGMENT
  3. MOV AX,DATA
  4. MOV DS,AX
  5. MOV AX,0000H ; CLEAN ACCUMULATORq
  6. MOV AX,EXTRA
  7. MOV ES,AX
  8. MOV AX,0000H ; CLEAN ACCUMULATOR
  9. MOV CL,STR_SIZE
  10. MOV SI,OFFSET STR1
  11. MOV DI,OFFSET STR2
  12. CLD ;CLEAR DIRECTION FLAGS
  13. ; OLD SCHOOL AND UNDERSTANDABLE CODE //
  14. ; ITER:
  15. ;     MOVSB
  16. ; LOOP ITER
  17. ; ELSE
  18. REP MOVSB
  19. ;SAME AS ABOVE BUT REP ONLY WORKS FOR
  20. ; MOVSB AUTO-MAGICALLY MOVES EVERYTHING FROM SI REG TO DI REG
  21. HLT
  22. CODE ENDS
  23. DATA SEGMENT
  24. STR1 DB "HELLO WORLD"
  25. STR_SIZE DB 11h
  26. DATA ENDS
  27. EXTRA SEGMENT
  28. STR2 DB 11h DUP(0)
  29. EXTRA ENDS
  30. END
RAW Paste Data