Visual C++ Express コンパイラを使用して asm32 をコンパイルしています。
; Example assembly language program -- adds 158 to number in memory
; Author: R. Detmer
; Date: 1/2008
.586
.MODEL FLAT
.STACK 4096 ; reserve 4096-byte stack
.DATA ; reserve storage for data
number DWORD -105
sum DWORD ?
.CODE ; start of main program code
main PROC
mov eax, number ; first number to EAX
add eax, 158 ; add 158
mov sum, eax ; sum to memory
mov eax, 0 ; exit with return code 0
ret
main ENDP
END ; end of source code
上記ではリンクエラーが発生しますが、これは次のとおりです。
..
.CODE ; start of main program code
main:nop
mov eax, number ; first number to EAX
add eax, 158 ; add 158
mov sum, eax ; sum to memory
mov eax, 0 ; exit with return code 0
ret
end main ; end of source code
..
大活躍!
唯一の違いはmain:nop vs main proc
これら2つの違いは何ですか?一方がによって閉じられend main
、もう一方が閉じられているのはmain endp main
なぜですか?
ここに私が得るエラーがあります:
1>------ Build started: Project: asm1, Configuration: Release Win32 ------
1> Assembling [Inputs]...
1>LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
1>C:\Users\...\Downloads\asm1\Release\asm1.exe : fatal error LNK1120: 1 unresolved externals