Changes

Jump to: navigation, search

Programming:Cartridges

801 bytes added, 13:20, 25 July 2022
added links to DES and Dandanator gerber files and documentation how to build
== Overview ==
The main media to distribute software on the CPC was were cassettes and 3 inch floppy disks. The Plus models, including the GX4000 console, introduced cartridges.
As the original media is harder to find (3" discs specially), cartridges are becoming one of the best options to distribute CPC software, for example:
* [http://www.dandare.es/Proyectos_Dandare/CPC_Dandanator%21_Mini.html Dandanator mini] –page only in Spanish–(*): is a cartridge format to be plugged in the expansion port that provides a number of generic and advanced features, including support for 512K of ROM (in 16K banks), and it works on any CPC without jumpers or special configuration.* [https://auamstrad.es/the-dandanator-entertainment-system/ DES]: the Dandanator Entertainment System (*), which is an interface that goes to the expansion port and supports cartridges. It has the same functionality as the Dandanator, with the difference that the expansion contains most of the functionality, and the cartridges are simpler –and cheaper–.
* [https://abalore.com/plus2cpc.html Plus2CPC]: provides a cheap way to plug CPC Plus cartridges on any CPC and, '''as long as the cartridge doesn’t use any Plus features''', it will work. It also offers 512K of ROM, just like the Dandanator, and uses the regular ROM mapping functions of the CPC.
* [[M4_Board|the M4 board]]: can load CRT CPR files on any CPC.* [[C4CPC|C4CPC]]: can load CRT CPR files on the GX4000. (*) Gerber files and documentation to build your own [http://www.dandare.es/Proyectos_Dandare/Descargas.html Dandanator] or [https://auamstrad.es/hardware/des-archivos-gerber DES] are available.
== Strategy ==
| 0x0000 || 16K || ROM || Code
|-
| 0x4000 || 16K || ROM RAM || R/W Data
|-
| 0x8000 || 16K || RAM || R/W Data
|}
When a ROM bank is mapped into lower ROM (0x0000) or higher ROM (0xC000), reads will go to ROM and writes will go to RAM and mapped ROM is only seen by the CPU. This is important because the gate array can only see RAM when drawing the screen.
The idea is mapping on higher ROM any of the banks as we need them, and we can use that data with RAM from 0x4000 to 0xffff, leaving on lower ROM the bank 0 with our code.
It is '''easy to support both CPC+ and Dandanator from a single code baseImportant''' using macros: when mapping data on high ROM with video RAM on 0xc000 you won't be able to draw masked sprites directly from that mapped ROM (reading video RAM is required to apply the mask). Either don't use 0xc000 for video memory or make a copy of those sprites to RAM from 0x4000 to 0xbfff and draw them from there.
Then However the RAM mode 0x7fc3 allows you to move the video RAM from 0xc000 to 0x4000, which allows it to be accessed directly from the upper ROM. It is '''easy to support both CPC+ and Dandanator from a single code base''' using macros and generating both CRT CPR and Dandanator ROMs is trivial. For example, these [https://github.com/reidrac/cpr-tools simple tools to make/dump CPC+ CPR cartridge files] can generate both formats (use RAW and padding flags to get a Dandanator ROM).
== Dandanator ==
ld 0 (iy), c
ei
 
Unmap higher ROM (have regular RAM in 0xc000):
ei
== CPC+ carts (CRTCPR) ==
Bank switch higher ROM:
out (c),c
ei
 
This is [[Programming:Crt0Cart|an example of CRT0 for SDCC for a CPR]]. It shows how to setup the CPC when booting from cartridge.
== References ==
144
edits