Memory Mapper
This page was last modified 15:57, 19 January 2019 by Mars2000you. Based on work by Gdx and Grauw and others.



A memory mapper is a general term describing a mechanism to map different blocks of memory into specific pages of the memory addressable by the CPU. It can apply to RAM, ROM or some combination of those. Often such a mechanism is used to let a CPU address more memory than it supports natively. Memory mappers are used on many different systems, and come in many different shapes & sizes.

In the MSX context, it normally refers to a RAM memory mapper as introduced optionally with the MSX2 standard. Memory mappers are also used in some ROM cartridges, usually these are referred to as a "MegaROM" or "ROM mapper".

Memory mappers on MSX2 and higher



  • Yamaha S1985 MSX2 engine supports a 512 KiB memory mapper. Due to a shared pin, it depends on the type of keyboard whether the maximum supported size is 256 or 512 KiB.
  • Toshiba T9769 MSX2+ engine supports a 512 KiB memory mapper.
  • Daewoo DW64MX1 MSX2 engine supports a 256 KiB memory mapper in slot 0-2.

Usually less than the fully supported size is installed. Expansion up to the supported size is relatively easy, expansion to bigger sizes requires adding more logic.

The Yamaha S3527 MSX engine does not include support for a memory mapper. Some MSX models include a memory mapper built using discrete logic ICs, often one or more 74LS670s.


Maximum size

An MSX memory mapper contains up to 256 (2^8) blocks of 16 KiB (16384 bytes) each. Thus the maximum size for a mapper is 4 MiB (4096 KiB).

I/O ports

Memory mappers have 4 write-only registers on the following I/O ports:

  • Port FCh (252) selects the segment in page 0 (0000-3FFFh).
  • Port FDh (253) selects the segment in page 1 (4000-7FFFh).
  • Port FEh (254) selects the segment in page 2 (8000-BFFFh).
  • Port FFh (255) selects the segment in page 3 (C000-FFFFh).

If multiple memory mappers are installed on the system, the registers will act on all of them at the same time.

The mapper registers are specified in the standard as write-only. Although on several mappers they can also be read, software must not make use of this, it will not be interoperable. See the section on reading back for more details.


The MSX2 BIOS initializes memory mappers by setting up the following configuration:

  • Segment 3 is set on page 0 (0000-3FFFh).
  • Segment 2 is set on page 1 (4000-7FFFh).
  • Segment 1 is set on page 2 (8000-BFFFh).
  • Segment 0 is set on page 3 (C000-FFFFh).

For software unaware of memory mappers, the default configuration above appears like a regular 64 KiB block of RAM.

RAM selection

The memory mapper RAM is only accessible in a 16 KiB page of the Z80’s address space if the memory mapper’s slot is selected for that page. So the memory mapper mechanism is layered on top of the MSX (sub)slot mechanism.

It is recommended to use the MSX-DOS2 extended BIOS mapper support routines when available. This will improve the compatibility and interoperability of your software in the MSX-DOS2 environment. Using MU or MemMan can be an alternative when DOS2 is not available. Otherwise, the mapper registers can be accessed directly, but this is only suitable when your software uses the mapper exclusively.

When using the MSX-DOS2 mapper support routines, it is recommended to allocate from all slots (B=20h), store the slot ID along with the segment number, and when selecting the mapper page also select its slot (if changed). This will enable you to use all of the available memory rather than only the primary mapper. This is especially relevant for the MSX Turbo R, where the internal memory is always the primary mapper, and only 256K in the ST, partly used by MSX-DOS2 and DRAM mode.

It is possible to select the same RAM block in several memory pages, in which case these pages will mirror each other. That is, the same 16K RAM block is visible in different memory pages.

Reading back mapper registers

The mapper registers are specified in the standard as write-only. Although on several mappers they can also be read, software must not make use of this, it will not be interoperable, especially if multiple memory mappers are present. That said, here are some details on what can happen when you do.

Firstly, not all memory mappers support read-back. A memory mapper without readable registers is simpler to construct, and thus quite a few memory mappers were built that way.

When a mapper has readable registers, they indicate the current segment selected on the corresponding memory page. Most memory mappers do not store all eight bits, the unused bits can be mirrors of the used bits, or remain either high or low or floating. As such, reading can cause bus conflicts when several mappers are present.

The amount of bits stored also needs not correspond to the amount of memory installed in the machine, e.g. the Panasonic FS-A1 (a 64K machine) stores values up to 1Fh (512K), bits 7 is always set and bits 6, 5 are always reset when no mapper is installed. The number of bits stored can indicate the amount of memory the MSX can be easily internally expanded to without adding additional logic.

Additionally some MSX machines block external cartridge slots from responding to I/O read requests to the mapper ports and other system ports. This is for example the case on Panasonic MSX2+ models and the Turbo R ST / GT.

As a result, when reading a mapper register in a configuration with multiple mappers, the result may come from the biggest mapper, or from a built-in mapper, or in some cases correspond to a floating data bus. Or some mix thereof. Therefore (as stated above) results are unreliable and programmers should not (ever!) read the mapper registers.

Unfortunately software which reads the mapper registers does exist, especially certain European 128K software and ROM cracks. For this reason most memory mappers support read-back of the mapper registers. This does not always help though, e.g. Pumpkin Adventure 2 will not work on a Panasonic MSX2+ with external memory mapper cartridge, no matter if it has read-back. For that software, either a software patch or an internal memory expansion is the only solution.

See: List of software reliant on mapper read-back

Multiple memory mappers

It is possible to have multiple memory mappers in an MSX, theoretically up to 15, for a maximum of 60 MiB! Some software exists that supports using all that RAM. On MSX2+ and Turbo R computers, the total amount of RAM (excluding video RAM) is displayed under the boot logo.

Each memory mapper has its own copy of the mapper registers. Depending on the mapper size, each may store a different number of bits. When writing to these registers, all memory mappers present will update their copy at the same time. For example if there are 3 memory mappers present, there will be 3 copies of the mapper registers which are updated simultaneously.

Memory mappers on MSX1

The BIOS in MSX1 computers doesn’t initialize memory mappers. At power up, most memory mappers will have block 0 selected for each of the 4 memory segments, which means a single 16 KiB block of RAM is mirrored in all segments. The machine will typically boot, but as soon as a program larger than a few KiB is loaded it will overwrite the system area.

There are several solutions to this:

  • Initialization can be performed by hand, followed by a reset (NOT a power cycle!).
  • Some CPLD- or FPGA-based memory mappers initialise to the standard 3-2-1-0 configuration.
  • The Yamaha CX5MII BIOS is patched by Yamaha to initialise the memory mapper like on MSX2 and above. It is one of the few MSX1 computers with a memory mapper.
  • An MSX1 BIOS ROM can be modified to do mapper initialization like on MSX2 and above.
  • Some cartridges meant to be used on MSX1 may include code to initialize memory mappers.
  • Booting with Nextor DOS will initialise the mapper.

Software support

In most cases it’s problematic (or at least difficult) to have multiple pieces of software share the RAM in an MSX. Memory mappers are no exception to this rule. The following solutions exists to make this easier:

  • MSX-DOS2: Provides extended BIOS mapper support routines which enable multiple applications to use the same memory mappers without overwriting each other’s RAM.
  • MU: Provides MSX-DOS2 compatible extended BIOS mapper support routines on MSX-DOS1. Software must explicitly free allocated memory on program termination though.
  • MemMan: Provides memory mapper and TSR support routines for software in both MSX-DOS1 and MSX-DOS2.

Also a few MSX1 machines and all MSX2 and higher machines have MSX-BASIC support for RAM disks of up to ~216 KiB (see CALL MEMINI). This built-in RAM disk is not aware of MSX-DOS2 or MemMan mapper support, so this RAM disk should not be used in combination with MSX-DOS2 or MemMan. Use the MSX-DOS2 or MemMan RAM disk functions instead.

How to know if Main-RAM is in a memory mapper

Use the Basic program DMM.BAS (listing below). It displays the size and the slot number. (Requires disk system)

5 'Display the main memory mapper size
10 S%=PEEK(&HF341) OR PEEK(&HF342) OR PEEK(&HF343) AND &H8F: IF S%<>PEEK(&HF344) AND &H8F THEN PRINT"Main-RAM is disposed in several slots!": BEEP: END
20 IF PEEK(&HF677)=&HC1 THEN 50
30 CLS: PRINT CHR$(13)+"DMMM v0.5 by GDX": PRINT "wait...";
40 POKE &HF676,1: POKE &HF677,&HC1: POKE &HC100,0: RUN"DMMM.BAS"
50 PRINT CHR$(13)+"wait...";STRING$(23,32);
60 FOR N=255 TO 0 STEP -1
70 OUT 254,N: POKE &H8000,N
80 NEXT N: SZ=0
90 FOR N=0 TO 255
100 OUT 254,N
110 OT=T: T=PEEK(&H8000)
120 IF N=255 AND OT=254 THEN SZ=255
140 NEXT N
150 'OUT 254,1: POKE &HF676,1: POKE &HF677,&H80: POKE &H8000,0
160 IF SZ<4 THEN PRINT CHR$(13);"No mapper found!": BEEP: END
170 PRINT CHR$(13);"Main mapper size:"; SZ*16+16;"KB"
180 PRINT"Slot:"; S% AND 3;
190 IF S%>128 THEN PRINT"-";(S% AND 12)/4