Simplify all of the remaining tile blitters

This commit is contained in:
Lucas Scharenbroich 2021-11-20 13:58:24 -06:00
parent cd5de05d74
commit 76801c0e5e
4 changed files with 96 additions and 104 deletions

View File

@ -5,40 +5,26 @@
; there is no way to do everything inline, so a composite tile is created on the fly and written to
; a direct page buffer. This direct page buffer is then used to render the tile.
_TBSolidSpriteTile_00
_TBSolidSpriteTile_0H
jsr _TBCopyTileDataToCBuff ; Copy the tile into the compositing buffer (using correct x-register)
jsr _TBApplySpriteData ; Overlay the data from the sprite plane (and copy into the code field)
jmp _TBFillPEAOpcode ; Fill in the code field opcodes
_TBSolidSpriteTile_0H
jsr _TBCopyTileDataToCBuffH
jsr _TBApplySpriteData
jmp _TBFillPEAOpcode
_TBSolidSpriteTile_V0
jsr _TBCopyTileDataToCBuffV
jsr _TBApplySpriteData
jmp _TBFillPEAOpcode
_TBSolidSpriteTile_VH
jsr _TBCopyTileDataToCBuffVH
jsr _TBCopyTileDataToCBuffV
jsr _TBApplySpriteData
jmp _TBFillPEAOpcode
; Fast variation that does not need to set the opcode
_TBFastSpriteTile_00
_TBFastSpriteTile_0H
jsr _TBCopyTileDataToCBuff ; Copy the tile into the compositing buffer
jmp _TBApplySpriteData ; Overlay the data form the sprite plane (and copy into the code field)
_TBFastSpriteTile_0H
jsr _TBCopyTileDataToCBuffH
jmp _TBApplySpriteData
_TBFastSpriteTile_V0
jsr _TBCopyTileDataToCBuffV
jmp _TBApplySpriteData
_TBFastSpriteTile_VH
jsr _TBCopyTileDataToCBuffVH
jsr _TBCopyTileDataToCBuffV
jmp _TBApplySpriteData
; Need to update the X-register before calling this
@ -78,17 +64,17 @@ _TBCopyTileDataToCBuff
--^
rts
_TBCopyTileDataToCBuffH
]line equ 0
lup 8
ldal tiledata+{]line*4}+64,x
sta blttmp+{]line*4}
ldal tiledata+{]line*4}+64+2,x
sta blttmp+{]line*4}+2
]line equ ]line+1
--^
rts
;_TBCopyTileDataToCBuffH
;]line equ 0
; lup 8
; ldal tiledata+{]line*4}+64,x
; sta blttmp+{]line*4}
;
; ldal tiledata+{]line*4}+64+2,x
; sta blttmp+{]line*4}+2
;]line equ ]line+1
; --^
; rts
_TBCopyTileDataToCBuffV
]src equ 7
@ -104,19 +90,19 @@ _TBCopyTileDataToCBuffV
--^
rts
_TBCopyTileDataToCBuffVH
]src equ 7
]dest equ 0
lup 8
ldal tiledata+{]src*4}+64,x
sta blttmp+{]dest*4}
ldal tiledata+{]src*4}+64+2,x
sta blttmp+{]dest*4}+2
]src equ ]src-1
]dest equ ]dest+1
--^
rts
;_TBCopyTileDataToCBuffVH
;]src equ 7
;]dest equ 0
; lup 8
; ldal tiledata+{]src*4}+64,x
; sta blttmp+{]dest*4}
;
; ldal tiledata+{]src*4}+64+2,x
; sta blttmp+{]dest*4}+2
;]src equ ]src-1
;]dest equ ]dest+1
; --^
; rts
; Copy tile mask data into the direct page compositing buffer.
@ -132,17 +118,17 @@ _TBCopyTileMaskToCBuff
--^
rts
_TBCopyTileMaskToCBuffH
]line equ 0
lup 8
ldal tiledata+{]line*4}+32+64,x
sta blttmp+{]line*4}+32
ldal tiledata+{]line*4}+32+64+2,x
sta blttmp+{]line*4}+32+2
]line equ ]line+1
--^
rts
;_TBCopyTileMaskToCBuffH
;]line equ 0
; lup 8
; ldal tiledata+{]line*4}+32+64,x
; sta blttmp+{]line*4}+32
;
; ldal tiledata+{]line*4}+32+64+2,x
; sta blttmp+{]line*4}+32+2
;]line equ ]line+1
; --^
; rts
_TBCopyTileMaskToCBuffV
]src equ 7
@ -158,19 +144,19 @@ _TBCopyTileMaskToCBuffV
--^
rts
_TBCopyTileMaskToCBuffVH
]src equ 7
]dest equ 0
lup 8
ldal tiledata+{]src*4}+32+64,x
sta blttmp+{]dest*4}+32
ldal tiledata+{]src*4}+32+64+2,x
sta blttmp+{]dest*4}+32+2
]src equ ]src-1
]dest equ ]dest+1
--^
rts
;_TBCopyTileMaskToCBuffVH
;]src equ 7
;]dest equ 0
; lup 8
; ldal tiledata+{]src*4}+32+64,x
; sta blttmp+{]dest*4}+32
;
; ldal tiledata+{]src*4}+32+64+2,x
; sta blttmp+{]dest*4}+32+2
;]src equ ]src-1
;]dest equ ]dest+1
; --^
; rts
; Copy just the data into the code field from the composite buffer

View File

@ -2,6 +2,7 @@
;
; Renders a composited tile with masking to the code field.
_TBMaskedSpriteTile_00
_TBMaskedSpriteTile_0H
sta _X_REG ; Immedately stash the parameters
sty _Y_REG
@ -10,15 +11,16 @@ _TBMaskedSpriteTile_00
jsr _TBMergeSpriteDataAndMask ; Overlay the data and mask from the sprite plane into the compositing buffer
jmp _TBMaskedCBuff ; Render the masked tile from the compositing buffer into the code field
_TBMaskedSpriteTile_0H
sta _X_REG
sty _Y_REG
jsr _TBCopyTileDataToCBuffH
jsr _TBCopyTileMaskToCBuffH
jsr _TBMergeSpriteDataAndMask
jmp _TBMaskedCBuff
;_TBMaskedSpriteTile_0H
; sta _X_REG
; sty _Y_REG
; jsr _TBCopyTileDataToCBuffH
; jsr _TBCopyTileMaskToCBuffH
; jsr _TBMergeSpriteDataAndMask
; jmp _TBMaskedCBuff
_TBMaskedSpriteTile_V0
_TBMaskedSpriteTile_VH
sta _X_REG
sty _Y_REG
jsr _TBCopyTileDataToCBuffV
@ -26,13 +28,13 @@ _TBMaskedSpriteTile_V0
jsr _TBMergeSpriteDataAndMask
jmp _TBMaskedCBuff
_TBMaskedSpriteTile_VH
sta _X_REG
sty _Y_REG
jsr _TBCopyTileDataToCBuffVH
jsr _TBCopyTileMaskToCBuffVH
jsr _TBMergeSpriteDataAndMask
jmp _TBMaskedCBuff
;_TBMaskedSpriteTile_VH
; sta _X_REG
; sty _Y_REG
; jsr _TBCopyTileDataToCBuffVH
; jsr _TBCopyTileMaskToCBuffVH
; jsr _TBMergeSpriteDataAndMask
; jmp _TBMaskedCBuff
_TBMergeSpriteDataAndMask
ldx _SPR_X_REG ; set to the unaligned tile block address in the sprite plane

View File

@ -3,28 +3,30 @@
; When the sprite is composited with the tile data, the tile mask is used to place the tile data on top of
; any sprite data
_TBSolidPrioritySpriteTile_00
_TBSolidPrioritySpriteTile_0H
jsr _TBCopyTileDataToCBuff ; Copy the tile data into the compositing buffer (using correct x-register)
jsr _TBCopyTileMaskToCBuff ; Copy the tile mask into the compositing buffer (using correct x-register)
jsr _TBApplyPrioritySpriteData ; Underlay the data fromthe sprite plane (and copy into the code field)
jmp _TBFillPEAOpcode ; Fill in the code field opcodes
_TBSolidPrioritySpriteTile_0H
jsr _TBCopyTileDataToCBuffH
jsr _TBCopyTileMaskToCBuffH
jsr _TBApplyPrioritySpriteData
jmp _TBFillPEAOpcode
;_TBSolidPrioritySpriteTile_0H
; jsr _TBCopyTileDataToCBuffH
; jsr _TBCopyTileMaskToCBuffH
; jsr _TBApplyPrioritySpriteData
; jmp _TBFillPEAOpcode
_TBSolidPrioritySpriteTile_V0
_TBSolidPrioritySpriteTile_VH
jsr _TBCopyTileDataToCBuffV
jsr _TBCopyTileMaskToCBuffV
jsr _TBApplyPrioritySpriteData
jmp _TBFillPEAOpcode
_TBSolidPrioritySpriteTile_VH
jsr _TBCopyTileDataToCBuffVH
jsr _TBCopyTileMaskToCBuffVH
jsr _TBApplyPrioritySpriteData
jmp _TBFillPEAOpcode
;_TBSolidPrioritySpriteTile_VH
; jsr _TBCopyTileDataToCBuffVH
; jsr _TBCopyTileMaskToCBuffVH
; jsr _TBApplyPrioritySpriteData
; jmp _TBFillPEAOpcode
; Need to update the X-register before calling this
_TBApplyPrioritySpriteData

View File

@ -2,6 +2,7 @@
;
; Renders a composited tile with masking to the code field. The sprite is underlaid
_TBMaskedPrioritySpriteTile_00
_TBMaskedPrioritySpriteTile_0H
sta _X_REG ; Immedately stash the parameters
sty _Y_REG
@ -10,15 +11,16 @@ _TBMaskedPrioritySpriteTile_00
jsr _TBUnderlaySpriteDataAndMask ; Underlay the data and mask from the sprite plane into the compositing buffer
jmp _TBMaskedCBuff ; Render the masked tile from the compositing buffer into the code field
_TBMaskedPrioritySpriteTile_0H
sta _X_REG
sty _Y_REG
jsr _TBCopyTileDataToCBuffH
jsr _TBCopyTileMaskToCBuffH
jsr _TBUnderlaySpriteDataAndMask
jmp _TBMaskedCBuff
;_TBMaskedPrioritySpriteTile_0H
; sta _X_REG
; sty _Y_REG
; jsr _TBCopyTileDataToCBuffH
; jsr _TBCopyTileMaskToCBuffH
; jsr _TBUnderlaySpriteDataAndMask
; jmp _TBMaskedCBuff
_TBMaskedPrioritySpriteTile_V0
_TBMaskedPrioritySpriteTile_VH
sta _X_REG
sty _Y_REG
jsr _TBCopyTileDataToCBuffV
@ -26,13 +28,13 @@ _TBMaskedPrioritySpriteTile_V0
jsr _TBUnderlaySpriteDataAndMask
jmp _TBMaskedCBuff
_TBMaskedPrioritySpriteTile_VH
sta _X_REG
sty _Y_REG
jsr _TBCopyTileDataToCBuffVH
jsr _TBCopyTileMaskToCBuffVH
jsr _TBUnderlaySpriteDataAndMask
jmp _TBMaskedCBuff
;_TBMaskedPrioritySpriteTile_VH
; sta _X_REG
; sty _Y_REG
; jsr _TBCopyTileDataToCBuffVH
; jsr _TBCopyTileMaskToCBuffVH
; jsr _TBUnderlaySpriteDataAndMask
; jmp _TBMaskedCBuff
_TBUnderlaySpriteDataAndMask
ldx _SPR_X_REG ; set to the unaligned tile block address in the sprite plane