[fpc-pascal]object code: how to generate?
pfv at cooldown.demon.nl
Sat Apr 27 11:46:35 CEST 2002
> I'm trying to make a really simple compiler, and i'm getting there, but i have one problem. The program makes a tree of the program, so i can traverse it and generate program code. But i would like to generate the (binary) object code, so it can actually create .EXE files, which can be run under DOS / windows.
> I think i can find the hex-codes of the instructions, but how can i make a REAL executable, so i don't have to make an interpreter. I've heard of the PSP, the first 256 bytes of a program, but i don't know how to write that to a file, neither (or what it is, for that matter).
> Do you think you could give me some help with this? Thanks in advance.
There is somewhere on the net a book online called "linkers and loaders".
And for the assembler part you can have a look at the sources of nasm.
More information about the fpc-pascal