xmas2019: work on music

This commit is contained in:
Vince Weaver 2019-12-19 14:18:34 -05:00
parent cbd11b0185
commit 48379693a9
4 changed files with 202 additions and 0 deletions

View File

@ -1,3 +1,4 @@
+ Make SINE twice as fast (64 instead of 128 entries?)
+ rmove sine4
+ Add snow
+ Add music

BIN
xmas_2019/music/jingle.pt3 Normal file

Binary file not shown.

View File

@ -167,4 +167,35 @@ hgr_offsets_l:
.byte <$2050,<$20D0,<$2150,<$21D0,<$2250,<$22D0,<$2350,<$23D0
div_7_q:
.byte 0,0,0,0,0,0,0 ; 0..6
.byte 1,1,1,1,1,1,1 ; 7..13
.byte 2,2,2,2,2,2,2 ; 14..20
.byte 3,3,3,3,3,3,3 ; 21..27
.byte 4,4,4,4,4,4,4 ; 28..34
.byte 5,5,5,5,5,5,5 ; 35..41
.byte 6,6,6,6,6,6,6 ; 42..48
.byte 7,7,7,7,7,7,7 ; 49..55
.byte 8,8,8,8,8,8,8 ; 56..62
.byte 9 ; 63
div_7_r:
.byte 0,1,2,3,4,5,6 ; 0..6
.byte 0,1,2,3,4,5,6 ; 7..13
.byte 0,1,2,3,4,5,6 ; 14..20
.byte 0,1,2,3,4,5,6 ; 21..27
.byte 0,1,2,3,4,5,6 ; 28..34
.byte 0,1,2,3,4,5,6 ; 35..41
.byte 0,1,2,3,4,5,6 ; 42..48
.byte 0,1,2,3,4,5,6 ; 49..55
.byte 0,1,2,3,4,5,6 ; 56..62
.byte 0 ; 63
.include "random16.s"

170
xmas_2019/snow_old.s Normal file
View File

@ -0,0 +1,170 @@
; Display falling snow
; by deater (Vince Weaver) <vince@deater.net>
; Zero Page
CH = $24
CV = $25
GBASL = $26
GBASH = $27
BASL = $28
BASH = $29
SEEDL = $4E
SEEDH = $4F
HGR_COLOR = $E4
SNOWX = $F0
HGR = $F3E2
NUMFLAKES = 10
.include "hardware.inc"
;==================================
;==================================
jsr HGR
bit FULLGR
display_loop:
; 0 4 8 c 10 14 18 1c
; 0 1 2 3 4 5 6 7
;=========================
; erase old snow
ldx #0
erase_loop:
lda snow_y,X ; get Y
lsr
lsr
lsr ; divide by 8
tay
clc
lda hgr_offsets_l,Y
adc snow_x,X
sta GBASL ; point GBASL to right location
lda snow_y,X
asl
asl
and #$1f
clc
adc hgr_offsets_h,Y
sta GBASH
ldy #0
lda #0
sta (GBASL),Y
inx
cpx #NUMFLAKES
bne erase_loop
;==========================
; move snow
ldx #0
move_snow:
lda snow_y,X ; inc to next line
cmp #191
bne just_inc
lda #0
sta snow_y,X
jmp done_inc
just_inc:
jsr random16
lda SEEDL
and #$f
beq snow_left
cmp #$1
beq snow_right
inc snow_y,X
jmp snow_no
snow_right:
inc snow_offset,X
jmp snow_no
snow_left:
dec snow_offset,X
snow_no:
done_inc:
inx
cpx #NUMFLAKES
bne move_snow
;=========================
; draw new snow
ldx #0
draw_loop:
lda snow_y,X
lsr
lsr
lsr
tay
clc
lda hgr_offsets_l,Y
adc snow_x,X
sta GBASL
lda snow_y,X
asl
asl
and #$1f
clc
adc hgr_offsets_h,Y
sta GBASH
ldy #0
lda #1
sta (GBASL),Y
inx
cpx #NUMFLAKES
bne draw_loop
lda #100
jsr WAIT
jmp display_loop ; 3
snow_x:
.byte 2,4,6,8,10,12,14,16,18,20
snow_offset:
.byte 0,1,2,3,4,5,6,7,0,1
snow_y:
.byte 0,0,0,0,0,0,0,0,0,0
hgr_offsets_h:
.byte >$2000,>$2080,>$2100,>$2180,>$2200,>$2280,>$2300,>$2380
.byte >$2028,>$20A8,>$2128,>$21A8,>$2228,>$22A8,>$2328,>$23A8
.byte >$2050,>$20D0,>$2150,>$21D0,>$2250,>$22D0,>$2350,>$23D0
hgr_offsets_l:
.byte <$2000,<$2080,<$2100,<$2180,<$2200,<$2280,<$2300,<$2380
.byte <$2028,<$20A8,<$2128,<$21A8,<$2228,<$22A8,<$2328,<$23A8
.byte <$2050,<$20D0,<$2150,<$21D0,<$2250,<$22D0,<$2350,<$23D0
.include "random16.s"