tymczasem, w innej bajce...
SS_ChannelNo equ 0xD283
SS_Reset equ 0xD284
SS_Flags equ 0xD290
SS_Freq equ 0xD291
SS_Len equ 0xD293
SS_Rep equ 0xD294
SS_AttDec equ 0xD295
SS_SusRel equ 0xD296
SS_Vol equ 0xD297
SS_Waveform equ 0xD298
org $2000
opt f+
main: sta SS_Reset
ldx #0x00
ldy #0x00
l0: sty SS_ChannelNo
lda Instruments,x
sta SS_AttDec
lda Instruments+1,x
sta SS_SusRel
lda Instruments+2,x
sta SS_Waveform
inx
inx
inx
iny
cpy #6
bne L0
ldx #0x00
l1: jsr Wait_For_Sync
lda #0x00
sta SS_ChannelNo
lda MusicP1+1,x
bne ch_0_ok
lda #0xB0
sta SS_Flags
jmp ch_1
ch_0_ok:
lda MusicP1,x
sta SS_Freq
lda MusicP1+1,x
sta SS_Freq+1
lda #0xF2
sta SS_Flags
ch_1: lda #0x01
sta SS_ChannelNo
lda MusicP2+1,x
bne ch_1_ok
lda #0xB0
sta SS_Flags
jmp ch_2
ch_1_ok:
lda MusicP2,x
sta SS_Freq
lda MusicP2+1,x
sta SS_Freq+1
lda #0xF1
sta SS_Flags
ch_2: lda #0x02
sta SS_ChannelNo
lda MusicP3+1,x
bne ch_2_ok
lda #0xB0
sta SS_Flags
jmp ch_3
ch_2_ok:
lda MusicP3,x
sta SS_Freq
lda MusicP3+1,x
sta SS_Freq+1
lda #0xF3
sta SS_Flags
ch_3: lda #0x03
sta SS_ChannelNo
lda MusicP4+1,x
bne ch_3_ok
lda #0xB0
sta SS_Flags
jmp ch_4
ch_3_ok:
lda MusicP4,x
sta SS_Freq
lda MusicP4+1,x
sta SS_Freq+1
lda #0xF2
sta SS_Flags
ch_4: lda #0x04
sta SS_ChannelNo
lda MusicP5+1,x
bne ch_4_ok
lda #0xB0
sta SS_Flags
jmp ch_5
ch_4_ok:
lda MusicP5,x
sta SS_Freq
lda MusicP5+1,x
sta SS_Freq+1
lda #0xF2
sta SS_Flags
ch_5:
ldy #0x03
L2: jsr Wait_For_Sync
dey
bne L2
ldy #2
L4: jsr Wait_For_Sync
dey
bne L4
inx
inx
jne l1
ldx #0x00
jmp l1
Wait_For_Sync:
lda $d40b
rne ;repeat last instruction if not equal
lda $d40b
req ;repeat last instruction if equal
rts
Instruments: .byte 0x36,0x9D,2
.byte 0xC6,0xCD,1
.byte 0x90,0x00,3
.byte 0x37,0x8C,2
.byte 0x38,0x7B,2
.byte 0x00,0x00,0
;---------------------------------
MusicP1: .word g4,0,g4,0,g4,0,g4,0,a4,0,a4,0,a4,0,a4,0,h4,0,h4,0,h4,0,h4,0,a4,0,a4,0,a4,0,a4,0,g4,0,g4,0,g4,0,g4,0,a4,0,a4,0,a4,0,a4,0,h4,0,h4,0,h4,0,h4,0,a4,0,a4,0,a4,0,a4,0
.word g4,0,g4,0,g4,0,g4,0,a4,0,a4,0,a4,0,a4,0,h4,0,h4,0,h4,0,h4,0,a4,0,a4,0,a4,0,a4,0,g4,0,g4,0,g4,0,g4,0,a4,0,a4,0,a4,0,a4,0,h4,0,h4,0,h4,0,h4,0,a4,0,a4,0,a4,0,a4,0
MusicP4: .word e4,0,e4,0,e4,0,e4,0,f4,0,f4,0,f4,0,f4,0,g4,0,g4,0,g4,0,g4,0,f4,0,f4,0,f4,0,f4,0,e4,0,e4,0,e4,0,e4,0,f4,0,f4,0,f4,0,f4,0,g4,0,g4,0,g4,0,g4,0,f4,0,f4,0,f4,0,f4,0
.word e4,0,e4,0,e4,0,e4,0,f4,0,f4,0,f4,0,f4,0,g4,0,g4,0,g4,0,g4,0,f4,0,f4,0,f4,0,f4,0,e4,0,e4,0,e4,0,e4,0,f4,0,f4,0,f4,0,f4,0,g4,0,g4,0,g4,0,g4,0,f4,0,f4,0,f4,0,f4,0
MusicP5: .word c4,0,c4,0,c4,0,c4,0,c4,0,c4,0,c4,0,c4,0,d4,0,d4,0,d4,0,d4,0,c4,0,c4,0,c4,0,c4,0,c4,0,c4,0,c4,0,c4,0,c4,0,c4,0,c4,0,c4,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