mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2024-11-25 15:32:59 +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
|
brl Exit ; If we could not allocate a sprite, exit
|
||||||
:sprite_ok
|
:sprite_ok
|
||||||
sta PlayerID
|
sta PlayerID
|
||||||
|
brl Exit
|
||||||
|
|
||||||
; Add 4 octoroks
|
; Add 4 octoroks
|
||||||
lda #OKTOROK
|
lda #OKTOROK
|
||||||
|
@ -40,4 +40,4 @@
|
|||||||
|
|
||||||
ASM TileStore.s
|
ASM TileStore.s
|
||||||
KND #$1001 ; Type and Attributes ($11=Static+Bank Relative,$01=Data)
|
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
|
||||||
stz SCBArrayPtr+2
|
stz SCBArrayPtr+2
|
||||||
|
|
||||||
|
stz SpriteBanks
|
||||||
|
stz SpriteMap
|
||||||
|
stz ActiveSpriteCount
|
||||||
|
|
||||||
stz OneSecondCounter
|
stz OneSecondCounter
|
||||||
|
|
||||||
]step equ 0
|
lda #13
|
||||||
lup 13
|
sta tmp15
|
||||||
|
stz tmp14
|
||||||
|
|
||||||
|
:loop
|
||||||
ldx #BlitBuff
|
ldx #BlitBuff
|
||||||
lda #^BlitBuff
|
lda #^BlitBuff
|
||||||
ldy #]step
|
ldy tmp14
|
||||||
jsr BuildBank
|
jsr BuildBank
|
||||||
]step equ ]step+4
|
|
||||||
--^
|
lda tmp14
|
||||||
|
clc
|
||||||
|
adc #4
|
||||||
|
sta tmp14
|
||||||
|
|
||||||
|
dec tmp15
|
||||||
|
bne :loop
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -474,6 +487,8 @@ _ReadControl
|
|||||||
pla
|
pla
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
put blitter/Template.s
|
||||||
|
|
||||||
put Memory.s
|
put Memory.s
|
||||||
put Graphics.s
|
put Graphics.s
|
||||||
put Sprite.s
|
put Sprite.s
|
||||||
@ -486,7 +501,6 @@ _ReadControl
|
|||||||
put blitter/Horz.s
|
put blitter/Horz.s
|
||||||
put blitter/PEISlammer.s
|
put blitter/PEISlammer.s
|
||||||
put blitter/Tables.s
|
put blitter/Tables.s
|
||||||
put blitter/Template.s
|
|
||||||
put blitter/Tiles.s
|
put blitter/Tiles.s
|
||||||
put blitter/Tiles00000.s ; normal tiles
|
put blitter/Tiles00000.s ; normal tiles
|
||||||
put blitter/Tiles00001.s ; dynamic tiles
|
put blitter/Tiles00001.s ; dynamic tiles
|
||||||
|
@ -184,7 +184,7 @@ _ApplyDirtyTiles
|
|||||||
|
|
||||||
; Loop again until the list of dirty tiles is empty
|
; Loop again until the list of dirty tiles is empty
|
||||||
|
|
||||||
:begin ldx DirtyTileCount
|
:begin ldy DirtyTileCount
|
||||||
bne :loop
|
bne :loop
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ SetScreenRect sty ScreenHeight ; Save the screen height and
|
|||||||
ldx #0
|
ldx #0
|
||||||
ldy #0
|
ldy #0
|
||||||
:tsloop
|
:tsloop
|
||||||
sta TileStore+TS_SCREEN_ADDR,x
|
stal TileStore+TS_SCREEN_ADDR,x
|
||||||
|
|
||||||
clc
|
clc
|
||||||
adc #4 ; Go to the next tile
|
adc #4 ; Go to the next tile
|
||||||
@ -205,7 +205,7 @@ Counter equ tmp3
|
|||||||
tax ; NOTE: Try to rework to use new TileStore2DLookup array
|
tax ; NOTE: Try to rework to use new TileStore2DLookup array
|
||||||
|
|
||||||
lda OnScreenAddr
|
lda OnScreenAddr
|
||||||
sta TileStore+TS_SCREEN_ADDR,x
|
stal TileStore+TS_SCREEN_ADDR,x
|
||||||
|
|
||||||
clc
|
clc
|
||||||
adc #4 ; Go to the next tile
|
adc #4 ; Go to the next tile
|
||||||
|
@ -693,22 +693,24 @@ _GetTileStoreOffset0
|
|||||||
; A = tile id
|
; A = tile id
|
||||||
; X = tile column [0, 40] (41 columns)
|
; X = tile column [0, 40] (41 columns)
|
||||||
; Y = tile row [0, 25] (26 rows)
|
; Y = tile row [0, 25] (26 rows)
|
||||||
|
;
|
||||||
|
; Registers are not preserved
|
||||||
_SetTile
|
_SetTile
|
||||||
pha
|
pha
|
||||||
jsr _GetTileStoreOffset0 ; Get the address of the X,Y tile position
|
jsr _GetTileStoreOffset0 ; Get the address of the X,Y tile position
|
||||||
tay
|
tax
|
||||||
pla
|
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
|
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
|
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
|
; txa ; Add this tile to the list of dirty tiles to refresh
|
||||||
jmp _PushDirtyTile ; on the next call to _ApplyTiles
|
jmp _PushDirtyTileX ; on the next call to _ApplyTiles
|
||||||
|
|
||||||
:nochange rts
|
:nochange rts
|
||||||
|
|
||||||
@ -735,11 +737,11 @@ _PushDirtyTile
|
|||||||
|
|
||||||
; alternate entry point if the x-register is already set
|
; alternate entry point if the x-register is already set
|
||||||
_PushDirtyTileX
|
_PushDirtyTileX
|
||||||
lda TileStore+TS_DIRTY,x
|
ldal TileStore+TS_DIRTY,x
|
||||||
bpl :occupied2
|
bpl :occupied2
|
||||||
|
|
||||||
txa ; any non-negative value will work, this saves work below
|
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
|
; txa
|
||||||
ldx DirtyTileCount ; 5
|
ldx DirtyTileCount ; 5
|
||||||
@ -775,18 +777,18 @@ PopDirtyTile ENT
|
|||||||
rtl
|
rtl
|
||||||
|
|
||||||
_PopDirtyTile
|
_PopDirtyTile
|
||||||
ldx DirtyTileCount
|
ldy DirtyTileCount
|
||||||
bne _PopDirtyTile2
|
bne _PopDirtyTile2
|
||||||
rts
|
rts
|
||||||
|
|
||||||
_PopDirtyTile2 ; alternate entry point
|
_PopDirtyTile2 ; alternate entry point
|
||||||
dex
|
dey
|
||||||
dex
|
dey
|
||||||
stx DirtyTileCount ; remove last item from the list
|
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
|
lda #$FFFF
|
||||||
sta TileStore+TS_DIRTY,y ; clear the occupied backlink
|
stal TileStore+TS_DIRTY,x ; clear the occupied backlink
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Run through the dirty tile list and render them into the code field
|
; 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
|
; Loop again until the list of dirty tiles is empty
|
||||||
|
|
||||||
:begin ldx DirtyTileCount
|
:begin ldy DirtyTileCount
|
||||||
bne :loop
|
bne :loop
|
||||||
rts
|
rts
|
Loading…
Reference in New Issue
Block a user