Question

I'm implementing an assemblinker for the 16-bit DCPU from the game 0x10c.

One technique that somebody suggested to me was using "overlays, like in Turbo Pascal back in the day" in order to swap code around at run time.

I get the basic idea (link overlayed symbols to same memory, swap before ref), but what was their implementation?

Was it a function that the compiler inserted before references? Was it a trap? Was the data for the overlay stored at the location of the overlay, or in a big table somewhere? Did it work well, or did it break often? Was there an interface for assembly to link with overlayed Pascal (and vice versa), or was it incompatible?

Google is giving me basically no information (other than it being a no-on on modern Pascal compilers). And, I'm just, like, five years too young to have ever needed them when they were current.

Était-ce utile?

La solution

A jump table per unit whose elements point to a trap (int 3F) when not loaded. But that is for older Turbo Pascal/Borland Pascal versions (5/6), newer ones also support (286) protected mode, and they might employ yet another scheme.

This scheme means that when an overlay is loaded, no trap overhead happens anymore.

I found this link in my references: The Slithy Tove. There are other nice details there, like how call chains are handled that span multiple overlays.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top