Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve GBC vs. CGB mismash #491

Merged
merged 3 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions constants/hardware_constants.asm
Rangi42 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
; From http://nocash.emubase.de/pandocs.htm.
; Reference documents:
; https://gbdev.io/pandocs/
; https://github.com/gbdev/hardware.inc

DEF GBC EQU $11
DEF CGB EQU $11

; MBC1
DEF MBC1SRamEnable EQU $0000
Expand Down
16 changes: 8 additions & 8 deletions engine/gfx/palettes.asm
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,11 @@ LoadSGB:
ret nc
ld a, 1
ld [wOnSGB], a
ld a, [wGBC]
ld a, [wOnCGB]
and a
jr z, .notGBC
jr z, .notCGB
ret
.notGBC
.notCGB
di
call PrepareSuperNintendoVRAMTransfer
ei
Expand Down Expand Up @@ -563,21 +563,21 @@ Wait7000:
ret

SendSGBPackets:
ld a, [wGBC]
ld a, [wOnCGB]
and a
jr z, .notGBC
jr z, .notCGB
push de
call InitGBCPalettes
call InitCGBPalettes
pop hl
call EmptyFunc3
ret
.notGBC
.notCGB
push de
call SendSGBPacket
pop hl
jp SendSGBPacket

InitGBCPalettes:
InitCGBPalettes:
ld a, $80 ; index 0 with auto-increment
ldh [rBGPI], a
inc hl
Expand Down
8 changes: 4 additions & 4 deletions home/start.asm
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
_Start::
cp GBC
jr z, .gbc
cp CGB
jr z, .cgb
xor a
jr .ok
.gbc
.cgb
ld a, FALSE
.ok
ld [wGBC], a
ld [wOnCGB], a
jp Init
3 changes: 2 additions & 1 deletion ram/wram.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,8 @@ wScriptedNPCWalkCounter:: db

ds 1

wGBC:: db
; always 0 since full CGB support was not implemented
SatoMew marked this conversation as resolved.
Show resolved Hide resolved
wOnCGB:: db

; if running on SGB, it's 1, else it's 0
wOnSGB:: db
Expand Down