tomaz / zx-next-dev-guide

Guide for ZX Spectrum Next assembler developer. Available as free to download PDF from releases page, or printed coil bound book at https://bit.ly/zx-next-assembler-dev-guide

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update memory paging info

tomaz opened this issue · comments

commented

in 3.2.3 you're mentioning that +3 all-ram mode will override the mmu. That is not the case.. the hardware is only storing the page assigned to the 8 mmu slots and writes to mmus or i/o ports modify that according to their function. A write to port 0x7ffd will change the bottom 16K and the top 16K as long as you're not in allram mode, eg. Entering into +3 all-ram mode will change the entire 64K. But you can continue to change mmu slots afterward as you like. Exiting +3 all-ram mode also affects the entire 64K.. the bottom 16K and top 16K are affected by the current state of ports and the middle 16K banks are set to 5,2 as would be the case for a +3 coming out of all-ram mode.

The machine also has Pentagon 512K and Pentagon 1024K modes that change how port 0x7ffd works but that is not the mode the Next is in under normal operation. There are a few paragraphs at the end of https://gitlab.com/SpectrumNext/ZX_Spectrum_Next_FPGA/-/blob/master/cores/zxnext/ports.txt that talk about this and port 0xeff7 (also from the pentagon) that wasn't mentioned in your doc.

nextreg 0x8e https://gitlab.com/SpectrumNext/ZX_Spectrum_Next_FPGA/-/blob/master/cores/zxnext/nextreg.txt#L841 is a shortcut for reading and writing ports 7ffd, 1ffd, dffd all at once but it's mainly for simplifying 128K banking which is not the preferred way of doing things on the Next. It is really there for nextzxos which was (is?) cramped on available space as it saves a lot of space, time and complexity for the frequent paging it must do to switch between banks.

from Discord

Note: as memory paging chapter is least focused, maybe only leave MMU part? It's the simplest one to use, and likely the only one that would really be used on Next (unless backwards compatibility is needed)

commented

Leaving this one as is for the moment being - text in book was taken from Next Dev Wiki which clearly states changes to MMU are ignored while in all-ram mode. Though that info is maybe incorrect/obsolete and Next does indeed allow MMU paging. This needs to be confirmed and tested on the device/emulator. If MMU changes are indeed allowed, text in book should be changed with explanation that "official docs are incorrect" to avoid confusion!

commented

Decided to rewrite the whole memory chapter. The new version should be more concise and usable as it also includes default bank usage and other related tables.