Loading a ROM with Carnivore 2 and SofaRun

Door mcolom

Master (181)

afbeelding van mcolom

28-12-2020, 19:11

Hi all!

I'm trying to convert one game into a ROM (it's a re-edition + improvement of an existing game, I hope you'll see it soon), and I have some problems which perhaps you could help me with.

This megaROM is based on a Konami-4 mapper, and it works fine with all of the MSX1 and MSX2 machines I've tried in openMSX. I took into account that RAM might be at any slot, that the cartridge could be inserted in slot 1 or 2, and these kinds of things. It seems to work well with emulated machines.

However, when loaded directly with srom (SofaROM 3.0 from SofaRun) in my SX-1 FPGA, it starts and at some point it hangs. Srom detects correctly it's a Konami mapper on a OCM device. However, if I insert the Carnivore 2 and run again srom, it detects everything well, it uses the "Device: Carnivore 2 - RAM" and in this case it works perfectly! And even more strangely, if I flash the ROM within Carnivore 2, it doesn't work at all when run as a cartridge.

Is there anything I might be missing? Any ideas?
Thanks in advance for your comments Smile

Aangemeld of registreer om reacties te plaatsen

Van mcolom

Master (181)

afbeelding van mcolom

29-12-2020, 01:46

Well, after some investigation, perhaps it's a bug in sofaROM.

In my code I have this:
; Copy page #1
ld a, 7
ld (Seg_P8000_SW), a ; 0x8000 - 0x9FFF
inc a
ld (Seg_PA000_SW), a ; 0xA000 - 0xBFFF

it's been patched by srom to this:
ld a, 7
ld (#f806), a --> I think this is fine.
inc a
ld (#a000),a --> I think here's the problem.

For other address I've seen that sofaROM changes the write to the switching address by a CALL. Here it didn't do it. It seems that it tried to prepare something with "ld (#f806), a " but then it missed to patch it with a CALL.

The ROM is correctly detected as Konami, and the doc says the switch addresses are 4000, 6000, 8000, and A000.
Any ideas on how I should write that piece of code so SofaROM detects it easily? Or am I doing something wrong?