2021-07-08 12:46:35 +00:00
|
|
|
; Renders a frame of animation
|
|
|
|
;
|
2022-02-21 16:31:35 +00:00
|
|
|
; The render function is the point of committment -- most of the APIs that set sprites and
|
2022-02-25 23:05:32 +00:00
|
|
|
; update coordinates are lazy; they simply save their values and set a dirty flag in the
|
2021-07-09 19:18:49 +00:00
|
|
|
; DirtyBits word.
|
|
|
|
;
|
|
|
|
; This function examines the dirty bits and actually performs the work to update the code field
|
|
|
|
; and internal data structure to properly render the play field. Then the update pipeline is
|
|
|
|
; executed.
|
2022-02-25 23:05:32 +00:00
|
|
|
;
|
|
|
|
; Everything is composited into the tiles in the playfield and then the screen is rendered in
|
|
|
|
; a single pass.
|
2022-04-29 17:38:04 +00:00
|
|
|
;
|
2021-07-09 20:38:32 +00:00
|
|
|
; TODO -- actually check the dirty bits and be selective on what gets updated. For example, if
|
|
|
|
; only the Y position changes, then we should only need to set new values on the
|
|
|
|
; virtual lines that were brought on screen. If the X position only changes by one
|
|
|
|
; byte, then we may have to change the CODE_ENTRY values or restore/set new OPCODE
|
|
|
|
; values, but not both.
|
|
|
|
|
2021-07-18 02:00:46 +00:00
|
|
|
; It's important to do _ApplyBG0YPos first because it calculates the value of StartY % 208 which is
|
|
|
|
; used in all of the other loops
|
2021-08-25 14:38:02 +00:00
|
|
|
_Render
|
2022-05-27 00:36:40 +00:00
|
|
|
stz SpriteRemovedFlag ; If we remove a sprite, then we need to flag a rebuild for the next frame
|
|
|
|
|
2021-07-09 20:38:32 +00:00
|
|
|
jsr _ApplyBG0YPos ; Set stack addresses for the virtual lines to the physical screen
|
2022-05-19 02:00:06 +00:00
|
|
|
; jsr _ApplyBG1YPos
|
2021-08-06 19:42:18 +00:00
|
|
|
|
|
|
|
; _ApplyBG0Xpos need to be split because we have to set the offsets, then draw in any updated tiles, and
|
|
|
|
; finally patch out the code field. Right now, the BRA operand is getting overwritten by tile data.
|
|
|
|
jsr _ApplyBG0XPosPre
|
2022-05-19 02:00:06 +00:00
|
|
|
; jsr _ApplyBG1XPosPre
|
2021-08-06 19:42:18 +00:00
|
|
|
|
2022-05-23 20:18:34 +00:00
|
|
|
jsr _RenderSprites ; Once the BG0 X and Y positions are committed, update sprite data
|
2021-10-31 20:42:59 +00:00
|
|
|
|
2022-05-18 05:34:25 +00:00
|
|
|
; jsr _UpdateBG0TileMap ; and the tile maps. These subroutines build up a list of tiles
|
|
|
|
; jsr _UpdateBG1TileMap ; that need to be updated in the code field
|
2021-08-06 19:42:18 +00:00
|
|
|
|
2022-05-18 05:34:25 +00:00
|
|
|
jsr _ApplyTilesFast ; This function actually draws the new tiles into the code field
|
2021-07-09 20:38:32 +00:00
|
|
|
|
2021-10-21 13:50:07 +00:00
|
|
|
jsr _ApplyBG0XPos ; Patch the code field instructions with exit BRA opcode
|
2022-05-19 02:00:06 +00:00
|
|
|
; jsr _ApplyBG1XPos ; Update the direct page value based on the horizontal position
|
2021-10-21 13:50:07 +00:00
|
|
|
|
|
|
|
; The code fields are locked in now and ready to be rendered
|
2021-07-20 03:42:51 +00:00
|
|
|
|
2022-02-19 02:43:55 +00:00
|
|
|
; jsr _ShadowOff
|
2021-07-20 03:42:51 +00:00
|
|
|
|
2021-10-31 00:24:23 +00:00
|
|
|
; Shadowing is turned off. Render all of the scan lines that need a second pass. One
|
|
|
|
; optimization that can be done here is that the lines can be rendered in any order
|
|
|
|
; since it is not shown on-screen yet.
|
2021-10-21 13:50:07 +00:00
|
|
|
|
2021-11-15 18:23:38 +00:00
|
|
|
; ldx #0 ; Blit the full virtual buffer to the screen
|
|
|
|
; ldy #8
|
|
|
|
; jsr _BltRange
|
2021-10-21 13:50:07 +00:00
|
|
|
|
|
|
|
; Turn shadowing back on
|
2021-07-20 03:42:51 +00:00
|
|
|
|
2022-02-19 02:43:55 +00:00
|
|
|
; jsr _ShadowOn
|
2021-07-20 03:42:51 +00:00
|
|
|
|
2021-10-21 13:50:07 +00:00
|
|
|
; Now render all of the remaining lines in top-to-bottom (or bottom-to-top) order
|
|
|
|
|
2022-02-19 02:43:55 +00:00
|
|
|
; lda ScreenY0 ; pass the address of the first line of the overlay
|
|
|
|
; clc
|
|
|
|
; adc #0
|
|
|
|
; asl
|
|
|
|
; tax
|
|
|
|
; lda ScreenAddr,x
|
|
|
|
; clc
|
|
|
|
; adc ScreenX0
|
2021-11-15 18:23:38 +00:00
|
|
|
; jsl Overlay
|
2021-10-31 00:24:23 +00:00
|
|
|
|
2021-11-15 18:23:38 +00:00
|
|
|
ldx #0 ; Blit the full virtual buffer to the screen
|
2021-07-09 20:38:32 +00:00
|
|
|
ldy ScreenHeight
|
|
|
|
jsr _BltRange
|
|
|
|
|
2022-02-25 23:05:32 +00:00
|
|
|
; ldx #0
|
|
|
|
; ldy ScreenHeight
|
|
|
|
; jsr _BltSCB
|
2021-11-15 18:23:38 +00:00
|
|
|
|
2022-05-23 04:54:47 +00:00
|
|
|
lda StartYMod208 ; Restore the fields back to their original state
|
2021-07-09 20:38:32 +00:00
|
|
|
ldx ScreenHeight
|
|
|
|
jsr _RestoreBG0Opcodes
|
|
|
|
|
2021-08-10 12:59:14 +00:00
|
|
|
lda StartY
|
|
|
|
sta OldStartY
|
|
|
|
lda StartX
|
|
|
|
sta OldStartX
|
|
|
|
|
2021-08-19 06:22:36 +00:00
|
|
|
lda BG1StartY
|
|
|
|
sta OldBG1StartY
|
|
|
|
lda BG1StartX
|
|
|
|
sta OldBG1StartX
|
|
|
|
|
2021-08-10 12:59:14 +00:00
|
|
|
stz DirtyBits
|
2022-02-19 02:43:55 +00:00
|
|
|
stz LastRender ; Mark that a full render was just performed
|
2022-05-27 00:36:40 +00:00
|
|
|
|
|
|
|
lda SpriteRemovedFlag ; If any sprite was removed, set the rebuild flag
|
|
|
|
beq :no_removal
|
|
|
|
lda #DIRTY_BIT_SPRITE_ARRAY
|
|
|
|
sta DirtyBits
|
|
|
|
:no_removal
|
2021-07-08 12:46:35 +00:00
|
|
|
rts
|
2022-01-20 02:58:57 +00:00
|
|
|
|
2022-05-18 05:34:25 +00:00
|
|
|
; The _ApplyTilesFast is the same as _ApplyTiles, but we use the _RenderTileFast subroutine
|
|
|
|
_ApplyTilesFast
|
2022-05-31 13:43:26 +00:00
|
|
|
ldx DirtyTileCount
|
|
|
|
|
2022-05-18 05:34:25 +00:00
|
|
|
tdc
|
|
|
|
clc
|
|
|
|
adc #$100 ; move to the next page
|
|
|
|
tcd
|
|
|
|
|
2022-05-31 13:43:26 +00:00
|
|
|
stx DP2_DIRTY_TILE_COUNT ; Cache the dirty tile count
|
2022-05-19 02:39:39 +00:00
|
|
|
jsr _PopDirtyTilesFast
|
2022-05-18 05:34:25 +00:00
|
|
|
|
|
|
|
tdc ; Move back to the original direct page
|
|
|
|
sec
|
|
|
|
sbc #$100
|
|
|
|
tcd
|
2022-05-31 13:43:26 +00:00
|
|
|
|
|
|
|
stz DirtyTileCount ; Reset the dirty tile count
|
2022-05-18 05:34:25 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
; The _ApplyTiles function is responsible for rendering all of the dirty tiles into the code
|
|
|
|
; field. In this function we switch to the second direct page which holds the temporary
|
|
|
|
; working buffers for tile rendering.
|
|
|
|
;
|
|
|
|
_ApplyTiles
|
|
|
|
tdc
|
|
|
|
clc
|
|
|
|
adc #$100 ; move to the next page
|
|
|
|
tcd
|
|
|
|
|
|
|
|
bra :begin
|
|
|
|
|
|
|
|
:loop
|
|
|
|
; Retrieve the offset of the next dirty Tile Store items in the X-register
|
|
|
|
|
|
|
|
jsr _PopDirtyTile2
|
|
|
|
|
|
|
|
; Call the generic dispatch with the Tile Store record pointer at by the X-register.
|
|
|
|
|
|
|
|
phb
|
|
|
|
; jsr _RenderTile2
|
|
|
|
plb
|
|
|
|
|
|
|
|
; Loop again until the list of dirty tiles is empty
|
|
|
|
|
|
|
|
:begin ldy DirtyTileCount
|
|
|
|
bne :loop
|
|
|
|
|
|
|
|
tdc ; Move back to the original direct page
|
|
|
|
sec
|
|
|
|
sbc #$100
|
|
|
|
tcd
|
|
|
|
rts
|
|
|
|
|
2022-02-19 02:43:55 +00:00
|
|
|
; This is a specialized render function that only updates the dirty tiles *and* draws them
|
2022-01-20 02:58:57 +00:00
|
|
|
; directly onto the SHR graphics buffer. The playfield is not used at all. In some way, this
|
|
|
|
; ignores almost all of the capabilities of GTE, but it does provide a convenient way to use
|
|
|
|
; the sprite subsystem + tile attributes for single-screen games which should be able to run
|
|
|
|
; close to 60 fps.
|
2022-02-25 23:05:32 +00:00
|
|
|
;
|
|
|
|
; In this renderer, we assume that there is no scrolling, so no need to update any information about
|
2022-01-20 02:58:57 +00:00
|
|
|
; the BG0/BG1 positions
|
|
|
|
_RenderDirty
|
2022-02-04 05:44:46 +00:00
|
|
|
lda LastRender ; If the full renderer was last called, we assume that
|
|
|
|
bne :norecalc ; the scroll positions have likely changed, so recalculate
|
|
|
|
jsr _RecalcTileScreenAddrs ; them to make sure sprites draw at the correct screen address
|
2022-05-18 05:34:25 +00:00
|
|
|
; jsr _ClearSpritesFromCodeField ; Restore the tiles to their non-sprite versions
|
2022-02-04 05:44:46 +00:00
|
|
|
:norecalc
|
2022-02-22 08:35:21 +00:00
|
|
|
|
2022-05-18 05:34:25 +00:00
|
|
|
; jsr _RenderSprites
|
|
|
|
; jsr _ApplyDirtyTiles
|
2022-04-29 17:38:04 +00:00
|
|
|
|
2022-02-04 05:44:46 +00:00
|
|
|
lda #1
|
|
|
|
sta LastRender
|
2022-01-20 02:58:57 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
_ApplyDirtyTiles
|
|
|
|
bra :begin
|
|
|
|
|
|
|
|
:loop
|
|
|
|
; Retrieve the offset of the next dirty Tile Store items in the Y-register
|
|
|
|
|
|
|
|
jsr _PopDirtyTile2
|
|
|
|
|
|
|
|
; Call the generic dispatch with the Tile Store record pointer at by the Y-register.
|
|
|
|
|
|
|
|
phb
|
|
|
|
jsr _RenderDirtyTile
|
|
|
|
plb
|
|
|
|
|
|
|
|
; Loop again until the list of dirty tiles is empty
|
|
|
|
|
2022-02-18 19:42:37 +00:00
|
|
|
:begin ldy DirtyTileCount
|
2022-01-20 02:58:57 +00:00
|
|
|
bne :loop
|
|
|
|
rts
|
|
|
|
|
|
|
|
; Only render solid tiles and sprites
|
|
|
|
_RenderDirtyTile
|
2022-05-31 13:43:26 +00:00
|
|
|
lda TileStore+TS_SPRITE_FLAG,y
|
2022-05-18 05:34:25 +00:00
|
|
|
beq NoSpritesDirty ; This is faster if there are no sprites
|
|
|
|
|
2022-05-31 13:43:26 +00:00
|
|
|
; TODO: handle sprite drawing
|
2022-02-22 08:35:21 +00:00
|
|
|
|
|
|
|
; The rest of this function handles that non-sprite blit, which is super fast since it blits directly from the
|
|
|
|
; tile data store to the graphics screen with no masking. The only extra work is selecting a blit function
|
|
|
|
; based on the tile flip flags.
|
2022-05-18 05:34:25 +00:00
|
|
|
;
|
2022-01-20 02:58:57 +00:00
|
|
|
; B is set to Bank 01
|
|
|
|
; Y is set to the top-left address of the tile in SHR screen
|
2022-05-18 05:34:25 +00:00
|
|
|
; A is set to the address of the tile data
|
|
|
|
NoSpritesDirty
|
2022-06-20 20:55:09 +00:00
|
|
|
; lda TileStore+TS_DIRTY_TILE_DISP,y
|
|
|
|
; stal :nsd+1
|
2022-05-31 13:43:26 +00:00
|
|
|
ldx TileStore+TS_SCREEN_ADDR,y ; Get the on-screen address of this tile
|
|
|
|
lda TileStore+TS_TILE_ADDR,y ; load the address of this tile's data (pre-calculated)
|
2022-05-18 05:34:25 +00:00
|
|
|
plb ; set the code field bank
|
2022-05-31 13:43:26 +00:00
|
|
|
:nsd jmp $0000
|
2022-02-25 23:05:32 +00:00
|
|
|
; Use some temporary space for the spriteIdx array (maximum of 4 entries)
|
|
|
|
|
|
|
|
stkSave equ tmp9
|
|
|
|
screenAddr equ tmp10
|
|
|
|
tileAddr equ tmp11
|
|
|
|
spriteIdx equ tmp12
|
|
|
|
|
|
|
|
; 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
|
|
|
|
; stack value.
|
2022-05-18 05:34:25 +00:00
|
|
|
FourSpritesDirty
|
|
|
|
ThreeSpritesDirty
|
|
|
|
TwoSpritesDirty
|
|
|
|
|
|
|
|
sta tileAddr
|
2022-05-31 13:43:26 +00:00
|
|
|
stx screenAddr
|
2022-05-18 05:34:25 +00:00
|
|
|
|
|
|
|
plb
|
|
|
|
tsc
|
|
|
|
sta stkSave ; Save the stack on the direct page
|
2022-02-25 23:05:32 +00:00
|
|
|
|
2022-05-18 05:34:25 +00:00
|
|
|
sei
|
|
|
|
clc
|
|
|
|
|
|
|
|
ldy tileAddr
|
|
|
|
lda screenAddr ; Saved in direct page locations
|
|
|
|
tcs
|
|
|
|
|
|
|
|
_R0W1
|
|
|
|
|
|
|
|
lda tiledata+{0*TILE_DATA_SPAN},y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{0*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{0*SPRITE_PLANE_SPAN},x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{0*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{0*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $00,s
|
|
|
|
|
|
|
|
lda tiledata+{0*TILE_DATA_SPAN}+2,y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{0*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{0*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{0*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{0*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $02,s
|
|
|
|
|
|
|
|
lda tiledata+{1*TILE_DATA_SPAN},y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{1*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{1*SPRITE_PLANE_SPAN},x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{1*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{1*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $A0,s
|
|
|
|
|
|
|
|
lda tiledata+{1*TILE_DATA_SPAN}+2,y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{1*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{1*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{1*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{1*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $A2,s
|
|
|
|
|
|
|
|
tsc
|
|
|
|
adc #320
|
|
|
|
tcs
|
|
|
|
|
|
|
|
lda tiledata+{2*TILE_DATA_SPAN},y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{2*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{2*SPRITE_PLANE_SPAN},x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{2*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{2*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $00,s
|
|
|
|
|
|
|
|
lda tiledata+{2*TILE_DATA_SPAN}+2,y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{2*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{2*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{2*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{2*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $02,s
|
|
|
|
|
|
|
|
lda tiledata+{3*TILE_DATA_SPAN},y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{3*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{3*SPRITE_PLANE_SPAN},x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{3*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{3*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $A0,s
|
|
|
|
|
|
|
|
lda tiledata+{3*TILE_DATA_SPAN}+2,y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{3*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{3*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{3*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{3*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $A2,s
|
|
|
|
|
|
|
|
tsc
|
|
|
|
adc #320
|
|
|
|
tcs
|
|
|
|
|
|
|
|
lda tiledata+{4*TILE_DATA_SPAN},y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{4*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{4*SPRITE_PLANE_SPAN},x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{4*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{4*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $00,s
|
|
|
|
|
|
|
|
lda tiledata+{4*TILE_DATA_SPAN}+2,y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{4*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{4*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{4*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{4*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $02,s
|
|
|
|
|
|
|
|
lda tiledata+{5*TILE_DATA_SPAN},y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{5*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{5*SPRITE_PLANE_SPAN},x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{5*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{5*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $A0,s
|
|
|
|
|
|
|
|
lda tiledata+{5*TILE_DATA_SPAN}+2,y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{5*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{5*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{5*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{5*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $A2,s
|
|
|
|
|
|
|
|
tsc
|
|
|
|
adc #320
|
|
|
|
tcs
|
|
|
|
|
|
|
|
lda tiledata+{6*TILE_DATA_SPAN},y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{6*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{6*SPRITE_PLANE_SPAN},x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{6*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{6*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $00,s
|
|
|
|
|
|
|
|
lda tiledata+{6*TILE_DATA_SPAN}+2,y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{6*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{6*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{6*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{6*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $02,s
|
|
|
|
|
|
|
|
lda tiledata+{7*TILE_DATA_SPAN},y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{7*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{7*SPRITE_PLANE_SPAN},x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{7*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{7*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $A0,s
|
|
|
|
|
|
|
|
lda tiledata+{7*TILE_DATA_SPAN}+2,y
|
|
|
|
ldx spriteIdx+2
|
|
|
|
andl spritemask+{7*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{7*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
ldx spriteIdx
|
|
|
|
andl spritemask+{7*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{7*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $A2,s
|
|
|
|
|
|
|
|
_R0W0
|
|
|
|
|
|
|
|
lda stkSave
|
|
|
|
tcs
|
|
|
|
cli
|
|
|
|
rts
|
2022-02-18 18:12:32 +00:00
|
|
|
|
2022-02-25 23:05:32 +00:00
|
|
|
; There is only one sprite at this tile, so do a fast blit that directly combines a tile with a single
|
|
|
|
; sprite and renders directly to the screen
|
2022-02-22 08:35:21 +00:00
|
|
|
;
|
2022-02-25 23:05:32 +00:00
|
|
|
; NOTE: Expect X-register to already have been set to the correct VBUFF address
|
2022-05-18 05:34:25 +00:00
|
|
|
OneSpriteDirty
|
|
|
|
ldy tileAddr ; load the address of this tile's data
|
|
|
|
lda screenAddr ; Get the on-screen address of this tile
|
|
|
|
|
|
|
|
plb
|
|
|
|
|
|
|
|
phd
|
|
|
|
sei
|
|
|
|
clc
|
|
|
|
tcd
|
|
|
|
|
|
|
|
_R0W1
|
|
|
|
|
|
|
|
lda tiledata+{0*TILE_DATA_SPAN},y
|
|
|
|
andl spritemask+{0*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{0*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $00
|
|
|
|
|
|
|
|
lda tiledata+{0*TILE_DATA_SPAN}+2,y
|
|
|
|
andl spritemask+{0*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{0*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $02
|
|
|
|
|
|
|
|
lda tiledata+{1*TILE_DATA_SPAN},y
|
|
|
|
andl spritemask+{1*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{1*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $A0
|
|
|
|
|
|
|
|
lda tiledata+{1*TILE_DATA_SPAN}+2,y
|
|
|
|
andl spritemask+{1*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{1*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $A2
|
|
|
|
|
|
|
|
tdc
|
|
|
|
adc #320
|
|
|
|
tcd
|
|
|
|
|
|
|
|
lda tiledata+{2*TILE_DATA_SPAN},y
|
|
|
|
andl spritemask+{2*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{2*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $00
|
|
|
|
|
|
|
|
lda tiledata+{2*TILE_DATA_SPAN}+2,y
|
|
|
|
andl spritemask+{2*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{2*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $02
|
|
|
|
|
|
|
|
lda tiledata+{3*TILE_DATA_SPAN},y
|
|
|
|
andl spritemask+{3*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{3*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $A0
|
|
|
|
|
|
|
|
lda tiledata+{3*TILE_DATA_SPAN}+2,y
|
|
|
|
andl spritemask+{3*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{3*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $A2
|
|
|
|
|
|
|
|
tdc
|
|
|
|
adc #320
|
|
|
|
tcd
|
|
|
|
|
|
|
|
lda tiledata+{4*TILE_DATA_SPAN},y
|
|
|
|
andl spritemask+{4*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{4*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $00
|
|
|
|
|
|
|
|
lda tiledata+{4*TILE_DATA_SPAN}+2,y
|
|
|
|
andl spritemask+{4*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{4*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $02
|
|
|
|
|
|
|
|
lda tiledata+{5*TILE_DATA_SPAN},y
|
|
|
|
andl spritemask+{5*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{5*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $A0
|
|
|
|
|
|
|
|
lda tiledata+{5*TILE_DATA_SPAN}+2,y
|
|
|
|
andl spritemask+{5*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{5*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $A2
|
|
|
|
|
|
|
|
tdc
|
|
|
|
adc #320
|
|
|
|
tcd
|
|
|
|
|
|
|
|
lda tiledata+{6*TILE_DATA_SPAN},y
|
|
|
|
andl spritemask+{6*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{6*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $00
|
|
|
|
|
|
|
|
lda tiledata+{6*TILE_DATA_SPAN}+2,y
|
|
|
|
andl spritemask+{6*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{6*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $02
|
|
|
|
|
|
|
|
lda tiledata+{7*TILE_DATA_SPAN},y
|
|
|
|
andl spritemask+{7*SPRITE_PLANE_SPAN},x
|
|
|
|
oral spritedata+{7*SPRITE_PLANE_SPAN},x
|
|
|
|
sta $A0
|
|
|
|
|
|
|
|
lda tiledata+{7*TILE_DATA_SPAN}+2,y
|
|
|
|
andl spritemask+{7*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
oral spritedata+{7*SPRITE_PLANE_SPAN}+2,x
|
|
|
|
sta $A2
|
|
|
|
|
|
|
|
_R0W0
|
|
|
|
cli
|
|
|
|
pld
|
|
|
|
rts
|