Moving from disk-format to megarom - page 0 not switchable?

Page 1/2
| 2

By Bengalack

Champion (389)

Bengalack's picture

01-05-2021, 12:43

First; the amount of information in this place is fantastic. I'm in the midst of taking a large codebase/game which is currently using dos, disk and memory mappers, to rom-format. This work is a rather significant amount of work (structure-wise). Lucky for me, the information here takes me along way. (BTW: For people to catch up, here are your links: 1, 2, 3, 4, 5, 6, 7, 8).

Anyways, I'm planning for 16kb pages. Initial thoughts went to: ASCII16, it seems like this format is well supported, also in physical editions.

**BUT**

is it really so that you can only switch pages in page 1 and 3? I need to switch in page 0 as well. Like my code in page 1, read A LOT of static data in page 0, and place in ram: Page 2 and some in ram: Page 3.

I then thought, docs says that page 2 is mirrored in page 0. But I can't really get this to work. At least not in openmsx.

Using this: "-romtype ASCII16", I just get this (4!=255):

Thoughts?

Login or register to post comments

By geijoenr

Master (254)

geijoenr's picture

01-05-2021, 13:40

I have read in a comment somewhere that mirroring is not generally supported by ASCII mappers. So probably openmsx doesn't support it either?

[EDIT] here https://www.msx.org/wiki/MegaROM_Mappers#ASC16_.28ASCII.29

By Bengalack

Champion (389)

Bengalack's picture

01-05-2021, 14:06

geijoenr wrote:

I have read in a comment somewhere that mirroring is not generally supported by ASCII mappers. So probably openmsx doesn't support it either?

Thanks, yes, I've seen the line "Mirror of pages is not present on many cartridges." too. But it is vague or non-specific, and I was hoping that there would be some implementations from the physical providers where it was present/possible. And if this is possible, it would make sense that openmsx made it possible to program for.

That said, I'm not tied to ASCII mappers. Are there any others that works, so that I can swap roms in 0-3FFF? Preferably 16kb blocks. Partly because I've read that 16kB blocks are better than 8kB when it comes to software that runs your rom. As physical memory mappers always use pages of 16kB there are no time delay when switching pages, but for 8kB there might be.

So.. still looking for a way to swap rom segments in page 0...

By Bengalack

Champion (389)

Bengalack's picture

01-05-2021, 14:49

Ok, so this seems like an area with many unknowns, still. Found this: https://github.com/openMSX/openMSX/issues/1149 and this: https://github.com/openMSX/openMSX/issues/1213

Seems like "Zemina 16k" has what I want, but it is not 100% clear how to use this in openmsx. And not sure if it is supported by manufacturers.

"Konami's MegaROMs without SCC" is another, it seems, but this one is 8kB pages, and I'll likely have to swap 2 pages at a time, and we get the aforementioned page-swap-slowdown when using non-physical box may occur(?). EDIT: This one has a FIXED segment for "4000h~5FFFh (mirror: C000h~DFFFh)". not good.

By geijoenr

Master (254)

geijoenr's picture

01-05-2021, 14:47

Well, you know. If something is not generally supported, unless you provide the hardware for the mapper yourself, chances are that it doesn't work in many computers. So I would avoid relying on that feature.

By Bengalack

Champion (389)

Bengalack's picture

01-05-2021, 14:57

geijoenr wrote:

Well, you know. If something is not generally supported, unless you provide the hardware for the mapper yourself, chances are that it doesn't work in many computers. So I would avoid relying on that feature.

Agree totally, I just need to check with all you people what my options are. I'm pretty late to the party, so normally I find that most things have been figured out, some way or another, before me. Maybe @Daemos or others have found out lately? A way to switch rom-segments in page 0?

By Bengalack

Champion (389)

Bengalack's picture

01-05-2021, 15:11

Ok, if there is no obvious way, an alternative is to copy my rom-segments into ram in page 0. As long as the work and switching in page 0 is not very performance dependent (like a frame-update), this should work. Feels like a workaround though :-)

By Daemos

Paragon (1948)

Daemos's picture

01-05-2021, 15:34

I never switch rom to page0 tried it and only got in trouble. For megarom kinda stuff I have RAM in page0 and rom always in page 1 or 2. Konami SCC can call every block in any page so the 8k blocks are not a real restriction.

Perhaps you can lighten up how you like to use the rom in page0 (purpose, what kind of operation etc.), then we can think along.

By Bengalack

Champion (389)

Bengalack's picture

01-05-2021, 18:14

Ok.

My main game code is from 0x0-0x7FFF. Level-data is from 0x8000-0xBFFF. Then I have som variables above 0xC000 + something called "orchestrate" which is memory-mapper-stuff, and an "upper location" to set pages, call from, and so on.

I may write a bit about the whole journey, technical stuff and such later, so I've been documenting a bit along the way. The drawings are also helpful during development, obviously. The (pretty stressful!) memory layout using memory mapper was like this.

Then I've been rewriting to get more towards something like this.

But today, when I realize that I cannot swap into page0, the new plan is like this:

I will only use page 0 as a place to load data from. The data will go from there into page 2 (or to VDP). Like level-data, or stored packed images in page 2 being unpacked and sent to video mem. All of these operations are during startup or a loading screen or so, so there is no stress with timings. And interrupts are going to be disabled all the time.

Not sure if the drawings are very intuitive for others, though.

As for 16kB-pages vs 8kB, it's based on the talks in this thread: https://www.msx.org/forum/msx-talk/development/is-rapid-swap... where it seems like running from SD-card can make stalls. During every frame, there will jumps between game.bin and other.bin in page 1. I don't want stalls there, regardless of environment (real hw, flashmem, or something else).

By Grauw

Ascended (9904)

Grauw's picture

01-05-2021, 18:37

In a ROM mapper, bank switching is instant and quick. It's one of the big advantages of the format - large storage, instant access.

By Bengalack

Champion (389)

Bengalack's picture

01-05-2021, 19:44

Grauw wrote:

In a ROM mapper, bank switching is instant and quick. It's one of the big advantages of the format - large storage, instant access.

I love the whole thing. It is fantastic. I'm playing with the idea of releasing a physical cartridge. This will be great -and using a flashrom will be just as good. Now, for people only having extra memory by means of a memory mapper, and is using Sofarun, it seems from the documentation that there might be disk usage at runtime. And then the "normal mapping" is 16 kb, so I'm assuming there will be hiccups here, at least for 8kB? I've barely used Sofarun, so I have no firsthand experience with page switching. Just want to work towards a good player experience in all scenarios - if possible. If my Sofarun-mm-thoughts are no issue, let me know :)

Page 1/2
| 2