tiny_music: auto-generate the frequency table
This commit is contained in:
parent
da37bbf9a1
commit
ad9b1b81af
|
@ -27,8 +27,6 @@ interrupt_handler:
|
|||
tya
|
||||
pha ; save Y
|
||||
|
||||
|
||||
|
||||
inc $0404 ; debug (flashes char onscreen)
|
||||
|
||||
|
||||
|
@ -113,10 +111,6 @@ done_update_song:
|
|||
|
||||
done_ay3_irq_handler:
|
||||
|
||||
|
||||
|
||||
exit_interrupt:
|
||||
|
||||
pla
|
||||
tay ; restore Y
|
||||
pla
|
||||
|
@ -126,7 +120,7 @@ exit_interrupt:
|
|||
; on II+/IIe (but not IIc) we need to do this?
|
||||
interrupt_smc:
|
||||
lda $45 ; restore A
|
||||
plp
|
||||
plp ; restore flags
|
||||
|
||||
rti ; return from interrupt ; 6
|
||||
|
||||
|
@ -134,15 +128,8 @@ interrupt_smc:
|
|||
; typical
|
||||
; ???? 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:
|
||||
|
||||
|
||||
|
||||
;=========================
|
||||
; Initialize the 6522s
|
||||
; set the data direction for all pins of PortA/PortB to be output
|
||||
|
@ -166,11 +164,11 @@ init_smc:
|
|||
txa
|
||||
tay
|
||||
lda (SONG_L),Y
|
||||
jsr ay3_write_reg
|
||||
jsr ay3_write_reg ; trashes Y
|
||||
dex
|
||||
bne init_loop
|
||||
|
||||
; update SONG_L to point to beginning
|
||||
; update SONG_L to point past the init
|
||||
lda SONG_L
|
||||
clc
|
||||
adc #14
|
||||
|
@ -179,6 +177,17 @@ init_smc:
|
|||
inc SONG_H
|
||||
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
|
||||
|
||||
|
||||
|
@ -223,3 +232,12 @@ ay3_write_reg:
|
|||
sty MOCK_6522_ORB2 ; 4
|
||||
|
||||
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
|
||||
|
||||
|
||||
.include "mockingboard_setup.s"
|
||||
.include "yankee_music.s"
|
||||
|
||||
.include "interrupt_handler.s"
|
||||
|
||||
.include "yankee_music.s"
|
||||
; must be last
|
||||
.include "mockingboard_setup.s"
|
||||
|
||||
|
|
Loading…
Reference in New Issue