The Memory
This page was last modified 10:35, 25 January 2019 by Mars2000you. Based on work by NYYRIKKI and Gdx and others.

The RAM

Memory of an MSX computer is composed of RAM and ROM. Z80 can only handle up to 64KB because it has only 16 addressing pins (for 16 bits) but MSX computers use two systems that allow to switch 16KB on four fixed areas. These areas are called "pages". The first is the slots system. It has appeared since the first generation of MSX computers. The second system is the Memory Mapper. It has appeared since the MSX2 in option. This system was designed to extend the RAM.

When the MSX starts up, the CPU executes the initialization routine in the Main-ROM at address 0000h (slot 0 or 0-0) and scans the primary and secondary slots as shown in the figure below.

MSX slots scan 1.png

So, the first page of RAM found in a slot will be selected as Main-RAM.

An MSX computer must have at least 8 KB of RAM, this is the upper E000h ~ FFFFh. This area is scanned if no 16KB page is found in the slots.

Notes:

  • On MSX1/2/2+ the main RAM is detected as described above. Memory mappers are not takes into account.
  • On MSX Turbo R, the internal RAM is selected by default, because it can be accessed at a much higher speed in R800 mode but we can forced the Z80 mode by holding '1' key during start up. Thus the main RAM is detected as described above.

Then, the system searches executable ROMs (with the characters "AB" in the lead) in each slot on the 4000h~7FFFh and 8000h~BFFFh pages.

Default memory map (under BASIC):

When no disk nor ROM keeps control, the system starts in Basic and the memory map is like below.

Default Memory Map.png

The ROMs

MSX computers have the following standard ROMs:

  • Main-ROM that contains the BIOS and the BASIC interpreter. (MSX1~)
  • Sub-ROM that contains new BASIC instructions and the BIOS for new devices added by MSX2. (MSX2~)
  • Disk-ROM that contains the Disk BIOS and Disk-Basic. (MSX Turbo R) (optional for previous generations)
  • MSX-Music that contains the FM-BIOS and FM-Basic. (MSX Turbo R) (optional for previous generations)

Even other Roms size can be 2K, 4k, 8K, etc the slots system divides the memory into 16kB pages, and a page can be selected on four pages by writing the page number to the slot registers. A ROM is auto-exectuted at MSX start up if the characters "AB" is found at the address 4000h or 8000h. (See Rom header for detail)

Roms size can be expanded by a system not standardised called Megarom. There are also Megaram mappers available, which are similar but use a MegaROM mapper type. But these are mostly meant for playing cracked ROM games. (See ROM mappers)