Request: Game Boy CD & Game Boy Color CD?
Hi guys. As I tested patched Game Boy games into MSU-1 (Only with Super Game Boy) on an emulator like VBA, there's not musics but I thought we could make sure that Game Boy games can got musics into CD audio on VBA and other Game Boy emulators but without Super Game Boy (Because Game Boy Color games not compatible on original Game Boy won't boot on Super Game Boy).
I can show you the code of Final Fantasy Adventure (Mystic Quest in Europe) working on Super Game Boy but we could modify it to make sure it's working into CD audio without Super Game Boy.
Code: Select all
define SGB_ROM_BANK = $10
architecture sm83
define romVersion = 4 // Final Fantasy Adventure (US): 1, Mystic Quest Germany: 2, Mystic Quest France: 3 , Mystic Quest Europe: 4
if !{defined MSU1BASE} {
define MSU1BASE($1800)
}
macro ROMBANK(bank) {
origin {bank} << 14
base $4000
}
macro JUMP_TO_BANK(bank) {
ld a,{bank}
ld ($2100),a
nop; nop; nop; nop; nop; nop; nop; nop; nop; nop
ret
}
macro CALL_AND_RETURN_TO_BANK(address, bank) {
nop; nop; nop; nop; nop; nop
call {address}
ld a,{bank}
ld ($2100),a
nop; nop
}
origin ($000146)
db $03 //add super gameboy support
origin ($000147)
db $03 // mbc1+sram+battery
origin ($000148)
db $04 // rom size 512k
origin ($000149)
db $01 // rom size 2k
origin ($00014B)
db $33 //add super gameboy support
origin ($00014D)
if {romVersion} == 1 { // Final Fantasy USA
db $5e //fix checksum
} else { //Mystic Quest
db $1d //fix checksum
}
origin ($00119D)
db $a0 //track change
origin ($0011A9)
db $a0 //track change
origin ($0011B5)
db $a0 //track change
if {romVersion} == 1 { // Final Fantasy USA
origin ($003E7C)
}
if {romVersion} == 2 { //Mystic Quest Ger
origin ($003e87)
}
if {romVersion} == 3 { //Mystic Quest Fra
origin ($003e87)
}
if {romVersion} == 4 { //Mystic Quest Eur
origin ($003E7C)
}
db $a0 //track change
//Special Tracks
// Town Theme
origin ($00340D0)
db $1f //unused town theme 04 -> 1f
// Requiem Theme
if {romVersion} == 1 { // Final Fantasy USA
origin ($003415e)
}
if {romVersion} == 2 { //Mystic Quest German
origin ($0034162)
}
if {romVersion} == 3 { //Mystic Quest France
origin ($003415c)
}
if {romVersion} == 4 { //Mystic Quest Europe
origin ($003415e)
}
db $1d //unused life lost theme 17 -> 1d
// Town Theme after wake up at Inn
if {romVersion} == 1 { // Final Fantasy USA
origin ($0037f17)
}
if {romVersion} == 2 { //Mystic Quest German
origin ($0037eb3)
}
if {romVersion} == 3 { //Mystic Quest France
origin ($0037ae8)
}
if {romVersion} == 4 { //Mystic Quest Europe
origin ($0037f17)
}
db $1f //unused town theme 04 -> 1f
origin ($001FF7)
ld a,{SGB_ROM_BANK}
ld ($2100),a
call InitHook
ROMBANK($02)
origin ($008EFB)
db $a0 //track change
ROMBANK($0F)
origin ($03C09E)
call initTransfer
ret //Conn: noise remove
//Track change
origin ($03C02E)
call trackChange
nop
nop
origin ($03FEC0)
//for track change
trackChange:
ld a,($ffa0)
ld b,a
ld a,($df75)
ret
initTransfer:
// free space in bank 0f
//Transfer source needs to be executed in gb wram since the track numbers dynamically change
//dfc0 seem to be good
ld a, $79
ld ($df70),a //transfer command $79
ld a, $01
ld ($df80),a
//transfer snes destination address 7f0000
ld a, {MSU1BASE}
ld ($df71),a
ld a, {MSU1BASE}>>8
ld ($df72),a
ld a, {MSU1BASE}>>16
ld ($df73),a
//number of bytes to transfer (one byte)
ld a, $01
ld ($df74),a
//load theme number
ld a,($ffa0)
ld ($df75),a
//transfer code
ld hl, $df70
call SendTrackNumber_Bank0F
ld a, $00
ld ($ff90),a //mute
ld ($ff93),a
or a
ret
origin ($03FFF0)
SendTrackNumber_Bank0F:
JUMP_TO_BANK({SGB_ROM_BANK})
//=====================================
// Super GameBoy Support Bank
//=====================================
origin ($080000)
// dummy seek to pad rom to 512k
ROMBANK({SGB_ROM_BANK})
InitHook:
call SGB.Init
ld a,$00
ld hl,$C000
ld bc,$2000
ret
define USE_CUSTOM_PALETTE
define USE_EXPANDED_BORDER
define USE_CUSTOM_BORDER
define USE_CUSTOM_SGB_CODE
include "sgb/sgb.asm"
origin ($043FF0)
UploadMSU1Code_Bank10:
CALL_AND_RETURN_TO_BANK(SGB.SendUploadCommand, $0F)
If we manage to do this we could name Game Boy games into CD audio "MSU-GB".