clear OAM, set sprite macro, empty tile equ
This commit is contained in:
@@ -2,6 +2,8 @@ INCLUDE "hardware.inc"
|
|||||||
|
|
||||||
RENDER_IN_HBL EQU 0
|
RENDER_IN_HBL EQU 0
|
||||||
|
|
||||||
|
EMPTY_BG_TILE EQU 17
|
||||||
|
|
||||||
_VRAM_BG_TILES EQU $9000
|
_VRAM_BG_TILES EQU $9000
|
||||||
|
|
||||||
SECTION "Memory Copy", ROM0
|
SECTION "Memory Copy", ROM0
|
||||||
@@ -31,6 +33,23 @@ MemorySet:
|
|||||||
jr nz, MemorySet
|
jr nz, MemorySet
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
; \1: sprite ID
|
||||||
|
; \2: X position
|
||||||
|
; \3: Y position
|
||||||
|
; \4: tile number
|
||||||
|
; \5: flags
|
||||||
|
SetSprite: MACRO
|
||||||
|
ld hl, _OAMRAM + \1 * 4
|
||||||
|
ld a, \3
|
||||||
|
ld [hl+], a
|
||||||
|
ld a, \2
|
||||||
|
ld [hl+], a
|
||||||
|
ld a, \4
|
||||||
|
ld [hl+], a
|
||||||
|
ld a, \5
|
||||||
|
ld [hl+], a
|
||||||
|
ENDM
|
||||||
|
|
||||||
AddConstantToHL: MACRO
|
AddConstantToHL: MACRO
|
||||||
IF \1 == 1
|
IF \1 == 1
|
||||||
inc hl
|
inc hl
|
||||||
@@ -129,7 +148,6 @@ Conway: MACRO
|
|||||||
.dead\@
|
.dead\@
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
SECTION "Load cell group and 8 neighbors to HRAM, then compute", ROM0
|
|
||||||
; \1..\8 offset to neighbors
|
; \1..\8 offset to neighbors
|
||||||
; destroys all registers
|
; destroys all registers
|
||||||
ConwayGroup: MACRO
|
ConwayGroup: MACRO
|
||||||
@@ -214,6 +232,12 @@ Start:
|
|||||||
ld bc, TilesEnd - Tiles
|
ld bc, TilesEnd - Tiles
|
||||||
call MemoryCopy
|
call MemoryCopy
|
||||||
|
|
||||||
|
; clear OAM
|
||||||
|
ld hl, _OAMRAM
|
||||||
|
ld d, 0
|
||||||
|
ld bc, 40 * 4
|
||||||
|
call MemorySet
|
||||||
|
|
||||||
; set scrolling to (0, 0)
|
; set scrolling to (0, 0)
|
||||||
xor a
|
xor a
|
||||||
ld [rSCX], a
|
ld [rSCX], a
|
||||||
@@ -221,7 +245,7 @@ Start:
|
|||||||
|
|
||||||
; clear screen (both buffers)
|
; clear screen (both buffers)
|
||||||
ld hl, _SCRN0
|
ld hl, _SCRN0
|
||||||
ld d, 17 ; empty tile
|
ld d, EMPTY_BG_TILE
|
||||||
ld bc, 32 * 32 * 2
|
ld bc, 32 * 32 * 2
|
||||||
call MemorySet
|
call MemorySet
|
||||||
|
|
||||||
@@ -383,14 +407,13 @@ ENDC
|
|||||||
jr .waitRender
|
jr .waitRender
|
||||||
|
|
||||||
.swap
|
.swap
|
||||||
; enable only v-blank interrupt
|
|
||||||
di
|
|
||||||
IF RENDER_IN_HBL != 0
|
IF RENDER_IN_HBL != 0
|
||||||
|
; enable only v-blank interrupt and wait for vbl
|
||||||
ld a, IEF_VBLANK
|
ld a, IEF_VBLANK
|
||||||
ld [rIE], a
|
ld [rIE], a
|
||||||
xor a
|
xor a
|
||||||
ldh [rIF], a
|
ldh [rIF], a
|
||||||
; wait v-blank
|
|
||||||
halt
|
halt
|
||||||
ENDC
|
ENDC
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user