Update demo to leverage BG1 scanline support
This commit is contained in:
parent
065603a758
commit
7aec32ced5
|
@ -42,6 +42,7 @@ seg1x equ 30
|
||||||
seg2x equ 32
|
seg2x equ 32
|
||||||
seg3x equ 34
|
seg3x equ 34
|
||||||
seg4x equ 36 ; BG1 x-pos
|
seg4x equ 36 ; BG1 x-pos
|
||||||
|
frameCountTotal equ 38
|
||||||
|
|
||||||
phk
|
phk
|
||||||
plb
|
plb
|
||||||
|
@ -101,6 +102,7 @@ seg4x equ 36 ; BG1 x-pos
|
||||||
lda #0
|
lda #0
|
||||||
sta StartY
|
sta StartY
|
||||||
stz frameCount
|
stz frameCount
|
||||||
|
stz frameCountTotal
|
||||||
|
|
||||||
pei StartX
|
pei StartX
|
||||||
pei StartY
|
pei StartY
|
||||||
|
@ -124,6 +126,11 @@ seg4x equ 36 ; BG1 x-pos
|
||||||
pea #BG0Offsets
|
pea #BG0Offsets
|
||||||
_GTESetAddress
|
_GTESetAddress
|
||||||
|
|
||||||
|
pea #scanlineHorzOffset2
|
||||||
|
pea #^BG1Offsets
|
||||||
|
pea #BG1Offsets
|
||||||
|
_GTESetAddress
|
||||||
|
|
||||||
pea $0000 ; one regular render to fill the screen with the tilemap
|
pea $0000 ; one regular render to fill the screen with the tilemap
|
||||||
_GTERender
|
_GTERender
|
||||||
|
|
||||||
|
@ -142,32 +149,15 @@ EvtLoop
|
||||||
:do_more
|
:do_more
|
||||||
cmp #'d'
|
cmp #'d'
|
||||||
bne :not_d
|
bne :not_d
|
||||||
; lda StartX
|
|
||||||
; cmp MaxBG0X
|
|
||||||
; bcc *+5
|
|
||||||
; brl :do_render
|
|
||||||
|
|
||||||
jsr DecRanges
|
jsr DecRanges
|
||||||
jsr SetOffsets
|
jsr SetOffsets
|
||||||
|
|
||||||
; pei StartX
|
|
||||||
; pei StartY
|
|
||||||
; _GTESetBG0Origin
|
|
||||||
brl :do_render
|
brl :do_render
|
||||||
:not_d
|
:not_d
|
||||||
|
|
||||||
cmp #'a'
|
cmp #'a'
|
||||||
bne :not_a
|
bne :not_a
|
||||||
; lda StartX
|
|
||||||
; bne *+5
|
|
||||||
; brl :do_render
|
|
||||||
|
|
||||||
jsr IncRanges
|
jsr IncRanges
|
||||||
jsr SetOffsets
|
jsr SetOffsets
|
||||||
|
|
||||||
; pei StartX
|
|
||||||
; pei StartY
|
|
||||||
; _GTESetBG0Origin
|
|
||||||
brl :do_render
|
brl :do_render
|
||||||
:not_a
|
:not_a
|
||||||
|
|
||||||
|
@ -195,12 +185,16 @@ EvtLoop
|
||||||
:not_w
|
:not_w
|
||||||
|
|
||||||
:do_render
|
:do_render
|
||||||
|
jsr SetBG1Animation ; Update the per-scanline BG1 offsets
|
||||||
|
|
||||||
pea #RENDER_PER_SCANLINE
|
pea #RENDER_PER_SCANLINE
|
||||||
|
; pea #0
|
||||||
_GTERender
|
_GTERender
|
||||||
|
|
||||||
; Update the performance counters
|
; Update the performance counters
|
||||||
|
|
||||||
inc frameCount
|
inc frameCount
|
||||||
|
inc frameCountTotal
|
||||||
pha
|
pha
|
||||||
_GTEGetSeconds
|
_GTEGetSeconds
|
||||||
pla
|
pla
|
||||||
|
@ -335,7 +329,7 @@ IncRanges
|
||||||
bne :out
|
bne :out
|
||||||
lda seg4x
|
lda seg4x
|
||||||
inc
|
inc
|
||||||
cmp #160
|
cmp #164
|
||||||
bcc *+5
|
bcc *+5
|
||||||
lda #0
|
lda #0
|
||||||
sta seg4x
|
sta seg4x
|
||||||
|
@ -355,6 +349,7 @@ InitOffsets
|
||||||
ldx #120
|
ldx #120
|
||||||
ldy #88
|
ldy #88
|
||||||
jsr _InitRange
|
jsr _InitRange
|
||||||
|
jsr _InitBG1
|
||||||
|
|
||||||
pla
|
pla
|
||||||
sta seg1x
|
sta seg1x
|
||||||
|
@ -364,7 +359,9 @@ InitOffsets
|
||||||
jsr SetOffset2
|
jsr SetOffset2
|
||||||
lsr
|
lsr
|
||||||
sta seg3x
|
sta seg3x
|
||||||
jmp SetOffset3
|
jsr SetOffset3
|
||||||
|
jsr SetBG1Offsets
|
||||||
|
rts
|
||||||
|
|
||||||
SetOffsets
|
SetOffsets
|
||||||
lda seg1x
|
lda seg1x
|
||||||
|
@ -373,11 +370,22 @@ SetOffsets
|
||||||
jsr SetOffset2
|
jsr SetOffset2
|
||||||
lda seg3x
|
lda seg3x
|
||||||
jsr SetOffset3
|
jsr SetOffset3
|
||||||
|
|
||||||
|
SetBG1Offsets
|
||||||
pei seg4x
|
pei seg4x
|
||||||
pea 0
|
pea 0
|
||||||
_GTESetBG1Origin
|
_GTESetBG1Origin
|
||||||
|
rts
|
||||||
|
|
||||||
|
SetBG1Animation
|
||||||
|
pea #scanlineHorzOffset2
|
||||||
|
pea #^BG1Offsets
|
||||||
|
lda frameCountTotal
|
||||||
|
and #$000F
|
||||||
|
asl
|
||||||
|
adc #BG1Offsets
|
||||||
|
pha
|
||||||
|
_GTESetAddress
|
||||||
rts
|
rts
|
||||||
|
|
||||||
SetOffset1
|
SetOffset1
|
||||||
|
@ -416,6 +424,24 @@ _SetRange
|
||||||
pla
|
pla
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
_offsets dw 0,0,0,1,1,2,3,3,4,4,4,3,3,2,1,1
|
||||||
|
_InitBG1
|
||||||
|
ldx #0
|
||||||
|
ldy #0
|
||||||
|
:loop lda _offsets,y
|
||||||
|
sta BG1Offsets,x
|
||||||
|
iny
|
||||||
|
iny
|
||||||
|
cpy #31
|
||||||
|
bcc *+5
|
||||||
|
ldy #0
|
||||||
|
|
||||||
|
inx
|
||||||
|
inx
|
||||||
|
cpx #448
|
||||||
|
bcc :loop
|
||||||
|
rts
|
||||||
|
|
||||||
_InitRange
|
_InitRange
|
||||||
txa
|
txa
|
||||||
asl
|
asl
|
||||||
|
@ -457,6 +483,7 @@ DoLoadBG1
|
||||||
|
|
||||||
BG1DataFile strl '1/bg1.bin'
|
BG1DataFile strl '1/bg1.bin'
|
||||||
BG0Offsets ds 416
|
BG0Offsets ds 416
|
||||||
|
BG1Offsets ds 448 ; Make this a bit larger so we can just update a pointer
|
||||||
|
|
||||||
PUT ../StartUp.s
|
PUT ../StartUp.s
|
||||||
PUT ../../shell/Overlay.s
|
PUT ../../shell/Overlay.s
|
||||||
|
|
|
@ -14,4 +14,5 @@ REM Cadius does not overwrite files, so clear the root folder first
|
||||||
|
|
||||||
REM Now copy files and folders as needed
|
REM Now copy files and folders as needed
|
||||||
%CADIUS% ADDFILE %IMAGE% %FOLDER% .\GTEDemo1
|
%CADIUS% ADDFILE %IMAGE% %FOLDER% .\GTEDemo1
|
||||||
|
%CADIUS% ADDFILE %IMAGE% %FOLDER% .\gen\bg1.bin
|
||||||
%CADIUS% ADDFILE %IMAGE% %FOLDER% ..\..\..\src\Tool160
|
%CADIUS% ADDFILE %IMAGE% %FOLDER% ..\..\..\src\Tool160
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue