waterfall: trying to get working with compact delays

This commit is contained in:
Vince Weaver 2018-09-27 22:34:10 -04:00
parent fa36d30d8b
commit 3f164367e5
2 changed files with 81 additions and 220 deletions

View File

@ -17,7 +17,7 @@ WATERFALL: waterfall.o
ld65 -o WATERFALL waterfall.o -C ../linker_scripts/apple2_1000.inc ld65 -o WATERFALL waterfall.o -C ../linker_scripts/apple2_1000.inc
waterfall.o: waterfall.s gr_copy.s gr_unrolled_copy.s vapor_lock.s \ waterfall.o: waterfall.s gr_copy.s gr_unrolled_copy.s vapor_lock.s \
put_sprite.s delay_a.s \ gr_putsprite.s delay_a.s \
waterfall_page1.inc waterfall_page2.inc tfv_sprites.inc waterfall_page1.inc waterfall_page2.inc tfv_sprites.inc
ca65 -o waterfall.o waterfall.s -l waterfall.lst ca65 -o waterfall.o waterfall.s -l waterfall.lst

View File

@ -158,7 +158,8 @@ wfloopB:dex ; 2
jmp display_loop jmp display_loop
jump_table: jump_table:
.word (display_even-1) ; .word (display_even-1)
.word (display_odd-1)
.word (display_odd-1) .word (display_odd-1)
.word (display_three-1) .word (display_three-1)
.word (display_four-1) .word (display_four-1)
@ -177,10 +178,6 @@ jump_addr:
; 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
; if even, 10 + 9 + display_even + 2 (balance) = 21+display_even
; if odd 10 + 8 + display_odd + 3 (balance) = 21+display_odd
; 3+6
; jump_table ; jump_table
; 38 + display_odd ; 38 + display_odd
@ -386,7 +383,8 @@ adjust_xpos:
.include "../asm_routines/keypress.s" .include "../asm_routines/keypress.s"
.include "gr_copy.s" .include "gr_copy.s"
.include "gr_unrolled_copy.s" .include "gr_unrolled_copy.s"
.include "put_sprite.s" .align $100
.include "gr_putsprite.s"
.include "mockingboard.s" .include "mockingboard.s"
.include "vapor_lock.s" .include "vapor_lock.s"
.include "delay_a.s" .include "delay_a.s"
@ -598,11 +596,11 @@ falls_loop_even:
nop ; 2 ; 58 nop ; 2 ; 58
dey ; 2 dey ; 2
beq falls_loop_even_done ; beq falls_loop_even_done ; 3
; 2 ; -1
jmp falls_loop_even ; 3 jmp falls_loop_even ; 3
falls_loop_even_done: falls_loop_even_done:
; 3
ldy #12 ; 2 ldy #12 ; 2
ground_loop_even: ground_loop_even:
@ -632,13 +630,10 @@ ground_loop_even:
jsr delay_a ; 25+27 jsr delay_a ; 25+27
dey ; 2 dey ; 2
beq ground_loop_even_done ; beq ground_loop_even_done ; 3
; 2 ; -1
jmp ground_loop_even ; 3 jmp ground_loop_even ; 3
ground_loop_even_done: ground_loop_even_done:
; 3
nop ; 2 nop ; 2
jmp display_loop_return ; 3 jmp display_loop_return ; 3
@ -650,270 +645,136 @@ ground_loop_even_done:
;================================= ;=================================
; we have 65 cycles per line ; we have 65 cycles per line
; the first 25 are in hblank ; 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: comes in with 38
; second+ scanline need to kill 65
display_odd: display_odd:
; first scanline: comes in with 38
odd_first_four_lines: odd_first_four_lines:
; line 0 ; line 0-3 = 65*4 = 260
; 38 ; -38
; -2
; -2
; -25
;=========================
; 193
lda #193 ; 2
jsr delay_a ; 125
ldy #4 ; 2 ldy #4 ; 2
asl DUMMY ; 6
asl DUMMY ; 6
asl DUMMY ; 6
lda YPOS ; 3
nop
nop
; line 1, 65 cycles
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
; line 2, 65 cycles
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
; line 3, 65 cycles
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
odd_twinkle_stars: odd_twinkle_stars:
twinkle_loop_odd: twinkle_loop_odd:
; page1 for 4 lines, 65 - 4 = 61 -2 = 59 - 25 = 34
; line 0 ; line 0
bit PAGE1 ; 4 bit PAGE1 ; 4
; delay 29 lda #34 ; 2
asl DUMMY ; 6 jsr delay_a ; 25+34
asl DUMMY ; 6
asl DUMMY ; 6 ; line 1
asl DUMMY ; 6
lda YPOS ; 3
nop ; 2
nop
; falls
bit PAGE1 ; 4 bit PAGE1 ; 4
lda YPOS ; 3 lda #34 ; 2
bit PAGE1 ; 4 jsr delay_a ; 25+34
; endfalls
; delay 21
; asl DUMMY ; 6
nop
nop
asl DUMMY ; 6
asl DUMMY ; 6
lda YPOS ; 3
; line 2 ; line 2
bit PAGE1 ; 4 bit PAGE1 ; 4
; delay 29 lda #34 ; 2
asl DUMMY ; 6 jsr delay_a ; 25+34
asl DUMMY ; 6
asl DUMMY ; 6
asl DUMMY ; 6
lda YPOS ; 3
nop ; 2
nop
; falls
bit PAGE1 ; 4
lda YPOS ; 3
bit PAGE1 ; 4
; end falls
; delay 21
; asl DUMMY ; 6
nop
nop
asl DUMMY ; 6
asl DUMMY ; 6
lda YPOS ; 3
; line 3 ; line 3
bit PAGE1 ; 4 bit PAGE1 ; 4
; delay 29 lda #27 ; 2
asl DUMMY ; 6 jsr delay_a ; 25+27
asl DUMMY ; 6
asl DUMMY ; 6
asl DUMMY ; 6
lda YPOS ; 3
nop ; 2
nop
; falls
bit PAGE1 ; 4
lda YPOS ; 3
bit PAGE1 ; 4
; end falls
; delay 21
; asl DUMMY ; 6
nop
nop
asl DUMMY ; 6
asl DUMMY ; 6
lda YPOS ; 3
; line 4
bit PAGE1 ; 4
; delay 29
asl DUMMY ; 6
asl DUMMY ; 6
asl DUMMY ; 6
asl DUMMY ; 6
lda YPOS ; 3
nop ; 2
nop
; falls
bit PAGE1 ; 4
lda YPOS ; 3
bit PAGE1 ; 4 ; 44
; end falls
; delay 21 - 7 from loop
; asl DUMMY ; 6
nop
nop
asl DUMMY ; 6
nop ; 2 ; 58
dey ; 2 dey ; 2
beq twinkle_loop_odd_done ; beq twinkle_loop_odd_done ; 3
; 2 ; -1
jmp twinkle_loop_odd ; 3 jmp twinkle_loop_odd ; 3
twinkle_loop_odd_done: twinkle_loop_odd_done:
ldy #31 ; 2 ldy #31 ; 2
falls_loop_odd: falls_loop_odd:
; line 0 ;=== line 0
bit PAGE0 ; 4 bit PAGE0 ; 4
; delay 29 ; delay 31
asl DUMMY ; 6 lda #4 ; 2
asl DUMMY ; 6 jsr delay_a ; 25+4
asl DUMMY ; 6
asl DUMMY ; 6 ; falls 11
lda YPOS ; 3
nop ; 2
nop
; falls
bit PAGE1 ; 4 bit PAGE1 ; 4
lda YPOS ; 3 lda YPOS ; 3
bit PAGE0 ; 4 bit PAGE0 ; 4
; endfalls
; delay 21 ; delay 19
; asl DUMMY ; 6 nop ; 2
nop nop ; 2
nop
asl DUMMY ; 6 asl DUMMY ; 6
asl DUMMY ; 6 asl DUMMY ; 6
lda YPOS ; 3 lda YPOS ; 3
; line 2 ;==== line 1
bit PAGE0 ; 4
; delay 31
lda #4 ; 2
jsr delay_a ; 25+4
; falls 8
bit PAGE0 ; 4 bit PAGE0 ; 4
; delay 29
asl DUMMY ; 6
asl DUMMY ; 6
asl DUMMY ; 6
asl DUMMY ; 6
lda YPOS ; 3 lda YPOS ; 3
bit PAGE0 ; 4
; delay 19
nop ; 2
nop ; 2 nop ; 2
nop
; falls
bit PAGE0 ; 4
lda YPOS ; 3
bit PAGE0 ; 4
; end falls
; delay 21
; asl DUMMY ; 6
nop
nop
asl DUMMY ; 6 asl DUMMY ; 6
asl DUMMY ; 6 asl DUMMY ; 6
lda YPOS ; 3 lda YPOS ; 3
; line 3 ;=== line 2
bit PAGE0 ; 4
; delay 31
lda #4 ; 2
jsr delay_a ; 25+4
; falls 8
bit PAGE0 ; 4 bit PAGE0 ; 4
; delay 29
asl DUMMY ; 6
asl DUMMY ; 6
asl DUMMY ; 6
asl DUMMY ; 6
lda YPOS ; 3 lda YPOS ; 3
bit PAGE0 ; 4
; delay 19
nop ; 2
nop ; 2 nop ; 2
nop
; falls
bit PAGE0 ; 4
lda YPOS ; 3
bit PAGE0 ; 4
; end falls
; delay 21
; asl DUMMY ; 6
nop
nop
asl DUMMY ; 6 asl DUMMY ; 6
asl DUMMY ; 6 asl DUMMY ; 6
lda YPOS ; 3 lda YPOS ; 3
; line 4 ;===line 4
bit PAGE0 ; 4 bit PAGE0 ; 4
; delay 29
asl DUMMY ; 6 ; delay 31
asl DUMMY ; 6 lda #4 ; 2
asl DUMMY ; 6 jsr delay_a ; 25+4
asl DUMMY ; 6
lda YPOS ; 3 ; falls 11
nop ; 2
nop
; falls
bit PAGE1 ; 4 bit PAGE1 ; 4
lda YPOS ; 3 lda YPOS ; 3
bit PAGE0 ; 4 ; 44 bit PAGE0 ; 4 ; 44
; end falls ; end falls
; delay 21 - 7 from loop ; delay 21 - 7 from loop
; asl DUMMY ; 6 nop ; 2
nop nop ; 2
nop
asl DUMMY ; 6 asl DUMMY ; 6
nop ; 2 ; 58 nop ; 2 ; 58
dey ; 2 dey ; 2
beq falls_loop_odd_done ; beq falls_loop_odd_done ; 3
; 2 ;-1
jmp falls_loop_odd ; 3 jmp falls_loop_odd ; 3
falls_loop_odd_done: falls_loop_odd_done:
; 3 ; 3