davidgiven / cpm65

CP/M for the 6502
BSD 2-Clause "Simplified" License
264 stars 24 forks source link

Suggestion: have the CCP zero out the bss for transient commands #136

Open ZornsLemma opened 3 months ago

ZornsLemma commented 3 months ago

(I'm interested in CP/M-65 but haven't actually used it, so apologies if this suggestion is inappropriate.)

The CCP knows where a transient command's relocation data starts, and that is the same place its bss starts. COMHDR_TPA_USAGE effectively tells it how large the bss is. It could therefore zero out this region after relocation and before executing the program, which would allow programs to assume their bss is zero-initialised on startup. As I understand it, currently a program has to zero out its own bss if it cares about it actually being zero-initialised.

I appreciate even if the above is reasonable that this is an API change, and programs which relied on this would not work correctly on older versions of CP/M-65.