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

@ -87,16 +87,16 @@ Overlay EXT
; Assumes the direct page is set and EngineMode and UserId has been initialized
_CoreStartUp
jsr IntStartUp ; Enable certain interrupts
jsr IntStartUp ; Enable certain interrupts
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 InitMemory ; Allocate and initialize memory for the engine
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 InitSprites ; Initialize the sprite subsystem
; jsr InitTiles ; Initialize the tile subsystem
jsr InitGraphics ; Initialize all of the graphics-related data
; jsr InitSprites ; Initialize the sprite subsystem
jsr InitTiles ; Initialize the tile subsystem
; jsr InitTimers ; Initialize the timer subsystem
jsr InitTimers ; Initialize the timer subsystem
rts
_CoreShutDown
@ -243,7 +243,7 @@ EngineReset
ldx #BlitBuff
lda #^BlitBuff
ldy tmp14
; jsr BuildBank
jsr BuildBank
lda tmp14
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_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_DATA_SPAN equ 4
TILE_STORE_WIDTH equ 41
TILE_STORE_HEIGHT equ 26
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_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
; sprites that may be rendered at a given tile. Given a tile store offset, X, the way to address the
; address for the Y'th sprite is
;
; lda TileStore+TS_VBUFF_0+{Y*TILE_STORE_SIZE},x
;
; 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
; Hold values for up to 4 sprites per tile
TS_VBUFF_ADDR_0 equ TILE_STORE_SIZE*12
TS_VBUFF_ADDR_1 equ TILE_STORE_SIZE*13
TS_VBUFF_ADDR_2 equ TILE_STORE_SIZE*14
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

View File

@ -669,7 +669,7 @@ dirty_sprite
stx spriteIdx+6
jmp BlitFourSprites
DirtyTileProcs dw _TBDirtyTile_00,_TBDirtyTile_0H,_TBDirtyTile_V0,_TBDirtyTile_VH
DirtyTileProcs dw _TBDirtyTile_00,_TBDirtyTile_0H,_TBDirtyTile_V0,_TBDirtyTile_VH
;DirtyTileSpriteProcs dw _TBDirtySpriteTile_00,_TBDirtySpriteTile_0H,_TBDirtySpriteTile_V0,_TBDirtySpriteTile_VH
; Blit tiles directly to the screen.
@ -699,8 +699,6 @@ _TBDirtyTile_VH
--^
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
; 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

View File

@ -76,12 +76,12 @@ InitSprites
; Return:
; A = vbuff address to be assigned to Sprite[VBUFF_ADDR]
CreateSpriteStamp ENT
phb
phk
plb
jsr _CreateSpriteStamp
plb
rtl
phb
phk
plb
jsr _CreateSpriteStamp
plb
rtl
_CreateSpriteStamp
pha ; Save the descriptor
@ -752,9 +752,6 @@ _CacheSpriteBanks
rts
; This is 13 blocks wide
SPRITE_PLANE_SPAN equ VBUFF_STRIDE_BYTES
; A = x coordinate
; Y = y coordinate
;GetSpriteVBuffAddr ENT

View File

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