banner



How Do I Print From A Register In Assembly

Member Avatar

The reason jibberish is output to the consol is because
DX is to contain the offset of a dollar-sign '$' terminated cord.

              mov dx, offset msg mov ah, 0x9 int 0x21 int 0x20 msg db 'how-do-you-do globe$'            

To print out the value contained in the registers you will
take to convert their value into the ASCII representation
of a hexadecimal/decimal/etc.. value.

To print out the value of the AX register in hex for case:

              mov ax, 0x1234 call printw int 0x20  printw:  push ax  shr ax, viii  call printb  pop ax  button ax  and  ax, 0xff  phone call printb  popular ax  ret  printb:   button ax   shr al, 4   call printasc   pop ax   and al, 0xf   phone call printasc   ret  printasc:   add together al, 0x30   cmp al, 0x39   jle printasc_e   add together al, 0x7   printasc_e:   mov dl, al   mov ah, 0x2   int 0x21   ret            

Source: https://www.daniweb.com/programming/software-development/threads/231029/displaying-contents-of-registers

Posted by: chiltonowayll.blogspot.com

0 Response to "How Do I Print From A Register In Assembly"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel