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 endif
pokecrystal_opt = -Cjv -t PM_CRYSTAL -i BYTE -n 0 -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 0x10 -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 0x10 -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 0x10 -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 0x10 -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 0x10 -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 %.gbc: $$(%_obj) layout.link
$(RGBLINK) -n $*.sym -m $*.map -l layout.link -o $@ $(filter %.o,$^) $(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 6 Halt (0=Active, 1=Stop Timer)
; Bit 7 Day Counter Carry Bit (1=Counter Overflow) ; 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 ; interrupt flags
DEF VBLANK EQU 0 DEF VBLANK EQU 0
DEF LCD_STAT EQU 1 DEF LCD_STAT EQU 1

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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