!MusicCounter = $DBF|!addr ;Where to read/write music values from (coin counter by default, which would also require a hex edit to adjust the max amount of coins if you want to make full use of the almost-255 song slots) !SongOffset = $0A ;Song ID to start at (keep in mind global song IDs are a thing too!) !MaxSong = $F3 ;Song ID to end at init: LDA !MusicCounter CLC : ADC #!SongOffset STA $1DFB|!addr main: ;check for L LDA $18 AND #%00100000 BNE prev ;check for R LDA $18 AND #%00010000 BNE next BRA selpress prev: LDA !MusicCounter CMP #$00 BEQ under DEC STA !MusicCounter BRA selpress next: LDA !MusicCounter CMP #!MaxSong BEQ over INC STA !MusicCounter BRA selpress under: LDA #!MaxSong STA !MusicCounter BRA selpress over: LDA #$00 STA !MusicCounter selpress: LDA $16 AND #%00100000 BEQ return LDA !MusicCounter CLC : ADC #!SongOffset STA $1DFB|!addr RTL