Answer the question
In order to leave comments, you need to log in
Why is the cx register not reset?
org 100h
Start:
mov ah, 0ah
mov dx, firstNum
int 21h
mov ah, 02h
mov dx, 10
int 21h
mov bx, firstNum
call A1
mov ah, $08
int 21h
mov ax, 4c00h ;выход
int 21h
A1:
push ax
push cx
push dx
push di
xor cx, cx
mov di, 10
mov cx, [bx+2]
mov si, 2
.A2:
xor dx, dx
mov dx, [bx+si]
sub dx, '0'
add ax, dx
mul di
inc si
loop .A2
pop si
pop di
call Show_AX
Show_AX:
push ax
push cx
push dx
push di
mov di, 10 ;di - основание с/c(системы счисления)
xor cx, cx ;cx - количество цифр в числе
@@Conv:
xor dx, dx
div di ;dl = num mod 10
add dl, '0' ;перевод в символьный формат
inc cx
push dx ;складываем в стeк
or ax, ax
jnz @@Conv
;вывод из стека на экран
@@Show:
pop dx ;dl = очередной символ
mov ah, $02 ;ah - функция вывода символа на экран
int 21h
loop @@Show
pop di
pop dx
pop cx
pop ax
mov ah, $08
int 21h
mov ax, 4c00h ;выход
int 21h
firstNum dw 6,0,5 dup(?)
Answer the question
In order to leave comments, you need to log in
Why is the cx register not reset?
A1:
push ax
push cx
push dx
push di
xor cx, cx
mov di, 10
mov cx, [bx+2]
A1:
push ax
push cx
push dx
push di
xor cx, cx
mov di, 10
mov cl, [bx+1]
firstNum db 6,0,6 dup(?)
.A2:
xor dx, dx
mov dx, [bx+si]
sub dx, '0'
add ax, dx
.A2:
xor dx, dx
mov dl, [bx+si]
sub dl, '0'
add ax, dx
A1:
push ax
push cx
push dx
push di
...
pop si
pop di
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question