mode7: update sky_demo to use common routines

This commit is contained in:
Vince Weaver 2017-12-21 14:01:21 -05:00
parent afa44a0e46
commit 1aa43c9496

View File

@ -32,6 +32,8 @@
scroll_forever:
jsr scroll_background
jsr page_flip ; 6
; lda #250
; jsr WAIT
@ -54,6 +56,7 @@ scroll_forever:
.include "../asm_routines/pageflip.s"
.include "../asm_routines/gr_setpage.s"
.include "../asm_routines/keypress.s"
.include "../asm_routines/bg_scroll.s"
;===============================================
; Variables
@ -62,90 +65,3 @@ scroll_forever:
.include "starry_sky.scroll"
;==================
; scroll background
;==================
; background already loaded
; ANGLE 0-15 sets angle
; CV is Y position to display at
; 182/220... 220/16 = 13.75
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
; 0 11 22 34 45 56 68 79 91 102 113 125 136 147 159 170 182
scroll_offsets:
.byte 0,11,22,34,45,56,68,79,91,102,113,125,136,147,159,170
scroll_background:
ldy ANGLE
lda scroll_offsets,Y
sta OFFSET
scrollbg_loop:
ldx #0
ldy CV
lsr
lda gr_offsets,Y ; get position
sta bgsm1+1
lda gr_offsets+2,Y ; get position
sta bgsm2+1
lda gr_offsets+4,Y ; get position
sta bgsm3+1
lda gr_offsets+6,Y ; get position
sta bgsm4+1
iny
clc
lda gr_offsets,Y ; get position
adc DRAW_PAGE
sta bgsm1+2
lda gr_offsets+2,Y ; get position
adc DRAW_PAGE
sta bgsm2+2
lda gr_offsets+4,Y ; get position
adc DRAW_PAGE
sta bgsm3+2
lda gr_offsets+6,Y ; get position
adc DRAW_PAGE
sta bgsm4+2
ldy OFFSET
bgdraw_loop:
lda scroll_row1,Y
bgsm1:
sta $400,X
lda scroll_row2,Y
bgsm2:
sta $480,X
lda scroll_row3,Y
bgsm3:
sta $500,X
lda scroll_row4,Y
bgsm4:
sta $580,X
iny
inx
cpx #40
bne bgdraw_loop
;==================
; flip pages
;==================
jsr page_flip ; 6
done_bgscrolling:
rts