Skip to content

Instantly share code, notes, and snippets.

@ehzawad
Forked from Arafat245/compare.asm
Created March 7, 2016 16:08
Show Gist options
  • Save ehzawad/c2ce4a62f5c693a7b7c9 to your computer and use it in GitHub Desktop.
Save ehzawad/c2ce4a62f5c693a7b7c9 to your computer and use it in GitHub Desktop.
printstring macro msg
mov ah, 09h
mov dx, offset msg
int 21h
endm
readnum macro num
push ax
push bx
mov ah,01h
int 21h
sub al,30h
mov bh,100
mul bh
mov num,al
mov ah,01h
int 21h
sub al,30h
mov bh,10
mul bh
add num,al
mov ah,01h
int 21h
sub al,30h
add num,al
pop bx
pop ax
endm
data segment
cr equ 0dh
lf equ 0ah
msg1 db 'Please enter first input:','$'
msg2 db cr,lf,'Please enter second input:','$'
msg3 db cr,lf,' In range','$'
num1 db ?
num2 db ?
data ends
code segment
assume cs:code, ds:data
start: mov ax, data
mov ds, ax
printstring msg1
readnum num1
printstring msg2
readnum num2
call compare
exit:
mov ah, 4ch
mov al, 00h
int 21h
compare proc near
mov al,78h ;120
mov bl,5ah ;90
;write desired code here
ret
compare endp
code ends
end start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment