어셈블리의 초급 단계입니다.정의되지 않은 기호를 외부에서 해결
I Visual Studio에서 수신 오류 :
1> File2.asm (27) : 오류 A2006 : 정의되지 않은 기호 : sprintf를
1> File2.asm (28) : 오류 A2006 : 정의되지 않은 기호 : MessageBoxA
파일 (1) 계산
파일이 인쇄는 창에 결과 무엇을 처리하는 것입니다.
라인 핸들 인쇄 지침은 다음과 같습니다
invoke sprintf, addr szBuf, offset $interm, eax, edx
invoke MessageBoxA, 0, addr szBuf, offset _title, 0
invoke ExitProcess, 0
은 무엇 나는 구축하지 않는 원인을 잘못하고 있는가?
sprintf가 C 함수이기 때문에 가능합니까?
File1.asm
.386
.model flat, stdcall
option casemap :none
PUBLIC squareroot
PUBLIC szBuf
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\msvcrt.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\msvcrt.lib
.data
_title db "Result",13,10,0
$interm db "%0.4f","+","%0.5f",13,10,0
Aval REAL8 1.000
Bval REAL8 -2.000
Cval REAL8 19.000
_fourval REAL8 4.000
$Tvalueinc REAL4 1.0,2.00,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0
$sampleval real10 4478784.0
$Powercounter dd ?
squareroot dq ?
$prevCW dw ?
$Tagword dd ?
$INT1 dq ?
EXTERN Finished:PROC
.code
szBuf:
add eax,4
fstcw $prevCW
fwait
fld Bval ; [loads first instance of b]]
fmul Bval ; [b*b = b^2]
fld Aval ;[Load a (a*c)]
fmul Cval ;(a*c)
fmul _fourval ;[4*a*c]
fsubp;[b^2-4*a*c]
ftst ;compare ST(0) with 0.0
fstsw ax ;[store camparison results in ax]
sahf ;transfer flags from AH register
mov ecx, 0004h
jb _negative ;jump if <0
fsqrt ;sqrt(b^2-4*a*c)
_negative:
fchs
fsqrt
fld $sampleval
xor eax,eax
$repeat:
inc eax
push eax
mov ax, $prevCW
push eax
fldcw [esp]
fld $Tvalueinc[ecx]
fdivp
fld st(0)
FRNDINT
fcomp
fstsw ax
Sahf
fnstenv [ebx-10h]
movzx eax, word ptr [ebx-10h + 8h]
fldcw $prevCW
pop eax
pop eax
jz $repeat
dec eax
cmp eax, $Powercounter
add ecx, 0004h
mov eax, dword ptr squareroot
mov edx, dword ptr squareroot[0004h]
jmp Finished
END szBuf
File2.asm
.386
.model flat,stdcall
option casemap:none
PUBLIC Finished
PUBLIC ExitProcess
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\msvcrt.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\msvcrt.lib
.data
_title db "Result",13,10,0
$interm db "%0.4f","+","%0.5f",13,10,0
.code
Finished:
invoke sprintf, addr szBuf, offset $interm, eax, edx
invoke MessageBoxA, 0, addr szBuf, offset _title, 0
invoke ExitProcess, 0
END