Skip to content

Instantly share code, notes, and snippets.

@Arafat245
Last active March 25, 2016 19:39
Show Gist options
  • Save Arafat245/56753b6686b9ce7a3e2c to your computer and use it in GitHub Desktop.
Save Arafat245/56753b6686b9ce7a3e2c to your computer and use it in GitHub Desktop.
; assembly is awesome
printstring macro msg
mov ah, 09h
mov dx, offset msg
int 21h
endm
readnum macro num
push ax
push dx
mov ah,01h
int 21h
sub al,'0'
mov bh,100
mul bh
mov ah,00h
mov num,ax
mov ah,01h
int 21h
sub al,'0'
mov bh,10
mul bh
mov ah,00h
add num,ax
mov ah,01h
int 21h
sub al,'0'
mov ah,00h
add num,ax
pop dx
pop ax
endm
data segment
cr equ 0dh
lf equ 0ah
arrow equ 0AFh
msg0 db ' ************ BLOOD PRESSURE MONITOR ***********',cr,lf,cr,lf,'$'
msg1 db 'Please enter sensor input for Systolic pressure(mmHg):','$'
msg2 db cr,lf,'Please enter sensor input for Diastolic pressure(mmHg):','$'
msg3 db cr,lf,'Normal systolic pressure ',02h,'$'
msg4 db cr,lf,'High systolic pressure ',018h,'$'
msg5 db cr,lf,'Low systolic pressure ', 019h,'$'
msg6 db cr,lf,'Normal diastolic pressure ',02h,'$'
msg7 db cr,lf,'High diastolic pressure ',018h,'$'
msg8 db cr,lf,'Low diastolic pressure ',019h,'$'
msg9 db cr,lf,'$'
msg10 db arrow,'$'
msg11 db cr,lf,'Pre-high systolic blood pressure!','$'
systolic dw ?
diastolic dw ?
data ends
code segment
assume cs:code, ds:data
start: mov ax, data
mov ds, ax
printstring msg0
printstring msg1
readnum systolic
printstring msg2
readnum diastolic
printstring msg9
printstring msg9
mov cx,80
parrow:
printstring msg10
loop parrow
;for systolic
cmp systolic,120
jg phighpressure
jle low
phighpressure:
cmp systolic,140
jle plhighpressure
jg highpressure
plhighpressure:
printstring msg11
jmp exit1
highpressure:
printstring msg4
jmp exit1
low:
cmp systolic,90
jge normal
jl lowpressure
lowpressure:
printstring msg5
jmp exit1
normal:
printstring msg3
jmp exit1
;for diastolic
exit1:
cmp diastolic,80
jg highpressured
jle lowd
highpressured:
printstring msg7
jmp exit
lowd:
cmp diastolic,60
jge normald
jl lowpressured
lowpressured:
printstring msg8
jmp exit
normald:
printstring msg6
jmp exit
exit:
mov ah, 4ch
mov al, 00h
int 21h
code ends
end start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment