[fpc-devel] Adding a redcode assembler to Free Pascal Compiler

Hans-Peter Diettrich DrDiettrich1 at aol.com
Tue Apr 5 16:21:12 CEST 2011


Skybuck Flying schrieb:

> So I wonder what is involved in supporting a new platform... be it real 
> hardware or virtual machines.
> 
> One thing which comes to mind is the RTL ?
> 
> Do new "targets" (as it's called ?) require their own RTL as well ? I 
> did see a mention about a dummy RTL as a possibility (Not sure if that's 
> needed but I would guess so ;)).

Of course every platform needs a RTL, at least for memory allocation, 
basic I/O and probably for file handling.

> So it would be cool if free pascal compiler could compile pascal sources 
> into redcode assembly, which can then be further compiled by the PMARS 
> executable/assembler.

Prepare your nodes to create the assembler code, and make the external 
assembler called for these source files.

> So I just need free pascal compiler to output redcode assembly... it 
> probably doesn't have to link anything or assemble anything further, 
> though a little bit of linking support for using multiple pascal sources 
> would be cool as well... not sure how that would work at assembly 
> level... maybe that's a good question too... would free pascal compiler 
> simply perform some kind of linking/syntax checking for uses clausule 
> based on assembly files (*.s) ? Or perhaps it does it via 
> interface/header files ? (probably last one). So as long as all headers 
> are present then assembly of those files don't matter and compiler knows 
> what it's doing... So linking of assemblies only happens later by other 
> tools (?).

IMO the compiler creates .ppu files for all units, as usual, and you'll 
have to call the external linker with the .o files, created by the also 
external assembler.

> So for example: a call to a routine of some unit is outputted 
> as a call to a label... and then the external assembler tool will 
> hopefully know what to do with those labels ;) (User will probably have 
> to supply multiple assembly files in such a case ;) that probably what 
> make files are for ;))

Get a description of the assembler syntax, so that you know what to put 
into your files.

DoDi




More information about the fpc-devel mailing list