Testing your megarom on a real machine / MegaFlashROM SCC+ SD

Page 1/2
| 2

By Bengalack

Champion (393)

Bengalack's picture

01-06-2021, 19:55

Developing a megarom with openmsx is fantastic. I just use carta "game.rom" -romtype ASCII16 and my 256kB file runs super-smoothly.

I regularly test the game on a real machine (A1-WSX). Today was the first time after I converted from disk to rom.

I tried Megaflashrom SCC+ SD and flashed using multimente. It stated romtype: unknown when flashing. Did not work. Just a light blue screen. Then I tried to flash manually by stating /a16 for ASCII 16. Then the game actually starts up and shows title screen. Trying to get further into the game, triggers one of my asserts. From the looks of it, page 2, has the wrong data slotid or rom-segment.

Anyways: I'd like to simulate this on openmsx. I found "MegaFlashROM SCC+ SD" as a possible extension, but it is not intuitive to me how I can simulate that my game-rom is flashed onto this.

Any tips on how to proceed?

Login or register to post comments

By thegeps

Paladin (832)

thegeps's picture

01-06-2021, 19:58

Well, I think you have to put your ROM file and your flashing tool in a disk image (or in a dir as disk) and launch the flashing tool

By Bengalack

Champion (393)

Bengalack's picture

01-06-2021, 20:17

thegeps wrote:

Well, I think you have to put your ROM file and your flashing tool in a disk image (or in a dir as disk) and launch the flashing tool

Ah, nice - I can try that! Thanks.

By ray2day

Hero (662)

ray2day's picture

01-06-2021, 20:43

Try the /U option.

By Bengalack

Champion (393)

Bengalack's picture

01-06-2021, 21:36

ray2day wrote:

Try the /U option.

Yes! Thanks, this worked! Thanks.

So... /U is: "Disables subslots and set MegaFlashROM SCC+ as unique device available." Ok. Good to know!

By ray2day

Hero (662)

ray2day's picture

01-06-2021, 21:44

Quote:

So... /U is: "Disables subslots and set MegaFlashROM SCC+ as unique device available." Ok. Good to know!

Yep!

By Grauw

Ascended (9912)

Grauw's picture

01-06-2021, 22:22

Hey Bengalack, this means there is some issue with the subslot handling. Feel free to provide some details on the slot selection code if you’d like some assistance to get this fixed. E.g. are you using the BIOS routines or accessing the slot selection I/O directly?

By Bengalack

Champion (393)

Bengalack's picture

01-06-2021, 23:45

Grauw wrote:

Hey Bengalack, this means there is some issue with the subslot handling. Feel free to provide some details on the slot selection code if you’d like some assistance to get this fixed. E.g. are you using the BIOS routines or accessing the slot selection I/O directly?

Awesome! Would be great to understand why this happens, yes please.

I'm not using BIOS, using A8 and FFFF directly. First, I assume disk is not present, second, I'm preparing RAM in page 0, so I cannot use BIOS. I thought I had figured out things, as... hmm it worked. It even works in openmsx using Sony HB-F500.

I am assuming that the outset of page-contents are as described on this page: https://www.msx.org/wiki/Develop_a_program_in_cartridge_ROM#...

algorithm is like: slot-id for main-rom is found in BIOS_EXPTBL in page3 (and active at startup), but I place ram there (which I search for manually). page 1 will remain untouched. page 2-ram is (according to the page above) the active page at cart-startup. page 2-rom gets the same slot-id as page 1 rom. Page 3 is never changed, well except when used for reading/writing at FFFF for subslot.

(0038 is no problem btw it seems)

So far it seems like page-2 is my problem. The game starts up, but fails when reading leveldata from ram in page 2.

I can provide more details... if needed (tomorrow).

By gdx

Enlighted (4498)

gdx's picture

02-06-2021, 01:59

You can emulate a slot expander with OpenMSX.

In general the issue with the Sony HB-F500 is not the expanded slots but the RAM which is divided into two in the slots.

By Bengalack

Champion (393)

Bengalack's picture

02-06-2021, 15:51

gdx wrote:

You can emulate a slot expander with OpenMSX.

Thanks. Will look into this sweet feature ASAP.

While I haven't totally fixed things yet, I understand more of this now and hope to nail things soon.

I've found two bugs in my code, one silly mistake in the subslot-identification-routine, and one silly mistake (jr nz ==> jr z) in the page-0-ramsearch.

When delving into this again now, I recall searching for MSX2-computers which had cartridge-slots in a subslot. Didn't find one (I assume this is because a physical slot needs to be able to accept a slot-expander), so I wasn't able to get this code tested. openmsx-slotexpander to the rescue I presume!

Some of my code must have been working "by chance" oO But I should be able to fix this now.

By Bengalack

Champion (393)

Bengalack's picture

02-06-2021, 18:43

Ok. Fixed it... in a way. Before, I was assuming the active slot in page2 to be ram (which I wanted it to be), based on this:

This works across the board in openmsx. Even with slotexpander. But not with MegaFlashROM_SCC+_SD. Thanks to openmsx' ability to emulate MegaFlashROM_SCC+_SD, i found that page 2's slot is the same as page 1 (=ROM). My fix for this is to set the slotid for page-2 equal to the one active in page3 (should always be ram). Not sure why MegaFlashROM_SCC+_SD does this differently. Characteristic of megaroms only? I don't know.

As I said, slotexpander works great as well (but didn't trigger my problem) - My only problem with slotexpander was to find documentation on it. Spent quite some time googling, analysing xml-files and reading docs, before I realized how to use it. The super simple documentation is: add "-ext slotexpander" and by that you get 4 new cart's. In my case: I got cartc, cartd, carte, cartf, and tested with those.

Another thing that was really funky in this bughunt was to use the "Memory Layout" to track slots and segments. The picture below is from such a session. You can see from the memory (EXPTBL) that slot 1 is expanded, but page 1, 2 and 3 is using this primary slot, but is shown as "1", and not "1-1" and "1-2" as is the real case here. Also, we cannot see segment. So it's a bit tricky. For this ascii16 mapper-type I write to some known adresses and swap segments - but it is not shown/tracked at all *visually*.

Thanks for the tips, all! And some last words: openmsx is fantastic. Wouldn't have been able to find out all this without it!

Page 1/2
| 2