Hello everybody, I'm stuck writing my program Here's what I wanted it to do:
- display a welcome message inside a console
- Wait for the user to imput a number from 0 to 9]
- compare that number to 0
- display a message if it is, else exit
Here is what I currently have:
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
include \masm32\include\masm32.inc
includelib \masm32\lib\masm32.lib
.data
capt db "SCHiM says: ",0
txt db "Enter a number 0-9:",0
.data?
data db ?
.code
start:
call AllocConsole
push offset txt
call StdOut
push 1
push offset data
call StdIn
mov al, data
cmp al, 0h
jz eqzero
invoke ExitProcess, NULL
eqzero:
push offset capt
call StdOut
push offset data
call StdOut
endloop:
jmp endloop
invoke ExitProcess, NULL
end start
The program assembles & links perfectly without any warnings or errors But cmp always returns 1, if I print the value in data (with StdOut) it shows me the exact value I've put in. So why isn't it working?
Thanks in advance