Difference between revisions of "Create a mapped ROM"

From MSX Game Library

(How to)
Line 38: Line 38:
  
 
== How to ==
 
== How to ==
 +
 +
First, you need to decide which mapper you want to use and what size you need.<br/>
 +
If you have no idea, start with a 128 KB ROM using ASCII-8 mapper.
 +
 +
The choice of ROM is made in the configuration file of the build tool (<tt>build.bat</tt>).
 +
 +
Example:
 +
<pre>
 +
set target=ROM_ASCII8
 +
set ROMSize=128
 +
</pre>
 +
 +
See the details of the configuration of the build tool: [[Targets#Mapped_ROM_program]].

Revision as of 01:44, 8 May 2022

To create cartridges larger than 64 KB, MSXGL allows to use 4 types of ROM mappers.

Principes

A mapped ROM is visible in pages 1 and 2 of the Z80 memory space (address 4000h-7FFFh and 8000h-BFFFh).
This 32 KB space is divided into either 4 banks of 8 KB or 2 banks of 16 KB. This is why mappers are often categorized as 8 KB mapper and 16 KB mapper.

ROMs using these mappers can be for example 128 KB, 256 KB, 512 KB, 1 MB, 2 MB or 4 MB in size (4 MB, only for 16 KB mapper).
The total content of the ROM is divided into blocks of the mapper size (8 or 16 KB). These blocks are called segments.

The concept of using mappers is to associate a given segment with a bank to make it visible to the Z80.
By changing the segments visible in each bank during the course of the program, we can thus access the entire contents of the ROM.

128 KB ROM using an 8 KB mapper (ASCII-8). The ROM is composed of 16 segments, visible to the Z80 through 4 banks.
In the example above, segment #0 is visible in bank #0, segment #1 in bank #1, segment #3 in bank #2 and segment #5 in bank #3.

The supported mappers are:

Target Description
ROM_ASCII8 ASCII-8: 8KB segments for a total of 64KB to 2MB
ROM_ASCII16 ASCII-16: 16KB segments for a total of 64KB to 4MB
ROM_KONAMI Konami Mega-ROM (aka Konami4) 8KB segments for a total of 64KB to 2MB
ROM_KONAMI_SCC Konami Mega-ROM SCC (aka Konami5): 8KB segments for a total of 64KB to 2MB

More details on the different mappers:

Note: "MegaROM" refers to a ROM of 128KB or more. Even though they are not widely supported, there is nothing to prevent you from creating a 64KB ROM using a mapper. We therefore prefer to use the term Mapped ROM here rather than MegaROM.

How to

First, you need to decide which mapper you want to use and what size you need.
If you have no idea, start with a 128 KB ROM using ASCII-8 mapper.

The choice of ROM is made in the configuration file of the build tool (build.bat).

Example:

set target=ROM_ASCII8
set ROMSize=128

See the details of the configuration of the build tool: Targets#Mapped_ROM_program.