尝试 assemble 汇编中的简单减法程序时出现错误 MSB3721
Error MSB3721 when trying to assemble a simple subtraction program in assembly
我正在编写一个简单的汇编程序,它必须减去 3 个整数,仅使用 16 位寄存器。然后我必须调用 DumpRegs 来显示输出。
我使用的是 Microsoft Visual Studio 2013。
我的代码:
INCLUDE Irvine32.inc
.386
.model flat, stdcall
.stack 4096
ExitProcess PROTO, dwExitCode:DWORD
.data
integerOne WORD 10 ; 16 bit WORD integerOne with the value 10
integerTwo WORD 3 ; 16 bit WORD integerTwo with the value 3
integerThree WORD 5 ; 16 bit WORD integerThree with the value 5
finalAnswer WORD ? ; 16 bit WORD finalAnswer with a unknown value
; to store the subtraction answer
.code ; Start of the code section
main PROC ; Main Procedure Start
mov EAX, 0 ; Moves 0 into the EAX register
mov AX, integerOne ; Loads the AX register with integerOne (10)
sub AX, integerTwo ; Subtracts integerTwo (3) from the AX register
sub AX, integerThree ; Subtracts integerThree (5) from the AX register
mov finalAnswer, AX ; Moves the contents of the AX register into finalAnswer
call DumpRegs ; Outputs the registers
INVOKE ExitProcess,0
main ENDP
END main
我在没有调试的情况下启动时遇到的错误如下:
Error 2 error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"Debug\Subtracting Three Integers.obj" /W3 /errorReport:prompt /Ta"Subtracting Three Integers.asm"" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\masm.targets 50 5 CSE 210 Assignment 2
我也收到警告:
Warning 1 warning A4011: multiple .MODEL directives found : .MODEL i C:\Users\Tapan\Desktop\Desktop Files\VS\CSE 210 Assignment 2\Subtracting Three Integers.asm 14 1 CSE 210 Assignment 2
这个程序 运行 昨天还不错,这里是输出 window 截图:
当您使用 Kip 的 Irvine Win32 库时,您这样做:
INCLUDE Irvine32.inc
你是在暗地里这样做:
.386
.model flat, stdcall
.stack 4096
通过执行 include irvine32.inc
并执行以上 3 行,您将这些选项定义两次。 Microsoft Assembler 将此视为错误。这是在这个有点神秘的错误消息中提出的,它抱怨定义了多个 .model
指令:
warning A4011: multiple .MODEL directives found : .MODEL i C:\Users\Tapan\Desktop\Desktop Files\VS\CSE 210 Assignment 2\Subtracting Three Integers.asm 14 1 CSE 210 Assignment 2
我相信为了在使用 include irvine32.inc
时避免这个问题,您只需删除以下所有三行并只包含 irvine32.inc:
.386
.model flat, stdcall
.stack 4096 ; If a bigger stack is needed(>4096) then define it to be larger
我正在编写一个简单的汇编程序,它必须减去 3 个整数,仅使用 16 位寄存器。然后我必须调用 DumpRegs 来显示输出。
我使用的是 Microsoft Visual Studio 2013。
我的代码:
INCLUDE Irvine32.inc
.386
.model flat, stdcall
.stack 4096
ExitProcess PROTO, dwExitCode:DWORD
.data
integerOne WORD 10 ; 16 bit WORD integerOne with the value 10
integerTwo WORD 3 ; 16 bit WORD integerTwo with the value 3
integerThree WORD 5 ; 16 bit WORD integerThree with the value 5
finalAnswer WORD ? ; 16 bit WORD finalAnswer with a unknown value
; to store the subtraction answer
.code ; Start of the code section
main PROC ; Main Procedure Start
mov EAX, 0 ; Moves 0 into the EAX register
mov AX, integerOne ; Loads the AX register with integerOne (10)
sub AX, integerTwo ; Subtracts integerTwo (3) from the AX register
sub AX, integerThree ; Subtracts integerThree (5) from the AX register
mov finalAnswer, AX ; Moves the contents of the AX register into finalAnswer
call DumpRegs ; Outputs the registers
INVOKE ExitProcess,0
main ENDP
END main
我在没有调试的情况下启动时遇到的错误如下:
Error 2 error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"Debug\Subtracting Three Integers.obj" /W3 /errorReport:prompt /Ta"Subtracting Three Integers.asm"" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\masm.targets 50 5 CSE 210 Assignment 2
我也收到警告:
Warning 1 warning A4011: multiple .MODEL directives found : .MODEL i C:\Users\Tapan\Desktop\Desktop Files\VS\CSE 210 Assignment 2\Subtracting Three Integers.asm 14 1 CSE 210 Assignment 2
这个程序 运行 昨天还不错,这里是输出 window 截图:
当您使用 Kip 的 Irvine Win32 库时,您这样做:
INCLUDE Irvine32.inc
你是在暗地里这样做:
.386
.model flat, stdcall
.stack 4096
通过执行 include irvine32.inc
并执行以上 3 行,您将这些选项定义两次。 Microsoft Assembler 将此视为错误。这是在这个有点神秘的错误消息中提出的,它抱怨定义了多个 .model
指令:
warning A4011: multiple .MODEL directives found : .MODEL i C:\Users\Tapan\Desktop\Desktop Files\VS\CSE 210 Assignment 2\Subtracting Three Integers.asm 14 1 CSE 210 Assignment 2
我相信为了在使用 include irvine32.inc
时避免这个问题,您只需删除以下所有三行并只包含 irvine32.inc:
.386
.model flat, stdcall
.stack 4096 ; If a bigger stack is needed(>4096) then define it to be larger