编写32位汇编程序遇到MSB3721
严重性 代码 说明 项目 项目级别 文件 行 列 类别 源 禁止显示状态 工具
错误 MSB3721 命令“ml.exe /c /nologo /safeseh /Zi /Fo"Debug\boolean.obj" /W3 /errorReport:prompt /Ta..\..\..\..\..\..\..\Irvine\Examples\Lib32\boolean.asm”已退出,返回代码为 1。 Project9 1 C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\BuildCustomizations\masm.targets 50 5 生成
源代码如下
include Irvine32.inc
.data
hahaha byte 'A'
dword AND_1
byte 'B'
dword OR_2
byte 'C'
dword NOT_3
byte 'D'
dword XOR_4
NumberOfEntries = 4
lululu byte "Press number A,B,C or D:",0
op1 byte "AND_1",0
op2 byte "OR_2",0
op3 byte "NOT_3",0
op4 byte "XOR_4",0
.code
main proc
mov edx,offset lululu
call WriteString
call ReadChar
mov ebx,offset hahaha
mov ecx,NumberOfEntries
L1:
cmp al,[ebx]
jne L2
call NEAR ptr [ebx+1]
call WriteString
call Crlf
jmp L3
L2:
add ebx,EntrySize
loop L1
L3:
exit
main endp
AND_1 proc
mov edx,offset op1
ret
AND_1 endp
OR_2 proc
mov edx,offset op2
ret
OR_2 endp
NOT_3 proc
mov edx,offset op3
ret
NOT_3 endp
XOR_4 proc
mov edx,offset op4
ret
XOR_4 endp
end main
但是《汇编语言基于x86处理器》的作者的程序就可以运行,两个程序极其相似,源代码如下
INCLUDE Irvine32.inc
.data
CaseTable BYTE 'A' ; lookup value
DWORD Process_A ; address of procedure
BYTE 'B'
DWORD Process_B
BYTE 'C'
DWORD Process_C
BYTE 'D'
DWORD Process_D
NumberOfEntries = 4
prompt BYTE "Press capital A,B,C,or D: ",0
msgA BYTE "Process_A",0
msgB BYTE "Process_B",0
msgC BYTE "Process_C",0
msgD BYTE "Process_D",0
.code
main PROC
mov edx,OFFSET prompt ; ask user for input
call WriteString
call ReadChar ; read one character
call ReadKey
mov ebx,OFFSET CaseTable ; point EBX to the table
mov ecx,NumberOfEntries ; loop counter
L1:
cmp al,[ebx] ; match found?
jne L2 ; no: continue
call NEAR PTR [ebx + 1] ; yes: call the procedure
call WriteString ; display message
call Crlf
jmp L3 ; exit the search
L2:
add ebx,5 ; point to the next entry
loop L1 ; repeat until ECX = 0
L3:
exit
main ENDP
Process_A PROC
mov edx,OFFSET msgA
ret
Process_A ENDP
Process_B PROC
mov edx,OFFSET msgB
ret
Process_B ENDP
Process_C PROC
mov edx,OFFSET msgC
ret
Process_C ENDP
Process_D PROC
mov edx,OFFSET msgD
ret
Process_D ENDP
END main