From: <fr...@us...> - 2016-08-10 12:03:23
|
Revision: 5724 http://sourceforge.net/p/fuse-emulator/code/5724 Author: fredm Date: 2016-08-10 12:03:21 +0000 (Wed, 10 Aug 2016) Log Message: ----------- TZX spec says that 0 duration pauses should have no effect on the current level. Modified Paths: -------------- trunk/libspectrum/hacking/ChangeLog trunk/libspectrum/tape.c Modified: trunk/libspectrum/hacking/ChangeLog =================================================================== --- trunk/libspectrum/hacking/ChangeLog 2016-08-07 22:07:22 UTC (rev 5723) +++ trunk/libspectrum/hacking/ChangeLog 2016-08-10 12:03:21 UTC (rev 5724) @@ -1100,3 +1100,5 @@ 20160801 zip.c: activate the const-enabled zlib API (Sergio). 20160802 zip.c: avoid mixing declarations and code for C89 compilers (Sergio). 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). Modified: trunk/libspectrum/tape.c =================================================================== --- trunk/libspectrum/tape.c 2016-08-07 22:07:22 UTC (rev 5723) +++ trunk/libspectrum/tape.c 2016-08-10 12:03:21 UTC (rev 5724) @@ -528,6 +528,21 @@ &(tape->state) ); } +/* TZX pauses should have no edge if there is no duration, from the spec: + A 'Pause' block of zero duration is completely ignored, so the 'current pulse + level' will NOT change in this case. This also applies to 'Data' blocks that + have some pause duration included in them. */ +static void +do_tail_pause( libspectrum_dword *tstates, + int *end_of_block, int *flags ) +{ + *end_of_block = 1; + if( *tstates == 0 ) { + /* The tail pause is optional - if there is no tail, there is no edge */ + *flags |= LIBSPECTRUM_TAPE_FLAGS_NO_EDGE; + } +} + static libspectrum_error rom_edge( libspectrum_tape_rom_block *block, libspectrum_tape_rom_block_state *state, @@ -579,7 +594,7 @@ case LIBSPECTRUM_TAPE_STATE_PAUSE: /* The pause at the end of the block */ *tstates = block->pause_tstates; - *end_of_block = 1; + do_tail_pause( tstates, end_of_block, flags ); break; default: @@ -676,7 +691,7 @@ case LIBSPECTRUM_TAPE_STATE_PAUSE: /* The pause at the end of the block */ *tstates = block->pause_tstates; - *end_of_block = 1; + do_tail_pause( tstates, end_of_block, flags ); break; default: @@ -784,7 +799,7 @@ case LIBSPECTRUM_TAPE_STATE_PAUSE: /* The pause at the end of the block */ *tstates = block->pause_tstates; - *end_of_block = 1; + do_tail_pause( tstates, end_of_block, flags ); break; default: @@ -857,7 +872,7 @@ case LIBSPECTRUM_TAPE_STATE_PAUSE: /* The pause at the end of the block */ *tstates = block->pause_tstates; - *end_of_block = 1; + do_tail_pause( tstates, end_of_block, flags ); break; default: @@ -1017,7 +1032,7 @@ case LIBSPECTRUM_TAPE_STATE_PAUSE: /* The pause at the end of the block */ *tstates = block->pause_tstates; - *end_of_block = 1; + do_tail_pause( tstates, end_of_block, flags ); break; default: @@ -1185,11 +1200,7 @@ case LIBSPECTRUM_TAPE_STATE_TAIL: /* The pulse at the end of the block */ *tstates = block->tail_length; - *end_of_block = 1; - if( *tstates == 0 ) { - /* The tail pulse is optional - if there is no tail, there is no edge */ - *flags |= LIBSPECTRUM_TAPE_FLAGS_NO_EDGE; - } + do_tail_pause( tstates, end_of_block, flags ); break; default: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |