두 개의 입력을 받아서 인쇄하는이 프로그램을 만들었습니다 (간단하지만 예하지만 연습용입니다). 컴파일되고 잘 실행되지만 의도 한대로 작동하지 않습니다.x86 어셈블리 - masm32 : 응답 대기 관련 문제
Enter a number: Enter another number:
그것은 수행해야합니다 :
Enter a number:
; wait for input.
Enter another number:
; wait for input.
; continue with program.
는 왜 한 줄에 인쇄 않습니다
.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
그것은이 출력이 표시됩니다 여기 내 코드는? 나는 프로세스를 중지하기 위해 거기에 halt
을 넣으려고했으나 Windows는 프로그램이 실행되는 것을 멈추고 the program is not responding
라고 말합니다.
편집 :
xor eax, eax
xor ebx, ebx
xor edx, edx
lea eax, buffer1
push eax
call StdOut
lea ebx, buffer2
push ebx
call StdOut
나는이 이전 코드를 실행, 그것은 "This program is not responding."
왜 이렇게 말한다 : 여기에
도움을 주시면 감사하겠습니다.
감사
Progrmr
은 왜 모두 한 줄에 인쇄되지 것입니다 : 또한 , 당신은 STDIN과 STDOUT에 대한 코드를 검토 혜택을 누릴 수 있습니까? 그게 무슨 일이야, 당신은 13, 10 텍스트를 추가해야합니다. 또한 실제로 400 바이트 버퍼를 원한다면 텍스트를 보관할 버퍼가 db가 아닐 것입니다. – Gunner
다른 줄로 이동하면 감사합니다. 하지만 여전히 입력을 기다리지 않고 num1과 num2를 모두 표시 한 다음 입력을 기다리지 않습니다. 왜? – Progrmr