I checked again and s_target_ROM_48K_ISR.rom
works just fine on OpenMSX 0.16 with the cartridge in subslot 1-1 on a Panasonic FS-A1ST (as in your test). I tested with other subslot or other machine (Phillips NMS 8235 or Canon V20) and everything work fine.
If someone else want to test the ROM: https://github.com/aoineko-fr/MSXgl/raw/main/projects/targets/emul/rom/s_target_ROM_48K_ISR.rom
I obviously used this ROM. You provided the link above. It crashes when i press ESC. Another weird thing, when I press F1 and go back to the main screen DSK is shown on page 1 when the ROM is in slot 1 but not when it is in slot 1-1.
@Matty, so glad your problem is solved and you can get to the 32K limit now. SDCC is not my field of expertise, so I can't help you much anyway.
Can you be more specific where 'openMSX is picky'? Can you send me an example where openMSX is behaving unexpectedly? Then I can investigate a bit.
There's nothing much to worry about at your side. This is about some people (wrongly, in my opinion) complaining about how OpenMSX deals with MegaROMs, and how they don't like that it takes several bytes to make it easier for an emulator to detect which kind of MegaROM it is dealing with. Because these bytes will reduce their maximum bytes they can use in their ROM, they say.
But perhaps it's just me failing to explain that C code generates pretty bulky assembly code, and those few bytes you would have saved from not making OpenMSX detect your MegaROM type easier won't be enough to give you even one extra C statement.
Finally, making physical MegaROMs requires people to think about them anyway, so even if we could make the generation of MegaROMs easier, they will still have to learn about bankswitching, physical implementation, the infinite varieties of MegaROM types, etc. So for their sanity (and mine), I think it's better for most developers to just stay at the 32K ROM format.
I obviously used this ROM. You provided the link above. It crashes when i press ESC. Another weird thing, when I press F1 and go back to the main screen DSK is shown on page 1 when the ROM is in slot 1 but not when it is in slot 1-1.
The program does not crash when you press [Esc], it reboots. This is the expected behavior. This is a sample to show how the same code can be compiled with MSXgl to different targets (plain/mapped ROM, MSX-DOS & BASIC). On DOS and BASIC, [Esc] allows to return to the OS. For a ROM, this reboot the system.
As for the code to detect a content of the page of a slot, it is a piece of WIP code specific to this program (I'll have to finish/debug it one day). It has nothing to do with the crt0s which have, a priori, no known problem.
Anyway, I've done a lot of tests with my crt0s (mostly via OpenMSX) and they are all positive. If you find a real case that doesn't work, let me know.
The program does not crash when you press [Esc], it reboots.
No, as you can see in the screenshot it crashes (freezes).
Look at this routine for 32K ROM compared to yours for example:
;------------------------------------------------------------------------------ ; Set page 2 at the same slot than the page 1 by direct access (for 32K ROM) .macro INIT_P1_TO_P2 crt0_p1_to_p02: ; Set primary slot of cartridge ROM on pages 1, 2 and 3 in a, (PPI_A) ; A=[P3|P2|P1|P0] read the primary slot register ld b, a ; B=[P3|P2|P1|P0] Store the primary slot register to B and a, #0b00001111 ; A=[00|00|P1|00] ld c, a ; C=[00|00|P1|P0] Keep P1 slot ID to C and a, #0b00001100 ; A=[00|00|P1|00] rlca rlca ; A=[00|P1|00|00] or a, c ld c,a ; C=[00|P1|P1|P0] and a, #0b00110000 ; A=[00|P1|00|00] rlca rlca or a, c ; A=[P1|P1|P1|P0] out (PPI_A), a ; Set primary slots ; Set secondary slot of cartridge ROM on pages 1 and 2 ld a, (SLTSL) ; A=[S3|S2|S1|S0] Read secondary slots register of ROM slot cpl and a, #0b11001111 ; A=[S3|00|S1|S0] ld c, a ; C=[S3|00|S1|S0] Keep P1 slot ID to C and a, #0b00001100 ; A=[00|00|S1|00] rlca rlca ; A=[00|S1|00|00] or a, c ; A=[S3|S1|S1|S0] ld (SLTSL), a ; Set secondary slots ; Restore initial primary slot on page 3 ld a, b and a, #0b11000000 ; A=[P3|00|00|00] ld c, a in a, (PPI_A) ; A=[C3|C2|C1|C0] and a, #0b00111111 ; A=[00|C2|C1|C0] or a, c ; A=[C3|C2|C1|C0] out (PPI_A), a ; Set primary slots .endm ;------------------------------------------------------------------------------
It's shorter, faster, easier to understand, uses less registers and doesn't touch the page 0.
Same thing but with the standard routine:
; Set page 2 at the same slot than the page 1 (for 32K ROM) .macro INIT_P1_TO_P2 crt0_p1_to_p02: call RSLREG ; A=[P3|P2|P1|P0] read the primary slot register rrca rrca and a, 3 ; A=[00|00|00|P1] ld c,a ld b,0 ld hl,EXPTBL add hl,bc ld a,(hl) and 80h ; Keep the secondary slot flag only ; jr z,No_Flag ; Jump if secondary slot flag = 0 (this line is optional. It avoids XX that are ignored by ENASLT when the flag is not set.) or a, c ld c,a inc hl inc hl inc hl inc hl ; HL=SLTTBL + P1 ld a,(hl) and 0Ch ; A=[80|00|S1|P1] or [00|00|XX|P1] No_Flag: or a, c ld h,080h call ENASLT ; Select the ROM on page 8000h-BFFFh .endm ;------------------------------------------------------------------------------
In both cases, you save space for the program in ROM.
The first example is useful only if you need to do direct access.
I don't understand why you want to do otherwise.
This is a sample to show how the same code can be compiled with MSXgl to different targets (plain/mapped ROM, MSX-DOS & BASIC). On DOS and BASIC, [Esc] allows to return to the OS. For a ROM, this reboot the system.
I think it's better to adapt the routines according to the specified environment. MSXs do not have unlimited memory.