大家好
我刚刚学习汇编
.386
.model flat
option casemap:none
;include windows.inc
;include user32.inc
;include kernel32.inc
;includelib user32.lib
;includelib kernel32.lib
.data
num db 0
pro1 db "how many do you want?",0aH,0dH,0
pro2 db "the sum is:",0aH,0dH,0
pro3 db "the average is:",0aH,0dH,0
.code
_start:
lea edx,pro1
mov al,09H
;int 21
xor eax,eax
; invoke ExitProcess,NULL
;end main
PUBLIC _start
END
我用一下命令生成console程序总是出错
ml /c /coff test.asm
link /subsystem:console /entry:start test/obj
而如果加入windows界面改为subsystem:windows就没问题,谢谢各位了
------解决方案--------------------
你这个是win32程序,当然不能生成16位dos啦
------解决方案--------------------
link /subsystem:console改成link /subsystem:windows试试。
------解决方案--------------------
你调用API也不声明调用方式是stdcall的,你能编译通过?不管是console还是windows都不行的吧。
.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib kernel32.lib
.data
num db 0
pro1 db "how many do you want?",0aH,0dH,0
pro2 db "the sum is:",0aH,0dH,0
pro3 db "the average is:",0aH,0dH,0
.code
_start:
invoke GetStdHandle,STD_OUTPUT_HANDLE
push eax
invoke WriteFile,eax,offset pro1,pro2 - pro1, NULL, 0
pop eax
invoke CloseHandle,eax
xor eax,eax
invoke ExitProcess,NULL
end _start