subslot emulation

By flok

Resident (34)

flok's picture

29-03-2020, 22:22

Hi,

While trying really hard to get my msx emulator (written in python https://github.com/flok99/pymsx) to do the right thing, I seem to fail at emulating the subslot register. This is visible when the disk-emulation tries to start msx-dos (it hangs).

Now to verify, can some-one tell me what is read from ffff when slot 1 is selected:
- and there is no cartridge nor roms in it
- or there's a 16/32kB rom it with no subslot
- or a 64 kB rom with no subslot
- or ram in it (in subslot 2 and fully selected)

I'm expecting that with no rom it, it shows 0xee (like anywhere else in a slot without rom/ram)
with a 16/32 rom, it'll be 0x00
and for a 64k rom whatever the eeprom behind contains at that address
and with ram the subslot-selection xor 0xff.

Right?
Any other cases I missed?

Thanks!

Login or register to post comments

By Parn

Hero (516)

Parn's picture

30-03-2020, 04:11

The address &HFFFF only behaves as the secondary slot register for that primary slot if the primary slot is expanded. Another thing: this is probably obvious, but to use the secondary slot register for a given slot, that slot must be selected on page 3.

So if you're trying to emulate secondary slots, it doesn't matter what's visible in page 3, if it's ROM, RAM, mirrored ROM, or nothing at all, since &HFFFF will be the secondary slot register in that case. It will always read back whatever was first written to it, but inverted.

Now, if that slot isn't expanded at all, then &HFFFF will mostly behave like a normal memory address, so it will read whatever you write in it if it's RAM or stay the same if it's ROM. Please note 16/32kB ROMs don't usually map to page 3 unless there's mirroring. If there's nothing at all it will read some undefined value.