12

The +2A and the +3 versions of the ZX Spectrum, made by Amstrad, had a new banking mode, called "special". This banking mode is entered by setting bit 0 of port 1FFD. When active, two bits from this port allows the programmer to choose one from four possible schemes (figure taken from http://www.worldofspectrum.org/faq/reference/128kreference.htm#Plus3):

         Bit 2 =0    Bit 2 =0    Bit 2 =1    Bit 2 =1
         Bit 1 =0    Bit 1 =1    Bit 1 =0    Bit 1 =1
 0xffff +--------+  +--------+  +--------+  +--------+
        | Bank 3 |  | Bank 7 |  | Bank 3 |  | Bank 3 |
        |        |  |        |  |        |  |        |
        |        |  |        |  |        |  |        |
        |        |  | screen |  |        |  |        |
 0xc000 +--------+  +--------+  +--------+  +--------+
        | Bank 2 |  | Bank 6 |  | Bank 6 |  | Bank 6 |
        |        |  |        |  |        |  |        |
        |        |  |        |  |        |  |        |
        |        |  |        |  |        |  |        |
 0x8000 +--------+  +--------+  +--------+  +--------+
        | Bank 1 |  | Bank 5 |  | Bank 5 |  | Bank 7 |
        |        |  |        |  |        |  |        |
        |        |  |        |  |        |  |        |
        |        |  | screen |  | screen |  | screen |
 0x4000 +--------+  +--------+  +--------+  +--------+
        | Bank 0 |  | Bank 4 |  | Bank 4 |  | Bank 4 |
        |        |  |        |  |        |  |        |
        |        |  |        |  |        |  |        |
        |        |  |        |  |        |  |        |
 0x0000 +--------+  +--------+  +--------+  +--------+

It is known that this banking scheem was added in order to support CP/M. I can see that the first scheme allows all the address space to be used by programs and data, leaving the screen out of the map.

Using the third and/or fourth scheme would allow CP/M (which I assume is resident at the top of the address space) to stay in place while updating the screen. I can see that this might be a bit difficult because once you enter a scheme other than first, you loose any pointer to memory from 0000h to BFFFh, making tasks like outputting a string to be more complex.

So,

  • How did they use this set of schemes to support CP/M?
  • What was the purpose of second scheme?

2 Answers 2

9

The first question is answered in the +3 CP/M manual (search for 'Memory Map'): 4-5-6-3 for CP/M bank 0, 0-1-2-3 for CP/M bank 1, and 4-7-6-3 for CP/M bank 2. The arrangement (doubtless by design) is very similar to that used for PCW CP/M, where CP/M banks 2,3,4 etc. are the same as bank 0, except for the 4000-7FFF range.

The design of CP/M is that programs load at 0100h, and occupy memory up to the base of CP/M. Therefore CP/M (or, in CP/M Plus, at least the 'resident' portion of it) needs to live at the top of memory, and not page itself out when it switches to a different bank. The three configurations used by CP/M were no doubt chosen with this idea in mind: all three have bank 3 in the top 16k.

The other configuration (4-5-6-7) isn't used by CP/M. It may have been done for symmetry (0-1-2-3 is all uncontended, so 4-5-6-7 is a matching all-contended configuration). Or it may have been included in case there was a requirement for CP/M code or loadable drivers in bank 5 to access the second screen in bank 7.

CP/M does character I/O one byte at a time (each character is passed to the BIOS call CONOUT in the C register), so the screen update code doesn't need to access the running program. If areas of memory have to be transferred between banks, this is done in small chunks using a buffer at the top of RAM.

5

I can't add much to the above answer, except that the additional modes would have been there either because they were a harmless side effect of the primary 64k CP/M mode that would have cost more to mask out than to leave, or they were there to mirror modes in other Amstrad Z80 boxes and help porting.

Richard Altwasser may know for sure, but he's run away.

1
  • 1
    Rupert used to work for Sinclair / Amstrad during this period and wrote some of the Spectrum ROM.
    – PeterI
    Jun 9, 2016 at 19:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .