Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top