mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-01 05:31:52 +00:00
trogdor: vertical scroll
This commit is contained in:
parent
ee0ae37c89
commit
bcd68fd7ed
@ -165,7 +165,8 @@ trogdor.o: trogdor.s \
|
||||
flames.inc \
|
||||
zp.inc hardware.inc qload.inc \
|
||||
graphics/trog00_trogdor.hgr.zx02 \
|
||||
hgr_sprite_big_mask.s horiz_scroll_simple.s hgr_copy_magnify.s
|
||||
hgr_sprite_big_mask.s horiz_scroll_simple.s hgr_copy_magnify.s \
|
||||
horiz_scroll_skip.s vertical_scroll.s
|
||||
ca65 -o trogdor.o trogdor.s -l trogdor.lst
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ magnify_outer_loop:
|
||||
sta GBASH
|
||||
|
||||
|
||||
ldy #0
|
||||
ldy #0 ; 2
|
||||
magnify_inner_loop:
|
||||
lda (INL),Y ; 5
|
||||
and #$f ; 2
|
||||
|
119
demos/trogdor/horiz_scroll_double.s
Normal file
119
demos/trogdor/horiz_scroll_double.s
Normal file
@ -0,0 +1,119 @@
|
||||
;======================================
|
||||
; do very simple horizontal scroll
|
||||
;======================================
|
||||
; skips by 4 because we need fairly high FPS
|
||||
|
||||
; originally ~12 seconds to scroll 80 (twice)
|
||||
|
||||
; also assumes every-other line the same
|
||||
|
||||
|
||||
; screens to pan in $2000/$4000 to left
|
||||
|
||||
|
||||
horiz_pan_skip:
|
||||
|
||||
pan_loop:
|
||||
|
||||
; how many times to scroll
|
||||
|
||||
lda #0
|
||||
sta COUNT
|
||||
|
||||
pan_outer_outer_loop:
|
||||
|
||||
|
||||
ldx #191
|
||||
pan_outer_loop:
|
||||
|
||||
txa
|
||||
pha
|
||||
|
||||
; self-modify the PAGE1 high input addresses
|
||||
|
||||
lda hposn_high,X
|
||||
sta pil_in_smc1+2 ; input source
|
||||
|
||||
sta pil_out_smc1+2 ; output odd
|
||||
sta pil_out_smc4+2
|
||||
|
||||
;self modify the PAGE2 high input addresses
|
||||
eor #$60
|
||||
sta pil_in_page2_smc1+2
|
||||
|
||||
|
||||
; self modify the PAGE1 LOW addresses
|
||||
lda hposn_low,X
|
||||
sta pil_out_smc1+1 ; output odd
|
||||
sta pil_out_smc4+1 ; output odd
|
||||
|
||||
|
||||
; self modify the PAGE1 LOW input addresses
|
||||
sta pil_in_smc1+1 ; input is regular+1
|
||||
inc pil_in_smc1+1
|
||||
|
||||
; offset in PAGE2 to get input from
|
||||
|
||||
clc
|
||||
adc COUNT
|
||||
sta pil_in_page2_smc1+1
|
||||
|
||||
|
||||
inx
|
||||
lda hposn_high,X
|
||||
sta pil_out_smc2+2 ; output even high
|
||||
sta pil_out_smc5+2
|
||||
|
||||
lda hposn_low,X ; output even low
|
||||
sta pil_out_smc2+1
|
||||
sta pil_out_smc5+1
|
||||
|
||||
|
||||
|
||||
;=========================
|
||||
; inner loop, from 0-39
|
||||
|
||||
ldy #0
|
||||
pan_inner_loop:
|
||||
|
||||
; load in+1, store to in
|
||||
|
||||
; if completely unrolled, would save 1 cycle for store and
|
||||
; 5 for the branch/loop
|
||||
; 192*6=not a lot
|
||||
|
||||
pil_in_smc1:
|
||||
lda $2000+1,Y ; 4
|
||||
pil_out_smc1:
|
||||
sta $2000,Y ; 5
|
||||
pil_out_smc2:
|
||||
sta $2000,Y ; 5
|
||||
|
||||
iny ; 2
|
||||
cpy #39 ; 2
|
||||
bne pan_inner_loop ; 2/3
|
||||
|
||||
; for right edge, scroll in from PAGE2
|
||||
|
||||
pil_in_page2_smc1:
|
||||
lda $4000
|
||||
pil_out_smc4:
|
||||
sta $2000,Y
|
||||
pil_out_smc5:
|
||||
sta $2000,Y
|
||||
|
||||
pla
|
||||
tax
|
||||
|
||||
dex
|
||||
dex
|
||||
cpx #$ff
|
||||
bne pan_outer_loop
|
||||
|
||||
inc COUNT
|
||||
lda COUNT
|
||||
cmp #39
|
||||
|
||||
bne pan_outer_outer_loop
|
||||
|
||||
rts
|
@ -1,6 +1,6 @@
|
||||
;==================================
|
||||
;======================================
|
||||
; do very simple horizontal scroll
|
||||
;==================================
|
||||
;======================================
|
||||
; screens to pan in $2000/$4000 to left
|
||||
|
||||
|
||||
@ -8,43 +8,66 @@ horiz_pan:
|
||||
|
||||
pan_loop:
|
||||
|
||||
; how many times to scroll
|
||||
|
||||
lda #0
|
||||
sta COUNT
|
||||
|
||||
pan_outer_outer_loop:
|
||||
|
||||
; do all 191 lines
|
||||
|
||||
ldx #191
|
||||
pan_outer_loop:
|
||||
|
||||
; self-modify the PAGE1 high addresses
|
||||
|
||||
lda hposn_high,X
|
||||
sta pil_smc1+2
|
||||
sta pil_smc2+2
|
||||
sta pil_smc4+2
|
||||
|
||||
;self modify the PAGE2 high addresses
|
||||
eor #$60
|
||||
sta pil_smc3+2
|
||||
|
||||
; self modify the PAGE1 LOW addresses
|
||||
lda hposn_low,X
|
||||
sta pil_smc2+1
|
||||
sta pil_smc4+1
|
||||
|
||||
; self mofidy the PAGE1 LOW input addresses
|
||||
sta pil_smc1+1
|
||||
inc pil_smc1+1
|
||||
|
||||
|
||||
clc
|
||||
adc COUNT
|
||||
sta pil_smc3+1
|
||||
|
||||
|
||||
;=========================
|
||||
; inner loop, from 0-39
|
||||
|
||||
ldy #0
|
||||
pan_inner_loop:
|
||||
|
||||
pil_smc1:
|
||||
lda $2000+1,Y
|
||||
pil_smc2:
|
||||
sta $2000,Y
|
||||
; load in+1, store to in
|
||||
|
||||
iny
|
||||
cpy #39
|
||||
bne pan_inner_loop
|
||||
; if completely unrolled, would save 1 cycle for store and
|
||||
; 5 for the branch/loop
|
||||
; 192*6=not a lot
|
||||
|
||||
pil_smc1:
|
||||
lda $2000+1,Y ; 4
|
||||
pil_smc2:
|
||||
sta $2000,Y ; 5
|
||||
|
||||
iny ; 2
|
||||
cpy #39 ; 2
|
||||
bne pan_inner_loop ; 2/3
|
||||
|
||||
; for right edge, scroll in from PAGE2
|
||||
|
||||
pil_smc3:
|
||||
lda $4000
|
||||
@ -55,8 +78,6 @@ pil_smc4:
|
||||
cpx #$ff
|
||||
bne pan_outer_loop
|
||||
|
||||
; jsr wait_until_keypress
|
||||
|
||||
inc COUNT
|
||||
lda COUNT
|
||||
cmp #39
|
||||
|
133
demos/trogdor/horiz_scroll_skip.s
Normal file
133
demos/trogdor/horiz_scroll_skip.s
Normal file
@ -0,0 +1,133 @@
|
||||
;======================================
|
||||
; do very simple horizontal scroll
|
||||
;======================================
|
||||
; skips by 4 because we need fairly high FPS
|
||||
|
||||
; originally ~12 seconds to scroll 80 (twice)
|
||||
; made double high, ~8s
|
||||
|
||||
; screens to pan in $2000/$4000 to left
|
||||
|
||||
|
||||
horiz_pan_skip:
|
||||
|
||||
pan_loop:
|
||||
|
||||
; how many times to scroll
|
||||
|
||||
lda #0
|
||||
sta COUNT
|
||||
|
||||
pan_outer_outer_loop:
|
||||
|
||||
|
||||
ldx #191
|
||||
pan_outer_loop:
|
||||
|
||||
txa
|
||||
pha
|
||||
|
||||
; self-modify the PAGE1 high input addresses
|
||||
|
||||
lda hposn_high,X
|
||||
sta pil_in_smc1+2 ; input source
|
||||
|
||||
sta pil_out_smc1+2 ; output odd
|
||||
sta pil_out_smc4+2
|
||||
|
||||
;self modify the PAGE2 high input addresses
|
||||
eor #$60
|
||||
sta pil_in_page2_smc1+2
|
||||
|
||||
|
||||
; self modify the PAGE1 LOW addresses
|
||||
lda hposn_low,X
|
||||
sta pil_out_smc1+1 ; output odd
|
||||
sta pil_out_smc4+1 ; output odd
|
||||
|
||||
|
||||
; self modify the PAGE1 LOW input addresses
|
||||
sta pil_in_smc1+1 ; input is regular+1
|
||||
inc pil_in_smc1+1
|
||||
inc pil_in_smc1+1
|
||||
inc pil_in_smc1+1
|
||||
inc pil_in_smc1+1
|
||||
|
||||
; offset in PAGE2 to get input from
|
||||
|
||||
clc
|
||||
adc COUNT
|
||||
sta pil_in_page2_smc1+1
|
||||
|
||||
|
||||
inx
|
||||
lda hposn_high,X
|
||||
sta pil_out_smc2+2 ; output even high
|
||||
sta pil_out_smc5+2
|
||||
|
||||
lda hposn_low,X ; output even low
|
||||
sta pil_out_smc2+1
|
||||
sta pil_out_smc5+1
|
||||
|
||||
|
||||
|
||||
;=========================
|
||||
; inner loop, from 0-36
|
||||
|
||||
ldy #0
|
||||
pan_inner_loop:
|
||||
|
||||
; load in+1, store to in
|
||||
|
||||
; if completely unrolled, would save 1 cycle for store and
|
||||
; 5 for the branch/loop
|
||||
; 192*6=not a lot
|
||||
|
||||
pil_in_smc1:
|
||||
lda $2000+1,Y ; 4
|
||||
pil_out_smc1:
|
||||
sta $2000,Y ; 5
|
||||
pil_out_smc2:
|
||||
sta $2000,Y ; 5
|
||||
|
||||
iny ; 2
|
||||
cpy #36 ; 2
|
||||
bne pan_inner_loop ; 2/3
|
||||
|
||||
; for right edge, scroll in from PAGE2
|
||||
|
||||
ldx #0
|
||||
tail_loop:
|
||||
|
||||
pil_in_page2_smc1:
|
||||
lda $4000,X
|
||||
pil_out_smc4:
|
||||
sta $2000,Y
|
||||
pil_out_smc5:
|
||||
sta $2000,Y
|
||||
|
||||
iny
|
||||
inx
|
||||
cpy #40
|
||||
bne tail_loop
|
||||
|
||||
|
||||
pla
|
||||
tax
|
||||
|
||||
dex
|
||||
dex
|
||||
cpx #$ff
|
||||
bne pan_outer_loop
|
||||
|
||||
inc COUNT
|
||||
inc COUNT
|
||||
inc COUNT
|
||||
inc COUNT
|
||||
|
||||
lda COUNT
|
||||
cmp #36
|
||||
|
||||
bne pan_outer_outer_loop
|
||||
|
||||
rts
|
@ -209,7 +209,7 @@ load_trogdor:
|
||||
;=======================
|
||||
;=======================
|
||||
|
||||
cli ; start music
|
||||
; cli ; start music
|
||||
|
||||
jsr $8000
|
||||
|
||||
|
@ -32,6 +32,15 @@ trogdor_main:
|
||||
lda #$20
|
||||
sta DRAW_PAGE
|
||||
|
||||
|
||||
lda SOUND_STATUS
|
||||
and #SOUND_MOCKINGBOARD
|
||||
beq trog_no_music
|
||||
|
||||
cli ; start music
|
||||
trog_no_music:
|
||||
|
||||
|
||||
;======================================
|
||||
; draw SCENE 1
|
||||
;======================================
|
||||
@ -53,13 +62,13 @@ trogdor_main:
|
||||
lda #$60
|
||||
jsr hgr_copy_magnify
|
||||
|
||||
jsr horiz_pan
|
||||
jsr horiz_pan_skip
|
||||
|
||||
; clear to white
|
||||
ldy #$7f
|
||||
jsr hgr_clear_screen
|
||||
|
||||
jsr horiz_pan
|
||||
jsr horiz_pan_skip
|
||||
|
||||
jsr hgr_page_flip
|
||||
|
||||
@ -244,6 +253,49 @@ left_flame_animate2:
|
||||
jsr hgr_clear_screen
|
||||
jsr hgr_page_flip
|
||||
|
||||
|
||||
|
||||
;======================================
|
||||
; draw SCENE 2
|
||||
;======================================
|
||||
; scroll trogdor intro place
|
||||
|
||||
; takes rougly 90 frames (3s) to scroll in
|
||||
; remains there 10 frames (almost .5s)
|
||||
|
||||
; orignal: 28s, want 9 times faster???
|
||||
; can easily do 8 times...
|
||||
|
||||
; now should be on PAGE1??
|
||||
|
||||
ldy #$7f
|
||||
jsr hgr_clear_screen
|
||||
jsr hgr_page_flip
|
||||
|
||||
; lda #24 ; 192/8
|
||||
; sta ANIMATE_COUNT
|
||||
|
||||
lda #0
|
||||
sta COUNT
|
||||
|
||||
scroll_in_loop:
|
||||
|
||||
jsr hgr_vertical_scroll
|
||||
|
||||
lda COUNT
|
||||
clc
|
||||
adc #8
|
||||
|
||||
cmp #192
|
||||
bne scroll_in_loop
|
||||
|
||||
lda #10
|
||||
jsr wait_ticks
|
||||
|
||||
|
||||
|
||||
;=======================================
|
||||
|
||||
jsr wait_until_keypress
|
||||
|
||||
; second
|
||||
@ -295,8 +347,9 @@ hposn_low = $1e00
|
||||
hposn_high = $1f00
|
||||
|
||||
.include "hgr_sprite_big_mask.s"
|
||||
.include "horiz_scroll_simple.s"
|
||||
.include "horiz_scroll_skip.s"
|
||||
.include "hgr_copy_magnify.s"
|
||||
.include "vertical_scroll.s"
|
||||
|
||||
;===============================
|
||||
; draw_flame_small
|
||||
|
79
demos/trogdor/vertical_scroll.s
Normal file
79
demos/trogdor/vertical_scroll.s
Normal file
@ -0,0 +1,79 @@
|
||||
|
||||
;=======================================
|
||||
; scrolls to PAGE1
|
||||
; relies on going off the edge...
|
||||
;=======================================
|
||||
|
||||
hgr_vertical_scroll:
|
||||
ldx #0
|
||||
|
||||
outer_vscroll_loop:
|
||||
lda hposn_low,X
|
||||
sta OUTL
|
||||
lda hposn_high,X
|
||||
sta OUTH
|
||||
|
||||
txa
|
||||
clc
|
||||
adc #8
|
||||
tay
|
||||
lda hposn_low,y
|
||||
sta INL
|
||||
lda hposn_high,Y
|
||||
sta INH
|
||||
|
||||
ldy #29
|
||||
inner_vscroll_loop:
|
||||
lda (INL),Y
|
||||
sta (OUTL),Y
|
||||
dey
|
||||
cpy #9
|
||||
bpl inner_vscroll_loop
|
||||
|
||||
inx
|
||||
cpx #184
|
||||
bne outer_vscroll_loop
|
||||
|
||||
|
||||
;================================
|
||||
; copy in off screen
|
||||
|
||||
; for now from 0..19
|
||||
|
||||
hgr_vertical_scroll2:
|
||||
ldx #184
|
||||
|
||||
outer_vscroll_loop2:
|
||||
lda hposn_low,X
|
||||
clc
|
||||
adc #10
|
||||
sta OUTL
|
||||
|
||||
lda hposn_high,X
|
||||
sta OUTH
|
||||
|
||||
ldy COUNT
|
||||
lda hposn_low,Y
|
||||
sta INL
|
||||
lda hposn_high,Y
|
||||
clc
|
||||
adc #$40 ; load from $6000
|
||||
sta INH
|
||||
|
||||
ldy #19
|
||||
inner_vscroll_loop2:
|
||||
lda (INL),Y
|
||||
sta (OUTL),Y
|
||||
dey
|
||||
bpl inner_vscroll_loop2
|
||||
|
||||
inc COUNT
|
||||
|
||||
inx
|
||||
cpx #192
|
||||
bne outer_vscroll_loop2
|
||||
|
||||
|
||||
|
||||
rts
|
||||
|
Loading…
Reference in New Issue
Block a user