
(重定位问题)高手帮我看下以下汇编代码哪错了? 10
.386;Processor(386+).modelflat;Uses32bitregistersextrnExitProcess:proc;TheAPIitusesex...
.386 ; Processor (386+)
.model flat ; Uses 32 bit registers
extrn ExitProcess:proc ; The API it uses
extrn MessageBoxA:proc
.data
;szMessage db "Hello World!",0 ; Message for MsgBox
szTitle db "Win32 rocks!",0 ; Title of that MsgBox
;kernel dd 70000000h
.code ; Here we go!
HelloWorld:
VStart:
call GetDelta
push 00000000h ; Sytle of MessageBox
push offset szTitle ; Title of MessageBox
push offset szMessage ; The message itself
push 00000000h ; Handle of owner
call MessageBoxA ; The API call itself
mov dword ptr [ebx+kernel],eax;这有问题
push 00000000h
call ExitProcess
GetDelta:
call delta
delta:
pop ebx
sub ebx,offset delta - VStart
ret
szMessage db "Hello World!",0 ; Message for MsgBox
kernel dd 70000000h
end HelloWorld
独孤星坛帅哥谢谢你的热心,不过这个问题对你深了点,呵呵。。 展开
.model flat ; Uses 32 bit registers
extrn ExitProcess:proc ; The API it uses
extrn MessageBoxA:proc
.data
;szMessage db "Hello World!",0 ; Message for MsgBox
szTitle db "Win32 rocks!",0 ; Title of that MsgBox
;kernel dd 70000000h
.code ; Here we go!
HelloWorld:
VStart:
call GetDelta
push 00000000h ; Sytle of MessageBox
push offset szTitle ; Title of MessageBox
push offset szMessage ; The message itself
push 00000000h ; Handle of owner
call MessageBoxA ; The API call itself
mov dword ptr [ebx+kernel],eax;这有问题
push 00000000h
call ExitProcess
GetDelta:
call delta
delta:
pop ebx
sub ebx,offset delta - VStart
ret
szMessage db "Hello World!",0 ; Message for MsgBox
kernel dd 70000000h
end HelloWorld
独孤星坛帅哥谢谢你的热心,不过这个问题对你深了点,呵呵。。 展开
2个回答
展开全部
在你的代码段中,没有给段寄存器初使化,,所以在你的那有问题的指令中没有找在数据段中找到变量kernel,因在段码段前面多加
mov ax,&data
mov ds,ax ;(我现学8086的,如位数不对你自已换回来吧)
还有,我看了几遍也找不到哪有EBX的初使语句和哪有子程序GetDelta 的定义,,更更奇怪的是,怎么在代码段中定义数据,,,
最后本人建议:不要用简化段定义来写代码,感觉乱乱的,最好用标准的完整段定义,,,,
mov ax,&data
mov ds,ax ;(我现学8086的,如位数不对你自已换回来吧)
还有,我看了几遍也找不到哪有EBX的初使语句和哪有子程序GetDelta 的定义,,更更奇怪的是,怎么在代码段中定义数据,,,
最后本人建议:不要用简化段定义来写代码,感觉乱乱的,最好用标准的完整段定义,,,,
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询