Kroc / v80

A minimal Z80 assembler, running on Z80. Useful for bootstrapping bigger projects.
MIT License
25 stars 3 forks source link

Reduce heap usage #11

Open Kroc opened 4 months ago

Kroc commented 4 months ago

Both in general, and specifically when assembling v80, which uses roughly 25KB of heap space. This would make assembling v80 a major squeeze on even a 48K system, if even possible. v80 is 8KB + 256B buffers, + 256B stack. v80's heap usage whilst assembling itself needs to be reduced to at least 20KB. There are general strategies, such as just using less labels, but this issue will focus on code changes that can help.

Kroc commented 4 months ago

Not heap related, but I don't have a good place to put this idea yet -- there's a lot of once-off initialisation routines we could move into the code-segment, so that they get overwritten when assembly begins. Things like parameter parsing, the no-parameters help message. The most difficult part is simply deciding how best to split the files and include them in such a way that's going to scale for multiple supported platforms/OSes besides just CP/M.

Kroc commented 1 month ago

The switch to v2-ISA-parser has massively reduced heap usage by doing away with all the forward references in the ISA definition. Heap usage has halved to just 12KB!