I hate asking such basic questions. It makes it look like I am being lazy! But I have spent hours looking over documentation, and for whatever reason, I can't get my head spun around straight on this small point.
I want to print the character "4" to the screen. I can do it as a string, but not from an ascii value.
Here is the working code:
include c:\masm32\include\masm32rt.inc
.data
num4 db "4", 10,0
.code
start:
invoke StdOut, addr num4
inkey
invoke ExitProcess, 0
end start
I just wanted to take a baby step from there and print ascii character 52 (which is "4"). Here's my best attempt so far:
include c:\masm32\include\masm32rt.inc
.data
.code
start:
myvar db 52
invoke StdOut, myvar
inkey
invoke ExitProcess, 0
end start
It assembles and links without trouble, but then crashes when I run it. I know that it doesn't have the 0 character at the end, but invoke StdOut, myvar,0
has too many arguments for StdOut.
My eventual goal is to be able to print a multiple digit number, as described by Alexey Frunze here:
x86 assembly (masm32) - how to split multi-digit data into individual characters
But since I am having so much trouble with syntax, I am taking baby steps. I found this, but it doesn't explain how to do the add 48 part syntactically:
x86 assembly - how to show the integer 2, not the second ASCII character
Please help me get past these opening hurdles, and thank you!