Complete initialization sequence.

This commit is contained in:
Lucas Scharenbroich 2022-04-25 16:35:47 -05:00
parent e5da3991cd
commit 1522922abe
5 changed files with 29 additions and 47 deletions

View File

@ -90,13 +90,13 @@ _CoreStartUp
jsr IntStartUp ; Enable certain interrupts jsr IntStartUp ; Enable certain interrupts
jsr InitMemory ; Allocate and initialize memory for the engine jsr InitMemory ; Allocate and initialize memory for the engine
; jsr EngineReset ; All of the resources are allocated, put the engine in a known state jsr EngineReset ; All of the resources are allocated, put the engine in a known state
; jsr InitGraphics ; Initialize all of the graphics-related data jsr InitGraphics ; Initialize all of the graphics-related data
; jsr InitSprites ; Initialize the sprite subsystem ; jsr InitSprites ; Initialize the sprite subsystem
; jsr InitTiles ; Initialize the tile subsystem jsr InitTiles ; Initialize the tile subsystem
; jsr InitTimers ; Initialize the timer subsystem jsr InitTimers ; Initialize the timer subsystem
rts rts
_CoreShutDown _CoreShutDown
@ -243,7 +243,7 @@ EngineReset
ldx #BlitBuff ldx #BlitBuff
lda #^BlitBuff lda #^BlitBuff
ldy tmp14 ldy tmp14
; jsr BuildBank jsr BuildBank
lda tmp14 lda tmp14
clc clc

View File

@ -199,7 +199,11 @@ VBUFF_SPRITE_STEP equ VBUFF_TILE_ROW_BYTES*3 ; Allocate space fo 16
VBUFF_SPRITE_START equ {8*VBUFF_TILE_ROW_BYTES}+4 ; Start at an offset so $0000 can be used as an empty value VBUFF_SPRITE_START equ {8*VBUFF_TILE_ROW_BYTES}+4 ; Start at an offset so $0000 can be used as an empty value
VBUFF_SLOT_COUNT equ 48 ; Have space for this many stamps VBUFF_SLOT_COUNT equ 48 ; Have space for this many stamps
; This is 13 blocks wide
SPRITE_PLANE_SPAN equ VBUFF_STRIDE_BYTES
; Tile storage parameters ; Tile storage parameters
TILE_DATA_SPAN equ 4
TILE_STORE_WIDTH equ 41 TILE_STORE_WIDTH equ 41
TILE_STORE_HEIGHT equ 26 TILE_STORE_HEIGHT equ 26
MAX_TILES equ {26*41} ; Number of tiles in the code field (41 columns * 26 rows) MAX_TILES equ {26*41} ; Number of tiles in the code field (41 columns * 26 rows)
@ -218,29 +222,9 @@ TS_VBUFF_ARRAY_ADDR equ TILE_STORE_SIZE*9 ; const value to an aligned 32
TS_BASE_TILE_DISP equ TILE_STORE_SIZE*10 ; derived from TS_TILE_ID to optimize base (non-sprite) tile dispatch in the Render function TS_BASE_TILE_DISP equ TILE_STORE_SIZE*10 ; derived from TS_TILE_ID to optimize base (non-sprite) tile dispatch in the Render function
TS_DIRTY_TILE_DISP equ TILE_STORE_SIZE*11 ; derived from TS_TILE_ID to optimize dirty tile dispatch in the Render function TS_DIRTY_TILE_DISP equ TILE_STORE_SIZE*11 ; derived from TS_TILE_ID to optimize dirty tile dispatch in the Render function
; 16 consecutive entries to provide directly addressable space for holding the VBUFF address for the ; Hold values for up to 4 sprites per tile
; sprites that may be rendered at a given tile. Given a tile store offset, X, the way to address the TS_VBUFF_ADDR_0 equ TILE_STORE_SIZE*12
; address for the Y'th sprite is TS_VBUFF_ADDR_1 equ TILE_STORE_SIZE*13
; TS_VBUFF_ADDR_2 equ TILE_STORE_SIZE*14
; lda TileStore+TS_VBUFF_0+{Y*TILE_STORE_SIZE},x TS_VBUFF_ADDR_3 equ TILE_STORE_SIZE*15
; TS_VBUFF_ADDR_COUNT equ TILE_STORE_SIZE*16 ; replace usage of TS_VBUFF_ARRAY_ADDR with this later
; Moving to the next tile can be done with a constant.
;
; lda TileStore+TS_VBUFF_0+{Y*TILE_STORE_SIZE}+{41*row}+{2*col},x
TS_VBUFF_0 equ TILE_STORE_SIZE*12
TS_VBUFF_1 equ TILE_STORE_SIZE*13
TS_VBUFF_2 equ TILE_STORE_SIZE*14
TS_VBUFF_3 equ TILE_STORE_SIZE*15
TS_VBUFF_4 equ TILE_STORE_SIZE*16
TS_VBUFF_5 equ TILE_STORE_SIZE*17
TS_VBUFF_6 equ TILE_STORE_SIZE*18
TS_VBUFF_7 equ TILE_STORE_SIZE*19
TS_VBUFF_8 equ TILE_STORE_SIZE*20
TS_VBUFF_9 equ TILE_STORE_SIZE*21
TS_VBUFF_10 equ TILE_STORE_SIZE*22
TS_VBUFF_11 equ TILE_STORE_SIZE*23
TS_VBUFF_12 equ TILE_STORE_SIZE*22
TS_VBUFF_13 equ TILE_STORE_SIZE*23
TS_VBUFF_14 equ TILE_STORE_SIZE*24
TS_VBUFF_15 equ TILE_STORE_SIZE*25

View File

@ -699,8 +699,6 @@ _TBDirtyTile_VH
--^ --^
rts rts
TILE_DATA_SPAN equ 4
; If there are two or more sprites at a tile, we can still be fast, but need to do extra work because ; If there are two or more sprites at a tile, we can still be fast, but need to do extra work because
; the VBUFF values need to be read from the direct page. Thus, the direct page cannot be mapped onto ; the VBUFF values need to be read from the direct page. Thus, the direct page cannot be mapped onto
; the graphics screen. We use the stack instead, but have to do extra work to save and restore the ; the graphics screen. We use the stack instead, but have to do extra work to save and restore the

View File

@ -752,9 +752,6 @@ _CacheSpriteBanks
rts rts
; This is 13 blocks wide
SPRITE_PLANE_SPAN equ VBUFF_STRIDE_BYTES
; A = x coordinate ; A = x coordinate
; Y = y coordinate ; Y = y coordinate
;GetSpriteVBuffAddr ENT ;GetSpriteVBuffAddr ENT

View File

@ -171,7 +171,7 @@ width equ FirstParam+2
tay tay
lda width,s lda width,s
tax tax
; jsr _SetScreenMode jsr _SetScreenMode
_TSExit #0;#4 _TSExit #0;#4
@ -192,8 +192,11 @@ output equ FirstParam
put Memory.s put Memory.s
put Timer.s put Timer.s
put Graphics.s put Graphics.s
put Tiles.s
put blitter/BG0.s put blitter/BG0.s
put blitter/BG1.s put blitter/BG1.s
put blitter/Template.s put blitter/Template.s
put blitter/TemplateUtils.s
put blitter/Tables.s put blitter/Tables.s
put blitter/Blitter.s put blitter/Blitter.s
; put blitter/Tiles.s