• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

YAAssemblerT: JE in Intel Asselbler (MASM611)

This program is being designed to read characters from keyboard input, store it as a number and print it.

;====================
.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 🙂
 
.model small
CR equ 13d
LF equ 10d
;====================
.stack 100h
;code written here defines runtime stack
;====================
.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 disp8,0075 ;Skip to printing NUMBER
cmp DL,30h
jb disp8,0075 ;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 disp8,0075
mul number

;Increment NUMBER by value corresponding to ASCII input
cmp DL,30h
je disp8,0023 ;Loop back to input
cmp DL,31h
add number,1
je disp8,0023 ;Loop back to input
cmp DL,32h
add number,2
je disp8,0023 ;Loop back to input
cmp DL,33h
add number,3
je disp8,0023 ;Loop back to input
cmp DL,34h
add number,4
je disp8,0023 ;Loop back to input
cmp DL,35h
add number,5
je disp8,0023 ;Loop back to input
cmp DL,36h
add number,6
je disp8,0023 ;Loop back to input
cmp DL,37h
add number,7
je disp8,0023 ;Loop back to input
cmp DL,38h
add number,8
je disp8,0023 ;Loop back to input
cmp DL,39h
add number,9
je disp8,0023 ;Loop back to input

;PRINT NUMBER

mov ax,4c00h
int 21h
main endp

end main

can anyone help me out with these jumps please?
 
Don't you use a label, then do "JE LABEL"?

I don't feel like digging up my Intel Microprocessor book seeing as how I hate assembly ...
 
Back
Top