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