mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2025-02-18 07:30:30 +00:00
Get minimal tiles and sprites rendering without a crash
This commit is contained in:
parent
1f9c9b3f5b
commit
4ea3033b5e
85
src/Tiles.s
85
src/Tiles.s
@ -114,8 +114,9 @@ InitTiles
|
|||||||
bra :out
|
bra :out
|
||||||
:fast
|
:fast
|
||||||
lda #0 ; Initialize with Tile 0
|
lda #0 ; Initialize with Tile 0
|
||||||
ldy #FastOverZA
|
ldy #FastProcs
|
||||||
jsr _SetTileProcs
|
jsr _SetTileProcs
|
||||||
|
bra :out
|
||||||
|
|
||||||
:dyn lda #0 ; Initialize with Tile 0
|
:dyn lda #0 ; Initialize with Tile 0
|
||||||
ldy #DynOverZA
|
ldy #DynOverZA
|
||||||
@ -209,25 +210,26 @@ _SetTile
|
|||||||
|
|
||||||
; Calculate the base tile proc selector from the tile Id
|
; Calculate the base tile proc selector from the tile Id
|
||||||
stz procIdx
|
stz procIdx
|
||||||
lda newTileId
|
|
||||||
|
|
||||||
clc
|
lda #TILE_PRIORITY_BIT
|
||||||
bit #TILE_PRIORITY_BIT
|
bit newTileId
|
||||||
beq :low_priority
|
beq :low_priority
|
||||||
sec
|
lda #4
|
||||||
:low_priority asl procIdx
|
sta procIdx
|
||||||
|
:low_priority
|
||||||
|
|
||||||
clc
|
lda #TILE_ID_MASK
|
||||||
bit #TILE_ID_MASK
|
bit newTileId
|
||||||
bne :not_zero
|
bne :not_zero
|
||||||
sec
|
lda #2
|
||||||
:not_zero asl procIdx
|
tsb procIdx
|
||||||
|
:not_zero
|
||||||
|
|
||||||
clc
|
lda #TILE_VFLIP_BIT
|
||||||
bit #TILE_VFLIP_BIT
|
|
||||||
beq :no_vflip
|
beq :no_vflip
|
||||||
sec
|
lda #1
|
||||||
:no_vflip asl procIdx
|
tsb procIdx
|
||||||
|
:no_vflip
|
||||||
|
|
||||||
; Multiple by 6 to get the correct table entry index
|
; Multiple by 6 to get the correct table entry index
|
||||||
|
|
||||||
@ -235,7 +237,7 @@ _SetTile
|
|||||||
lda procIdx
|
lda procIdx
|
||||||
asl
|
asl
|
||||||
adc procIdx
|
adc procIdx
|
||||||
tay
|
sta procIdx
|
||||||
|
|
||||||
; Now integrate with the engine mode indicator
|
; Now integrate with the engine mode indicator
|
||||||
|
|
||||||
@ -270,7 +272,7 @@ _SetTile
|
|||||||
; Specialized check for when the engine is in "Fast" mode. If is a simple decision tree based on whether
|
; Specialized check for when the engine is in "Fast" mode. If is a simple decision tree based on whether
|
||||||
; the tile priority bit is set, and whether this is the special tile 0 or not.
|
; the tile priority bit is set, and whether this is the special tile 0 or not.
|
||||||
:setTileFast
|
:setTileFast
|
||||||
lda #FastProcs
|
ldy #FastProcs
|
||||||
lda procIdx
|
lda procIdx
|
||||||
jsr _SetTileProcs
|
jsr _SetTileProcs
|
||||||
jmp _PushDirtyTileX
|
jmp _PushDirtyTileX
|
||||||
@ -280,21 +282,18 @@ _SetTile
|
|||||||
; are both Dynamic tiles or both Basic tiles, then we can use an optimized routine. Otherwise
|
; are both Dynamic tiles or both Basic tiles, then we can use an optimized routine. Otherwise
|
||||||
; we must set the opcodes as well as the operands
|
; we must set the opcodes as well as the operands
|
||||||
:setTileDyn
|
:setTileDyn
|
||||||
lda #DynProcs
|
brk $55
|
||||||
|
ldy #DynProcs
|
||||||
lda procIdx
|
lda procIdx
|
||||||
jsr _SetTileProcs
|
jsr _SetTileProcs
|
||||||
jmp _PushDirtyTileX
|
jmp _PushDirtyTileX
|
||||||
|
|
||||||
:out
|
|
||||||
jmp _PushDirtyTileY ; on the next call to _ApplyTiles
|
|
||||||
|
|
||||||
; X = Tile Store offset
|
; X = Tile Store offset
|
||||||
; Y = Engine Mode Base Table address
|
; Y = Engine Mode Base Table address
|
||||||
; A = Table proc index
|
; A = Table proc index
|
||||||
;
|
;
|
||||||
; see TileProcTables in static/TileStore.s
|
; see TileProcTables in static/TileStore.s
|
||||||
bnkPtr equ blttmp
|
tblPtr equ blttmp
|
||||||
tblPtr equ blttmp+4
|
|
||||||
_SetTileProcs
|
_SetTileProcs
|
||||||
|
|
||||||
; Set a long pointer to this bank
|
; Set a long pointer to this bank
|
||||||
@ -447,6 +446,7 @@ last_bit lda (SPRITE_VBUFF_PTR+{]1*2}),y
|
|||||||
clc ; pre-adjust these later
|
clc ; pre-adjust these later
|
||||||
adc _Sprites+TS_VBUFF_BASE+{]1*2}
|
adc _Sprites+TS_VBUFF_BASE+{]1*2}
|
||||||
sta sprite_ptr0+{]2*4}
|
sta sprite_ptr0+{]2*4}
|
||||||
|
tyx
|
||||||
jmp (K_TS_ONE_SPRITE,x)
|
jmp (K_TS_ONE_SPRITE,x)
|
||||||
next_bit
|
next_bit
|
||||||
<<<
|
<<<
|
||||||
@ -472,6 +472,15 @@ endbit mac
|
|||||||
jmp ]3
|
jmp ]3
|
||||||
<<<
|
<<<
|
||||||
|
|
||||||
|
endbit1 mac
|
||||||
|
lda (SPRITE_VBUFF_PTR+{]1*2}),y
|
||||||
|
clc ; pre-adjust these later
|
||||||
|
adc _Sprites+TS_VBUFF_BASE+{]1*2}
|
||||||
|
sta sprite_ptr0+{]2*4}
|
||||||
|
tyx
|
||||||
|
jmp (K_TS_ONE_SPRITE,x)
|
||||||
|
<<<
|
||||||
|
|
||||||
; OPTIMIZATION:
|
; OPTIMIZATION:
|
||||||
;
|
;
|
||||||
; bit #$00FF ; Optimization to skip the first 8 bits if they are all zeros
|
; bit #$00FF ; Optimization to skip the first 8 bits if they are all zeros
|
||||||
@ -499,22 +508,22 @@ endbit mac
|
|||||||
; ]4 address of four sprite process
|
; ]4 address of four sprite process
|
||||||
|
|
||||||
SpriteBitsToVBuffAddrs mac
|
SpriteBitsToVBuffAddrs mac
|
||||||
dobit1 0;0;b_1_1;]1
|
dobit1 0;0;b_1_1
|
||||||
dobit1 1;0;b_2_1;]1
|
dobit1 1;0;b_2_1
|
||||||
dobit1 2;0;b_3_1;]1
|
dobit1 2;0;b_3_1
|
||||||
dobit1 3;0;b_4_1;]1
|
dobit1 3;0;b_4_1
|
||||||
dobit1 4;0;b_5_1;]1
|
dobit1 4;0;b_5_1
|
||||||
dobit1 5;0;b_6_1;]1
|
dobit1 5;0;b_6_1
|
||||||
dobit1 6;0;b_7_1;]1
|
dobit1 6;0;b_7_1
|
||||||
dobit1 7;0;b_8_1;]1
|
dobit1 7;0;b_8_1
|
||||||
dobit1 8;0;b_9_1;]1
|
dobit1 8;0;b_9_1
|
||||||
dobit1 9;0;b_10_1;]1
|
dobit1 9;0;b_10_1
|
||||||
dobit1 10;0;b_11_1;]1
|
dobit1 10;0;b_11_1
|
||||||
dobit1 11;0;b_12_1;]1
|
dobit1 11;0;b_12_1
|
||||||
dobit1 12;0;b_13_1;]1
|
dobit1 12;0;b_13_1
|
||||||
dobit1 13;0;b_14_1;]1
|
dobit1 13;0;b_14_1
|
||||||
dobit1 14;0;b_15_1;]1
|
dobit1 14;0;b_15_1
|
||||||
endbit 15;0;]1
|
endbit1 15;0
|
||||||
|
|
||||||
b_1_1 dobit 1;1;b_2_2;]2
|
b_1_1 dobit 1;1;b_2_2;]2
|
||||||
b_2_1 dobit 2;1;b_3_2;]2
|
b_2_1 dobit 2;1;b_3_2;]2
|
||||||
|
@ -368,7 +368,6 @@ _TSGetSeconds
|
|||||||
put render/Sprite1.s
|
put render/Sprite1.s
|
||||||
put render/Sprite2.s
|
put render/Sprite2.s
|
||||||
put tiles/DirtyTileQueue.s
|
put tiles/DirtyTileQueue.s
|
||||||
; put tiles/FastRenderer.s
|
|
||||||
put blitter/Horz.s
|
put blitter/Horz.s
|
||||||
put blitter/Vert.s
|
put blitter/Vert.s
|
||||||
put blitter/BG0.s
|
put blitter/BG0.s
|
||||||
|
@ -85,7 +85,7 @@ _TBCopyTileMaskToCBuffV
|
|||||||
;
|
;
|
||||||
; A specialized routine that fills in a tile with a single constant value. It's intended to be used to
|
; A specialized routine that fills in a tile with a single constant value. It's intended to be used to
|
||||||
; fill in solid colors, so there are no specialized horizontal or verical flipped variantsConstUnderZero
|
; fill in solid colors, so there are no specialized horizontal or verical flipped variantsConstUnderZero
|
||||||
_TBConstTile0 tax
|
_TBConstTile0
|
||||||
_TBConstTileX
|
_TBConstTileX
|
||||||
lda #0
|
lda #0
|
||||||
sta: $0001,y
|
sta: $0001,y
|
||||||
|
Loading…
x
Reference in New Issue
Block a user