Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INESMAP 0
- INESPRG 1
- seqTimer equ 0
- sequenceIdx equ 1
- ORG $8000
- timerL:
- DB $47, $17, $e9, $bf, $96, $70, $4c, $2a, $0a, $ec, $cf, $b4, $9b, $83, $6c, $57, $43, $30, $1e, $0d, $fd, $ee, $df, $d2, $c5
- silentL:
- DB $01
- timerH:
- DB $03, $03, $02, $02, $02, $02, $02, $02, $02, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00, $00, $00
- silent equ #silentL-timerL
- song:
- DB 12,14,16,12,12,14,16,12,16,17,19,silent,16,17,19,silent,19,21,19,17,16,silent,12,silent,19,21,19,17,16,silent,12,silent,12,silent,7,silent,12,silent,silent,silent,12,silent,7,silent,12,silent,silent,silent
- songLen=$-song
- main:
- SEI
- ;enable pulse channel
- LDA #$01
- STA $4015
- ;set volume and duty cycle
- LDA #$bf
- STA $4000
- ;disable sweep
- LDA #$08
- STA $4001
- CLI
- end:
- JMP end
- IRQ:
- ;check if frame interrupt
- LDA $4015
- AND #$40
- BEQ ++
- ;decrement and jump if timer not run out
- DEC seqTimer
- BPL ++
- ;reset counter
- LDA #$20
- STA seqTimer
- ;timer action
- LDY sequenceIdx
- ;check OOB
- LDA #songLen
- CMP sequenceIdx
- BNE +
- LDY #$0
- + LDX song, y
- ;get timer value from table
- LDA timerL,x
- STA $4002
- LDA timerH,x
- STA $4003
- INY
- STY sequenceIdx
- ++ RTI
- NMI:
- RTI
- PAD $BFFA
- DW NMI
- PAD $BFFC, $80
- DW main
- PAD $BFFE
- DW IRQ
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement