Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

There are defined ways how a cartridge is recognized in a C64 or C128 system . But what defines a MEGA65 cartridge and how is it started? The Slot 0 core needs to know and also the ROM has probably to do something.

We decided to go both the C64 and C128 way: a MEGA65 cartridge has the bytes $4D $36, $34 at $8007. This spells “m65” (the C128 has “cbm” at that location, while the C64 can have “CBM80” at $8004). Without being mapped (EXROM/GAME lines are high, so the system won’t map it!), this can be found at $4008007 in flat memory.

Like the C128 $8000 (in cartridge space) has the coldstart and warmstart code:

        * = $8000
cartVectors:
        jmp coldStart       // cold-start vector
        jmp warmStart       // warm-start vector
cartFlags:
        .byte %00000001     // flags, bit 0 = 1 map & start
cartMagic:
        .byte $4D,$36,$35   // "m65" string

Cartridge Startup

If the ROM sees the identifier at $4008007, and bit 1 of $4008006 is 1, it will DMA 8 KB from $4008000 to $8000 and execute a JMP $8000. This will execute the coldStart routine of the cartridge and everything else is up to the cartridge.

  • A simple cart storing a program less than 8 KB in size can just run from 0.8000.

  • A cart larger than 8 KB in size will need a bootstrap routine to set up memory as desired. All cartridge hardware lines are available at 400.xxxx, so the actual bootstrap code will depend on the cartridge hardware platform.

  • EasyFlash 1 can store up to 1 megabyte, making 16 KB visible at a time in two 8 KB chunks at 400.8000 (ROML) and 400.E000 (ROMH). Only EF bank 0 ROML is DMA’d to 0.8000 during cart start-up. The cart’s bootstrap code should be able to write to the 400.DE00 EasyFlash bank register to select one of 64 banks to replace ROML and ROMH. This does not change 0.8000 automatically: the cart’s bootstrap needs to decide how to access and install cart data read from 400.xxxx.

  • Custom hardware must serve a DMA’able bootstrap program at $8000-9FFF.

CRT files and EasyProg

Someone writing software intended to be installed on an EasyFlash 1CR cart is likely to distribute that software as a file that an end user can install on their own EF1CR hardware. For C64/C128 carts, software is distributed as a CRT file, which can also be run in the VICE emulator. The end user uses EasySplit and EasyProg to write the CRT to the EF1CR using their C64.

We don’t yet have comparable tools for MEGA65 carts, but it’s worth discussing the appropriate format extensions while we’re figuring out the rest of it.

  • RFC: Use a CRT signature of: MEGA65 CARTRIDGE

  • Other format changes might be justified if this is added to the CRT standard by the VICE team, e.g. incrementing the format version bytes.

  • A fork of EasyProg would be required to recognize the CRT signature and install the M65 cart header described above.

  • A fork of bin2efcrt would be useful for developers. The change to the CRT signature would be straightforward.

I have not yet tested EasyProg from GO64 mode. It works well with the C64 core. Ideally we’d have a new version of EasyProg that runs in MEGA65 mode and can read full CRT files off the SD card, but that’ll be a big project.

External References

  • No labels