diff --git a/OSBindings/Mac/Clock Signal/Info.plist b/OSBindings/Mac/Clock Signal/Info.plist index a5f0c8a78..459574a27 100644 --- a/OSBindings/Mac/Clock Signal/Info.plist +++ b/OSBindings/Mac/Clock Signal/Info.plist @@ -268,7 +268,6 @@ CFBundleTypeExtensions cas - tsx CFBundleTypeIconFile cassette @@ -300,6 +299,22 @@ LSTypeIsPackage 0 + + CFBundleTypeExtensions + + tsx + + CFBundleTypeIconFile + cassette + CFBundleTypeName + MSX Tape Image + CFBundleTypeRole + Viewer + LSTypeIsPackage + 0 + NSDocumentClass + $(PRODUCT_MODULE_NAME).MachineDocument + CFBundleExecutable $(EXECUTABLE_NAME) diff --git a/Storage/Tape/Parsers/MSX.cpp b/Storage/Tape/Parsers/MSX.cpp index e06ef7f1c..a392b2d00 100644 --- a/Storage/Tape/Parsers/MSX.cpp +++ b/Storage/Tape/Parsers/MSX.cpp @@ -96,33 +96,25 @@ int Parser::get_byte(const FileSpeed &speed, Storage::Tape::BinaryTapePlayer &ta "The cassette is first read continuously until a start bit is found. This is done by locating a negative transition, measuring the following cycle length (1B1FH) and comparing this to see if it is greater than LOWLIM." + + ... but I don't buy that, as it makes the process overly dependent on phase. + So I'm going to look for the next two consecutive pulses that are each big + enough to be half of a zero. */ - float minimum_start_bit_duration = static_cast(speed.minimum_start_bit_duration) * 0.00001145f; + const float minimum_start_bit_duration = static_cast(speed.minimum_start_bit_duration) * 0.00001145f * 0.5f; + int input = 0; while(!tape_player.get_tape()->is_at_end()) { - // Find a negative transition. - while(!tape_player.get_tape()->is_at_end() && tape_player.get_input()) { - tape_player.run_for_input_pulse(); - } - - // Measure the following cycle (i.e. two transitions). + // Find next transition. bool level = tape_player.get_input(); - float time_to_transition = 0.0f; - int transitions = 0; - while(!tape_player.get_tape()->is_at_end()) { - time_to_transition += static_cast(tape_player.get_cycles_until_next_event()) / static_cast(tape_player.get_input_clock_rate()); + float duration = 0.0; + while(level == tape_player.get_input()) { + duration += static_cast(tape_player.get_cycles_until_next_event()) / static_cast(tape_player.get_input_clock_rate()); tape_player.run_for_input_pulse(); - if(level != tape_player.get_input()) { - level = tape_player.get_input(); - transitions++; - if(transitions == 2) - break; - } } - // Check length against 'LOWLIM' (i.e. the minimum start bit duration). - if(time_to_transition > minimum_start_bit_duration) { - break; - } + input = (input << 1); + if(duration >= minimum_start_bit_duration) input |= 1; + if((input&3) == 3) break; } /*