mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2024-12-26 05:31:42 +00:00
Implement full per-scanline offset support for BG1
This commit is contained in:
parent
7dd690ac04
commit
d31bd30649
@ -174,6 +174,7 @@ OVERLAY_BELOW equ $4000 ; Overlay is drawn below scanline sprite
|
||||
|
||||
; GetAddress table IDs
|
||||
scanlineHorzOffset equ $0001
|
||||
scanlineHorzOffset2 equ $0002
|
||||
|
||||
; Tile constants
|
||||
; TILE_RESERVED_BIT equ $8000
|
||||
|
@ -195,7 +195,8 @@ DIRTY_BIT_BG1_REFRESH equ $0020
|
||||
DIRTY_BIT_SPRITE_ARRAY equ $0040
|
||||
|
||||
; GetAddress table IDs
|
||||
scanlineHorzOffset equ $0001 ; table of 416 words, a double-array of scanline offset values. Must be 0, 163
|
||||
scanlineHorzOffset equ $0001 ; Table of 416 words, a double-array of scanline offset values. Values must be in range [0, 163]
|
||||
scanlineHorzOffset2 equ $0002 ; Table of 416 words, a double-array of scanline offset values. Values must be in range [0, 163]
|
||||
|
||||
; Script definition
|
||||
YIELD equ $8000
|
||||
@ -297,6 +298,7 @@ _DirectListBottom EXT
|
||||
|
||||
StartXMod164Tbl EXT
|
||||
LastOffsetTbl EXT
|
||||
BG1StartXMod164Tbl EXT
|
||||
|
||||
; Tool error codes
|
||||
NO_TIMERS_AVAILABLE equ 10
|
||||
|
26
src/Tool.s
26
src/Tool.s
@ -886,13 +886,23 @@ _TSGetAddress
|
||||
|
||||
lda :tblId,s
|
||||
cmp #scanlineHorzOffset
|
||||
bne :out
|
||||
bne :next_1
|
||||
|
||||
lda StartXMod164Tbl
|
||||
sta :output,s
|
||||
lda StartXMod164Tbl+2
|
||||
sta :output+2,s
|
||||
bra :out
|
||||
|
||||
:next_1 cmp #scanlineHorzOffset2
|
||||
bne :next_2
|
||||
|
||||
lda BG1StartXMod164Tbl
|
||||
sta :output,s
|
||||
lda BG1StartXMod164Tbl+2
|
||||
sta :output+2,s
|
||||
bra :out
|
||||
:next_2
|
||||
:out
|
||||
_TSExit #0;#2
|
||||
|
||||
@ -904,12 +914,24 @@ _TSSetAddress
|
||||
_TSEntry
|
||||
lda :tblId,s
|
||||
cmp #scanlineHorzOffset
|
||||
bne :out
|
||||
bne :next_1
|
||||
|
||||
lda :ptr,s
|
||||
sta StartXMod164Tbl
|
||||
lda :ptr+2,s
|
||||
sta StartXMod164Tbl+2
|
||||
bra :out
|
||||
|
||||
:next_1
|
||||
cmp #scanlineHorzOffset2
|
||||
bne :next_2
|
||||
|
||||
lda :ptr,s
|
||||
sta BG1StartXMod164Tbl
|
||||
lda :ptr+2,s
|
||||
sta BG1StartXMod164Tbl+2
|
||||
bra :out
|
||||
:next_2
|
||||
:out
|
||||
_TSExit #0;#6
|
||||
|
||||
|
@ -388,13 +388,17 @@ BG1YOffsetTable ENT
|
||||
; dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
--^
|
||||
|
||||
; Per-scanline offsets for BG0
|
||||
; Pointer to per-scanline offsets for BG0
|
||||
StartXMod164Tbl ENT
|
||||
dw 0,0
|
||||
|
||||
LastOffsetTbl ENT
|
||||
ds 416
|
||||
|
||||
; Pointer to per-scanline offsets for BG1
|
||||
BG1StartXMod164Tbl ENT
|
||||
dw 0,0
|
||||
|
||||
; Other Toolset variables
|
||||
OneSecondCounter ENT
|
||||
dw 0
|
||||
|
Loading…
Reference in New Issue
Block a user