Answer the question
In order to leave comments, you need to log in
How can you enter a second number as well?
I almost finished the lab, but I need to enter one more number (the number must be stored in the bx register), please help me, I really need it...
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 si
push di
xor cx, cx
xor ax, ax
mov di, 10
mov cl, [bx+1]
mov si, 1
.A2:
inc si
xor dx, dx
mov dl, [bx+si]
sub dl, '0'
add ax, dx
mul di
loop .A2
idiv di
pop si
pop di
mov bx, 2
call Calculation
Calculation:
; imul bx, 10 ;10*A
; mov cx, bx
mul ax ;B*B
imul ax, 6 ;6*B^2
xor ax, bx ;10*A xor 6*B^2
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 5,0,4 dup(?)
secondNum dw 5,0,4 dup(?)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question