sd2snes/snes/msu1/spc.a65
ikari b964f1fa7b MSU1 video player update (framerate support)
There is now a small header for the MSU video files:

 uint16_t framecount;
 uint8_t  std_frameduration;
 uint8_t  alt_frameduration;
 uint8_t  alt_durfreq;

framecount is the number of frames in the video.
std_frameduration is the usual duration of a video frame in SNES video frames.
alt_frameduration is an alternate duration
alt_durfreq specifies after how many frames the alternate duration should be used for a single video frame. The frame counter is reset afterwards.

This allows to use simple pulldown patterns.
e.g. for a 29.97fps video you need 2:2 pulldown (display every video frame for two SNES video frames).
In this case, std_frameduration, alt_frameduration, alt_durfreq are: 2, 2, x (any number is good for the freq in this case)
For 23.976fps video one would do 3:2 pulldown (displaying every other video frame for three SNES video frames).
The format would be: 2, 3, 1

Frame size is always 224x144, 32512 bytes (4 tiles wasted to save tilemap memory), followed by 512 bytes of palette.
2010-12-31 03:07:22 +01:00

57 lines
1002 B
Plaintext

spc_upload:
rep #$20 : .al
sep #$10 : .xs
lda #$bbaa ; wait for IPL bootup
- cmp $2140
bne -
; IPL portmap outside transfer state:
; $2141 = command (transfer / run)
; $2142-3 = target address
; $2140 = trigger
lda @spcaddr
sta $2142
ldx #$01 ; transfer
stx $2141
ldx #$cc
stx $2140
; wait for echo
- cpx $2140
bne -
; IPL portmap inside transfer state:
; $2140 = sequence number
; $2141 = payload
; 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 ; set exec address
stz $2141 ; command: run
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!