Stop in instant load

This commit is contained in:
fabio.olimpieri 2013-03-09 10:00:42 +00:00
parent 329b8e37ef
commit 66f4481760
6 changed files with 47 additions and 18 deletions

View File

@ -117,6 +117,8 @@ void computer_init () { //Called only on start-up
ordenador.tape_readed = 0; ordenador.tape_readed = 0;
ordenador.tape_stop = 1; // tape stop ordenador.tape_stop = 1; // tape stop
ordenador.tape_stop_fast = 1; // tape stop
ordenador.stop_tape_start_countdown =0;
ordenador.tape_fast_load = 1; // fast load by default ordenador.tape_fast_load = 1; // fast load by default
ordenador.rewind_on_reset = 1; //Rewound on reset by default ordenador.rewind_on_reset = 1; //Rewound on reset by default
ordenador.pause_instant_load = 0; ordenador.pause_instant_load = 0;
@ -562,7 +564,7 @@ inline void show_screen (int tstados) {
if ((ordenador.turbo_state == 0) || (curr_frames%7 == 0)) ordenador.readkeyboard = 1; if ((ordenador.turbo_state == 0) || (curr_frames%7 == 0)) ordenador.readkeyboard = 1;
curr_frames++; curr_frames++;
if (ordenador.tape_start_countdwn==1) ordenador.tape_stop=0; //Autoplay if (ordenador.tape_start_countdwn==1) ordenador.tape_stop=0; //Autoplay
if (ordenador.tape_start_countdwn>0) ordenador.tape_start_countdwn--; if ((ordenador.tape_start_countdwn>0)&&(ordenador.stop_tape_start_countdown ==0)) ordenador.tape_start_countdwn--;
if (ordenador.pause_fastload_countdwn>0) ordenador.pause_fastload_countdwn--; if (ordenador.pause_fastload_countdwn>0) ordenador.pause_fastload_countdwn--;
} }
return; return;
@ -668,7 +670,7 @@ inline void show_screen (int tstados) {
if (ordenador.tape_start_countdwn==1) ordenador.tape_stop=0; //Autoplay if (ordenador.tape_start_countdwn==1) ordenador.tape_stop=0; //Autoplay
if (ordenador.tape_start_countdwn>0) ordenador.tape_start_countdwn--; if ((ordenador.tape_start_countdwn>0)&&(ordenador.stop_tape_start_countdown ==0)) ordenador.tape_start_countdwn--;
if (ordenador.pause_fastload_countdwn>0) ordenador.pause_fastload_countdwn--; if (ordenador.pause_fastload_countdwn>0) ordenador.pause_fastload_countdwn--;
if (ordenador.mustlock) { if (ordenador.mustlock) {
@ -711,7 +713,7 @@ inline void show_screen_precision (int tstados) {
ordenador.readkeyboard = 1; ordenador.readkeyboard = 1;
curr_frames++; curr_frames++;
if (ordenador.tape_start_countdwn==1) ordenador.tape_stop=0; //Autoplay if (ordenador.tape_start_countdwn==1) ordenador.tape_stop=0; //Autoplay
if (ordenador.tape_start_countdwn>0) ordenador.tape_start_countdwn--; if ((ordenador.tape_start_countdwn>0)&&(ordenador.stop_tape_start_countdown ==0)) ordenador.tape_start_countdwn--;
if (ordenador.pause_fastload_countdwn>0) ordenador.pause_fastload_countdwn--; if (ordenador.pause_fastload_countdwn>0) ordenador.pause_fastload_countdwn--;
} }
//if (ordenador.tstados_counter > 31) ordenador.interr = 0; //if (ordenador.tstados_counter > 31) ordenador.interr = 0;
@ -915,7 +917,7 @@ inline void show_screen_precision (int tstados) {
if (ordenador.tape_start_countdwn==1) ordenador.tape_stop=0; //Autoplay if (ordenador.tape_start_countdwn==1) ordenador.tape_stop=0; //Autoplay
if (ordenador.tape_start_countdwn>0) ordenador.tape_start_countdwn--; if ((ordenador.tape_start_countdwn>0)&&(ordenador.stop_tape_start_countdown ==0)) ordenador.tape_start_countdwn--;
if (ordenador.pause_fastload_countdwn>0) ordenador.pause_fastload_countdwn--; if (ordenador.pause_fastload_countdwn>0) ordenador.pause_fastload_countdwn--;
if (ordenador.mustlock) { if (ordenador.mustlock) {
@ -1244,12 +1246,15 @@ inline void read_keyboard () {
case SDLK_F5: // STOP tape case SDLK_F5: // STOP tape
//if ((ordenador.tape_fast_load == 0)) //if ((ordenador.tape_fast_load == 0))
ordenador.tape_stop = 1; ordenador.tape_stop = 1;
ordenador.tape_start_countdwn=0; ordenador.tape_stop_fast = 1;
ordenador.stop_tape_start_countdown = 1;
break; break;
case SDLK_F6: // PLAY tape case SDLK_F6: // PLAY tape
//if (ordenador.tape_fast_load == 0) if (ordenador.tape_fast_load == 0)
ordenador.tape_stop = 0; ordenador.tape_stop = 0;
ordenador.tape_stop_fast = 0;
ordenador.stop_tape_start_countdown = 0;
break; break;
case SDLK_F9: case SDLK_F9:
@ -1552,8 +1557,12 @@ inline void read_keyboard () {
ordenador.s15 = (ordenador.s15 & 0xE0)| (ordenador.k15 ^ 0x1F); ordenador.s15 = (ordenador.s15 & 0xE0)| (ordenador.k15 ^ 0x1F);
ordenador.js = ordenador.jk; ordenador.js = ordenador.jk;
if (joybutton_matrix[0][SDLK_F6] && (ordenador.tape_fast_load == 0)) if (joybutton_matrix[0][SDLK_F6]) //Play the tape
ordenador.tape_stop = 0; //Play the tape {
ordenador.tape_stop_fast = 0;
if (ordenador.tape_fast_load == 0) ordenador.tape_stop = 0;
ordenador.stop_tape_start_countdown = 0;
}
//Virtual Keyboard //Virtual Keyboard
@ -1707,6 +1716,8 @@ void ResetComputer () {
microdrive_reset(); microdrive_reset();
ordenador.tape_stop = 1; ordenador.tape_stop = 1;
ordenador.tape_stop_fast = 1;
ordenador.stop_tape_start_countdown = 0;
if (ordenador.rewind_on_reset) if (ordenador.rewind_on_reset)
{ {

View File

@ -168,6 +168,8 @@ struct computer {
enum tapmodes tape_current_mode; enum tapmodes tape_current_mode;
enum block_type next_block; enum block_type next_block;
unsigned char tape_stop; // 1=tape stop unsigned char tape_stop; // 1=tape stop
unsigned char tape_stop_fast; // 1=tape stop
unsigned char stop_tape_start_countdown; // 1=tape stop start countdown
enum taptypes tape_file_type; enum taptypes tape_file_type;
unsigned int tape_counter0; unsigned int tape_counter0;
unsigned int tape_counter1; unsigned int tape_counter1;

View File

@ -1546,7 +1546,7 @@ int main(int argc,char *argv[]) {
/* if PC is 0x056c, a call to LD_BYTES has been made, so if /* if PC is 0x056c, a call to LD_BYTES has been made, so if
FAST_LOAD is 1, we must load the block in memory and return */ FAST_LOAD is 1, we must load the block in memory and return */
if((!ordenador.mdr_paged)&&(PC==0x056c) && (ordenador.tape_fast_load==1)) { if((!ordenador.mdr_paged)&&(PC==0x056c) && (ordenador.tape_fast_load==1)&&(ordenador.tape_stop_fast == 0)) {
if (ordenador.tap_file!=NULL) if (ordenador.tap_file!=NULL)
{ {
if (ordenador.pause_fastload_countdwn==0) if (ordenador.pause_fastload_countdwn==0)

View File

@ -439,18 +439,22 @@ static int manage_tape(int which)
retorno=-1; retorno=-1;
break; break;
case 2: //Play case 2: //Play
//if (ordenador.tape_fast_load == 0) if (ordenador.tape_fast_load == 0)
ordenador.tape_stop = 0; ordenador.tape_stop = 0;
ordenador.tape_stop_fast = 0;
ordenador.stop_tape_start_countdown = 0;
retorno=-1; retorno=-1;
break; break;
case 3: //Stop case 3: //Stop
//if (ordenador.tape_fast_load == 0) //if (ordenador.tape_fast_load == 0)
ordenador.tape_stop = 1; ordenador.tape_stop = 1;
ordenador.tape_start_countdwn=0; ordenador.tape_stop_fast = 1;
ordenador.stop_tape_start_countdown = 1;
retorno=-1; retorno=-1;
break; break;
case 4: //Rewind case 4: //Rewind
ordenador.tape_stop=1; ordenador.tape_stop=1;
ordenador.tape_stop_fast = 1;
ordenador.tape_start_countdwn=0; ordenador.tape_start_countdwn=0;
if(ordenador.tap_file!=NULL) { if(ordenador.tap_file!=NULL) {
ordenador.tape_current_mode=TAP_TRASH; ordenador.tape_current_mode=TAP_TRASH;

View File

@ -631,13 +631,16 @@ void taps_menu() {
case SDLK_ESCAPE: // to exit the help case SDLK_ESCAPE: // to exit the help
fin=0; fin=0;
break; break;
case SDLK_1: case SDLK_1: //select tape
//ordenador.tape_stop=1; ordenador.tape_stop=1;
ordenador.tape_stop_fast = 1;
ordenador.tape_start_countdwn=0;
select_tapfile(); select_tapfile();
break; break;
case SDLK_2: case SDLK_2: //rewind tape
fin=0; fin=0;
ordenador.tape_stop=1; ordenador.tape_stop=1;
ordenador.tape_stop_fast = 1;
ordenador.tape_start_countdwn=0; ordenador.tape_start_countdwn=0;
if(ordenador.tap_file!=NULL) { if(ordenador.tap_file!=NULL) {
ordenador.tape_current_mode=TAP_TRASH; ordenador.tape_current_mode=TAP_TRASH;
@ -646,8 +649,9 @@ void taps_menu() {
sprintf(ordenador.osd_text,"Tape rewound"); sprintf(ordenador.osd_text,"Tape rewound");
ordenador.osd_time=50; ordenador.osd_time=50;
break; break;
case SDLK_3: case SDLK_3: //Instant load settings
ordenador.tape_stop=1; ordenador.tape_stop=1;
ordenador.tape_stop_fast = 1;
ordenador.tape_start_countdwn=0; ordenador.tape_start_countdwn=0;
ordenador.tape_fast_load=1-ordenador.tape_fast_load; ordenador.tape_fast_load=1-ordenador.tape_fast_load;
if(ordenador.tap_file!=NULL) { if(ordenador.tap_file!=NULL) {

View File

@ -83,6 +83,7 @@ inline void tape_read_tap (FILE * fichero, int tstados) {
sprintf (ordenador.osd_text, "No tape selected"); sprintf (ordenador.osd_text, "No tape selected");
ordenador.osd_time = 100; ordenador.osd_time = 100;
ordenador.tape_stop=1; //Stop the tape ordenador.tape_stop=1; //Stop the tape
ordenador.tape_stop_fast=1; //Stop the tape
return; return;
} }
@ -189,6 +190,7 @@ inline void tape_read_tap (FILE * fichero, int tstados) {
case TAP_STOP: case TAP_STOP:
ordenador.tape_current_mode = TAP_TRASH; // initialize ordenador.tape_current_mode = TAP_TRASH; // initialize
ordenador.tape_stop = 1; // pause it ordenador.tape_stop = 1; // pause it
ordenador.tape_stop_fast = 1; // pause it
break; break;
default: default:
break; break;
@ -209,6 +211,7 @@ inline void tape_read_tzx (FILE * fichero, int tstados) {
sprintf (ordenador.osd_text, "No tape selected"); sprintf (ordenador.osd_text, "No tape selected");
ordenador.osd_time = 100; ordenador.osd_time = 100;
ordenador.tape_stop=1; //Stop the tape ordenador.tape_stop=1; //Stop the tape
ordenador.tape_stop_fast = 1; // pause it
return; return;
} }
@ -445,7 +448,7 @@ inline void tape_read_tzx (FILE * fichero, int tstados) {
retval=fread(&value,1,1,fichero); retval=fread(&value,1,1,fichero);
if(ordenador.mode128k==0) { if(ordenador.mode128k==0) {
ordenador.tape_stop = 1; ordenador.tape_stop = 1;
ordenador.tape_start_countdwn=0; ordenador.tape_stop_fast = 1; // pause it
return; return;
} }
break; break;
@ -633,6 +636,7 @@ inline void tape_read_tzx (FILE * fichero, int tstados) {
ordenador.tape_current_mode = TAP_TRASH; // read new block ordenador.tape_current_mode = TAP_TRASH; // read new block
ordenador.next_block= NOBLOCK; ordenador.next_block= NOBLOCK;
ordenador.tape_stop = 1; ordenador.tape_stop = 1;
ordenador.tape_stop_fast = 1; // pause it
} }
break; break;
case TZX_PURE_TONE: case TZX_PURE_TONE:
@ -663,6 +667,7 @@ inline void tape_read_tzx (FILE * fichero, int tstados) {
ordenador.tape_current_mode = TAP_TRASH; // initialize ordenador.tape_current_mode = TAP_TRASH; // initialize
ordenador.next_block= NOBLOCK; ordenador.next_block= NOBLOCK;
ordenador.tape_stop = 1; // pause it ordenador.tape_stop = 1; // pause it
ordenador.tape_stop_fast = 1; // pause it
break; break;
default: default:
break; break;
@ -681,6 +686,7 @@ void rewind_tape(FILE *fichero,unsigned char pause) {
retval=fread(&value,1,1,ordenador.tap_file); // jump over the header retval=fread(&value,1,1,ordenador.tap_file); // jump over the header
ordenador.next_block= NOBLOCK; ordenador.next_block= NOBLOCK;
ordenador.tape_stop=pause; ordenador.tape_stop=pause;
ordenador.tape_stop_fast=pause;
if (pause) ordenador.tape_start_countdwn=0; //Stop tape play countdown if (pause) ordenador.tape_start_countdwn=0; //Stop tape play countdown
} }
@ -1044,7 +1050,9 @@ void fastload_block_tzx (FILE * fichero) {
break; break;
case 0x2A: // pause if 48K case 0x2A: // pause if 48K
retorno=2; ordenador.tape_stop_fast=1;
fseek(fichero, byte_position, SEEK_SET);
return;
break; break;
case 0x30: // text description case 0x30: // text description
@ -1107,7 +1115,7 @@ void fastload_block_tzx (FILE * fichero) {
if (retorno==2) if (retorno==2)
{ {
fseek(fichero, byte_position, SEEK_SET); fseek(fichero, byte_position, SEEK_SET);
ordenador.tape_stop=1; //Start the tape ordenador.tape_stop=0; //Start the tape
return; return;
} }