MSU1 AV player demo
This commit is contained in:
parent
e0b817e17c
commit
d6e7623463
@ -1,4 +1,4 @@
|
||||
OBJS = header.ips reset.o65 main.o65 data.o65 const.o65 dma.o65 msu1.o65 # gfx.o65 # vars.o65
|
||||
OBJS = header.ips reset.o65 main.o65 data.o65 const.o65 dma.o65 msu1.o65 spc.o65 # gfx.o65 # vars.o65
|
||||
|
||||
all: msu1vid.sfc
|
||||
|
||||
|
||||
@ -14,11 +14,9 @@ hdma_blank .byt 40
|
||||
|
||||
; h/vscroll: write to $210d twice, write to $210e twice (mode 3)
|
||||
; adjust hscroll and vscroll to split one tilemap row into two display rows
|
||||
; (tilemap memory saving measure)
|
||||
hdma_scroll .byt 40
|
||||
.word 0
|
||||
.word 511
|
||||
.byt 16
|
||||
; in conjunction with 16x16 tiles this reduces the effective tilemap size
|
||||
; to 288 bytes
|
||||
hdma_scroll .byt 56
|
||||
.word 0
|
||||
.word 152+255
|
||||
.byt 16
|
||||
@ -51,13 +49,13 @@ hdma_scroll .byt 40
|
||||
; tilemap address switch: write to $2107 once (mode 0)
|
||||
; last row of tilemap is located elsewhere due to size
|
||||
hdma_tilemap .byt 40
|
||||
.byt $3c
|
||||
.byt $bc
|
||||
.byt 127
|
||||
.byt $3c
|
||||
.byt $bc
|
||||
.byt 1
|
||||
.byt $3c
|
||||
.byt $bc
|
||||
.byt 1
|
||||
.byt $7c
|
||||
.byt $fc
|
||||
.byt 0
|
||||
|
||||
; tilemap part 1 (goes to VRAM 7F00-7FFF)
|
||||
@ -89,3 +87,29 @@ tilemap .word $0000, $0000, $0002, $0004, $0006, $0008, $000a, $000c
|
||||
tilemap2 .word $0000, $01c0, $01c2, $01c4, $01c6, $01c8, $01ca, $01cc
|
||||
.word $01ce, $01e0, $01e2, $01e4, $01e6, $01e8, $01ea, $0000
|
||||
|
||||
spcaddr .word $0100 ; target address
|
||||
spcexec .word $0100 ; execute address
|
||||
spclen .byt 100 ; length
|
||||
|
||||
spccode .byt $e8, $6c ; - MOV A, #$6c
|
||||
.byt $c4, $f2 ; MOV $f2, A
|
||||
.byt $e8, $20 ; MOV A, #$20
|
||||
.byt $c4, $f3 ; MOV $f3, A
|
||||
.byt $78, $20, $f3 ; CMP $f3, #$20
|
||||
.byt $d0, $f3 ; BNE -
|
||||
|
||||
.byt $e8, $2c ; - MOV A, #$6c
|
||||
.byt $c4, $f2 ; MOV $f2, A
|
||||
.byt $e8, $00 ; MOV A, #$20
|
||||
.byt $c4, $f3 ; MOV $f3, A
|
||||
.byt $78, $00, $f3 ; CMP $f3, #$20
|
||||
.byt $d0, $f3 ; BNE -
|
||||
|
||||
.byt $e8, $3c ; - MOV A, #$6c
|
||||
.byt $c4, $f2 ; MOV $f2, A
|
||||
.byt $e8, $00 ; MOV A, #$20
|
||||
.byt $c4, $f3 ; MOV $f3, A
|
||||
.byt $78, $00, $f3 ; CMP $f3, #$20
|
||||
.byt $d0, $f3 ; BNE -
|
||||
|
||||
.byt $2f, $fe ; - BRA -
|
||||
|
||||
@ -49,10 +49,12 @@ setup_hdma:
|
||||
sty $4332
|
||||
sta $4334
|
||||
|
||||
ldx #184 ;Set IRQ trigger to line 184
|
||||
ldx #185 ;Set IRQ trigger to line 185
|
||||
stx $4209 ;
|
||||
lda #$a1 ;NMI + V-Count IRQ + Auto Joypad Read
|
||||
lda #$21 ;V-Count IRQ + Auto Joypad Read
|
||||
sta $4200
|
||||
lda #$0e
|
||||
sta $420c
|
||||
rts
|
||||
|
||||
|
||||
|
||||
@ -9,23 +9,22 @@ RESET:
|
||||
jmp @GAME_MAIN
|
||||
|
||||
NMI_16bit:
|
||||
php
|
||||
rep #$30 : .al : .xl
|
||||
pha: phx: phy: phd: phb
|
||||
jsl @NMI_ROUTINE
|
||||
rep #$30 : .al : .xl
|
||||
int_exit:
|
||||
plb: pld: ply: plx: pla
|
||||
plp
|
||||
pha
|
||||
sep #$20 : .as
|
||||
lda $4210 ; ack interrupt
|
||||
lda #$0e
|
||||
sta $420c ; enable HDMA ch. 1-3
|
||||
pla
|
||||
rti
|
||||
|
||||
IRQ_16bit:
|
||||
php
|
||||
rep #$30 : .al : .xl
|
||||
pha: phx: phy: phd: phb
|
||||
jsl @IRQ_ROUTINE
|
||||
rep #$30 : .al : .xl
|
||||
bra int_exit
|
||||
pha
|
||||
sep #$20 : .as
|
||||
lda #$01
|
||||
sta isr_flag
|
||||
lda $4211 ;Acknowledge irq
|
||||
pla
|
||||
rti
|
||||
|
||||
;error vectors
|
||||
ABT_8bit: ABT_16bit:
|
||||
|
||||
@ -6,6 +6,7 @@ GAME_MAIN:
|
||||
jsr killdma
|
||||
jsr waitblank
|
||||
jsr snes_init
|
||||
jsr spc_upload
|
||||
lda #$01
|
||||
sta $420d ; fast cpu
|
||||
jsr setup_gfx
|
||||
@ -148,8 +149,7 @@ snes_init:
|
||||
stz $420a ;
|
||||
stz $420b ;
|
||||
stz $420c ;
|
||||
lda #$01
|
||||
sta $420d ; FAAAAAST
|
||||
stz $420d ; FAAAAAST
|
||||
lda #$8f
|
||||
sta $2100 ;INIDISP: force blank
|
||||
stz $2101 ;
|
||||
|
||||
@ -9,6 +9,10 @@ msu1init:
|
||||
stx MSU_SEEK_BANK
|
||||
- bit MSU_STATUS
|
||||
bmi -
|
||||
|
||||
stx MSU_TRACK
|
||||
- bit MSU_STATUS
|
||||
bvs -
|
||||
ldx #$0000
|
||||
stx $2116
|
||||
|
||||
@ -27,6 +31,8 @@ msu1loop:
|
||||
sep #$20 : .as
|
||||
rep #$10 : .xl
|
||||
stz dispcnt
|
||||
lda #$01
|
||||
sta MSU_CONTROL
|
||||
msu1loop2
|
||||
lda isr_flag
|
||||
beq msu1loop2
|
||||
@ -45,7 +51,6 @@ msu1loop2
|
||||
cmp #$02
|
||||
bne msu1loop2
|
||||
|
||||
stz dispcnt
|
||||
;load palette
|
||||
stz $2121
|
||||
lda #$22
|
||||
@ -56,6 +61,7 @@ msu1loop2
|
||||
stx $4305
|
||||
lda #$01
|
||||
sta $420b
|
||||
stz dispcnt
|
||||
lda charptr
|
||||
bne ptr2
|
||||
ptr1
|
||||
@ -64,10 +70,10 @@ ptr1
|
||||
sta charptr
|
||||
ldx #$0000
|
||||
stx $2116
|
||||
bra msu1loop2
|
||||
jmp msu1loop2
|
||||
ptr2
|
||||
stz $210b
|
||||
stz charptr
|
||||
ldx #$4000
|
||||
stx $2116
|
||||
bra msu1loop2
|
||||
jmp msu1loop2
|
||||
|
||||
@ -11,16 +11,20 @@
|
||||
; NMI - called on VBlank
|
||||
NMI_ROUTINE:
|
||||
sep #$20 : .as
|
||||
pha
|
||||
lda $4210 ; ack interrupt
|
||||
lda #$0e
|
||||
sta $420c ; enable HDMA ch. 1-3
|
||||
; lda #$0e
|
||||
; sta $420c ; enable HDMA ch. 1-3
|
||||
pla
|
||||
rtl
|
||||
|
||||
; IRQ - called when triggered
|
||||
IRQ_ROUTINE:
|
||||
sep #$20 : .as
|
||||
pha
|
||||
lda $4211 ;Acknowledge irq
|
||||
lda #$01
|
||||
sta isr_flag
|
||||
lda $4211 ;Acknowledge irq
|
||||
pla
|
||||
rtl
|
||||
|
||||
|
||||
50
snes/msu1/spc.a65
Normal file
50
snes/msu1/spc.a65
Normal file
@ -0,0 +1,50 @@
|
||||
spc_upload:
|
||||
rep #$20 : .al
|
||||
sep #$10 : .xs
|
||||
|
||||
lda #$bbaa ; wait for IPL bootup
|
||||
- cmp $2140
|
||||
bne -
|
||||
|
||||
; IPL protocol: $2142-3 = target address
|
||||
lda @spcaddr
|
||||
sta $2142
|
||||
ldx #$01
|
||||
stx $2141
|
||||
ldx #$cc
|
||||
stx $2140
|
||||
; wait for echo
|
||||
- cpx $2140
|
||||
bne -
|
||||
|
||||
; init counters
|
||||
sep #$20 : .as
|
||||
ldx #$00 ; sequence counter
|
||||
lda @spclen
|
||||
tay ; countdown
|
||||
spc_loop
|
||||
lda @spccode, x ; fill data byte
|
||||
sta $2141 ; write data...
|
||||
stx $2140 ; ...and write sequence counter
|
||||
- cpx $2140 ; wait for echo from IPL
|
||||
bne -
|
||||
inx ; increment sequence counter...
|
||||
dey
|
||||
bne spc_loop ; if not, do it again
|
||||
|
||||
spc_end
|
||||
rep #$20 : .al
|
||||
lda @spcexec
|
||||
sta $2142
|
||||
stz $2141 ; data = 0
|
||||
ldx $2140
|
||||
inx
|
||||
inx
|
||||
stx $2140 ; send sequence end / execute
|
||||
- cpx $2140 ; wait for last echo
|
||||
bne -
|
||||
|
||||
sep #$20 : .as
|
||||
rep #$10 : .xl
|
||||
|
||||
rts ; and done!
|
||||
Loading…
x
Reference in New Issue
Block a user