我发现了一段我尝试在 Windows 上使用 MASM 构建的代码。构建不会导致任何错误,但我无法确定它是代码问题还是 MASM 问题,因为我对这个主题完全陌生。
请告诉我为什么程序在控制台上什么也不打印。谢谢你。
(1) 源代码
;==============================================================
.386
.model flat,stdcall
option casemap:none
;==============================================================
include \masm32\include\windows.inc
include \masm32\include\masm32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib
.data
szLine db 80 DUP("="),0
szCaption db "Mein erstes Consolen Programm:",10,0
szEingabe db "Bitte eine Zahl eingeben:",0
szAusgabe db "Deine Zahl:",0
Zahl db 20 DUP(0)
.code
start:
push offset szLine
call StdOut
push offset szCaption
call StdOut
push offset szLine
call StdOut
push offset szEingabe
call StdOut
push 20
push offset Zahl
call StdIn
push offset szAusgabe
call StdOut
push offset Zahl
call StdOut
push 0
push 0
call StdIn
push 0
call ExitProcess
end start
(2) 构建结果
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.
Assembling: C:\1.asm
***********
ASCII build
***********
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
Volume in drive C has no label.
Volume Serial Number is DEF0-6193
Directory of C:\
11.11.2013 14:24 911 1.asm
11.11.2013 14:37 2.560 1.exe
11.11.2013 14:37 1.027 1.obj
3 File(s) 4.498 bytes
0 Dir(s) 33.380.294.656 bytes free
Press any key to continue . . .
(3) 输出
当我在控制台上运行 exe 文件时,它什么也没有显示。
C:\Users\LOL>c:\1.exe
C:\Users\LOL>
(4) 预期结果
至少有一点输出。(“=”等)