This program is being designed to read characters from keyboard input, store it as a number and print it.
would anyone like to contribute? I'm new to jumps 🙂
;====================
.data
number dw 0
;====================
.code
main proc
mov ax,@data
mov ds,ax
;read character
mov ah, 0
int 16h ; read character and store to AL
;Move freshly read character out of the way, load 10 in for
; multiplication in event that NUMBER is not still zero (no longer first loop)
mov DL,AL
mov AL, 10
;If ASCII input is not a number from 0-9, exit
cmp DL,39h
ja ;Skip to printing NUMBER
cmp DL,30h
jb ;Skip to printing NUMBER
;See if NUMBER = 0.
;If NUMBER = 0, this is the first iteration- go on.
;Else, multiply by 10.
cmp number,0
jne
mul character
;Increment NUMBER by value corresponding to ASCII input
cmp DL,30h
je ;Loop back to input
cmp DL,31h
add number,1
je ;Loop back to input
cmp DL,32h
add number,2
je ;Loop back to input
cmp DL,33h
add number,3
je ;Loop back to input
cmp DL,34h
add number,4
je ;Loop back to input
cmp DL,35h
add number,5
je ;Loop back to input
cmp DL,36h
add number,6
je ;Loop back to input
cmp DL,37h
add number,7
je ;Loop back to input
cmp DL,38h
add number,8
je ;Loop back to input
cmp DL,39h
add number,9
je ;Loop back to input
;PRINT NUMBER
mov ax,4c00h
int 21h
main endp
end main
would anyone like to contribute? I'm new to jumps 🙂