Hello. This code im going to show you, is supposed to allow one to view the contents of a register or memory location. Im using it on masm and it compiles ok. Although i dont know where the print routine displays register contents. Any words would be a big help, thank you.
http://support.microsoft.com/kb/85068
; Assemble options needed: none
.MODEL small
.STACK
.CODE
Start:
mov ax, 0FFFFh ; Load AX with something distinctive.
call print_word ; Print the contents of the AX register.
mov ax, 4c00h ; Prepare to exit.
int 21h ; Exit.
print_word PROC ; MS-DOS version.
push dx ; Save all registers that are used.
push cx
push bx
push ax
mov dx, 4 ; Loop will print out 4 hex characters.
nexthex:
push dx ; Save the loop counter.
mov cl, 4 ; Rotate register 4 bits.
rol ax, cl
push ax ; Save current value in AX.
and al, 0Fh ; Mask off all but 4 lowest bits.
cmp al, 10 ; Check to see if digit is 0-9.
jl decimal ; Digit is 0-9.
add al, 7 ; Add 7 for Digits A-F.
decimal:
add al, 30h ; Add 30h to get ASCII character.
mov dl, al
mov ah, 02h ; Prepare for interrupt.
int 21h ; Do MS-DOS call to print out value.
pop ax ; Restore value to AX.
pop dx ; Restore the loop counter.
dec dx ; Decrement loop counter.
jnz nexthex ; Loop back if there is another character
; to print.
pop ax ; Restore all registers that were used.
pop bx
pop cx
pop dx
ret
print_word ENDP
END Start