Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .include "snes.h"
- ; *** vector settings
- .name "SNES Test Rom"
- .SNESNATIVEVECTOR
- COP NullHandler
- BRK NullHandler
- ABORT NullHandler
- NMI NullHandler
- UNUSED $0000
- IRQ NullHandler
- .ENDNATIVEVECTOR
- .SNESEMUVECTOR
- COP NullHandler
- UNUSED $0000
- ABORT NullHandler
- NMI NullHandler
- RESET main
- IRQBRK NullHandler
- .ENDEMUVECTOR
- .define apulock 5
- .macro loadData args p
- lda.b [p]
- ldy.b p
- iny
- bne +
- inc p+2
- ldy #$8000
- + sty p
- .endm
- .section MAIN force
- .define pointer 0
- main:
- sei
- stz.w $4200
- stz.w $2140
- stz.w $2141
- stz.w $2142
- stz.w $2143
- lda.b #$80
- sta.w $2100
- clc ;
- xce ; Emulation flag 解除
- lda.b #$01
- sta.b apulock
- rep #$38
- lda.w #0
- tcd
- lda.w #$1ff
- tcs
- lda.w #EngineData
- sta.b pointer
- lda.w #:EngineData
- sta.b pointer+2
- jsr uploadSpc ; SPC Engine Upload
- sep #$20
- lda.b #0 ;
- - cmp.w $2140 ; smw spc 初期化待ち合わせ
- bne - ;
- lda.b #$ff
- sta.w $2141
- rep #$20
- lda.w #BrrData
- sta.b pointer
- lda.w #:BrrData
- sta.b pointer+2
- jsr uploadSpc
- Upend:
- sep #$30
- rep #4
- cli
- lda.b #$80
- sta.w $4200
- stz.b apulock
- lda.b #2
- sta.w $2142
- - bra -
- .ends
- .section SPCRoutine free
- ;.define pointer 0
- .define counter 3
- uploadSpc:
- php
- rep #$30
- lda.w #$BBAA
- - cmp.w $2140
- bne -
- sep #$20
- lda.b #$cc
- sta.b counter
- _uploadLoop:
- loadData pointer
- xba
- loadData pointer
- pha
- loadData pointer
- sta.w $2142
- loadData pointer
- sta.w $2143
- pla
- xba
- rep #$20
- cmp.w #$0000
- beq _exit
- tax
- sep #$20
- lda.b #1
- sta.w $2141
- lda.b counter
- sta.w $2140
- - cmp.w $2140
- bne -
- stz.b counter
- _writeLoop:
- loadData pointer
- sta.w $2141
- lda counter
- sta.w $2140
- - cmp.w $2140
- bne -
- inc counter
- dex
- bne _writeLoop
- NextBlock:
- inc counter
- jmp _uploadLoop
- _exit:
- sep #$20
- stz.w $2141
- lda.b counter
- sta.w $2140
- - cmp.w $2140
- bne -
- stz.w $2140
- stz.w $2141
- stz.w $2142
- stz.w $2143
- plp
- rts
- .ends
- .macro frmac args file
- .fopen file fp
- .fsize fp sz
- .dw sz-2
- .rept sz
- .fread fp d
- .db d
- .endr
- .fclose fp
- .undef sz, d
- .endm
- .section ENG superfree
- EngineData:
- frmac "bin/smw-spc_binary.bin"
- frmac "bin/snd.bin"
- OwSeq:
- frmac "bin/owseq.bin"
- .dw $0, $500
- .ends
- .section BRRDATA superfree
- BrrData:
- frmac "bin/brrtab.bin"
- frmac "bin/brrdata.bin"
- .dw $0
- .ends
- .section NullHandler
- NullHandler:
- sep #$20
- lda.b #1
- sta.w $2143
- lda.b apulock
- bne +++
- lda.b $10
- bne +
- lda.b #1
- bra ++
- + lda.b #0
- ++ sta.w $2143
- sta.b $10
- +++ rti
- .ends
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement