[fpc-pascal] Inline bytes

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Aug 9 15:33:52 CEST 2012

Rainer Stratmann wrote on Thu, 09 Aug 2012:

> Am Thursday 09 August 2012 15:14:29 schrieb Jonas Maebe:
>> {$asmmode att}
>> asm
>>    .byte $0x1f, $0xef, $0x1a
>> end;

I made an error here, the "$" should be removed (see Thomas' mail)

>> {$asmmode intel}
>> asm
>>    db $1a, $ef, $1a
>> end;
> Thanks, the next problem then is: I wanted to do that in an inline procedure
> but if the compiler detects an asm statement then inline is disabled(!).

That's correct, it is not possible inline assembler statements in FPC.  
You can try a macro instead:

{$macro on}
{$define IReallyKnowWhatIAmDoing:=asm .byte 0x1f, 0xef, 0x1a end}


You will have to declare the macro in a common include file or in  
every main source file if you want to use it in more than one  
compilation module though.


More information about the fpc-pascal mailing list