(160K) in all. The +3 that followed it a few years later increased that to almost 192K with an additional 32K of ROM while the Next has increased that number even further to 1024K or 2048K depending on if you have expanded the ram on your machine or not.
All the extra memory is hidden from the processor by the hardware using a process called paging – NextBASIC (and the processor) always sees the memory as 16K of ROM and 48K of RAM (or 64K of RAM with no ROM in allRAM mode – though that is never used by NextBASIC and NextZXOS and it's reserved for CP/M).
While the processor can indeed address only 64K of memory at once, the extra memory can be slotted in and out of that 64K at will as seen in the introduction to this chapter. Consider an old jukebox. Although it (and you) can only deal with one album at a time, there are many more albums there which can be selected with the right buttons. So, even though there's much more information than you can use at any one time, you can pick and choose which part is relevant.
It is much the same for the processor. By setting the right bits in an I/O port, it can pick and choose which chunks of the available of memory it wants to use. When in non–banked usage of NextBASIC as well as when using legacy software most of the memory is ignored, but for Next mode games playing, Layer 2 graphics and the use of all the new capabilities the ZX Spectrum Next is equipped with, having sixteen or even thirty two times as much RAM is really rather useful!
Normally, usage of the additional memory capabilities are handled directly by NextZXOS and NextBASIC either automatically or by using the BANK commands, however in order to understand the underlying mechanisms we can elaborate a little bit.
Look again at the memory map; RAM pages 2 and 5 are always in the positions shown when NextBASIC is used, though there's no reason why they shouldn't be in the "legacy banked" section (C000h to FFFFh) – however, it would be difficult to see any use for this.
For legacy usage (usually where programs generate very strictly timed video effects), RAM banks are considered as being of one of two types: contended (meaning that there's a competition between the CPU and the ULA for access to them) and uncontended (meaning the CPU has their exclusive use).
Only four banks are ever contended: banks 4 to 7. The rest of the available RAM banks are always uncontended. This is a setting that can be turned on an off by using a Next Register as we saw in the previous chapter. It's turned OFF by default, but for compatibility reasons, NextZXOS turns it ON when loading software in a legacy format (.SNA, .Z80 or .TAP). When writing software that may be used in older models, place any machine code which has critical timing loops (such as music) in uncontended banks5.
Assuming contention has been turned ON, to turn it OFF you will need to issue a:
REG 8, % REG 8|@01000000
command, setting therefore NextREG 8, D6 to 1. The inverse (setting it to 0) will turn contention ON again for these banks. Alternatively you can just press the NMI button and set it/reset it using the NMI menu under Settings > General which is much much easier!
The ZX Spectrum Next uses a combination of paging techniques we called standard at the beginning of this chapter. In reality, it uses three: The 128K style paging (described below) controlled by I/O address 7FFDh, the +3 style paging controlled by I/O address 1FFDh extended by Next Memory Bank Select control controlled by I/O address DFFDh.
The reason for this complicated scheme is that the original ZX Spectrum 128K which introduced banking, only had 8 pages of RAM (8 × 16K) to deal with and only two of ROM (2 × 16K) so there was no appropriate care taken for further expansion. In an original 128K ma-
5 For comparison, executing NOPs in contended RAM will give an effective clock frequency of approximately 2.6MHz as opposed to the normal 3.5MHz in uncontended RAM for the base clock speed. This is a speed reduction of about 25%
ZX Spectrum Next User Manual, 3rd Edition (ISBN 978-1-5272-5496-1), written and illustrated by Phoebus R. Dokos. Copyright © 2020-2024 Phoebus Dokos / SpecNext Ltd. Licensed under CC BY-NC-SA 4.0. This is a transcription and can contain errors; check any doubt against the printed page.