MSU1 video player frame rate support
This commit is contained in:
parent
fc4885b5df
commit
d11f36f630
@ -1,9 +1,14 @@
|
||||
.data
|
||||
|
||||
framecnt .word 0
|
||||
dispcnt .byt 0
|
||||
|
||||
charaddr .word 0
|
||||
stddur .byt 0
|
||||
altdur .byt 0
|
||||
altcnt .byt 0
|
||||
curdur .byt 0
|
||||
curcnt .byt 0
|
||||
numframes .word 0
|
||||
firstframe .byt 0
|
||||
charptr .byt 0
|
||||
|
||||
;----------parameters for dma----------
|
||||
|
||||
@ -25,18 +25,39 @@ msu1init:
|
||||
stx $4302
|
||||
stz $4304
|
||||
|
||||
lda #$01
|
||||
sta firstframe
|
||||
|
||||
rts
|
||||
|
||||
|
||||
msu1loop:
|
||||
sep #$20 : .as
|
||||
rep #$10 : .xl
|
||||
stz dispcnt
|
||||
lda #$01
|
||||
sta MSU_CONTROL
|
||||
lda $2001
|
||||
sta numframes
|
||||
lda $2001
|
||||
sta numframes+1
|
||||
lda $2001
|
||||
sta curdur
|
||||
sta stddur
|
||||
lda $2001
|
||||
sta altdur
|
||||
lda $2001
|
||||
sta altcnt
|
||||
stz curcnt
|
||||
ldy numframes
|
||||
dey
|
||||
|
||||
msu1loop2
|
||||
lda isr_flag
|
||||
beq msu1loop2
|
||||
stz isr_flag
|
||||
lda dispcnt
|
||||
cmp #$02
|
||||
beq +
|
||||
bpl +
|
||||
;load half picture
|
||||
lda #$18
|
||||
sta $4301
|
||||
@ -46,11 +67,32 @@ msu1loop2
|
||||
stx $4305
|
||||
lda #$01
|
||||
sta $420b
|
||||
inc dispcnt
|
||||
+ inc dispcnt
|
||||
lda dispcnt
|
||||
cmp #$02
|
||||
cmp curdur
|
||||
bne msu1loop2
|
||||
|
||||
lda firstframe
|
||||
beq +
|
||||
|
||||
lda #$01
|
||||
sta MSU_CONTROL
|
||||
stz firstframe
|
||||
|
||||
+
|
||||
inc curcnt
|
||||
lda curcnt
|
||||
cmp altcnt
|
||||
bne +
|
||||
stz curcnt
|
||||
lda altdur
|
||||
bra skip
|
||||
+ lda stddur
|
||||
skip sta curdur
|
||||
stz dispcnt
|
||||
dey
|
||||
beq msu1stop
|
||||
|
||||
;load palette
|
||||
stz $2121
|
||||
lda #$22
|
||||
@ -61,7 +103,6 @@ msu1loop2
|
||||
stx $4305
|
||||
lda #$01
|
||||
sta $420b
|
||||
stz dispcnt
|
||||
lda charptr
|
||||
bne ptr2
|
||||
ptr1
|
||||
@ -77,3 +118,11 @@ ptr2
|
||||
ldx #$4000
|
||||
stx $2116
|
||||
jmp msu1loop2
|
||||
|
||||
msu1stop:
|
||||
lda #$80
|
||||
sta $2100
|
||||
stz $420c
|
||||
stz MSU_CONTROL
|
||||
- bra -
|
||||
|
||||
|
||||
@ -76,13 +76,18 @@ int main(int argc, char **argv) {
|
||||
char inpal[768], outpal[512];
|
||||
|
||||
FILE *in, *out;
|
||||
int fileno;
|
||||
int fileno=1;
|
||||
uint16_t numcolors;
|
||||
char filename[80];
|
||||
out=fopen("out.msu", "wb");
|
||||
for(fileno = 1; fileno < 9290; fileno++) {
|
||||
sprintf(filename, "%08d.tga", fileno);
|
||||
in=fopen(filename, "rb");
|
||||
uint8_t numframes_l, numframes_h;
|
||||
uint8_t std_frameduration = 2;
|
||||
uint8_t alt_frameduration = 0;
|
||||
uint8_t alt_durfreq = 0;
|
||||
fwrite(&filename, 5, 1, out); /* write padding for now */
|
||||
while(1) {
|
||||
sprintf(filename, "%08d.tga", fileno++);
|
||||
if((in=fopen(filename, "rb"))==NULL) break;
|
||||
fseek(in, 5, SEEK_SET);
|
||||
fread(&numcolors, 2, 1, in);
|
||||
fseek(in, 18, SEEK_SET);
|
||||
@ -99,6 +104,14 @@ int main(int argc, char **argv) {
|
||||
convertpalette(inpal, outpal);
|
||||
fwrite(outpal, 512, 1, out);
|
||||
}
|
||||
numframes_l=fileno&0xff;
|
||||
numframes_h=fileno>>8;
|
||||
fseek(out, 0, SEEK_SET);
|
||||
fwrite(&numframes_l, 1, 1, out);
|
||||
fwrite(&numframes_h, 1, 1, out);
|
||||
fwrite(&std_frameduration, 1, 1, out);
|
||||
fwrite(&alt_frameduration, 1, 1, out);
|
||||
fwrite(&alt_durfreq, 1, 1, out);
|
||||
fclose(out);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user