Change MBC from MBC3 (0x10) to MBC5 (0x1b) (#7)

This commit is contained in:
xCrystal 2023-07-31 18:52:47 +02:00
parent d8c2e7688a
commit 8ac94cc479
8 changed files with 36 additions and 30 deletions

View File

@ -151,12 +151,12 @@ $(foreach obj, $(pokecrystal11_vc_obj), $(eval $(call DEP,$(obj),$(obj:11_vc.o=.
endif
pokecrystal_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
pokecrystal11_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
pokecrystal_au_opt = -Cjv -t PM_CRYSTAL -i BYTU -n 0 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
pokecrystal_debug_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
pokecrystal11_debug_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
pokecrystal11_vc_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x10 -r 3 -p 0
pokecrystal_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m 0x1b -r 3 -p 0
pokecrystal11_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x1b -r 3 -p 0
pokecrystal_au_opt = -Cjv -t PM_CRYSTAL -i BYTU -n 0 -k 01 -l 0x33 -m 0x1b -r 3 -p 0
pokecrystal_debug_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 0 -k 01 -l 0x33 -m 0x1b -r 3 -p 0
pokecrystal11_debug_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x1b -r 3 -p 0
pokecrystal11_vc_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x1b -r 3 -p 0
%.gbc: $$(%_obj) layout.link
$(RGBLINK) -n $*.sym -m $*.map -l layout.link -o $@ $(filter %.o,$^)

View File

@ -37,6 +37,12 @@ DEF RTC_DH EQU $0c ; Upper 1 bit of Day Counter, Carry Bit, Halt Flag
; Bit 6 Halt (0=Active, 1=Stop Timer)
; Bit 7 Day Counter Carry Bit (1=Counter Overflow)
; MBC5
DEF MBC5SRamEnable EQU $0000
DEF MBC5RomBankLo EQU $2000
DEF MBC5RomBankHi EQU $3000
DEF MBC5SRamBank EQU $4000
; interrupt flags
DEF VBLANK EQU 0
DEF LCD_STAT EQU 1

View File

@ -10,13 +10,13 @@ InitSound::
push af
ld a, BANK(_InitSound)
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
call _InitSound
pop af
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
pop af
pop bc
@ -34,13 +34,13 @@ UpdateSound::
push af
ld a, BANK(_UpdateSound)
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
call _UpdateSound
pop af
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
pop af
pop bc
@ -51,14 +51,14 @@ UpdateSound::
_LoadMusicByte::
; [wCurMusicByte] = [a:de]
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
ld a, [de]
ld [wCurMusicByte], a
ld a, BANK(LoadMusicByte)
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
ret
PlayMusic::
@ -73,7 +73,7 @@ PlayMusic::
push af
ld a, BANK(_PlayMusic) ; aka BANK(_InitSound)
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
ld a, e
and a
@ -88,7 +88,7 @@ PlayMusic::
.end
pop af
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
pop af
pop bc
pop de
@ -107,7 +107,7 @@ PlayMusic2::
push af
ld a, BANK(_PlayMusic)
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
push de
ld de, MUSIC_NONE
@ -118,7 +118,7 @@ PlayMusic2::
pop af
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
pop af
pop bc
@ -140,7 +140,7 @@ PlayCry::
; Cries are stuck in one bank.
ld a, BANK(PokemonCries)
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
ld hl, PokemonCries
rept MON_CRY_LENGTH
@ -163,13 +163,13 @@ endr
ld a, BANK(_PlayCry)
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
call _PlayCry
pop af
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
pop af
pop bc
@ -200,7 +200,7 @@ PlaySFX::
push af
ld a, BANK(_PlaySFX)
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
ld a, e
ld [wCurSFX], a
@ -208,7 +208,7 @@ PlaySFX::
pop af
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
.done
pop af

View File

@ -145,7 +145,7 @@ FarCopyRadioText::
ld d, a
ld a, [hli]
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
ld a, e
ld l, a
ld a, d
@ -155,7 +155,7 @@ FarCopyRadioText::
call CopyBytes
pop af
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
ret
BattleTextbox::

View File

@ -11,7 +11,7 @@ FarCall::
SECTION "rst10", ROM0[$0010]
Bankswitch::
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
ret
SECTION "rst18", ROM0[$0018]

View File

@ -141,7 +141,7 @@ Init::
ldh [hBGMapAddress], a
xor a ; SRAM_DISABLE
ld [MBC3SRamEnable], a
ld [MBC5SRamEnable], a
ldh a, [hCGB]
and a

View File

@ -25,16 +25,16 @@ endc
push af
; enable sram write
ld a, SRAM_ENABLE
ld [MBC3SRamEnable], a
ld [MBC5SRamEnable], a
; select sram bank
pop af
ld [MBC3SRamBank], a
ld [MBC5SRamBank], a
ret
CloseSRAM::
push af
ld a, SRAM_DISABLE
; disable sram write
ld [MBC3SRamEnable], a
ld [MBC5SRamEnable], a
pop af
ret

View File

@ -745,7 +745,7 @@ TextCommand_FAR::
ld a, [hli]
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
push hl
ld h, d
@ -755,7 +755,7 @@ TextCommand_FAR::
pop af
ldh [hROMBank], a
ld [MBC3RomBank], a
ld [MBC5RomBankLo], a
ret
TextCommand_BCD::