Browse Source

Wait for vblank with HALT

master
Forest Belton 2 years ago
parent
commit
833b910df7
2 changed files with 15 additions and 6 deletions
  1. +10
    -1
      src/main.s
  2. +5
    -5
      src/player.s

+ 10
- 1
src/main.s View File

@ -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

+ 5
- 5
src/player.s View File

@ -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]

Loading…
Cancel
Save