From de5bdc6041935382709f5ebd6431faad519de283 Mon Sep 17 00:00:00 2001 From: Lucas Scharenbroich Date: Fri, 12 Nov 2021 09:07:51 -0600 Subject: [PATCH] Rename tile blitters to match internal bit fields and add in the solid prioity blitter --- src/Core.s | 5 +- src/blitter/Tiles.s | 2 +- src/blitter/Tiles01000.s | 136 +-------------- src/blitter/{Tiles10001.s => Tiles01001.s} | 0 src/blitter/Tiles01010.s | 147 ++-------------- src/blitter/Tiles10000.s | 191 ++++++++++++++++++++- src/blitter/Tiles10010.s | 147 ++++++++++++++-- src/blitter/Tiles10011.s | 6 - src/blitter/Tiles11000.s | 26 ++- 9 files changed, 367 insertions(+), 293 deletions(-) rename src/blitter/{Tiles10001.s => Tiles01001.s} (100%) delete mode 100644 src/blitter/Tiles10011.s diff --git a/src/Core.s b/src/Core.s index 35d582b..cde25af 100644 --- a/src/Core.s +++ b/src/Core.s @@ -8,7 +8,7 @@ use .\Defs.s ; Feature flags -NO_INTERRUPTS equ 1 ; turn off for crossrunner debugging +NO_INTERRUPTS equ 0 ; turn off for crossrunner debugging NO_MUSIC equ 1 ; turn music + tool loading off ; External data provided by the main program segment @@ -394,7 +394,8 @@ ReadControl ENT ; put blitter/Tiles00001.s ; put blitter/Tiles00010.s ; put blitter/Tiles00011.s - put blitter/Tiles01000.s + put blitter/Tiles10000.s + put blitter/Tiles11000.s ; put blitter/Tiles10001.s ; put blitter/Tiles10010.s ; put blitter/Tiles10011.s diff --git a/src/blitter/Tiles.s b/src/blitter/Tiles.s index 7c264bc..c1fcb4d 100644 --- a/src/blitter/Tiles.s +++ b/src/blitter/Tiles.s @@ -182,7 +182,7 @@ TileProcs dw _TBSolidTile_00,_TBSolidTile_0H,_TBSolidTile_V0 dw _TBSolidTile_00,_TBSolidTile_0H,_TBSolidTile_V0,_TBSolidTile_VH ; 10110 : fringed masked normal tiles w/sprite dw _TBSolidTile_00,_TBSolidTile_0H,_TBSolidTile_V0,_TBSolidTile_VH ; 10111 : fringed masked dynamic tiles w/sprite - dw _TBSolidTile_00,_TBSolidTile_0H,_TBSolidTile_V0,_TBSolidTile_VH ; 11000 : high-priority normal tiles w/sprite + dw _TBSolidPrioritySpriteTile_00,_TBSolidPrioritySpriteTile_0H,_TBSolidPrioritySpriteTile_V0,_TBSolidPrioritySpriteTile_VH ; 11000 : high-priority normal tiles w/sprite dw _TBSolidTile_00,_TBSolidTile_0H,_TBSolidTile_V0,_TBSolidTile_VH ; 11001 : high-priority dynamic tiles w/sprite dw _TBSolidTile_00,_TBSolidTile_0H,_TBSolidTile_V0,_TBSolidTile_VH ; 11010 : high-priority masked normal tiles w/sprite dw _TBSolidTile_00,_TBSolidTile_0H,_TBSolidTile_V0,_TBSolidTile_VH ; 11011 : high-priority masked dynamic tiles w/sprite diff --git a/src/blitter/Tiles01000.s b/src/blitter/Tiles01000.s index 77df282..c723a94 100644 --- a/src/blitter/Tiles01000.s +++ b/src/blitter/Tiles01000.s @@ -1,132 +1,6 @@ -; _TBSolidSpriteTile +; _TBPriorityTile ; -; Renders solid tiles with sprites layered on top of the tile data. Because we need to combine -; data from the sprite plane, tile data and write to the code field (which are all in different banks), -; 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 -; ldx #45*128 - jsr _TBCopyTileDataToCBuff ; Copy the tile into the compositing buffer (using correct x-register) - jsr _TBApplySpriteData ; Overlay the data form 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 _TBApplySpriteData - jmp _TBFillPEAOpcode - -; Fast variation that does not need to set the opcode -_TBFastSpriteTile_00 - 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 - jmp _TBApplySpriteData - -; Need to update the X-register before calling this -_TBApplySpriteData - ldx _SPR_X_REG ; set to the unaligned tile block address in the sprite plane - -]line equ 0 - lup 8 - lda blttmp+{]line*4} - andl spritemask+{]line*SPRITE_PLANE_SPAN},x - oral spritedata+{]line*SPRITE_PLANE_SPAN},x - sta: $0004+{]line*$1000},y - - lda blttmp+{]line*4}+2 - andl spritemask+{]line*SPRITE_PLANE_SPAN}+2,x - oral spritedata+{]line*SPRITE_PLANE_SPAN}+2,x - sta: $0001+{]line*$1000},y -]line equ ]line+1 - --^ - rts - -; Copy tile data into the direct page compositing buffer. The main reason to do this in full passes is -; because we can avoid needing to use both the X and Y registers during the compositing process and -; reserve Y to hold the code field address. -; -; Also, we can get away with not setting the bank register, this is a wash in terms of speed, but results -; in simpler, more composable subroutines -_TBCopyTileDataToCBuff -]line equ 0 - lup 8 - ldal tiledata+{]line*4},x - sta blttmp+{]line*4} - - ldal tiledata+{]line*4}+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 -]dest equ 0 - lup 8 - ldal tiledata+{]src*4},x - sta blttmp+{]dest*4} - - ldal tiledata+{]src*4}+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 just the data into the code field from the composite buffer -_TBSolidComposite -]line equ 0 - lup 8 - lda blttmp+{]line*4} - sta: $0004+{]line*$1000},y - lda blttmp+{]line*4}+2 - sta: $0001+{]line*$1000},y -]line equ ]line+1 - --^ - rts +; The priority bit allows the tile to be rendered in front of sprites. If there's no sprite +; in this tile area, then just fallback to the Tile00000.s implementation +_TBPriorityTile dw _TBSolidTile_00,_TBSolidTile_0H,_TBSolidTile_V0,_TBSolidTile_VH + dw _TBCopyData,_TBCopyDataH,_TBCopyDataV,_TBCopyDataVH diff --git a/src/blitter/Tiles10001.s b/src/blitter/Tiles01001.s similarity index 100% rename from src/blitter/Tiles10001.s rename to src/blitter/Tiles01001.s diff --git a/src/blitter/Tiles01010.s b/src/blitter/Tiles01010.s index b8f4a30..53dbbdf 100644 --- a/src/blitter/Tiles01010.s +++ b/src/blitter/Tiles01010.s @@ -1,132 +1,19 @@ -; _TBMaskedSpriteTile +; _TBMaskedPriorityTile ; -; Renders a composited tile with masking to the code field. -_TBMaskedSpriteTile dw _TBMaskedSpriteTile_00 - dw _TBMaskedSpriteTile_0H - dw _TBMaskedSpriteTile_V0 - dw _TBMaskedSpriteTile_VH -; dw _TBCopyData,_TBCopyDataH,_TBCopyDataV,_TBCopyDataVH - -_TBMaskedSpriteTile_00 - jsr _TBCreateComposite - jsr _TBSolidComposite - jmp _TBFillPEAOpcode - -_TBMaskedSpriteTile_0H - jsr _TBCreateCompositeH - jsr _TBSolidComposite - jmp _TBFillPEAOpcode - -_TBMaskedSpriteTile_V0 - jsr _TBCreateCompositeV - jsr _TBSolidComposite - jmp _TBFillPEAOpcode - -_TBMaskedSpriteTile_VH - jsr _TBCreateCompositeVH - jsr _TBSolidComposite - jmp _TBFillPEAOpcode - -_TBCreateCompositeDataAndMask - phb - pea #^tiledata - plb - -]line equ 0 - lup 8 - lda: tiledata+{]line*4},y - andl spritemask+{]line*SPRITE_PLANE_SPAN},x - oral spritedata+{]line*SPRITE_PLANE_SPAN},x - sta blttmp+{]line*4} - - lda: tiledata+{]line*4}+32,y - andl spritemask+{]line*SPRITE_PLANE_SPAN},x - sta blttmp+{]line*4}+32 - - lda: tiledata+{]line*4}+2,y - andl spritemask+{]line*SPRITE_PLANE_SPAN}+2,x - oral spritedata+{]line*SPRITE_PLANE_SPAN}+2,x - sta blttmp+{]line*4}+2 - - lda: tiledata+{]line*4}+32+2,y - andl spritemask+{]line*SPRITE_PLANE_SPAN}+2,x - sta blttmp+{]line*4}+32+2 -]line equ ]line+1 - --^ - - plb - plb - rts - -_TBCreateCompositeH - phb - pea #^tiledata - plb - -]line equ 0 - lup 8 - lda: tiledata+{]line*4}+64,y - andl spritemask+{]line*SPRITE_PLANE_SPAN},x - oral spritedata+{]line*SPRITE_PLANE_SPAN},x - sta blttmp+{]line*4} - - lda: tiledata+{]line*4}+64+2,y - andl spritemask+{]line*SPRITE_PLANE_SPAN}+2,x - oral spritedata+{]line*SPRITE_PLANE_SPAN}+2,x - sta blttmp+{]line*4}+2 -]line equ ]line+1 - --^ - - plb - plb - rts - - -_TBCreateCompositeV -]src equ 7 -]dest equ 0 - lup 8 - lda: tiledata+{]src*4},y - andl spritemask+{]dest*SPRITE_PLANE_SPAN},x - oral spritedata+{]dest*SPRITE_PLANE_SPAN},x - sta blttmp+{]dest*4} - - lda: tiledata+{]src*4}+2,y - andl spritemask+{]dest*SPRITE_PLANE_SPAN}+2,x - oral spritedata+{]dest*SPRITE_PLANE_SPAN}+2,x - sta blttmp+{]dest*4}+2 -]src equ ]src-1 -]dest equ ]dest+1 - --^ - rts - -_TBCreateCompositeVH -]src equ 7 -]dest equ 0 - lup 8 - lda: tiledata+{]src*4}+64,y - andl spritemask+{]dest*SPRITE_PLANE_SPAN},x - oral spritedata+{]dest*SPRITE_PLANE_SPAN},x - sta blttmp+{]dest*4} - - lda: tiledata+{]src*4}+64+2,y - andl spritemask+{]dest*SPRITE_PLANE_SPAN}+2,x - oral spritedata+{]dest*SPRITE_PLANE_SPAN}+2,x - sta blttmp+{]dest*4}+2 -]src equ ]src-1 -]dest equ ]dest+1 - --^ - rts - -; Copy just the data into the code field from the composite buffer -_TBSolidComposite -]line equ 0 - lup 8 - lda blttmp+{]line*4} - sta: $0004+{]line*$1000},y - lda blttmp+{]line*4}+2 - sta: $0001+{]line*$1000},y -]line equ ]line+1 - --^ - rts +; The priority bit allows the tile to be rendered in front of sprites. If there's no sprite +; in this tile area, then just fallback to the Tile00000.s implementation +_TBMaskedPriorityTile dw _TBMaskedTile_00,_TBMaskedTile_0H,_TBMaskedTile_V0,_TBMaskedTile_VH + dw _TBCopyData,_TBCopyDataH,_TBCopyDataV,_TBCopyDataVH +; NOTE: Eventually, we want a way to support this use-case +; +; When the high-priority bit is set for a tile, then the BG0 tile will be rendered behind the BG1 data. In +; order to support this, the optional BG1 mask buffer needs to be enabled and *every* word in the tile +; becomes a JMP handler (similar to masked dynamic tiles) +; +; The 8 bytes of code that is generated in the JMP handler is +; +; lda #tiledata +; and [dp],y +; ora (dp),y +; nop diff --git a/src/blitter/Tiles10000.s b/src/blitter/Tiles10000.s index c723a94..f435fab 100644 --- a/src/blitter/Tiles10000.s +++ b/src/blitter/Tiles10000.s @@ -1,6 +1,187 @@ -; _TBPriorityTile +; _TBSolidSpriteTile ; -; The priority bit allows the tile to be rendered in front of sprites. If there's no sprite -; in this tile area, then just fallback to the Tile00000.s implementation -_TBPriorityTile dw _TBSolidTile_00,_TBSolidTile_0H,_TBSolidTile_V0,_TBSolidTile_VH - dw _TBCopyData,_TBCopyDataH,_TBCopyDataV,_TBCopyDataVH +; Renders solid tiles with sprites layered on top of the tile data. Because we need to combine +; data from the sprite plane, tile data and write to the code field (which are all in different banks), +; 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 +; ldx #45*128 + jsr _TBCopyTileDataToCBuff ; Copy the tile into the compositing buffer (using correct x-register) + jsr _TBApplySpriteData ; Overlay the data form 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 _TBApplySpriteData + jmp _TBFillPEAOpcode + +; Fast variation that does not need to set the opcode +_TBFastSpriteTile_00 + 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 + jmp _TBApplySpriteData + +; Need to update the X-register before calling this +_TBApplySpriteData + ldx _SPR_X_REG ; set to the unaligned tile block address in the sprite plane + +]line equ 0 + lup 8 + lda blttmp+{]line*4} + andl spritemask+{]line*SPRITE_PLANE_SPAN},x + oral spritedata+{]line*SPRITE_PLANE_SPAN},x + sta: $0004+{]line*$1000},y + + lda blttmp+{]line*4}+2 + andl spritemask+{]line*SPRITE_PLANE_SPAN}+2,x + oral spritedata+{]line*SPRITE_PLANE_SPAN}+2,x + sta: $0001+{]line*$1000},y +]line equ ]line+1 + --^ + rts + +; Copy tile data into the direct page compositing buffer. The main reason to do this in full passes is +; because we can avoid needing to use both the X and Y registers during the compositing process and +; reserve Y to hold the code field address. +; +; Also, we can get away with not setting the bank register, this is a wash in terms of speed, but results +; in simpler, more composable subroutines +_TBCopyTileDataToCBuff +]line equ 0 + lup 8 + ldal tiledata+{]line*4},x + sta blttmp+{]line*4} + + ldal tiledata+{]line*4}+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 +]dest equ 0 + lup 8 + ldal tiledata+{]src*4},x + sta blttmp+{]dest*4} + + ldal tiledata+{]src*4}+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. +_TBCopyTileMaskToCBuff +]line equ 0 + lup 8 + ldal tiledata+{]line*4}+32,x + sta blttmp+{]line*4}+32 + + ldal tiledata+{]line*4}+32+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 +]dest equ 0 + lup 8 + ldal tiledata+{]src*4}+32,x + sta blttmp+{]dest*4}+32 + + ldal tiledata+{]src*4}+32+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 +_TBSolidComposite +]line equ 0 + lup 8 + lda blttmp+{]line*4} + sta: $0004+{]line*$1000},y + lda blttmp+{]line*4}+2 + sta: $0001+{]line*$1000},y +]line equ ]line+1 + --^ + rts diff --git a/src/blitter/Tiles10010.s b/src/blitter/Tiles10010.s index 53dbbdf..b8f4a30 100644 --- a/src/blitter/Tiles10010.s +++ b/src/blitter/Tiles10010.s @@ -1,19 +1,132 @@ -; _TBMaskedPriorityTile +; _TBMaskedSpriteTile ; -; The priority bit allows the tile to be rendered in front of sprites. If there's no sprite -; in this tile area, then just fallback to the Tile00000.s implementation -_TBMaskedPriorityTile dw _TBMaskedTile_00,_TBMaskedTile_0H,_TBMaskedTile_V0,_TBMaskedTile_VH - dw _TBCopyData,_TBCopyDataH,_TBCopyDataV,_TBCopyDataVH +; Renders a composited tile with masking to the code field. +_TBMaskedSpriteTile dw _TBMaskedSpriteTile_00 + dw _TBMaskedSpriteTile_0H + dw _TBMaskedSpriteTile_V0 + dw _TBMaskedSpriteTile_VH +; dw _TBCopyData,_TBCopyDataH,_TBCopyDataV,_TBCopyDataVH + +_TBMaskedSpriteTile_00 + jsr _TBCreateComposite + jsr _TBSolidComposite + jmp _TBFillPEAOpcode + +_TBMaskedSpriteTile_0H + jsr _TBCreateCompositeH + jsr _TBSolidComposite + jmp _TBFillPEAOpcode + +_TBMaskedSpriteTile_V0 + jsr _TBCreateCompositeV + jsr _TBSolidComposite + jmp _TBFillPEAOpcode + +_TBMaskedSpriteTile_VH + jsr _TBCreateCompositeVH + jsr _TBSolidComposite + jmp _TBFillPEAOpcode + +_TBCreateCompositeDataAndMask + phb + pea #^tiledata + plb + +]line equ 0 + lup 8 + lda: tiledata+{]line*4},y + andl spritemask+{]line*SPRITE_PLANE_SPAN},x + oral spritedata+{]line*SPRITE_PLANE_SPAN},x + sta blttmp+{]line*4} + + lda: tiledata+{]line*4}+32,y + andl spritemask+{]line*SPRITE_PLANE_SPAN},x + sta blttmp+{]line*4}+32 + + lda: tiledata+{]line*4}+2,y + andl spritemask+{]line*SPRITE_PLANE_SPAN}+2,x + oral spritedata+{]line*SPRITE_PLANE_SPAN}+2,x + sta blttmp+{]line*4}+2 + + lda: tiledata+{]line*4}+32+2,y + andl spritemask+{]line*SPRITE_PLANE_SPAN}+2,x + sta blttmp+{]line*4}+32+2 +]line equ ]line+1 + --^ + + plb + plb + rts + +_TBCreateCompositeH + phb + pea #^tiledata + plb + +]line equ 0 + lup 8 + lda: tiledata+{]line*4}+64,y + andl spritemask+{]line*SPRITE_PLANE_SPAN},x + oral spritedata+{]line*SPRITE_PLANE_SPAN},x + sta blttmp+{]line*4} + + lda: tiledata+{]line*4}+64+2,y + andl spritemask+{]line*SPRITE_PLANE_SPAN}+2,x + oral spritedata+{]line*SPRITE_PLANE_SPAN}+2,x + sta blttmp+{]line*4}+2 +]line equ ]line+1 + --^ + + plb + plb + rts + + +_TBCreateCompositeV +]src equ 7 +]dest equ 0 + lup 8 + lda: tiledata+{]src*4},y + andl spritemask+{]dest*SPRITE_PLANE_SPAN},x + oral spritedata+{]dest*SPRITE_PLANE_SPAN},x + sta blttmp+{]dest*4} + + lda: tiledata+{]src*4}+2,y + andl spritemask+{]dest*SPRITE_PLANE_SPAN}+2,x + oral spritedata+{]dest*SPRITE_PLANE_SPAN}+2,x + sta blttmp+{]dest*4}+2 +]src equ ]src-1 +]dest equ ]dest+1 + --^ + rts + +_TBCreateCompositeVH +]src equ 7 +]dest equ 0 + lup 8 + lda: tiledata+{]src*4}+64,y + andl spritemask+{]dest*SPRITE_PLANE_SPAN},x + oral spritedata+{]dest*SPRITE_PLANE_SPAN},x + sta blttmp+{]dest*4} + + lda: tiledata+{]src*4}+64+2,y + andl spritemask+{]dest*SPRITE_PLANE_SPAN}+2,x + oral spritedata+{]dest*SPRITE_PLANE_SPAN}+2,x + sta blttmp+{]dest*4}+2 +]src equ ]src-1 +]dest equ ]dest+1 + --^ + rts + +; Copy just the data into the code field from the composite buffer +_TBSolidComposite +]line equ 0 + lup 8 + lda blttmp+{]line*4} + sta: $0004+{]line*$1000},y + lda blttmp+{]line*4}+2 + sta: $0001+{]line*$1000},y +]line equ ]line+1 + --^ + rts -; NOTE: Eventually, we want a way to support this use-case -; -; When the high-priority bit is set for a tile, then the BG0 tile will be rendered behind the BG1 data. In -; order to support this, the optional BG1 mask buffer needs to be enabled and *every* word in the tile -; becomes a JMP handler (similar to masked dynamic tiles) -; -; The 8 bytes of code that is generated in the JMP handler is -; -; lda #tiledata -; and [dp],y -; ora (dp),y -; nop diff --git a/src/blitter/Tiles10011.s b/src/blitter/Tiles10011.s deleted file mode 100644 index 841f1bd..0000000 --- a/src/blitter/Tiles10011.s +++ /dev/null @@ -1,6 +0,0 @@ -; _TBPriorityDynamicMaskTile -; -; The priority bit allows the tile to be rendered in front of sprites. If there's no sprite -; in this tile area, then just fallback to the Tile00000.s implementation -_TBPriorityDynamicMaskTile dw _TBDynamicMaskTile_00,_TBDynamicMaskTile_00,_TBDynamicMaskTile_00,_TBDynamicMaskTile_00 - dw _TBDynamicTile_00,_TBDynamicTile_00,_TBDynamicTile_00,_TBDynamicTile_00 diff --git a/src/blitter/Tiles11000.s b/src/blitter/Tiles11000.s index 79acfb2..ed59086 100644 --- a/src/blitter/Tiles11000.s +++ b/src/blitter/Tiles11000.s @@ -1,7 +1,31 @@ -; _TBPrioritySpriteTile +; _TBSolidPrioritySpriteTile ; ; 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 +; ldx #45*128 + 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_V0 + jsr _TBCopyTileDataToCBuffV + jsr _TBCopyTileMaskToCBuffV + jsr _TBApplyPrioritySpriteData + jmp _TBFillPEAOpcode + +_TBSolidPrioritySpriteTile_VH + jsr _TBCopyTileDataToCBuffVH + jsr _TBCopyTileMaskToCBuffVH + jsr _TBApplyPrioritySpriteData + jmp _TBFillPEAOpcode ; Need to update the X-register before calling this _TBApplyPrioritySpriteData