Most firmware defines a key to prevent its execution at MSX startup. It's a bit annoying having to press this key on every boot, but it is even more annoying when this key is also being used by another cartridge.
While browsing through the wiki, I saw that the Hitachi MB-H1 and MB-H2 computers use another very practical method since no need to press any key, the firmware searches if a ROM cartridge is inserted in the slot 1 or 2, if no ROM cartridge is found, the firmware is executed. By cons, the secondary slots are not taken into account, so if you insert a disk interface with several functions (memory expansion, megaflash-ROM, etc.), it will not be detected and the firmware will start, which causes a conflict.
Used routine is:
ld hl,0FCD9h ld b,020h xor a Loop: or (hl) inc hl djnz Loop or a ret nz
It's short. I made a similaire routine that taken into account the secondary slots. So it seems works perfectly but its takes is 123 bytes. I'm putting it down here in case anyone is interested.
; Routine to search if a ROM cartridge is inserted in slot 1 or 2 ; It must executed from slot 0-x or 3-x ; ; Output: Back with Z flag reseted if ROM cartridge is found RDSLT equ 0000Ch ; Read a byte in a Slot Firmware equ 0xxxxh ; Specify the firmware start address here org 0xxxxh ; Specify the routine location here SrchROM: push hl push de push bc ld b,1 ; Primary slot ID ld hl,08000h ; Header address call Rom_srch ; Return NZ if ROM cartridge is not found jp z,Back ld b,1 ; Primary slot ID ld hl,04000h ; Header address call Rom_srch ; Return NZ if ROM cartridge is not found jp z,Back ld b,2 ; Primary slot ID ld hl,08000h ; Header address call Rom_srch ; Return NZ if ROM cartridge is not found jp z,Back ld b,2 ; Primary slot ID ld hl,04000h ; Header address call Rom_srch ; Return NZ if ROM cartridge is not found ; jp z,Back Back: pop bc pop de pop hl jp nz,Firmware ; Run the firmware ret Rom_srch: push hl ld hl,EXPTBL ld d,0 ld e,b add hl,de ld a,(hl) bit 7,a jr nz,Sub_slt Prim_slt: pop hl ld a,b push bc call RDSLT pop bc cp 041h ret nz ; Back if ROM cartridge not found inc hl ld a,b call RDSLT cp 042h ret ; Back Sub_slt: set 7,b ld c,0 ; Secondary slot ID pop hl Sub_slt_lp: ld a,c rlca rlca or b push bc call RDSLT pop bc cp 041h jr nz,NotFound ; Jump if ROM cartridge not found ld a,c rlca rlca or b inc hl push bc call RDSLT pop bc dec hl cp 042h ret z ; Back if ROM cartridge found NotFound: inc c ld a,4 cp c jp nz,Sub_slt_lp or a ; Reset Z because ROM cartridge not found ret ; Back if ROM cartridge found
I also made a patch for the MB-H1 firmware which will be available soon. :)
PS: I know MFR + SD is able to bypass firmwares but this method works for everything (if there is room for the routine of course).