I implemented the multiplication of two big integer in emu8086
with code as below :
; MULTIPLY N1 * N2 = RES
MULTIPLY PROC
MOV BH, 0H
MOV CH, 0H
MOV CL, L1; initial counter of first loop ( L1 -> length of N1 )
DEC CX
MUL_1:
MOV COUNTER, CL ; store counter of first loop
MOV CL, L2 ; initial counter of second loop ( L2 -> length of N2 )
MUL_2:
MOV BH, 0H
MOV BL, COUNTER
DEC BL
MOV AL, N1[BX] ; get BX th byte of N1
MOV BL, CL
DEC BL
MUL N2[BX] ; multiple N1 and N2 's bytes
MOV BH, 0H
MOV BL, COUNTER
ADD BX, CX
DEC BX
ADD RES[BX], AL ; AL should be add into RES[loop1_counter + loop2_counter - 1]
ADC RES[BX+1], AH; AH and carry should be add into RES[loop1_counter + loop2_counter ]
ADC RES[BX+2], 0H; carry of above addition should be place here.
LOOP MUL_2
MOV CL, COUNTER; retrieve loop 1 counter
LOOP MUL_1
RET ; end function
MULTIPLY ENDP
So, i want to print it in Decimal Mode
, i know how to print result in HexaDecimal
:
PRINT_TABLE PROC
MOV CX, 16D
CASE:
MOV BX, 16D
SUB BX, CX
MOV AL, RES[BX]
CMP AL, 10D
JB LBL1
JAE LBL2
LBL1:
ADD AL, '0'
JMP CONTINUE
LBL2:
ADD AL, 55D
CONTINUE:
MOV DL, AL
MOV AH, 02H
INT 21H
LOOP CASE
RET
PRINT_TABLE ENDP
Could any one please help me to print my result in Decimal Mode ?
Thanks for your advance :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…