0

main.asm

program_intialization:
    org 0x7C00
    mov bp,0x7C00
program_start:
    call is

    mov ((ax or al)),0x21
    call output_number

times 510-($-$$) db 0
dw 0xaa55
library:
    %include "io.asm"
program_end:
 jmp $

io.asm

output_character:
    push ax
    push bx
    mov ah,0x0E
    mov bx,0x000F
    int 0x10
    pop bx
    pop ax
    ret
output_number:
        mov dx,0
        mov cx,10
        div cx
        push dx
        cmp ax,0x00
        je output_digit
        call output_number
    output_digit:
        pop ax
        add ax,0x30
        call output_character
        ret

passing value through al different in result from ax

  • through al gives 43553
  • through ax gives 33

why they give a different results , the ax result is the needed one , but i want to know how al gives this result to know how the code works and prevent future unexpected results

  • 3
    When you're only setting `al`, you're leaving `ah` with whatever it already contained, which apparently wasn't zero in this case. – Michael Apr 06 '22 at 05:53

0 Answers0