From 8822967fdf4b3c454f08eac1a6c9a1faf70df0ca Mon Sep 17 00:00:00 2001 From: Forest Belton <65484+forestbelton@users.noreply.github.com> Date: Sat, 4 Sep 2021 11:26:18 -0400 Subject: [PATCH] Transition from title to game --- src/game.s | 13 +++++++++++++ src/title.s | 10 +++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/game.s b/src/game.s index f589300..dcad180 100644 --- a/src/game.s +++ b/src/game.s @@ -1,11 +1,24 @@ +INCLUDE "hardware.inc" + SECTION "Game Loop", ROM0 Game_Start:: + ; disable ldc (CAN ONLY BE DONE DURING VBLANK) & interrupts + halt + di + ld hl, rLCDC + res 7, [hl] + ld hl, intro_Data call Map_Load call Player_Init + ; re-enable ldc & interrupts + ld hl, rLCDC + set 7, [hl] + ei + .loop: ld hl, frame inc [hl] diff --git a/src/title.s b/src/title.s index aff4067..a1ecaa9 100644 --- a/src/title.s +++ b/src/title.s @@ -1,3 +1,4 @@ +INCLUDE "game.inc" INCLUDE "hardware.inc" SECTION "Title Loop", ROM0 @@ -36,8 +37,15 @@ Title_Start:: call Keys_Update - ; todo: check for start press and transition to game state + ld a, [keys] + and PADF_START + jr z, .wait + ld a, GAME_STATEF_GAME + ld [state], a + ret + +.wait: ; wait for vblank halt