Remove unused tilesColorCollapsing

This commit is contained in:
StewBC 2021-04-30 14:18:00 -07:00
parent dfa049472d
commit 579373335d

View File

@ -30,10 +30,10 @@ mask:
jsr tilesPrepKeysTiles ; make animated keys from the key tile jsr tilesPrepKeysTiles ; make animated keys from the key tile
jmp tilesPrepConveyorTiles ; Make rotated conveyor tiles into conveyorAnimTiles jmp tilesPrepConveyorTiles ; Make rotated conveyor tiles into conveyorAnimTiles
.endproc .endproc
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
.proc tilesMakeInstances .proc tilesMakeInstances
numTiles = sizeL numTiles = sizeL
iLevelTile = sizeH iLevelTile = sizeH
@ -42,7 +42,7 @@ mask:
tileMemH = srcPtrH tileMemH = srcPtrH
lda #TILES_PER_LEVEL ; for all tiles used in a level lda #TILES_PER_LEVEL ; for all tiles used in a level
sta numTiles sta numTiles
lda #TILE_BYTES - 1 ; start at the end of tile memory lda #TILE_BYTES - 1 ; start at the end of tile memory
sta iWrite sta iWrite
@ -59,20 +59,20 @@ loop:
lda levelTiles, x ; and get the id for the tile from the table lda levelTiles, x ; and get the id for the tile from the table
asl ; mult tile offset * 16 (width of a tile) asl ; mult tile offset * 16 (width of a tile)
asl asl
asl asl
rol tileMemH rol tileMemH
asl asl
rol tileMemH ; offset of tile start (from background) now in tileMem ptr rol tileMemH ; offset of tile start (from background) now in tileMem ptr
adc #<tiles ; add tiles base address adc #<tiles ; add tiles base address
sta tileMemL sta tileMemL
lda #>tiles lda #>tiles
adc tileMemH adc tileMemH
sta tileMemH ; tileMem pointer now points at memory for the tile sta tileMemH ; tileMem pointer now points at memory for the tile
ldy #TILE_BYTES - 1 ; 0 based, copy all the bytes of the tile ldy #TILE_BYTES - 1 ; 0 based, copy all the bytes of the tile
ldx iWrite ldx iWrite
: :
lda (tileMemL), y ; get the tile byte lda (tileMemL), y ; get the tile byte
sta tilesInstances, x ; and save it to instance 0 sta tilesInstances, x ; and save it to instance 0
@ -84,19 +84,15 @@ loop:
beq copyDone ; see if all tiles done beq copyDone ; see if all tiles done
lda iWrite ; more tiles to do, adjust the tile write ptr lda iWrite ; more tiles to do, adjust the tile write ptr
clc clc
adc #TILE_BYTES ; by moving it to the end of the next tile adc #TILE_BYTES ; by moving it to the end of the next tile
sta iWrite sta iWrite
inc iLevelTile ; and advance the index into the table to the next tile inc iLevelTile ; and advance the index into the table to the next tile
bne loop ; BRA to do the next tile bne loop ; BRA to do the next tile
copyDone: copyDone:
rts rts
.endproc
.proc tilesColorCollapsing
rts
.endproc .endproc
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@ -118,7 +114,7 @@ copyDone:
ldy currLevel ; get the offset of the tiles in the level tile table ldy currLevel ; get the offset of the tiles in the level tile table
lda mult8, y lda mult8, y
clc clc
adc iLevelTile ; and add the parameter offset (0 for color and 3 for mono) adc iLevelTile ; and add the parameter offset (0 for color and 3 for mono)
sta iLevelTile sta iLevelTile
@ -127,7 +123,7 @@ loop:
lda levelMasks, y ; and extract the masks for this tile lda levelMasks, y ; and extract the masks for this tile
tay tay
lda masksLeft, y lda masksLeft, y
sta colMaskL sta colMaskL
lda masksRight, y lda masksRight, y
sta colMaskR sta colMaskR
@ -154,7 +150,7 @@ loop:
rts rts
.endproc .endproc
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@ -184,7 +180,7 @@ colorLoopLeft:
dex ; and do the next color for that instance dex ; and do the next color for that instance
bne colorLoopLeft ; repeat for all 4 color frames bne colorLoopLeft ; repeat for all 4 color frames
tya ; move Y back 63 bytes, to the next white key byte tya ; move Y back 63 bytes, to the next white key byte
sec sec
sbc #63 sbc #63
tay tay
@ -198,14 +194,14 @@ colorLoopRight:
and masksRight, x and masksRight, x
sta keyAnimTiles, y sta keyAnimTiles, y
tya tya
adc #TILE_BYTES adc #TILE_BYTES
tay tay
dex dex
bne colorLoopRight bne colorLoopRight
tya tya
sec sec
sbc #63 sbc #63
tay ; y is now pointing at the next left byte tay ; y is now pointing at the next left byte
cpy #TILE_BYTES ; see if the whole key has been processes cpy #TILE_BYTES ; see if the whole key has been processes
@ -231,25 +227,25 @@ colorLoopRight:
ldx currLevel ldx currLevel
lda conveyorDirections, x ; get a local copy of the conveyor direction lda conveyorDirections, x ; get a local copy of the conveyor direction
sta dir sta dir
clc ; point srcPtr at the conveyor tile clc ; point srcPtr at the conveyor tile
lda #DATA_CONVEYOR - TILE_BYTES lda #DATA_CONVEYOR - TILE_BYTES
sta srcPtrL sta srcPtrL
lda #>tilesInstances lda #>tilesInstances
sta srcPtrH sta srcPtrH
lda #<conveyorAnimTiles ; point dstPtr at the first animated tile lda #<conveyorAnimTiles ; point dstPtr at the first animated tile
sta dstPtrL sta dstPtrL
lda #>conveyorAnimTiles lda #>conveyorAnimTiles
sta dstPtrH sta dstPtrH
ldy #TILE_BYTES - 1 ; copy the tile to the animated tiles ldy #TILE_BYTES - 1 ; copy the tile to the animated tiles
: :
lda (srcPtrL), y lda (srcPtrL), y
and #$7F ; clear the MSB, will be fixed later and #$7F ; clear the MSB, will be fixed later
sta (dstPtrL), y sta (dstPtrL), y
dey dey
bpl :- bpl :-
ldy #CONVEYOR_FRAMES - 1 ; set a counter for how many frames to process ldy #CONVEYOR_FRAMES - 1 ; set a counter for how many frames to process
@ -259,10 +255,10 @@ processTile:
clc ; move srcPtr to dstPtr (the new src) clc ; move srcPtr to dstPtr (the new src)
lda dstPtrL ; and move dstPtr to the next frame to animate lda dstPtrL ; and move dstPtr to the next frame to animate
sta srcPtrL sta srcPtrL
adc #TILE_BYTES adc #TILE_BYTES
sta dstPtrL sta dstPtrL
lda dstPtrH lda dstPtrH
sta srcPtrH sta srcPtrH
bcc :+ bcc :+
inc dstPtrH inc dstPtrH
@ -276,7 +272,7 @@ processTile:
lda dir ; different algorithm for each direction lda dir ; different algorithm for each direction
cmp #2 cmp #2
beq left beq left
right: right:
ldy #0 ; top row ldy #0 ; top row
@ -287,9 +283,9 @@ right:
left: left:
ldy #0 ldy #0
jsr shiftRight jsr shiftRight
ldy #4 ldy #4
jsr shiftLeft jsr shiftLeft
nextFrame: nextFrame:
ldy frame ldy frame
@ -304,11 +300,11 @@ shiftRight:
asl ; shift 1/2 a pixel, bit 1 and 0 clear asl ; shift 1/2 a pixel, bit 1 and 0 clear
sta (dstPtrL), y ; save left shifted. carry has a pixel bit that needs to move sta (dstPtrL), y ; save left shifted. carry has a pixel bit that needs to move
iny iny
lda (dstPtrL), y lda (dstPtrL), y
rol ; shift right byte once, carry goes in, MSB bit out in carry rol ; shift right byte once, carry goes in, MSB bit out in carry
asl ; shift second time, bit 0 is now a zero, carry bit needs moving left asl ; shift second time, bit 0 is now a zero, carry bit needs moving left
sta (dstPtrL), y sta (dstPtrL), y
dey dey
lda #0 ; start fresh lda #0 ; start fresh
@ -329,7 +325,7 @@ shiftRight:
ora (dstPtrL), y ; add to bit0 of left byte ora (dstPtrL), y ; add to bit0 of left byte
sta (dstPtrL), y ; and save sta (dstPtrL), y ; and save
rts rts
shiftLeft: shiftLeft:
ldx #1 ldx #1
@ -339,20 +335,20 @@ shiftLeft:
sta (dstPtrL), y ; save byte sta (dstPtrL), y ; save byte
lda #0 ; move bit in for next byte to bit 6 lda #0 ; move bit in for next byte to bit 6
ror ror
lsr lsr
sta carry sta carry
iny iny
lda (dstPtrL), y lda (dstPtrL), y
ror ; move right byte one over (carry needs to go left now) ror ; move right byte one over (carry needs to go left now)
ora carry ; add bit from left ora carry ; add bit from left
sta (dstPtrL), y ; save sta (dstPtrL), y ; save
lda #0 ; start fresh lda #0 ; start fresh
ror ; move carry to bit 6 ror ; move carry to bit 6
lsr lsr
dey dey
ora (dstPtrL), y ; add to left byte ora (dstPtrL), y ; add to left byte
dex dex
bpl :- bpl :-
sta (dstPtrL), y ; save sta (dstPtrL), y ; save
@ -367,7 +363,7 @@ finalFix:
lda #$80 ; if set, set color on for all frames lda #$80 ; if set, set color on for all frames
ora conveyorAnimTiles, y ora conveyorAnimTiles, y
sta conveyorAnimTiles, y sta conveyorAnimTiles, y
dey dey
bpl :- bpl :-
bmi done bmi done
@ -375,13 +371,13 @@ clear:
lda #$7f ; if not set, make sure color isn't on for all lda #$7f ; if not set, make sure color isn't on for all
and conveyorAnimTiles, y and conveyorAnimTiles, y
sta conveyorAnimTiles, y sta conveyorAnimTiles, y
dey dey
bpl clear bpl clear
done: done:
rts rts
.endproc .endproc
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Copy a pre-animated key tile into the tilesInstances so it looks as ; Copy a pre-animated key tile into the tilesInstances so it looks as
@ -404,13 +400,13 @@ done:
: :
lda keyAnimTiles, x ; read the frame and write to key tile lda keyAnimTiles, x ; read the frame and write to key tile
sta tilesInstances + DATA_KEY - TILE_BYTES, y sta tilesInstances + DATA_KEY - TILE_BYTES, y
dex dex
dey dey
bpl :- bpl :-
rts rts
.endproc .endproc
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Copy a pre-animated conveyor lines over the lines in the conveyor frame tile, ; Copy a pre-animated conveyor lines over the lines in the conveyor frame tile,
@ -428,14 +424,14 @@ done:
lda conveyorAnimTiles, x ; copy the 4 animated bytes for lda conveyorAnimTiles, x ; copy the 4 animated bytes for
sta tilesInstances + DATA_CONVEYOR - TILE_BYTES sta tilesInstances + DATA_CONVEYOR - TILE_BYTES
inx inx
lda conveyorAnimTiles, x ; instance 0 over lda conveyorAnimTiles, x ; instance 0 over
sta tilesInstances + DATA_CONVEYOR - TILE_BYTES + 1 sta tilesInstances + DATA_CONVEYOR - TILE_BYTES + 1
inx ; to the tile area 0 inx ; to the tile area 0
inx inx
inx inx
lda conveyorAnimTiles, x lda conveyorAnimTiles, x
sta tilesInstances + DATA_CONVEYOR - TILE_BYTES + 4 sta tilesInstances + DATA_CONVEYOR - TILE_BYTES + 4
@ -443,6 +439,6 @@ done:
lda conveyorAnimTiles, x lda conveyorAnimTiles, x
sta tilesInstances + DATA_CONVEYOR - TILE_BYTES + 5 sta tilesInstances + DATA_CONVEYOR - TILE_BYTES + 5
rts rts
.endproc .endproc