I have created this program that takes two inputs and prints them out (simple, yes, but it's for practise). It compiles, and runs fine, but it doesn't do what I intended. Here is my code:
.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib
.data
num1 db "Enter a number:", 0
num2 db "Enter another number:", 0
.data?
buffer1 dd 100 dup(?)
buffer2 dd 100 dup(?)
.code
start:
lea eax, num1
push eax
call StdOut
lea ebx, buffer1
push ebx
call StdIn
hlt
lea eax, num2
push eax
call StdOut
lea edx, buffer2
push edx
call StdIn
xor eax, eax
xor ebx, ebx
xor edx, edx
lea eax, buffer1
push eax
call StdOut
lea ebx, buffer2
push ebx
call StdOut
push 0
call ExitProcess
end start
It displays this output:
Enter a number: Enter another number:
It should do:
Enter a number:
; wait for input.
Enter another number:
; wait for input.
; continue with program.
Why does it print on one line? I tried putting halt
in there to stop the process, but Windows stops the program from running, and says the program is not responding
.
EDIT:
Here is the code that I said I would edit in:
xor eax, eax
xor ebx, ebx
xor edx, edx
lea eax, buffer1
push eax
call StdOut
lea ebx, buffer2
push ebx
call StdOut
When I run this with the previous code, it says "This program is not responding."
Why is this?
Any help would be appreciated.
Regards,
Progrmr