dos33fsprogs/demos/l/music_256/play_frame.s

80 lines
1.1 KiB
ArmAsm
Raw Normal View History

2022-01-15 20:07:13 +00:00
play_frame:
;============================
; see if still counting down
lda SONG_COUNTDOWN
bpl done_update_song
set_notes_loop:
;==================
; load next byte
ldy SONG_OFFSET
lda tracker_song,Y
;==================
; see if hit end
2022-01-15 20:58:47 +00:00
; this song only 16 notes so valid notes always positive
; cmp #$80
2022-01-16 01:51:35 +00:00
bpl not_end
2022-01-15 20:07:13 +00:00
;====================================
; if at end, loop back to beginning
2022-01-15 20:58:47 +00:00
asl ; reset song offset to 0
2022-01-15 20:07:13 +00:00
sta SONG_OFFSET
2022-01-15 20:58:47 +00:00
beq set_notes_loop
2022-01-15 20:07:13 +00:00
2022-01-16 01:51:35 +00:00
not_end:
2022-01-15 20:07:13 +00:00
; NNNNNECC -- c=channel, e=end, n=note
2022-01-16 01:51:35 +00:00
pha ; save note
2022-01-15 20:07:13 +00:00
and #3
2022-01-16 01:51:35 +00:00
tax
ldy #$0E
sty AY_REGS+8,X ; $08 set volume A,B,C
2022-01-15 20:07:13 +00:00
asl
tax ; put channel offset in X
2022-01-16 01:51:35 +00:00
pla ; restore note
tay
2022-01-15 20:07:13 +00:00
and #$4
sta SONG_COUNTDOWN ; always 4 long?
tya
lsr
lsr
lsr ; get note in A
tay ; lookup in table
lda frequencies_high,Y
sta AY_REGS+1,X
2022-01-16 01:51:35 +00:00
; sta $500,X
lda frequencies_low,Y
sta AY_REGS,X ; set proper register value
; visualization
blah_urgh:
sta $400,Y
inc blah_urgh+1
2022-01-15 20:07:13 +00:00
;============================
; point to next
; assume less than 256 bytes
inc SONG_OFFSET
done_update_song:
dec SONG_COUNTDOWN
2022-01-15 21:23:59 +00:00
bmi set_notes_loop