From: <fr...@us...> - 2016-08-11 12:18:15
|
Revision: 5725 http://sourceforge.net/p/fuse-emulator/code/5725 Author: fredm Date: 2016-08-11 12:18:13 +0000 (Thu, 11 Aug 2016) Log Message: ----------- Fix playback of TZX GDB blocks with no pilot tones. Modified Paths: -------------- trunk/libspectrum/hacking/ChangeLog trunk/libspectrum/tape.c trunk/libspectrum/tape_block.c trunk/libspectrum/tape_block.h trunk/libspectrum/test/test.c trunk/libspectrum/test/test.h trunk/libspectrum/test/test_edges.c Added Paths: ----------- trunk/libspectrum/test/no-pilot-gdb.tzx Modified: trunk/libspectrum/hacking/ChangeLog =================================================================== --- trunk/libspectrum/hacking/ChangeLog 2016-08-10 12:03:21 UTC (rev 5724) +++ trunk/libspectrum/hacking/ChangeLog 2016-08-11 12:18:13 UTC (rev 5725) @@ -1102,3 +1102,5 @@ 20160802 zip.c: minor tweaks to make things a bit more idiomatic (Fred). 20160810 tape.c: TZX spec says that 0 duration pauses should have no effect on the current level (Fred). +20160810 tape.c,tape_block.[ch],test/{no-pilot-gdb.tzx,test.[ch],test_edges.c}: + fix playback of TZX GDB blocks with no pilot tones (Fred). Modified: trunk/libspectrum/tape.c =================================================================== --- trunk/libspectrum/tape.c 2016-08-10 12:03:21 UTC (rev 5724) +++ trunk/libspectrum/tape.c 2016-08-11 12:18:13 UTC (rev 5725) @@ -932,7 +932,7 @@ return r; } -static libspectrum_byte +libspectrum_byte get_generalised_data_symbol( libspectrum_tape_generalised_data_block *block, libspectrum_tape_generalised_data_block_state *state ) { Modified: trunk/libspectrum/tape_block.c =================================================================== --- trunk/libspectrum/tape_block.c 2016-08-10 12:03:21 UTC (rev 5724) +++ trunk/libspectrum/tape_block.c 2016-08-11 12:18:13 UTC (rev 5725) @@ -348,9 +348,6 @@ generalised_data_init( libspectrum_tape_generalised_data_block *block, libspectrum_tape_generalised_data_block_state *state ) { - state->state = block->pilot_table.symbols_in_block ? - LIBSPECTRUM_TAPE_STATE_PILOT : LIBSPECTRUM_TAPE_STATE_DATA1; - state->run = 0; state->symbols_through_run = 0; state->edges_through_symbol = 0; @@ -362,6 +359,16 @@ state->bits_through_byte = 0; state->bytes_through_stream = 0; + if( block->pilot_table.symbols_in_block ) { + state->state = LIBSPECTRUM_TAPE_STATE_PILOT; + } else if( block->data_table.symbols_in_block ) { + state->state = LIBSPECTRUM_TAPE_STATE_DATA1; + state->current_byte = block->data[ 0 ]; + state->current_symbol = get_generalised_data_symbol( block, state ); + } else { + state->state = LIBSPECTRUM_TAPE_STATE_PAUSE; + } + return LIBSPECTRUM_ERROR_NONE; } Modified: trunk/libspectrum/tape_block.h =================================================================== --- trunk/libspectrum/tape_block.h 2016-08-10 12:03:21 UTC (rev 5724) +++ trunk/libspectrum/tape_block.h 2016-08-11 12:18:13 UTC (rev 5725) @@ -503,6 +503,9 @@ void libspectrum_tape_raw_data_next_bit( libspectrum_tape_raw_data_block *block, libspectrum_tape_raw_data_block_state *state ); +libspectrum_byte +get_generalised_data_symbol( libspectrum_tape_generalised_data_block *block, + libspectrum_tape_generalised_data_block_state *state ); libspectrum_error generalised_data_edge( libspectrum_tape_generalised_data_block *block, libspectrum_tape_generalised_data_block_state *state, Added: trunk/libspectrum/test/no-pilot-gdb.tzx =================================================================== (Binary files differ) Index: trunk/libspectrum/test/no-pilot-gdb.tzx =================================================================== --- trunk/libspectrum/test/no-pilot-gdb.tzx 2016-08-10 12:03:21 UTC (rev 5724) +++ trunk/libspectrum/test/no-pilot-gdb.tzx 2016-08-11 12:18:13 UTC (rev 5725) Property changes on: trunk/libspectrum/test/no-pilot-gdb.tzx ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Modified: trunk/libspectrum/test/test.c =================================================================== --- trunk/libspectrum/test/test.c 2016-08-10 12:03:21 UTC (rev 5724) +++ trunk/libspectrum/test/test.c 2016-08-11 12:18:13 UTC (rev 5725) @@ -770,6 +770,7 @@ { test_26, "Writing +3 .Z80 file", 0 }, { test_27, "Reading old SZX file", 0 }, { test_28, "Zero tail length PZX file", 0 }, + { test_29, "No pilot pulse GDB TZX file", 0 }, }; static size_t test_count = ARRAY_SIZE( tests ); Modified: trunk/libspectrum/test/test.h =================================================================== --- trunk/libspectrum/test/test.h 2016-08-10 12:03:21 UTC (rev 5724) +++ trunk/libspectrum/test/test.h 2016-08-11 12:18:13 UTC (rev 5725) @@ -30,5 +30,6 @@ test_return_t test_15( void ); test_return_t test_28( void ); +test_return_t test_29( void ); #endif Modified: trunk/libspectrum/test/test_edges.c =================================================================== --- trunk/libspectrum/test/test_edges.c 2016-08-10 12:03:21 UTC (rev 5724) +++ trunk/libspectrum/test/test_edges.c 2016-08-11 12:18:13 UTC (rev 5725) @@ -142,3 +142,56 @@ return check_edges( DYNAMIC_TEST_PATH( "zero-tail.pzx" ), zero_tail_edges_list, 0x1ff ); } + +static test_edge_sequence_t +no_pilot_gdb_list[] = +{ + /* Set signal level block */ + { 0, 1, 17 }, /* Set signal level low, end of block */ + + /* GDB with 0 tail */ + { 771, 1, 0 }, /* Byte 1, bit 1, pulse 1 */ + { 1542, 1, 0 }, /* Byte 1, bit 1, pulse 2 */ + { 771, 1, 0 }, /* Byte 1, bit 2, pulse 1 */ + { 1542, 1, 0 }, /* Byte 1, bit 2, pulse 2 */ + { 771, 1, 0 }, /* Byte 1, bit 3, pulse 1 */ + { 1542, 1, 0 }, /* Byte 1, bit 3, pulse 2 */ + { 771, 1, 0 }, /* Byte 1, bit 4, pulse 1 */ + { 1542, 1, 0 }, /* Byte 1, bit 4, pulse 2 */ + { 771, 1, 0 }, /* Byte 1, bit 5, pulse 1 */ + { 1542, 1, 0 }, /* Byte 1, bit 5, pulse 2 */ + { 771, 1, 0 }, /* Byte 1, bit 6, pulse 1 */ + { 1542, 1, 0 }, /* Byte 1, bit 6, pulse 2 */ + { 771, 1, 0 }, /* Byte 1, bit 7, pulse 1 */ + { 1542, 1, 0 }, /* Byte 1, bit 7, pulse 2 */ + { 771, 1, 0 }, /* Byte 1, bit 8, pulse 1 */ + { 1542, 1, 0 }, /* Byte 1, bit 8, pulse 2 */ + { 771, 1, 0 }, /* Byte 2, bit 1, pulse 1 */ + { 1542, 1, 0 }, /* Byte 2, bit 1, pulse 2 */ + { 771, 1, 0 }, /* Byte 2, bit 2, pulse 1 */ + { 1542, 1, 0 }, /* Byte 2, bit 2, pulse 2 */ + { 771, 1, 0 }, /* Byte 2, bit 3, pulse 1 */ + { 1542, 1, 0 }, /* Byte 2, bit 3, pulse 2 */ + { 771, 1, 0 }, /* Byte 2, bit 4, pulse 1 */ + { 1542, 1, 0 }, /* Byte 2, bit 4, pulse 2 */ + { 771, 1, 0 }, /* Byte 2, bit 5, pulse 1 */ + { 1542, 1, 0 }, /* Byte 2, bit 5, pulse 2 */ + { 771, 1, 0 }, /* Byte 2, bit 6, pulse 1 */ + { 1542, 1, 0 }, /* Byte 2, bit 6, pulse 2 */ + { 771, 1, 0 }, /* Byte 2, bit 7, pulse 1 */ + { 1542, 1, 0 }, /* Byte 2, bit 7, pulse 2 */ + { 771, 1, 0 }, /* Byte 2, bit 8, pulse 1 */ + { 1542, 1, 0 }, /* Byte 2, bit 8, pulse 2 */ + { 0, 1, 259 }, /* End of block, end of tape, stop the tape (normally no + edge but not at end of tape) */ + + { -1, 0, 0 } /* End marker */ + +}; + +test_return_t +test_29( void ) +{ + return check_edges( DYNAMIC_TEST_PATH( "no-pilot-gdb.tzx" ), + no_pilot_gdb_list, 0x1ff ); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |