稍微修改一下 MASM,我不知道这些错误是什么意思,或者我是否正在编写接近正确的代码。正如目前所写的那样,它应该只是问候用户,询问两个数字并说再见(在进行任何计算或任何特殊操作之前尝试让骨架工作)。
INCLUDELIB Irvine32.inc ; Note: line number 7
.data
userName BYTE 33 DUP(0) ;string to be entered by user
firstNumber DWORD ? ;integer to be entered by user
secondNumber DWORD ? ;integer to be entered by user
intro_1 BYTE "Elementary Arithmetic by Marshall Todt", 0
intro_2 BYTE "Enter 2 numbers, and I'll show you the sum, difference,", 0
intro_3 BYTE "product, quotient, and remainder.", 0
prompt_1 BYTE "Enter the first integer: ", 0
prompt_2 BYTE "Enter the second integer: ",0
goodBye BYTE "Impressed? Bye!", 0
.code
main PROC
;Introduction
mov edx, OFFSET intro_1
call WriteString
call CrLf
move edx, OFFSET intro_2
call WriteString
call CrLF
move edx, OFFSET intro_3
call WriteString
call CrLF
;Get the data
mov edx, OFFSET prompt_1
call WriteString
call ReadInt
mov firstNumber, eax
mov edx, OFFSET prompt_2
call WriteString
call ReadInt
mov secondNumber, eax
;Say "Good-bye"
mov edx, OFFSET goodBye
call WriteString
call CrLf
exit ; exit to operating system
main ENDP
END main
这些是我得到的错误:
Error 1 error A2013: .MODEL must precede this directive c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 10 1 Assignment1
Error 2 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 11 1 Assignment1
Error 3 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 12 1 Assignment1
Error 4 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 13 1 Assignment1
Error 5 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 14 1 Assignment1
Error 6 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 15 1 Assignment1
Error 7 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 16 1 Assignment1
Error 8 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 17 1 Assignment1
Error 9 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 18 1 Assignment1
Error 10 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 19 1 Assignment1
Error 11 error A2013: .MODEL must precede this directive c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 21 1 Assignment1
Error 12 error A2034: must be in segment block : main c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 22 1 Assignment1
Error 13 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 25 1 Assignment1
Error 14 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 26 1 Assignment1
Error 15 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 27 1 Assignment1
Error 16 error A2008: syntax error : edx c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 28 1 Assignment1
Error 17 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 29 1 Assignment1
Error 18 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 30 1 Assignment1
Error 19 error A2008: syntax error : edx c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 31 1 Assignment1
Error 20 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 32 1 Assignment1
Error 21 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 33 1 Assignment1
Error 22 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 36 1 Assignment1
Error 23 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 37 1 Assignment1
Error 24 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 38 1 Assignment1
Error 25 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 39 1 Assignment1
Error 26 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 40 1 Assignment1
Error 27 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 41 1 Assignment1
Error 28 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 42 1 Assignment1
Error 29 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 43 1 Assignment1
Error 30 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 48 1 Assignment1
Error 31 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 49 1 Assignment1
Error 32 error A2034: must be in segment block c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 50 1 Assignment1
Error 33 error A2008: syntax error : exit c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 51 1 Assignment1
Error 34 error A1010: unmatched block nesting : main c:\Users\Marshall\documents\visual studio 2010\Projects\Solution1\Assignment1\Assignment1.asm 52 1 Assignment1
Error 35 error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"Debug\Assignment1.obj" /W3 /errorReport:prompt /TaAssignment1.asm" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\masm.targets 49 6 Assignment1