mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-20 01:29:36 +00:00
tiny_music: auto-generate the frequency table
This commit is contained in:
parent
da37bbf9a1
commit
ad9b1b81af
|
@ -27,8 +27,6 @@ interrupt_handler:
|
||||||
tya
|
tya
|
||||||
pha ; save Y
|
pha ; save Y
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
inc $0404 ; debug (flashes char onscreen)
|
inc $0404 ; debug (flashes char onscreen)
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,10 +111,6 @@ done_update_song:
|
||||||
|
|
||||||
done_ay3_irq_handler:
|
done_ay3_irq_handler:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
exit_interrupt:
|
|
||||||
|
|
||||||
pla
|
pla
|
||||||
tay ; restore Y
|
tay ; restore Y
|
||||||
pla
|
pla
|
||||||
|
@ -126,7 +120,7 @@ exit_interrupt:
|
||||||
; on II+/IIe (but not IIc) we need to do this?
|
; on II+/IIe (but not IIc) we need to do this?
|
||||||
interrupt_smc:
|
interrupt_smc:
|
||||||
lda $45 ; restore A
|
lda $45 ; restore A
|
||||||
plp
|
plp ; restore flags
|
||||||
|
|
||||||
rti ; return from interrupt ; 6
|
rti ; return from interrupt ; 6
|
||||||
|
|
||||||
|
@ -134,15 +128,8 @@ interrupt_smc:
|
||||||
; typical
|
; typical
|
||||||
; ???? cycles
|
; ???? cycles
|
||||||
|
|
||||||
; starts at C4
|
|
||||||
frequency_lookup:
|
|
||||||
.byte $F4,$E6,$D9,$CD,$C1,$B7,$AC,$A3,$99,$91,$89,$81,$00,$00,$00,$00
|
|
||||||
.byte $7A,$73,$6C,$66,$60,$5B,$56,$51,$4C,$48,$44,$40,$00,$00,$00,$00
|
|
||||||
.byte $3D,$39,$36,$33,$30,$2D,$2B,$28,$26,$24,$22,$20,$00,$00,$00,$00
|
|
||||||
|
|
||||||
; .byte $EE,$E1,$D4,$C8,$BD,$B2,$A8,$9F,$96,$8E,$86,$7E,$00,$00,$00,$00
|
|
||||||
; .byte $77,$70,$6A,$64,$5E,$59,$54,$4F,$4B,$47,$43,$3F,$00,$00,$00,$00
|
|
||||||
; .byte $3B,$38,$35,$32,$2F,$2C,$2A,$27,$25,$23,$21,$1F,$00,$00,$00,$00
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,6 @@ MOCK_AY_LATCH_ADDR = $7 ; 1 1 1
|
||||||
|
|
||||||
mockingboard_init:
|
mockingboard_init:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;=========================
|
;=========================
|
||||||
; Initialize the 6522s
|
; Initialize the 6522s
|
||||||
; set the data direction for all pins of PortA/PortB to be output
|
; set the data direction for all pins of PortA/PortB to be output
|
||||||
|
@ -166,11 +164,11 @@ init_smc:
|
||||||
txa
|
txa
|
||||||
tay
|
tay
|
||||||
lda (SONG_L),Y
|
lda (SONG_L),Y
|
||||||
jsr ay3_write_reg
|
jsr ay3_write_reg ; trashes Y
|
||||||
dex
|
dex
|
||||||
bne init_loop
|
bne init_loop
|
||||||
|
|
||||||
; update SONG_L to point to beginning
|
; update SONG_L to point past the init
|
||||||
lda SONG_L
|
lda SONG_L
|
||||||
clc
|
clc
|
||||||
adc #14
|
adc #14
|
||||||
|
@ -179,6 +177,17 @@ init_smc:
|
||||||
inc SONG_H
|
inc SONG_H
|
||||||
no_oflo:
|
no_oflo:
|
||||||
|
|
||||||
|
; create Frequency Table
|
||||||
|
ldx #12
|
||||||
|
make_freq_loop:
|
||||||
|
lda frequency_lookup,X
|
||||||
|
lsr
|
||||||
|
sta frequency_lookup+16,X
|
||||||
|
lsr
|
||||||
|
sta frequency_lookup+32,X
|
||||||
|
dex
|
||||||
|
bpl make_freq_loop
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
@ -223,3 +232,12 @@ ay3_write_reg:
|
||||||
sty MOCK_6522_ORB2 ; 4
|
sty MOCK_6522_ORB2 ; 4
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
; starts at C4
|
||||||
|
frequency_lookup:
|
||||||
|
.byte $F4,$E6,$D9,$CD,$C1,$B7,$AC,$A3,$99,$91,$89,$81,$00
|
||||||
|
|
||||||
|
;.byte $00,$00,$00,$00
|
||||||
|
;.byte $7A,$73,$6C,$66,$60,$5B,$56,$51,$4C,$48,$44,$40,$00,$00,$00,$00
|
||||||
|
;.byte $3D,$39,$36,$33,$30,$2D,$2B,$28,$26,$24,$22,$20,$00,$00,$00,$00
|
||||||
|
|
|
@ -47,7 +47,10 @@ forever:
|
||||||
jmp forever
|
jmp forever
|
||||||
|
|
||||||
|
|
||||||
.include "mockingboard_setup.s"
|
.include "yankee_music.s"
|
||||||
|
|
||||||
.include "interrupt_handler.s"
|
.include "interrupt_handler.s"
|
||||||
|
|
||||||
.include "yankee_music.s"
|
; must be last
|
||||||
|
.include "mockingboard_setup.s"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user