Created
February 6, 2016 11:28
-
-
Save abrarShariar/914cc48d9fa1a972ddc2 to your computer and use it in GitHub Desktop.
Swap string with intermediate registers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;swap string with intermediate register | |
.model small | |
.stack 100h | |
.data | |
txt01 dw 'Programmer$' | |
txt02 dw 'Hacker$' | |
.code | |
main proc | |
mov ax,@data | |
mov ds,ax | |
lea cx,txt01 ;load address of txt01 in cx | |
lea bx,txt02 ;load address of txt02 in bx | |
;before swap | |
mov ah,09 ;string print | |
mov dx,cx ;'Programmer' | |
int 21h | |
mov dx,bx ;'Hacker' | |
int 21h | |
;swap | |
xchg bx,cx | |
;after swap | |
mov dx,cx ;'Hacker' | |
int 21h | |
mov dx,bx ;'Programmer' | |
int 21h | |
mov ah,4ch ;terminate | |
int 21h | |
main endp | |
end main | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment