From: <fr...@us...> - 2011-05-14 14:10:14
|
Revision: 4436 http://fuse-emulator.svn.sourceforge.net/fuse-emulator/?rev=4436&view=rev Author: fredm Date: 2011-05-14 14:10:07 +0000 (Sat, 14 May 2011) Log Message: ----------- Tweak set signal level and pause blocks to correct level information. Modified Paths: -------------- trunk/libspectrum/hacking/ChangeLog trunk/libspectrum/tape.c trunk/libspectrum/tzx_read.c Modified: trunk/libspectrum/hacking/ChangeLog =================================================================== --- trunk/libspectrum/hacking/ChangeLog 2011-05-14 05:52:06 UTC (rev 4435) +++ trunk/libspectrum/hacking/ChangeLog 2011-05-14 14:10:07 UTC (rev 4436) @@ -844,3 +844,5 @@ 20100514 doc/libspectrum.txt,libspectrum.h.in,tape.c,tape_accessors.txt, tape_block.[ch],tzx_read.c,tzx_write.c: add support for the TZX set signal level block (Fred). +20100514 tape.c,tzx_read.c: tweak set signal level and pause blocks to correct + level information (Fred). Modified: trunk/libspectrum/tape.c =================================================================== --- trunk/libspectrum/tape.c 2011-05-14 05:52:06 UTC (rev 4435) +++ trunk/libspectrum/tape.c 2011-05-14 14:10:07 UTC (rev 4436) @@ -387,8 +387,13 @@ case LIBSPECTRUM_TAPE_BLOCK_PAUSE: *tstates = block->types.pause.length_tstates; end_of_block = 1; - *flags |= block->types.pause.level ? LIBSPECTRUM_TAPE_FLAGS_LEVEL_HIGH : - LIBSPECTRUM_TAPE_FLAGS_LEVEL_LOW; + /* If the pause isn't a "don't care" level then set the appropriate pulse + level */ + if( block->types.pause.level != -1 && + block->types.pause.length_tstates ) { + *flags |= block->types.pause.level ? LIBSPECTRUM_TAPE_FLAGS_LEVEL_HIGH : + LIBSPECTRUM_TAPE_FLAGS_LEVEL_LOW; + } /* 0 ms pause => stop tape */ if( *tstates == 0 ) { *flags |= LIBSPECTRUM_TAPE_FLAGS_STOP; } break; @@ -426,8 +431,10 @@ case LIBSPECTRUM_TAPE_BLOCK_SET_SIGNAL_LEVEL: *tstates = 0; end_of_block = 1; + /* Inverted as the following block will flip the level before recording + the edge */ *flags |= block->types.set_signal_level.level ? - LIBSPECTRUM_TAPE_FLAGS_LEVEL_HIGH : LIBSPECTRUM_TAPE_FLAGS_LEVEL_LOW; + LIBSPECTRUM_TAPE_FLAGS_LEVEL_LOW : LIBSPECTRUM_TAPE_FLAGS_LEVEL_HIGH; break; /* For blocks which contain no Spectrum-readable data, return zero Modified: trunk/libspectrum/tzx_read.c =================================================================== --- trunk/libspectrum/tzx_read.c 2011-05-14 05:52:06 UTC (rev 4435) +++ trunk/libspectrum/tzx_read.c 2011-05-14 14:10:07 UTC (rev 4436) @@ -647,7 +647,8 @@ /* Get the pause length */ libspectrum_set_pause_ms( block, (*ptr)[0] + (*ptr)[1] * 0x100 ); - libspectrum_tape_block_set_level( block, -1 ); /* No specific level */ + /* TZX format spec says pause is low */ + libspectrum_tape_block_set_level( block, 0 ); (*ptr) += 2; libspectrum_tape_append_block( tape, block ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |