From 3a23d5d8cf096654f9cdf1f9dbca8a92f46e3b66 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 15 Aug 2016 22:44:36 -0400 Subject: [PATCH] Adjusted the check digit. --- Storage/Tape/Formats/TapePRG.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Storage/Tape/Formats/TapePRG.cpp b/Storage/Tape/Formats/TapePRG.cpp index 2fc74b9e9..750ac6ade 100644 --- a/Storage/Tape/Formats/TapePRG.cpp +++ b/Storage/Tape/Formats/TapePRG.cpp @@ -106,7 +106,6 @@ void TapePRG::get_next_output_token() if(byte_offset < 9) { _output_byte = (uint8_t)(9 - byte_offset) | 0x80; - _check_digit = 0; } else if(byte_offset == 199) { @@ -114,6 +113,7 @@ void TapePRG::get_next_output_token() } else { + if(byte_offset == 9) _check_digit = 0; if(_filePhase == FilePhaseHeader) { switch(byte_offset - 9) @@ -137,10 +137,11 @@ void TapePRG::get_next_output_token() _output_byte = (uint8_t)fgetc(_file); if(feof(_file)) _output_byte = 0x20; } + + _check_digit ^= _output_byte; } printf("%02x ", _output_byte); - _check_digit ^= _output_byte; } switch(bit_offset)