开发者

How to write inline assembly in gnu pascal?

开发者 https://www.devze.com 2022-12-09 22:06 出处:网络
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.

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 pr开发者_运维百科ocedure '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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消