It seems no one have seen my second question, so here it is again:
I just thought that, alternatively, I might also switch page 0 to a page of the megarom.
That might be easier, since I know already which slot it's in, right ?
Is it possible ?
If the mapped-ROM cartridge is mirrored, if page 0 be the same than page 2, an ISR at 8038h should be visible at 0038h. In this case, I don't see why it wouldn't work by putting page 0 on the slot of your cartridge.
Now, I'm not sure if (all) the mapped-ROM are mirrored.
This is the case for original cartridges but not for others. It depends on the developer.
What flash card interface do you have?
Personnally, I have a MegaflashROM SCC and a Sunrise CF. But ideally I would like it to work in all cases.
So I guess it's back to the RAM switch, then.
I asked what your interface is because I made a patch that allows to check if a cartridge has mirrors or not (with SHEM for example) for Sunrise ATA-IDE/CF and Beer.
Konami cartridges with Konami8 or SCC mapper have all mirrors but people who imitate them do not necessarily reproduce the mirrors, same for emulators.
Once you have the slot number, it becomes easy to select it.
I'm sure it is, but I don't really know how to do it ...
You just load the slot address (RAMAD0 for example) in 'a' and call ENASLT ?
If I understand well, RAMADx
are only set by DiskROM.
And as RAM slot for each page is not store we have no other choice than read each slot's page 0 and see if it's RAM.
Switching p0 is done like this, indeed
Ld a, (ramad0)
Ld h, 0
Call enaslt
When diskrom is active
Enaslt essentially does this
Out (a8), pslot
Ld (-1),sslot
Finding RAM yourself is not that difficult perse. Let us say we found RAM in 2,3 (arbitrary) then use that to format A to the slot id that enaslt needs and call that.
I Could sure whip up some findram function, dont have one at hand atm
Switching p0 is done like this, indeed
Ld a, (ramad0)
Ld h, 0
Call enaslt
If I remember correctly, it does not work on some MSX's that have its RAM in a slot 0-X.
If I didn't make a mistake, the routine below should work:
; ; Select the Main-RAM slot on page 0 ; SelectMainRamSlt-p0: di in a,(0A8h) and 0c0h ld e,a ; Store the current primary slots for page 3 to E ld a,(0FFFFh) cpl and 0c0h ld d,a ; Store the current secondary slots for page 3 to D ; Select the slot of Main-RAM on page 0 into page 3 & 0 ld a,(MainRamSlt-p0) ld b,a ; Store the slot number for the Main-RAM on page 0 and 3 ld c,a ; Store the page 3 Main-RAM primary slot number rlca ; P000000P rlca ; PP000000 or c ; PP0000PP ld c,a ld a,b and 3ch or c out (0A8h),a ; Select the page 3 Main-RAM primary slot on pages 0 and 3 bit 7,b jr z,NoSecSlt ld a,(0FFFFh) cpl and 0FCh ld c,a ld a,b and 00Ch rlca ; 00000SS0 rlca ; 000000SS or c ld (0FFFFh),a ; Select the page 3 Main-RAM secondary slot on pages 0 ; Restore the Main-RAM to page 3 in a,(0A8h) and 3fh or e ; restore the previous current primary slots on page 3 out (0A8h),a ; Select the previous current primary slots on page 3 ld a,(0FFFFh) cpl and 3fh or d ld (0FFFFh),a ; restore the previous current secondary slots on page 3 NoSecSlt: ei ret
At first sight, it can look complicated but it's just moving right bits to the right places.
The conditional relative jump to NoSecSlt is not essential.
Switching slots is in essence easy, what makes it difficult is WHERE you have the switch function located and is page 3 the default RAM where secslt (#FFFF / -1) is present.
If you take away all those prereqs, you can out #a8 and poke -1 directly.
The ENASLT does checks on the prereqs and is bulky to say the least. But it's a very save one. If you have a slot switch on interrupt for example, and need high speed, you could just use direct addressing of port information. Provided you know how the system is set-up at that moment.
In most situations, page 3 is the default RAM, so the secslt info is always present.
GDX his example should, ofcourse, not be in page 0.
btw, GDX: should this
ld a,(CurrentRamSlt)
and 00Ch
not be
ld a,d ; you stored this earlier
?
Ro, I edited this passage just before your comment, but it's possible there's still a mistake. I make this routine by modifying another one earlier.
Edit: I added the following missing line towards the end.
out (0A8h),a ; Select the previous current primary slots on page 3