Seriously, I hate programming the music. It's one thing I learned to do only recently, and I suck at it. Here's my crappy sound engine with the notes it's supposed to play...
MusicPlay:
LDA musiccounter
CMP #$01
BNE MusicCheck
LDA #$00
STA musicxreg
STA musicyreg
INC musiccounter
MusicCheck:
LDA musiccounter
CMP #$02
BCS .playmus
RTS
.playmus
LDX musicxreg
LDY musicyreg
LDA Music,x
STA musicnote
LDA Music+1,x
STA musicnote2
LDA Music+2,x
STA musiclength
LDA musiccounter
CMP #$03
BEQ Played
INC musiccounter
lda #%01111111 ;Duty 01, Volume 15
sta $4000
lda musicnote ;See the .dbs in Music
sta $4002
lda musicnote2
sta $4003
jmp Played
NoNote:
lda #%00000000 ;I believe this is not used anymore
sta $4000
Played:
INY
STY musicyreg
CPY musiclength
BEQ .nextnote2
RTS
.nextnote2
LDY #$00
STY musicyreg
INC musicxreg
INC musicxreg
INC musicxreg
DEC musiccounter
RTS
Music: ;Lower 3 bits are in BIN so it is easier to program these
.db $CF,%00000011,$0D,$00,%00000000,$01,$01,%00000011,$0D,$00,%00000000,$01,$73,%00000010,$0D,$00
.db %00000000,$01,$53,%00000010,$27,$01,%00000000,$01,$81,%00000000,$FF,$01,%00000000,$01,$66,%00000000
.db $AA,$01,%00000000,$01,$87,%00000000,$77,$01,%00000000,$0A,$DD,%00000000,$53,$01,%00000000,$01
(Those are indeed not the notes of the final game)
Right now, the sound engine only plays Square 1 stuff, and I'll still have to make it play the other channels. I already hate sound programming
-------------------------
"Energy Tanks, Missiles, Power Bombs... You want it? It's yours my friend! As long as you have enough credits!"
Edited: 04/08/2014
at 03:30 PM
by Vectrex28