Skip to content

Instantly share code, notes, and snippets.

@abrarShariar
Created February 6, 2016 10:50
Show Gist options
  • Save abrarShariar/fe7eaf1e0875f093bee3 to your computer and use it in GitHub Desktop.
Save abrarShariar/fe7eaf1e0875f093bee3 to your computer and use it in GitHub Desktop.
swap variable(char) with intermediate register
;swap between two varible with intermediate register
.model small
.stack 100h
.data
a db ?
b db ?
.code
main proc
mov a,'1'
mov b,'2'
;before swap
mov ah,02
mov dl,a ;1
int 21h
mov dl,b ;2
int 21h
xchg dl,a ;swap
mov b,dl
;tab
mov ah,02
mov dl,09h
int 21h
;after swap
mov dl,a
int 21h ;2
mov dl,b
int 21h ;1
main endp
end main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment