kervinck / gigatron-rom

System, apps and tooling for the Gigatron TTL microcomputer
BSD 2-Clause "Simplified" License
231 stars 80 forks source link

Small changes to modules in Core/ to support programs other than the main ROMs #197

Closed psr closed 3 years ago

psr commented 3 years ago

In general, the files in Core/ expect to be used directly from the *rom*.asm.py scripts in the repository root directory. Building different things, working under Contrib/, and running code differently (such as in unit tests), can violate some of those assumptions.

Hopefully these changes are fairly uncontroversial. I'm trying to fix bugs rather than rebuild the tooling (at this stage anyway!) I've pulled them onto a different branch, and made them a separate PR from my other work, so that they can be properly reviewed.

I think I might have a few more similar changes to come.

psr commented 3 years ago

I'm tempted to make similar changes to how the various rom scripts call asm.loadBindings(). In Contrib/psr/py-gtemu I build a ROM image based on ROMv4.asm.py, with a custom Reset GCL file, and the consequence is that I need to copy interface.json into place beforehand.

But the result would be a huge diff in the listings files, which doesn't feel justified.

at67 commented 3 years ago

I don't see any issues with any of these changes so far, I'll merge this pull request once I've checked the changes against all possible use cases I can think of this weekend.

P.S. A quick look through the source shows define(), symbol() and end() referencing the global _symbols table, I would have thought this file uses the _symbols table for every SYS call reference, zero page reference, etc.

Cheers.

psr commented 3 years ago

Thanks. I thought I might want to make some further changes, but I think I've decided to leave it for now. I'm not really proposing to change how loadBindings() and symbol references work - just how we calculate the path to the right json file. But I'm not even proposing to change that at the moment.

More PRs to come soon.