Skip to content

Instantly share code, notes, and snippets.

@abrarShariar
Created February 5, 2016 20:19
Show Gist options
  • Save abrarShariar/3864bcd1f53c21156244 to your computer and use it in GitHub Desktop.
Save abrarShariar/3864bcd1f53c21156244 to your computer and use it in GitHub Desktop.
code to take 3 char input and print them in reverse way
;code to take 3 char input and print them in reverse way
.model small
.stack 100h
.data
input db 'INPUT: $'
output db 'OUTPUT: $'
.code
main proc
mov ax,@data ;prepare data segment
mov ds,ax
mov ah,09h ;print string
lea dx,input ;load offset address of input
int 21h
mov ah,01h ;input char
int 21h
mov cl,al
int 21h
mov ch,al
int 21h
mov bl,al
mov ah,02h ;newline and cret
mov dl,0Ah
int 21h
mov dl,0Dh
int 21h
;print string
mov ah,09h
lea dx,output
int 21h
mov ah,02h ;output char
mov dl,bl ;reverse
int 21h
mov dl,ch
int 21h
mov dl,cl
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