Search code examples
assemblyx86-16emu8086

How to get Assembly calculations in int format


I'm still learning asm. im trying to find out why ax reg turns to 28 and not 25. I'm using emu8086.

mov dx,0h    ; dx = 0
mov ax,0050h ; ax = 50
mov bx,2     ; bx = 2
    
div bx ; ax / 2 =50.
       ; but ax is now 28?

Solution

  • Values in assembly are usually in hex, explicitly stated with the h at the of 0050h

    50h or 0x50 is 80 in base 10
    80/2=40
    40 in hex is 0x28
    therefore your result is 0x28 or 28h