PROGRAM 1 : Multiple digits key-in and display ——- ; Author: DAVID PELED ;

PROGRAM 1 : Multiple digits key-in and display
——-
; Author: DAVID PELED
;Multiple digits display
.model small ; The CPU alocates small memory for the program
.386 ; For 32 bits assembly
.stack 100h ; 100(16) locations = 256(10)
.data ; For variables
by_10 dd 10 ; 32 bits variable with an initial value of 10
disp_Number dd 0 ; 32 bits variable with an initial value of 10
last_key dd 0 ; LAST KEY BEING PRESSED
stk_count db 0 ; 8 bits counter
.code ; write the code for the program
main proc
mov ax,@data ; set up data segment
mov ds,ax
Call keyin
mov eax, disp_Number
call dsp
mov ax, 4c00h
int 21h
dsp proc
rpt:
mov edx, 0
div by_10 ; EAX/By_10
mov disp_Number, eax
push dx ; remainder push into the stack
inc stk_count
cmp disp_Number, 0
jnz rpt
rpt2:
pop dx ;pop from the stack
add dl, 30h ; make it ascii
mov ah, 6
int 21h
dec stk_count
jnz rpt2
ret
dsp endp
KeyIN proc
mov disp_Number, 0
LP:
mov ah,1 ; KEY IN COMMANDS
INT 21h
cmp al, 13 ; COMPARE TO 13 TO VIEW IF CR WAS PRESSED
JZ short finKey
sub al, 30h ; REMOVE THE ASCII TO GET A PURE NUMBER
AND eax, 000000ffh ; FF = 1111 1111 ; TO ERASE ALL VALUE

💡 Buy the answer for only $12 Get it now →

S OTHER THEN IN AL
mov last_key, eax
mov eax, disp_Number
mul by_10
add eax, last_key
mov disp_Number, eax
jmp LP
finKey:
ret
KeyIN endp
main endp
end main
—————————————–
PROGRAM 2 : Display the multiple digits in multiple bases
——–
; Author: DAVID PELED
;Multiple digits display
.model small ; The CPU alocates small memory for the program
.386 ; For 32 bits assembly
.stack 100h ; 100(16) locations = 256(10)
.data ; For variables
by_x dd 2 ; 32 bits variable with an initial value of 10
stk_count db 0 ; 8 bits counter
.code ; write the code for the program
main proc
mov ax,@data ; set up data segment
mov ds,ax
LP1:
mov eax, 253 ; 253(10) 11111101
call dsp
inc by_x
mov dl, 20H
mov ah, 6
int 21h
cmp by_x, 41
js lp1
mov ax, 4c00h ; END THE PROGRAM
int 21h
dsp proc
rpt:
; PUSH TO THE STACK
mov edx, 0
div by_x ; EAX/By_x
push dx ; remainder push into the stack
inc stk_count
CMP EAX, 0
jnz rpt
rpt2:
pop dx ;pop from the stack DX = DH + DL
cmp dl, 10
js short skip2
add dl, 7
skip2:
add dl, 30h ; make it ascii for display
mov ah, 6
int 21h
dec stk_count
jnz rpt2
ret
dsp endp
main endp
end main

💡 Buy the answer for only $12 Get it now →