I'm totally dumb in managing memory slots and I'm trying to do Things far beyond my capabilities
Anyone willing to give me some advice?
I have a 64KROM and I need to do, in the order:
1)switch the ROM in page 3,
2)move to VRAM same data,
3)restore the RAM in page 3,
4)switch the ROM in page 0,
5)use some ROM data with those in RAM
6)restore the BIOS in page 0
can i use some standard code?
do you have snippets?
Is there some article/example somewhere on the net?
Any help is welcome
(..) and I'm trying to do Things far beyond my capabilities
Well in that case: may I suggest you make the BIOS do the tricky part? More exactly: use an inter-slot call (standard BIOS call)
It would go like:
1) Using standard BIOS entry, you call your own ROM at some address in page 3 (make sure you have some code there!)
2) BIOS routine shuffles slot settings around, and calls your ROM at specified address
3) your ROM routine then moves around / processes some data, and simply RETurns
4) BIOS routine restores slot settings as they where when BIOS call was made
I'm not sure if this method would work for both page 0 and 3, but it seems to me like an obvious route to take. IIRC there are some limitations as to what Z80 registers you can use for parameter passing, and it would probably be wise to leave interrupts disabled inside the page 0 / page 3 ROM code. But if you can work with that, give it a try!
Just out of curiosity: why would you want to switch slots in pages 0 or 3, when you're making ROM software? I mean, most ROMs only use 4000-BFFFh range. If more ROM than 32K is used, the usual fix is to switch 8 or 16K blocks *within* that range (megaROMs). Either way, page 0 (BIOS ROM) and page 3 (RAM / stack / system variables) is NOT ever paged out. Is there some special thing your software does that makes this *necessary*
If you want to do it easily, use interslot calls and make sure that you have both data and code in every 16 KB chunk. Therefore, all you have to do is a CALSLT (is this the name?). The system will return to the "normal" settings afterwards: BIOS in page 0, RAM in page 3.
Anyway, there's some discussion about slot and subslot management at the "Desarrollo" corner at http://www.karoshicorp.com - check the "Desarrollo compatible" threads. Spanish only ;)
Have you read the slot management chapter of MSX2 Technical Handbook? Available at www.konamiman.com
Anyway having a 64K ROM is very rare, can't you use a mapped ROM instead?
Can't you use a mapped ROM instead?
Yes, he's right, it would be easier for you if you use a megaROM mapper.
That way, you can switch all your 8 logical pages in the physical pages 1 & 2.
A few tips for switching page 3:
- leave interrupts disabled, because the msx systemvariables are not accessable by the interrupt routine
- because (part of) the slotroutines are in page 3, you can not use the systemcalls for slots (ENASLT) to switch page 3 back. This means using port 0A8h and memory address 0FFFFh directly.
A few tips for switching page 0:
- leave interrupts disabled, because the interrupt routine in the system rom is not available
- you can not use ENASLT for switching page 0, the system will hang. This means using port 0A8h and memory address 0FFFFh directly.
- because the slotrutines are in page 0, you can not use the systemcalls for slots to switch page 0 back. This means using port 0A8h and memory address 0FFFFh directly.
hey, look who's alive. Hai mr Zeilenmaker. Long time no see
Hi, thanks for the feedback. I'll read the docs, but I have a question:
How can the BIOS manage the call to code in page 3 without using tha RAM ???
The return to the main without using stack actually seems to me impossible
for the BIOS (and for any other routine actually)
Are you all sure that this is the way to use ROM in page 3 ?
Personally, I found it easier to make my own slot management code than to deal with bios. Leaves you with more flexibility and quick enough to use in a game.
Could you have some snippet?
It would greatly help!
Pull MJTT through the debugger
Don't you have an account yet? Become an MSX-friend and register an account!