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