如何在 gnu pascal 中编写内联汇编?
由于没有官方参考资料,我只有一篇教程 gpcasm.zip 。但是当我尝试遵循 tut 并尝试内联时我的 debian 上的汇编示例。gpc 对此不满意。
gnu_asm.pas : In procedure 'MyStupidDelay': gnu_asm.pas:3: error : can't find a register in class AREG while reloading asm
这是代码
program gnu_asm;
Procedure MyStupidDelay(time : integer);
Begin
Asm("0 : pushl $0xfffff
1 : decl(%%esp)
jnz 1b
addl $0x4, %%esp
decl %%eax
jnz 0b"
:
: "a" (time)
: "eax" );
end;
begin
write("only for test");
end.
另一个问题,是否还有其他有关 gnu pascal 中内联汇编的参考、教程、示例。
谢谢。
Since there is not offical reference,I got only one tutorial
gpcasm.zip .But when I try to follow the tut and try the inline assembly example on my debian.The gpc was not happy with it.
gnu_asm.pas : In procedure 'MyStupidDelay': gnu_asm.pas:3: error : can't find a register in class AREG while reloading asm
Here is the code
program gnu_asm;
Procedure MyStupidDelay(time : integer);
Begin
Asm("0 : pushl $0xfffff
1 : decl(%%esp)
jnz 1b
addl $0x4, %%esp
decl %%eax
jnz 0b"
:
: "a" (time)
: "eax" );
end;
begin
write("only for test");
end.
Another question,are there any other refernece, tutorials, examples on inline assembly in gnu pascal.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题可能不是帕斯卡部分,而是汇编器部分。
有关类似问题,请参阅此。
有关更多信息,请说明您的目标机器和有关编译选项的信息。
The problem may not be the pascal part but the assembler part.
See this for a similar problem.
For more info pls state your target machine and infos on the compile options.