Difference between revisions of "Create a plain ROM"
From MSX Game Library
Line 7: | Line 7: | ||
Therefore, they cannot be more than 64 KB in size (the maximum size visible to the Z80). | Therefore, they cannot be more than 64 KB in size (the maximum size visible to the Z80). | ||
A program in ROM is detected by the MSX system thanks to a header located at addresses 4000h or 8000h but can in theory use any space between 0000h and FFFFh. | A program in ROM is detected by the MSX system thanks to a header located at addresses 4000h or 8000h but can in theory use any space between 0000h and FFFFh. | ||
+ | Generally, a ROM uses one or more 16 KB pages (numbered from 0 to 3). Pages 1 and 2 can be used freely, but the system expects to have special content in pages 0 and 3: | ||
+ | * Page 0: | ||
+ | ** The MSX BIOS with all standard functions. | ||
+ | ** The interrupt handling code (ISR) at address <tt>0038h</tt>. | ||
+ | * Page 3: | ||
+ | ** RAM with call stack and BIOS variables area. | ||
+ | ** Secondary slot register at address <tt>FFFFh</tt>. | ||
+ | MSXgl was designed to easily override the limitations of page 0 by providing BIOS-independent functionality and by providing ISR code that can install automatically in <tt>0038h</tt>. | ||
+ | On the other hand, it is not easy to use page 3, especially because the call stack is located there. | ||
+ | However, it is possible to write code that will copy the contents of page 3 to VRAM (or to RAM in another page for MSX2 or above). | ||
== Targets == | == Targets == |
Revision as of 21:36, 2 May 2023
A plain ROM is a format of binary application to be write into a ROM. The most common use case is the creation of game cartridges. The build tool will generate a .ROM file that can be written to an EPROM (like with a Mega Flash ROM cartridge).
Principles
A plain ROM, unlike a mapped ROM, is constructed from a single block whose parts will always be seen by the Z80 at the same address. Therefore, they cannot be more than 64 KB in size (the maximum size visible to the Z80). A program in ROM is detected by the MSX system thanks to a header located at addresses 4000h or 8000h but can in theory use any space between 0000h and FFFFh. Generally, a ROM uses one or more 16 KB pages (numbered from 0 to 3). Pages 1 and 2 can be used freely, but the system expects to have special content in pages 0 and 3:
- Page 0:
- The MSX BIOS with all standard functions.
- The interrupt handling code (ISR) at address 0038h.
- Page 3:
- RAM with call stack and BIOS variables area.
- Secondary slot register at address FFFFh.
MSXgl was designed to easily override the limitations of page 0 by providing BIOS-independent functionality and by providing ISR code that can install automatically in 0038h. On the other hand, it is not easy to use page 3, especially because the call stack is located there. However, it is possible to write code that will copy the contents of page 3 to VRAM (or to RAM in another page for MSX2 or above).
Targets
To create an plain ROM you just have to choice one of the following targets format:
Target | Description |
---|---|
ROM_8K | 8 KB ROM in page 1 (4000h ~ 5FFFh) |
ROM_8K_P2 | 8 KB ROM in page 2 (8000h ~ 9FFFh) |
ROM_16K | 16 KB ROM in page 1 (4000h ~ 7FFFh) |
ROM_16K_P2 | 16 KB ROM in page 2 (8000h ~ BFFFh) |
ROM_32K | 32 KB ROM in page 1&2 (4000h ~ BFFFh) |
ROM_48K | 48 KB ROM in page 0-2 (0000h ~ BFFFh) |
ROM_48K_ISR | 48 KB ROM in page 0-2 (0000h ~ BFFFh) with ISR replacement |
ROM_64K | 64 KB ROM in page 0-3 (0000h ~ FFFFh) |
ROM_64K_ISR | 64 KB ROM in page 0-3 (0000h ~ FFFFh) with ISR replacement |
ROM | Alias for ROM_32K |
For more detail, see Target article.