Harry Potter wrote:
> I'm sorry for being pushy :( , but I really want to implement a
> Simon's cartridge setup for GenCart64. The problem is, no matter
> whether I write 0 or 1 to $DE00, the Simon's BASIC ROM at $A000-$BFFF
> seems to *always* be visible.
The documentation is wrong, at least the one I can find here:
http://ist.uwaterloo.ca/~schepers/formats/CRT.TXT
Is there a new version of this description somewhere?
You can find the relevant source code for Vice in this file:
http://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/c64/cart/simonsbasic.c
The comment at the beginning says:
- reading io1 switches to 8k game config (bank 0 at $8000)
- writing io1 switches to 16k game config (bank 0 at $8000, bank 1 at $a000)
And this is the implementation:
static BYTE simon_io1_read(WORD addr)
{
cart_config_changed_slotmain(0, 0, CMODE_READ);
return 0;
}
static void simon_io1_store(WORD addr, BYTE value)
{
cart_config_changed_slotmain(1, 1, CMODE_WRITE);
}
The "cart_config_changed_slotmain" function is implemented in
c64cartmem.c. The first two parameters defines which mapping is used
during phi=1 and phi=0 (for the CPU and for the VIC, looks like some
cartridges can use different memory mappings depending on if the CPU
wants to access the cartridge, or if the VIC wants to access it, which
sounds interesting). The important lines in this function are these:
export_slotmain.game = mode_phi2 & 1;
export_slotmain.exrom = ((mode_phi2 >> 1) & 1) ^ 1;
The meaning of GAME and EXROM are inverted in Vice, so on a real Simons'
BASIC cartridge the EXROM line is always 0, and if you read $de00, the
GAME line will be set to 1, switching to 8k game config. If you write to
$de00, the GAME line will be set to 0, switching to 16k game config.
You can set breakpoints in Vice for read and write access to $de00
("break load de00" and "break store de00"). Looks like there is some
clever code to use parts of the old C64 BASIC interpreter ROM, and then
switching to the Simons' ROM at $a000, if some new stuff from Simons'
BASIC is needed, which is not in the $8000-$9fff area.