From 2179edc7fe22393434759622ac8e827018175a7a Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 17 Jul 2017 07:43:47 -0400 Subject: [PATCH] Adjusted to allow the very first thing found to be data, and ensured that unrecognised symbols break files just as gaps do. --- Storage/Tape/Parsers/ZX8081.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Storage/Tape/Parsers/ZX8081.cpp b/Storage/Tape/Parsers/ZX8081.cpp index 960992dd5..336ccdb46 100644 --- a/Storage/Tape/Parsers/ZX8081.cpp +++ b/Storage/Tape/Parsers/ZX8081.cpp @@ -95,11 +95,8 @@ int Parser::get_next_byte(const std::shared_ptr &tape) { while(c--) { if(is_at_end(tape)) return -1; SymbolType symbol = get_next_symbol(tape); - if(symbol == SymbolType::FileGap) { - return_symbol(symbol); - return -1; - } if(symbol != SymbolType::One && symbol != SymbolType::Zero) { + return_symbol(symbol); return -1; } result = (result << 1) | (symbol == SymbolType::One ? 1 : 0); @@ -110,10 +107,7 @@ int Parser::get_next_byte(const std::shared_ptr &tape) { std::shared_ptr> Parser::get_next_file_data(const std::shared_ptr &tape) { if(is_at_end(tape)) return nullptr; SymbolType symbol = get_next_symbol(tape); - if(symbol != SymbolType::FileGap) { - return nullptr; - } - while(symbol == SymbolType::FileGap && !is_at_end(tape)) { + while((symbol == SymbolType::FileGap || symbol == SymbolType::Unrecognised) && !is_at_end(tape)) { symbol = get_next_symbol(tape); } if(is_at_end(tape)) return nullptr;