From 833b910df70793c3e8047cd13d3270e3c51d5394 Mon Sep 17 00:00:00 2001 From: Forest Belton <65484+forestbelton@users.noreply.github.com> Date: Thu, 1 Jul 2021 11:59:43 -0400 Subject: [PATCH] Wait for vblank with HALT --- src/main.s | 11 ++++++++++- src/player.s | 10 +++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main.s b/src/main.s index 3715d36..7cf5085 100644 --- a/src/main.s +++ b/src/main.s @@ -14,6 +14,11 @@ SECTION "Frame", WRAM0 frame:: db +SECTION "VBlank", ROM0[$40] + +handle_vblank: + reti + SECTION "Code", ROM0 start: @@ -21,6 +26,9 @@ start: res 7, [hl] res 2, [hl] + ld hl, rIE + ld [hl], IEF_VBLANK + call BG_Init call OAM_Init call Keys_Init @@ -46,7 +54,8 @@ start: call Keys_Update call Player_Update - call wait_for_vblank + ; wait for vblank + halt ld a, HIGH(_OAM) call DMA_Start diff --git a/src/player.s b/src/player.s index 5afcc70..8a549d3 100644 --- a/src/player.s +++ b/src/player.s @@ -54,11 +54,11 @@ Player_Init:: Player_Update:: ; Only update every 2 frames - ld hl, frame - ld a, [hl] - and %1 - cp %1 - ret nz + ; ld hl, frame + ; ld a, [hl] + ; and %1 + ; cp %1 + ; ret nz ld hl, keys ld b, [hl]