From fd93e04b9b20e22eaa833d324920dc819f8fdad6 Mon Sep 17 00:00:00 2001 From: "fabio.olimpieri" Date: Fri, 19 Apr 2013 12:03:15 +0000 Subject: [PATCH] Fix tape loading; Speedlock 4-7, Softlock and Powerload work now --- src/computer.c | 1 + src/tape.c | 22 +++++++++++----------- src/tape_browser.c | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/computer.c b/src/computer.c index e6df424..0d1f836 100644 --- a/src/computer.c +++ b/src/computer.c @@ -1717,6 +1717,7 @@ void ResetComputer () { ordenador.tape_stop = 1; ordenador.tape_stop_fast = 1; ordenador.stop_tape_start_countdown = 0; + ordenador.tape_current_bit = 0; if (ordenador.rewind_on_reset) { diff --git a/src/tape.c b/src/tape.c index ec2b0ce..bd9e950 100644 --- a/src/tape.c +++ b/src/tape.c @@ -302,8 +302,8 @@ inline void tape_read_tzx (FILE * fichero, int tstados) { ordenador.tape_pause_at_end = ((unsigned int) value2) + 256 * ((unsigned int) value3); - if(ordenador.tape_pause_at_end==0) - ordenador.tape_pause_at_end=10; // to avoid problems + //if(ordenador.tape_pause_at_end==0) + //ordenador.tape_pause_at_end=10; // to avoid problems ordenador.tape_pause_at_end *= 3500; retval=fread (&value, 1, 1, fichero); @@ -323,7 +323,7 @@ inline void tape_read_tzx (FILE * fichero, int tstados) { ordenador.tape_current_mode = TAP_GUIDE; ordenador.tape_counter0 = ordenador.tape_block_level; ordenador.tape_counter1 = ordenador.tape_block_level; - ordenador.tape_current_bit = 0; + //ordenador.tape_current_bit = 0; break; case 0x12: // pure tone @@ -356,10 +356,10 @@ inline void tape_read_tzx (FILE * fichero, int tstados) { } break; - case 0x14: // turbo tape block + case 0x14: // pure data done = 1; bucle = 0; - ordenador.tape_current_bit = 0; + //ordenador.tape_current_bit = 0; retval=fread(&value2,1,1,fichero); retval=fread(&value3,1,1,fichero); ordenador.tape_bit0_level = ((unsigned int) value2) + 256 * ((unsigned int) value3); @@ -576,7 +576,7 @@ inline void tape_read_tzx (FILE * fichero, int tstados) { return; } else { // guide tone ended. send sync tone ordenador.tape_counter0 = ordenador.tape_sync_level0 - tstados; - ordenador.tape_counter1 = ordenador.tape_sync_level0; // new pulse + ordenador.tape_counter1 = ordenador.tape_sync_level1; // new pulse ordenador.tape_current_mode = TAP_DATA; // data mode ordenador.tape_bit = 0x80; // from bit0 to bit7 if((ordenador.tape_byte_counter==1)&&(ordenador.tape_bits_at_end!=8)) { // last byte @@ -631,8 +631,8 @@ inline void tape_read_tzx (FILE * fichero, int tstados) { break; case TAP_PAUSE: // pause - ordenador.tape_readed = 0; - ordenador.tape_current_bit = 0; + //ordenador.tape_readed = 0; + //ordenador.tape_current_bit = 0; if (ordenador.tape_counter_rep > tstados) { ordenador.tape_counter_rep -= tstados; } else { @@ -642,8 +642,8 @@ inline void tape_read_tzx (FILE * fichero, int tstados) { } break; case TAP_PAUSE2: // pause and stop - ordenador.tape_readed = 0; - ordenador.tape_current_bit = 0; + //ordenador.tape_readed = 0; + //ordenador.tape_current_bit = 0; if (ordenador.tape_counter_rep > tstados) { ordenador.tape_counter_rep -= tstados; } else { @@ -1031,7 +1031,7 @@ void fastload_block_tzx (FILE * fichero) { retorno=2; break; - case 0x14: // turbo tape block + case 0x14: // pure data retorno=2; break; diff --git a/src/tape_browser.c b/src/tape_browser.c index 817fe5c..d5b99d9 100644 --- a/src/tape_browser.c +++ b/src/tape_browser.c @@ -75,7 +75,7 @@ void create_browser_tzx (FILE * fichero) { browser_list[block_number]->position=byte_position; strcpy(browser_list[block_number]->info, " "); - printf("TZX browser: %X en %d\n",blockid, byte_position); + printf("TZX browser: %X en %d\n",blockid, byte_position+1); switch(blockid) { case 0x10: // classic tape block