skx / cpmulator

Golang CP/M emulator for zork, Microsoft BASIC, Turbo Pascal, Wordstar, lighthouse-of-doom, etc
MIT License
98 stars 3 forks source link

Turbo pascal is broken for multi-file projects #127

Closed skx closed 2 months ago

skx commented 2 months ago

This took a bit of time to track down, but compiling "MC.PAS" currently fails.

I'd assumed a file operation would be:

All those functions take a pointer to an FCB entry, and I thought this FCB entry would be stable - after all why wouldn't it be? Turns out that turbo pascal sometimes jumps around the address of the FCB.

So we need to store the original FCB, which we just use as a hash-key for lookups within the FCB entry itself. Use Al field for that. It will be stable, I hope!