JohnEarnest / Octo

A Chip8 IDE
MIT License
679 stars 54 forks source link

MMU support for XO-Chip #136

Closed bastetfurry closed 3 years ago

bastetfurry commented 3 years ago

With the XO-Chip you already have i := long NNNN for accessing memory beyond 4 KB, now i would like to propose a MMU extension that would let you mirror any 2 KB slice from the whole 64 KB range to $0800-$0fff so that one could easily swap in different code parts. In essence this would be one command with a byte or register argument of which the first five bits decide which pages gets mirrored in. The MMU gets set to %00000001 on startup to retain backward compatibility.

JohnEarnest commented 3 years ago

An interesting suggestion. Bank-switching is very flexible, but it does complicate the programming model. Is there a specific program you're working on which would require fast access to extended code-ram?

There's some discussion in octo's metaprogramming guide about ways to do bank-switching at the software level.

bastetfurry commented 3 years ago

Nothing yet, it was just an idea that came to mind. I am working on a small handheld based on the ESP32 and wanted to add some Chip 8 support to it which in turn made me think what i would need if i where to write a game, a dungeon crawler for example, for the Chip 8 system.

JohnEarnest commented 3 years ago

I try to be very conservative about extending the CHIP-8 instruction set further. It's easy to add instructions, but once someone uses one you're stuck with it forever.

There are already a number of examples of dungeon-crawler-style games for XO-CHIP and SCHIP that may be of interest to you as examples:

JohnEarnest commented 3 years ago

I'm not going to add an MMU or other memory-banking instructions to XO-Chip at this time. For now, there seems to be compelling evidence that the current model is sufficient for a wide range of complex programs, and there are several techniques available for ameliorating limited code-ram in software. Closing.