dos33fsprogs/demos/lovebyte2022/cometsong_256/play_frame.s

77 lines
1.1 KiB
ArmAsm
Raw Normal View History

2022-01-15 20:07:13 +00:00
play_frame:
;============================
; see if still counting down
2022-01-19 04:53:24 +00:00
song_countdown_smc:
lda #$FF ; initially negative so we enter loop
2022-01-15 20:07:13 +00:00
bpl done_update_song
set_notes_loop:
;==================
; load next byte
2022-01-19 04:53:24 +00:00
pla ; located on stack
2022-01-15 20:07:13 +00:00
;==================
; see if hit end
2022-01-15 20:58:47 +00:00
; this song only 16 notes so valid notes always positive
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-19 05:14:44 +00:00
tax ; reset stack offset to $FF
2022-01-19 04:53:24 +00:00
txs
2022-01-19 05:14:44 +00:00
bmi 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-19 05:14:44 +00:00
tay ; save note
2022-01-15 20:07:13 +00:00
and #3
2022-01-16 01:51:35 +00:00
2022-01-15 20:07:13 +00:00
asl
tax ; put channel offset in X
2022-01-19 05:14:44 +00:00
tya ; restore note
2022-01-16 01:51:35 +00:00
2022-01-15 20:07:13 +00:00
and #$4
2022-01-19 04:53:24 +00:00
sta song_countdown_smc+1 ; always 4 long?
2022-01-15 20:07:13 +00:00
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
lda frequencies_low,Y
sta AY_REGS,X ; set proper register value
; visualization
2022-01-21 20:35:53 +00:00
star_smc:
sta $500 ; 3
;blah_urgh:
; sta $400,Y
; inc blah_urgh+1
2022-01-16 01:51:35 +00:00
2022-01-15 20:07:13 +00:00
;============================
; point to next
2022-01-19 04:53:24 +00:00
; don't have to, PLA did it for us
2022-01-15 20:07:13 +00:00
done_update_song:
2022-01-19 04:53:24 +00:00
dec song_countdown_smc+1
2022-01-15 21:23:59 +00:00
bmi set_notes_loop