Pause time before playing tape taken from tzx file, fixed bug in tzx tape (case 2A)

This commit is contained in:
fabio.olimpieri 2013-02-10 20:47:29 +00:00
parent b1b2f85992
commit 0a281faeba

View File

@ -428,6 +428,8 @@ inline void tape_read_tzx (FILE * fichero, int tstados) {
break; break;
case 0x2A: // pause if 48K case 0x2A: // pause if 48K
for(bucle=0;bucle<4;bucle++)
retval=fread(&value,1,1,fichero);
if(ordenador.mode128k==0) { if(ordenador.mode128k==0) {
ordenador.pause = 1; ordenador.pause = 1;
return; return;
@ -883,12 +885,13 @@ void fastload_block_tzx (FILE * fichero) {
*/ */
unsigned int longitud, len, bucle, number_bytes, byte_position; unsigned int longitud, len, bucle, number_bytes, byte_position;
unsigned char value[65536], empty, blockid, parity; unsigned char value[65536], empty, blockid, parity, pause[2];
int retval; int retval, retval2;
//ordenador.other_ret = 1; // next instruction must be RET //ordenador.other_ret = 1; // next instruction must be RET
procesador.PC=0x5e2; procesador.PC=0x5e2;
longitud =0; longitud =0;
pause[0]=pause[1]=0;
if (!(procesador.Ra.br.F & F_C)) { // if Carry=0, is VERIFY, so return OK if (!(procesador.Ra.br.F & F_C)) { // if Carry=0, is VERIFY, so return OK
procesador.Rm.br.F |= F_C; // verify OK procesador.Rm.br.F |= F_C; // verify OK
@ -927,9 +930,9 @@ void fastload_block_tzx (FILE * fichero) {
printf("TZX: ID_fast: %X en %ld\n",blockid,ftell(fichero)); printf("TZX: ID_fast: %X en %ld\n",blockid,ftell(fichero));
switch(blockid) { switch(blockid) {
case 0x10: // classic tape block case 0x10: // classic tape block
retval=fread (value, 1, 2, fichero); //pause lenght retval=fread (pause, 1, 2, fichero); //pause lenght
retval=fread (value, 1, 2, fichero); // read length of current block retval2=fread (value, 1, 2, fichero); // read length of current block
if (retval!=2) if ((retval!=2)||(retval2!=2))
{ {
procesador.Rm.br.F &= (~F_C); // Load error procesador.Rm.br.F &= (~F_C); // Load error
procesador.Rm.wr.IX += procesador.Rm.wr.DE; procesador.Rm.wr.IX += procesador.Rm.wr.DE;
@ -1003,6 +1006,10 @@ void fastload_block_tzx (FILE * fichero) {
case 0x2A: // pause if 48K case 0x2A: // pause if 48K
retval=fread(value,1,4,fichero); retval=fread(value,1,4,fichero);
if(ordenador.mode128k==0) {
ordenador.pause = 1;
return;
}
break; break;
case 0x30: // text description case 0x30: // text description
@ -1159,9 +1166,19 @@ void fastload_block_tzx (FILE * fichero) {
if (retval==5) if (retval==5)
if ((value[4]!=0x0)&&(value[4]!=0xFF)) blockid=0x11; //custom data if ((value[4]!=0x0)&&(value[4]!=0xFF)) blockid=0x11; //custom data
} }
if ((blockid==0x11)||(blockid==0x12)||(blockid==0x13)||(blockid==0x14)||(blockid==0x21)||(blockid==0x24)) ordenador.tape_start_countdwn=80; //autoplay countdown if ((blockid==0x11)||(blockid==0x12)||(blockid==0x13)||(blockid==0x14)||(blockid==0x21)||(blockid==0x24))
fseek(fichero, byte_position, SEEK_SET); {
//Anticipate auto ultra fast mode
if ((ordenador.turbo_state!= 1)&&(ordenador.turbo==1))
{
update_frequency(10000000);
jump_frames=7;
ordenador.turbo_state=4;
}
ordenador.tape_start_countdwn=((unsigned int)pause[0]+256*(unsigned int)pause[1])/30+1; //autoplay countdown
}
fseek(fichero, byte_position, SEEK_SET);
} }
return; return;