use automata and hardware constants in render
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
INCLUDE "hardware.inc"
|
||||
|
||||
CELLS_WIDTH = 40
|
||||
CELLS_HEIGHT = 36
|
||||
CELLS_PER_TILE = 2
|
||||
TILE_WIDTH = CELLS_WIDTH / CELLS_PER_TILE
|
||||
TILE_HEIGHT = CELLS_HEIGHT / CELLS_PER_TILE
|
||||
BUFFER_SIZE = TILE_WIDTH * TILE_HEIGHT
|
||||
INCLUDE "automata.inc"
|
||||
|
||||
; automata buffers with 4 cells per byte
|
||||
; 2x2 bytes per cell, bit ordering:
|
||||
|
||||
6
Code/automata.inc
Normal file
6
Code/automata.inc
Normal file
@@ -0,0 +1,6 @@
|
||||
CELLS_WIDTH = 40
|
||||
CELLS_HEIGHT = 36
|
||||
CELLS_PER_TILE = 2
|
||||
TILE_WIDTH = CELLS_WIDTH / CELLS_PER_TILE
|
||||
TILE_HEIGHT = CELLS_HEIGHT / CELLS_PER_TILE
|
||||
BUFFER_SIZE = TILE_WIDTH * TILE_HEIGHT
|
||||
@@ -1,5 +1,6 @@
|
||||
INCLUDE "hardware.inc"
|
||||
INCLUDE "utils.inc"
|
||||
INCLUDE "automata.inc"
|
||||
|
||||
RENDER_IN_HBL EQU 0
|
||||
|
||||
@@ -71,7 +72,7 @@ LCDStatInterruptHandler:
|
||||
|
||||
; go to next line
|
||||
ld a, e
|
||||
add a, 32 - 20
|
||||
add a, SCRN_VX_B - TILE_WIDTH
|
||||
ld e, a
|
||||
jr nc, .nocarry
|
||||
inc d
|
||||
@@ -82,7 +83,7 @@ LCDStatInterruptHandler:
|
||||
jr z, .finish
|
||||
|
||||
; reset tile counter
|
||||
ld c, 20
|
||||
ld c, TILE_WIDTH
|
||||
|
||||
jr .loop
|
||||
|
||||
@@ -118,7 +119,7 @@ LCDStatInterruptHandler:
|
||||
EXPORT InitRender
|
||||
SECTION "Init render", ROM0
|
||||
InitRender:
|
||||
ld a, $9C
|
||||
ld a, HIGH(_SCRN1)
|
||||
ldh [Video + 1], a
|
||||
xor a
|
||||
ldh [Video], a
|
||||
@@ -136,9 +137,9 @@ StartRender:
|
||||
ld [Rendered + 1], a
|
||||
|
||||
; start rendering
|
||||
ld a, 20
|
||||
ld a, TILE_WIDTH
|
||||
ldh [TilesLeft], a
|
||||
ld a, 18
|
||||
ld a, TILE_HEIGHT
|
||||
ldh [LinesLeft], a
|
||||
|
||||
; enable v-blank and lcd stat interrupt for h-blank
|
||||
|
||||
Reference in New Issue
Block a user