So I have this "calculator" in assembly and I have array num1 db 4 dup(0) for 4 numbers, lets say you enter 9 8 7 5, so 9 goes in position 0 of num1, 8 position 1 and so on... num1 = [9,8,7,6]
I also have:
bdec dw 1000d, 100d, 10d, 1d ;powers of 10 according to number position
num1h dw 0 ;word where I will sum the result
and I use this code to create a number out of digits inside an array base on power position.
I expect the code to do this: num1h = 9x10^3 + 8x10^2 + 7x10^1 + 5x10^0
NUM1P proc
        push ax
        push bx
        push cx
        
        mov di,0
        mov cx, 0
        mov ax, 0
        mov num1h,0
    
    power_base:
        mov al, [num1+di] 
        mov bx, [bdec+di]
        mul bx
        add num1h,ax
        inc cx
        inc di
        cmp cx,4
        je exitn1p
        jmp power_base
    exitn1p:
    pop cx
    pop bx
    pop ax
    ret
    endp    
When i print the result it gives me back 25852
Now printing function works fine because it prints whatever you have in BX, so when I move a number directly to BX and use the printing function, let's say 5637 it will work fine:
        call NUM1P
    ;mov bx, num1h
        mov bx, 5637 
    call IMPRIME_BX
    jmp jmp_mouse_no_clic
But when I try to transfer a number directly to bx using num1h, things get weird...
Any ideas on what might I be doing wrong?
Or any ideas on how can I debug a program with such an interface?
 
    