Skip to content

Commit 564b2e5

Browse files
author
Hacktix
committed
Implemented CGB-only check
1 parent 2cd4c65 commit 564b2e5

File tree

4 files changed

+46
-2
lines changed

4 files changed

+46
-2
lines changed

gb8.sav

Whitespace-only changes.

inc/gb8.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
EmuScreenPtrVRAM EQU $9842
22
GameTitlePtrVRAM EQU $99AA
3+
NonCGBPtrVRAM EQU $98A2
34

45
CursorTileNo EQU $AB
56

src/main.asm

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ SECTION "Entry Point", ROM0[$100]
2727

2828
SECTION "Main", ROM0[$150]
2929
Main::
30+
; Store initial value of L in RAM
31+
ld [wInitialRegA], a
32+
3033
; Wait for VBlank, disable LCD
3134
ldh a, [rLY]
3235
cp SCRN_Y
@@ -47,5 +50,42 @@ Main::
4750
call InitPalettes
4851
call InitFont
4952

53+
; Check if running in CGB mode
54+
ld a, [wInitialRegA]
55+
cp BOOTUP_A_CGB
56+
jp nz, ScreenNonCGB
57+
5058
; Jump to Selection Menu Initialization
51-
jp StartSelectionMenu
59+
jp StartSelectionMenu
60+
61+
ScreenNonCGB::
62+
; Initialize DMG Palette
63+
ld a, %11010100
64+
ld [rBGP], a
65+
66+
; Print CGB-only text to screen
67+
ld hl, (NonCGBPtrVRAM)
68+
ld de, strNonCGB1
69+
call PrintString
70+
ld hl, (NonCGBPtrVRAM + $40)
71+
ld de, strNonCGB2
72+
call PrintString
73+
ld hl, (NonCGBPtrVRAM + $80)
74+
ld de, strNonCGB3
75+
call PrintString
76+
77+
; Initialize LCD and clear IF/IE
78+
xor a
79+
ldh [rIF], a
80+
ldh [rIE], a
81+
ld a, LCDCF_ON | LCDCF_BGON | LCDCF_BG8000
82+
ldh [rLCDC], a
83+
ei
84+
nop
85+
86+
; HALT infinitely
87+
halt
88+
89+
strNonCGB1: db "THIS SOFTWARE IS", 0
90+
strNonCGB2: db "INTENDED FOR USE", 0
91+
strNonCGB3: db "ON GAMEBOY COLOR", 0

src/ram.asm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,7 @@ wSelectionPage:: db
3737
wSelectionCursorPos:: db
3838
wInputCooldown:: db
3939
wPageTitles:: db
40-
wAllowInput:: db
40+
wAllowInput:: db
41+
42+
SECTION "Other Variables", WRAM0
43+
wInitialRegA:: db

0 commit comments

Comments
 (0)