Tatara

Appendix G
Memory

TATARA and TANREN keep their tables, and TANREN keeps the program it builds, in the MSX’s memory mapper, not in the 64 KB that the Z80 can see. This appendix describes how the tools use memory, how much they need to build a program, and what to do when there is not enough. It is about the memory the tools need while they work, not about the memory the finished program needs when it runs.

G.1 The memory map

A memory mapper is RAM divided into segments of 16 KB. The Z80 sees four of them at a time, one in each quarter of its 64 KB, which are called pages. Figure G.1 shows how the four pages are used while TATARA or TANREN runs:

PIC

Figure G.1: The Z80’s 64 KB while TATARA or TANREN runs, and the mapper segments behind the window.

G.2 What goes into the mapper

The segments that MSX-DOS2 has not given to anything else are free, and the tools ask MSX-DOS2 for them as they need them:

So the size of a program is limited by the free memory of the mapper, not by the memory that MSX-DOS leaves for programs below C000h.

G.3 How much memory the tools need to build a program

What counts is the free memory, not the total. MSX-DOS2 takes part of the mapper for itself: 112 KB on an MSX2 or MSX2+ and 176 KB on an MSX turbo R, in the tests below, without a RAM disk. A RAM disk takes more.

Table G.1 shows what fitted in the free memory of several machines. Each source defined names of 16 characters with EQU, and the program was 40 KB of data, linked as a .COM program.

MSX Total MSX-DOS2 Free 2000 names 8000 names 40 KB program
MSX2 128 KB 112 KB 16 KB no (495) no (495) no
MSX2 192 KB 112 KB 80 KB yes no (2479) yes
turbo R 256 KB 176 KB 80 KB yes no (2479) yes
turbo R 384 KB 176 KB 208 KB yes no (6447) yes
turbo R 512 KB 176 KB 336 KB yes yes yes
turbo R 1024 KB 176 KB 848 KB yes yes yes
Table G.1: What fits in the free memory of the mapper. A number in brackets is how many names fitted.

These rules of thumb follow from it:

Most cartridges that give an MSX2 the MSX-DOS2 kernel bring a mapper of their own: ASCII’s MSX-DOS2 cartridge has 128 KB, the SD-512 and the MegaFlashRom SCC+ SD 512 KB, and the Carnivore2 1 MB. A cartridge with only a mapper, such as the MEGA-MAPPER with up to 4 MB or the 16 MB memory cartridge V3, adds memory to any MSX. Appendix H lists these cartridges and where to get them.

How much memory an MSX has

The startup screen of an MSX shows how much memory it has, but some models show only the memory of the mapper inside the computer, not of one in a cartridge. MAPPER.COM, from https://github.com/javilm/msx-mapper, shows every mapper that MSX-DOS2 found, with how much of each MSX-DOS2 uses and how much is free:

A:\>mapper 
Total 256Kb (176Kb sys, 0Kb user, 80Kb free). 
Memory mappers detected by MSX-DOS2: 
[PRIMARY] Expanded slot 3-0: 176Kb sys, 0Kb user, 80Kb free.
 

The free figure is the one that the tools can use.

G.4 When the mapper is full

When there is no free segment left, the tool stops with out of mapper memory. To get more room: