[fpc-devel] Adding a redcode assembler to Free Pascal Compiler
Skybuck Flying
skybuck2000 at hotmail.com
Tue Apr 5 02:21:19 CEST 2011
Hello,
I kinda forget to mention something in my previous posting to this mailing
list, but perhaps it should go into a seperate thread anyway:
As I mentioned in the previous posting with subject: "Adding a new assembler
to Free Pascal Compiler"... I am interested in using free pascal compiler to
create support for virtual machines and perhaps new hardware in the future.
As a learning exercise I would like to start with writing a little redcode
assembler for Free Pascal Compiler to be able to compile Pascal Source Code
to Redcode/PMARS95 instructions/assembler. (Redcode is the assembly
code/language for PMARS95 which is the virtual machine).
I already have a virtual machine for the redcode assembly/instructions,
there is also the open source pmars virtual machine which you can have a
look at to see what I am writing about ;)
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 ;)).
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.
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 (?). 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 ;))
Bye,
Skybuck.
More information about the fpc-devel
mailing list