mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-02-28 06:30:18 +00:00
waterfall: re-achieved vapor lock
This commit is contained in:
parent
77d19ad466
commit
7149077cf3
@ -46,6 +46,9 @@ TEXT = $FB36 ;; Set text mode
|
|||||||
HOME = $FC58 ;; Clear the text screen
|
HOME = $FC58 ;; Clear the text screen
|
||||||
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
|
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
|
||||||
|
|
||||||
|
; location we don't care about
|
||||||
|
|
||||||
|
DUMMY = $300
|
||||||
|
|
||||||
waterfall_demo:
|
waterfall_demo:
|
||||||
|
|
||||||
@ -60,6 +63,7 @@ waterfall_demo:
|
|||||||
lda #0
|
lda #0
|
||||||
sta BIRD_DIR
|
sta BIRD_DIR
|
||||||
sta BIRD_STATE
|
sta BIRD_STATE
|
||||||
|
sta FRAME
|
||||||
|
|
||||||
lda #4
|
lda #4
|
||||||
sta DRAW_PAGE
|
sta DRAW_PAGE
|
||||||
@ -188,61 +192,49 @@ loopB:
|
|||||||
; Vertical blank = 4550 cycles (70 scan lines)
|
; Vertical blank = 4550 cycles (70 scan lines)
|
||||||
; Total of 17030 cycles to get back to where was
|
; Total of 17030 cycles to get back to where was
|
||||||
|
|
||||||
; We want to alternate between page1 and page2 every 65 cycles
|
; if even, 10 + 9 + display_even + 2 (balance) = 21+display_even
|
||||||
; vblank = 4550 cycles to do scrolling
|
; if odd 10 + 8 + display_odd + 3 (balance) = 21+display_odd
|
||||||
|
|
||||||
|
; we have 3 (the jmp) + 6 (the rts) - 1 (fallthrough)
|
||||||
; 2 + 48*( (4+2+25*(2+3)) + (4+2+23*(2+3)+4+5)) + 9)
|
; = 8 cycles that need to be eaten by the vblank
|
||||||
; 48*[(6+125)-1] + [(6+115+10)-1]
|
|
||||||
|
|
||||||
display_loop:
|
display_loop:
|
||||||
|
inc FRAME ; 5
|
||||||
ldy #96 ; 2
|
lda FRAME ; 3
|
||||||
|
lda #$0 ; 2
|
||||||
outer_loop:
|
beq even
|
||||||
|
; 2
|
||||||
bit PAGE0 ; 4
|
lda FRAME ; (nop) ; 3
|
||||||
ldx #12 ; 65 cycles with PAGE0 ; 2
|
jsr display_odd ; 6
|
||||||
page0_loop: ; delay 61+bit
|
jmp vblank ; 3
|
||||||
dex ; 2
|
even:
|
||||||
bne page0_loop ; 2/3
|
; 3
|
||||||
|
nop ; (nop) ; 2
|
||||||
|
jsr display_even ; 6
|
||||||
; bit(4) -1(fallthrough) + loop*5 -1(fallthrouh)+4 extra = 61
|
jmp vblank ; 3
|
||||||
; 5L = 55
|
|
||||||
|
|
||||||
bit PAGE1 ; 4
|
|
||||||
ldx #11 ; 65 cycles with PAGE1 ; 2
|
|
||||||
;
|
|
||||||
page1_loop: ; delay 115+(7 loop)+4 (bit)+4(extra)
|
|
||||||
dex ; 2
|
|
||||||
bne page1_loop ; 2/3
|
|
||||||
|
|
||||||
dey ; 2
|
|
||||||
bne outer_loop ; 2/3
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
vblank:
|
||||||
;======================================================
|
;======================================================
|
||||||
; We have 4550 cycles in the vblank, use them wisely
|
; We have 4550 cycles in the vblank, use them wisely
|
||||||
;======================================================
|
;======================================================
|
||||||
; do_nothing should be 4550
|
; do_nothing should be 4550
|
||||||
; +1 fallthrough from above
|
; -8 letfover from HBLANK code
|
||||||
; -2 display loop setup
|
|
||||||
; -6 jsr to do_nothing
|
|
||||||
; -49 check for keypress
|
; -49 check for keypress
|
||||||
; -2252 copy screen
|
; -2252 copy screen
|
||||||
; -2231 draw sprite
|
; -2231 draw sprite
|
||||||
; =============
|
; =============
|
||||||
; 11 cycles
|
; 10 cycles
|
||||||
|
|
||||||
; jsr do_nothing ; 6
|
; jsr do_nothing ; 6
|
||||||
|
|
||||||
; 17 cycles
|
; 17 cycles
|
||||||
inc YPOS ; 5
|
inc YPOS ; 5
|
||||||
inc YPOS ; 5
|
inc YPOS ; 5
|
||||||
inc YPOS ; 5
|
; inc YPOS ; 5
|
||||||
nop ; 2
|
; nop ; 2
|
||||||
|
; nop ; 2
|
||||||
|
|
||||||
|
|
||||||
;=========================
|
;=========================
|
||||||
@ -475,3 +467,100 @@ gr_offsets:
|
|||||||
.align $100
|
.align $100
|
||||||
.include "tfv_sprites.inc"
|
.include "tfv_sprites.inc"
|
||||||
|
|
||||||
|
.align $100
|
||||||
|
|
||||||
|
;==========================================
|
||||||
|
; DISPLAY ODD
|
||||||
|
|
||||||
|
display_odd:
|
||||||
|
|
||||||
|
ldy #96 ; 2
|
||||||
|
|
||||||
|
outer_loop_odd:
|
||||||
|
|
||||||
|
bit PAGE0 ; 4
|
||||||
|
ldx #12 ; 65 cycles with PAGE0 ; 2
|
||||||
|
page0_loop_odd: ; delay 61+bit
|
||||||
|
dex ; 2
|
||||||
|
bne page0_loop_odd ; 2/3
|
||||||
|
|
||||||
|
|
||||||
|
; bit(4) -1(fallthrough) + loop*5 -1(fallthrouh)+4 extra = 61
|
||||||
|
; 5L = 55
|
||||||
|
|
||||||
|
bit PAGE1 ; 4
|
||||||
|
ldx #11 ; 65 cycles with PAGE1 ; 2
|
||||||
|
;
|
||||||
|
page1_loop_odd: ; delay 115+(7 loop)+4 (bit)+4(extra)
|
||||||
|
dex ; 2
|
||||||
|
bne page1_loop_odd ; 2/3
|
||||||
|
|
||||||
|
dey ; 2
|
||||||
|
bne outer_loop_odd ; 2/3
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;=================================
|
||||||
|
; Display Even
|
||||||
|
;=================================
|
||||||
|
; we have 65 cycles per line
|
||||||
|
; the first 25 are in hblank
|
||||||
|
; we come in already 21 cycles into things
|
||||||
|
; so the first scanline is a loss (but that's OK)
|
||||||
|
|
||||||
|
; first scanline: 21+ 2 (from ldy) so need to kill 65-23 = 42
|
||||||
|
; second scanline, again kill so 65 killed
|
||||||
|
|
||||||
|
display_even:
|
||||||
|
|
||||||
|
|
||||||
|
even_first_line:
|
||||||
|
ldy #95 ; 2
|
||||||
|
|
||||||
|
asl DUMMY ; 6
|
||||||
|
asl DUMMY ; 6
|
||||||
|
asl DUMMY ; 6
|
||||||
|
asl DUMMY ; 6
|
||||||
|
asl DUMMY ; 6
|
||||||
|
asl DUMMY ; 6
|
||||||
|
asl DUMMY ; 6
|
||||||
|
|
||||||
|
asl DUMMY ; 6
|
||||||
|
asl DUMMY ; 6
|
||||||
|
asl DUMMY ; 6
|
||||||
|
asl DUMMY ; 6
|
||||||
|
asl DUMMY ; 6
|
||||||
|
asl DUMMY ; 6
|
||||||
|
asl DUMMY ; 6
|
||||||
|
asl DUMMY ; 6
|
||||||
|
asl DUMMY ; 6
|
||||||
|
asl DUMMY ; 6
|
||||||
|
lda YPOS ; 3
|
||||||
|
nop ; 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
outer_loop_even:
|
||||||
|
|
||||||
|
bit PAGE1 ; 4
|
||||||
|
ldx #12 ; 65 cycles with PAGE0 ; 2
|
||||||
|
page1_loop_even: ; delay 61+bit
|
||||||
|
dex ; 2
|
||||||
|
bne page1_loop_even ; 2/3
|
||||||
|
|
||||||
|
|
||||||
|
; bit(4) -1(fallthrough) + loop*5 -1(fallthrouh)+4 extra = 61
|
||||||
|
; 5L = 55
|
||||||
|
|
||||||
|
bit PAGE0 ; 4
|
||||||
|
ldx #11 ; 65 cycles with PAGE1 ; 2
|
||||||
|
;
|
||||||
|
page0_loop_even: ; delay 115+(7 loop)+4 (bit)+4(extra)
|
||||||
|
dex ; 2
|
||||||
|
bne page0_loop_even ; 2/3
|
||||||
|
|
||||||
|
dey ; 2
|
||||||
|
bne outer_loop_even ; 2/3
|
||||||
|
|
||||||
|
rts ; 6
|
||||||
|
Loading…
x
Reference in New Issue
Block a user