Slots
This page was last modified 11:13, 20 August 2018 by Gdx. Based on work by NYYRIKKI.

All MSX models support primary slots (*4) and secondary slots (4 primary slots max) in BIOS level. How ever all MSX models don't have any primary slots extended, but this can be changed by placing for example Slot Expander hardware to any primary slot. In this explanation I will call these slots like this: Primary slots (0-3) = 0, 1, 2, 3. Secondary slots (0-3) = <Primary slot>-0, <Primary slot>-1, <Primary slot>-2, <Primary slot>-3.

Typically MSX1 has Main-ROM in primary slot 0 or in secondary slot 0-0. Expansion port that is on top of computer is typically slot 1. If there is another expansion port then this is slot slot 2 and RAM is in slot 3.

In MSX2 SLOT 0 is usually expanded to 0-0, 0-1, 0-2 and 0-3. Same goes with slot 3. This is because these computers need to point more memory because they need Sub-ROM and maybe also disk drive, Kanji ROM, manufacturer custom software etc. In these computers main BIOS is in slot 0-0 and RAM is typically in some Sub-ROM under slot 3 (3-X)

Please note: I just explained how things are TYPICALLY, don't trust this info as fact!

Each slot (no matter is it not expanded main slot or expanded slot) can have max 64KB of addressable space.

This space is divided to 4 parts 16KB each. The main slot part that is selected as visual for Z80 is controlled trough I/O port A8h. Each 2 bits represent one of the memory areas (0000h-3FFFh, 4000h-07FFFh, 8000h-BFFFh, C000h-FFFFh) and the value of the bits represent the slot number (0-3). Reading value from port I/O A8h is always supported.

IF the main slot is divided into secondary slots (optional) then selecting only primary slot is not enough. (If you only select primary slot you will now see last used secondary slot that might be wrong one) Selecting secondary slot is pain in the ass since this is done by writing similar value to memory address FFFFh IN THE PRIMARY SLOT WHERE YOU WANT TO SELECT THE SECONDARY SLOT !!! This means that you first need to select the primary slot visible in area C000h-FFFFh before you can select secondary slot.

In other words every expanded primary slot has their own secondary slot selection register in address FFFFh Address FFFFh can be read, but it always returns ALL THE BITS INVERTED. This means that you need to execute "CPL" in assembler or "XOR 255" in BASIC to get the value that was written to this address.

In BIOS these primary slots and secondary slot are handled automatically and the routines related to slot handling require you to give a SlotID as parameter. This is a byte where bits 0 & 1 represent primary slot, BIT 7 tells if slot is expanded or not and bits 2 & 3 represent secondary slot if bit 7 is set.