News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

output register value

Started by CollegeBoy88, July 16, 2010, 01:36:08 AM

Previous topic - Next topic

CollegeBoy88

I've been searching both Google and the forum, and I can't find out how one can output the value of a register/variable on the screen.  int 21h doesn't work, windows displays an error when it is run.

For example, how do I output the value of register AX?
Here's the code:

include \masm32\include\masm32rt.inc

.code
start:
    mov ax, 0
    mov cx, 0
a: add cx,1
    add ax, cx
    cmp cx, 5
    jne a
    exit
end start

oex

in 32 bit you could

movzx ebx, ax
print str$(ebx)
inkey

I think also this would work but not sure:
movzx eax, ax
print str$(eax)
inkey

movzx zeros the other 2 bytes, inkey pauses the application untl a key is pressed so you can see output before application quits
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

CollegeBoy88

It works fine. Thanks.  :U