mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2024-11-29 11:50:25 +00:00
Continue fixing code issues; strange relocation error happening
This commit is contained in:
parent
95058fb969
commit
260b2097c2
@ -61,6 +61,7 @@ OKTOROK equ {SPRITE_16X16+79}
|
||||
brl Exit ; If we could not allocate a sprite, exit
|
||||
:sprite_ok
|
||||
sta PlayerID
|
||||
brl Exit
|
||||
|
||||
; Add 4 octoroks
|
||||
lda #OKTOROK
|
||||
|
@ -40,4 +40,4 @@
|
||||
|
||||
ASM TileStore.s
|
||||
KND #$1001 ; Type and Attributes ($11=Static+Bank Relative,$01=Data)
|
||||
SNA SPRMASK
|
||||
SNA TSTORE
|
||||
|
2
demos/zelda/TileStore.s
Normal file
2
demos/zelda/TileStore.s
Normal file
@ -0,0 +1,2 @@
|
||||
TileStore ENT
|
||||
ds 65536
|
26
src/Core.s
26
src/Core.s
@ -320,16 +320,29 @@ EngineReset
|
||||
stz SCBArrayPtr
|
||||
stz SCBArrayPtr+2
|
||||
|
||||
stz SpriteBanks
|
||||
stz SpriteMap
|
||||
stz ActiveSpriteCount
|
||||
|
||||
stz OneSecondCounter
|
||||
|
||||
]step equ 0
|
||||
lup 13
|
||||
lda #13
|
||||
sta tmp15
|
||||
stz tmp14
|
||||
|
||||
:loop
|
||||
ldx #BlitBuff
|
||||
lda #^BlitBuff
|
||||
ldy #]step
|
||||
ldy tmp14
|
||||
jsr BuildBank
|
||||
]step equ ]step+4
|
||||
--^
|
||||
|
||||
lda tmp14
|
||||
clc
|
||||
adc #4
|
||||
sta tmp14
|
||||
|
||||
dec tmp15
|
||||
bne :loop
|
||||
|
||||
rts
|
||||
|
||||
@ -474,6 +487,8 @@ _ReadControl
|
||||
pla
|
||||
rts
|
||||
|
||||
put blitter/Template.s
|
||||
|
||||
put Memory.s
|
||||
put Graphics.s
|
||||
put Sprite.s
|
||||
@ -486,7 +501,6 @@ _ReadControl
|
||||
put blitter/Horz.s
|
||||
put blitter/PEISlammer.s
|
||||
put blitter/Tables.s
|
||||
put blitter/Template.s
|
||||
put blitter/Tiles.s
|
||||
put blitter/Tiles00000.s ; normal tiles
|
||||
put blitter/Tiles00001.s ; dynamic tiles
|
||||
|
@ -184,7 +184,7 @@ _ApplyDirtyTiles
|
||||
|
||||
; Loop again until the list of dirty tiles is empty
|
||||
|
||||
:begin ldx DirtyTileCount
|
||||
:begin ldy DirtyTileCount
|
||||
bne :loop
|
||||
rts
|
||||
|
||||
|
@ -137,7 +137,7 @@ SetScreenRect sty ScreenHeight ; Save the screen height and
|
||||
ldx #0
|
||||
ldy #0
|
||||
:tsloop
|
||||
sta TileStore+TS_SCREEN_ADDR,x
|
||||
stal TileStore+TS_SCREEN_ADDR,x
|
||||
|
||||
clc
|
||||
adc #4 ; Go to the next tile
|
||||
@ -205,7 +205,7 @@ Counter equ tmp3
|
||||
tax ; NOTE: Try to rework to use new TileStore2DLookup array
|
||||
|
||||
lda OnScreenAddr
|
||||
sta TileStore+TS_SCREEN_ADDR,x
|
||||
stal TileStore+TS_SCREEN_ADDR,x
|
||||
|
||||
clc
|
||||
adc #4 ; Go to the next tile
|
||||
|
@ -693,22 +693,24 @@ _GetTileStoreOffset0
|
||||
; A = tile id
|
||||
; X = tile column [0, 40] (41 columns)
|
||||
; Y = tile row [0, 25] (26 rows)
|
||||
;
|
||||
; Registers are not preserved
|
||||
_SetTile
|
||||
pha
|
||||
jsr _GetTileStoreOffset0 ; Get the address of the X,Y tile position
|
||||
tay
|
||||
tax
|
||||
pla
|
||||
|
||||
cmp TileStore+TS_TILE_ID,y ; Only set to dirty if the value changed
|
||||
cmpl TileStore+TS_TILE_ID,x ; Only set to dirty if the value changed
|
||||
beq :nochange
|
||||
|
||||
sta TileStore+TS_TILE_ID,y ; Value is different, store it.
|
||||
stal TileStore+TS_TILE_ID,x ; Value is different, store it.
|
||||
|
||||
jsr _GetTileAddr
|
||||
sta TileStore+TS_TILE_ADDR,y ; Committed to drawing this tile, so get the address of the tile in the tiledata bank for later
|
||||
stal TileStore+TS_TILE_ADDR,x ; Committed to drawing this tile, so get the address of the tile in the tiledata bank for later
|
||||
|
||||
tya ; Add this tile to the list of dirty tiles to refresh
|
||||
jmp _PushDirtyTile ; on the next call to _ApplyTiles
|
||||
; txa ; Add this tile to the list of dirty tiles to refresh
|
||||
jmp _PushDirtyTileX ; on the next call to _ApplyTiles
|
||||
|
||||
:nochange rts
|
||||
|
||||
@ -735,11 +737,11 @@ _PushDirtyTile
|
||||
|
||||
; alternate entry point if the x-register is already set
|
||||
_PushDirtyTileX
|
||||
lda TileStore+TS_DIRTY,x
|
||||
ldal TileStore+TS_DIRTY,x
|
||||
bpl :occupied2
|
||||
|
||||
txa ; any non-negative value will work, this saves work below
|
||||
sta TileStore+TS_DIRTY,x ; and is 1 cycle fater than loading a constanct value
|
||||
stal TileStore+TS_DIRTY,x ; and is 1 cycle fater than loading a constanct value
|
||||
|
||||
; txa
|
||||
ldx DirtyTileCount ; 5
|
||||
@ -775,18 +777,18 @@ PopDirtyTile ENT
|
||||
rtl
|
||||
|
||||
_PopDirtyTile
|
||||
ldx DirtyTileCount
|
||||
ldy DirtyTileCount
|
||||
bne _PopDirtyTile2
|
||||
rts
|
||||
|
||||
_PopDirtyTile2 ; alternate entry point
|
||||
dex
|
||||
dex
|
||||
stx DirtyTileCount ; remove last item from the list
|
||||
dey
|
||||
dey
|
||||
sty DirtyTileCount ; remove last item from the list
|
||||
|
||||
ldy DirtyTiles,x ; load the offset into the Tile Store
|
||||
ldx DirtyTiles,y ; load the offset into the Tile Store
|
||||
lda #$FFFF
|
||||
sta TileStore+TS_DIRTY,y ; clear the occupied backlink
|
||||
stal TileStore+TS_DIRTY,x ; clear the occupied backlink
|
||||
rts
|
||||
|
||||
; Run through the dirty tile list and render them into the code field
|
||||
@ -814,6 +816,6 @@ _ApplyTiles
|
||||
|
||||
; Loop again until the list of dirty tiles is empty
|
||||
|
||||
:begin ldx DirtyTileCount
|
||||
:begin ldy DirtyTileCount
|
||||
bne :loop
|
||||
rts
|
Loading…
Reference in New Issue
Block a user