[fpc-pascal]object code: how to generate?

Alan Grimes alangrimes at starpower.net
Sat Apr 27 08:38:19 CEST 2002


> K Stol wrote:
> 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
> 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).

DOS supports two types of binaries.

-- Flat binaries ending with .com that are loaded at 0x100h. ( you can
find interesting DOS data structures in the PSP!! =) (16-bit)

-- MZ executables, binaries that have an executable header with
important inf0z. (16-bit)

DOS programs that use dos4gw are actually a format called "Linear
Executable" -- 32 bit, that are linked to a 16-bit loader stub. --
freepascal uses a similar system. 

(at the dos prompt, type "type myexe.exe".. the first two letters of the
output is the type.)

Windows supports several other executable types such as "PE" 

To link to binaries produced by other tools, you will need to output one
of the standard executable formats, OMF, ELF, a.out, etc... 

> Do you think you could give me some help with this? Thanks in advance.

I'll try, but I have great difficulty with that...

om

If you get anywhere with this I will surely need your experience in
developing my OS. =) 

-- 
It feels good to be home on my 486.
http://users.rcn.com/alangrimes/




More information about the fpc-pascal mailing list