diff --git a/StaticAnalyser/Acorn/AcornAnalyser.cpp b/StaticAnalyser/Acorn/AcornAnalyser.cpp index 0803c39a2..db261ff6c 100644 --- a/StaticAnalyser/Acorn/AcornAnalyser.cpp +++ b/StaticAnalyser/Acorn/AcornAnalyser.cpp @@ -112,6 +112,6 @@ void StaticAnalyser::Acorn::AddTargets( // TODO: disks - if(target.tapes.size() || target.cartridges.size()) +// if(target.tapes.size() || target.cartridges.size()) destination.push_back(target); } diff --git a/StaticAnalyser/Acorn/Tape.cpp b/StaticAnalyser/Acorn/Tape.cpp index 77f5b54a4..fcb893fb5 100644 --- a/StaticAnalyser/Acorn/Tape.cpp +++ b/StaticAnalyser/Acorn/Tape.cpp @@ -198,13 +198,13 @@ static std::unique_ptr GetNextChunk(Acorn1200BaudTapeParser &parser // read out name char name[11]; int name_ptr = 0; - while(!parser.is_at_end() && name_ptr < 11) + while(!parser.is_at_end() && name_ptr < sizeof(name)) { name[name_ptr] = (char)parser.get_next_byte(); if(!name[name_ptr]) break; name_ptr++; } - name[10] = '\0'; + name[sizeof(name)-1] = '\0'; new_chunk->name = name; // addresses diff --git a/Storage/Tape/Formats/TapeUEF.cpp b/Storage/Tape/Formats/TapeUEF.cpp index 5151a1cf9..7221e56fc 100644 --- a/Storage/Tape/Formats/TapeUEF.cpp +++ b/Storage/Tape/Formats/TapeUEF.cpp @@ -7,8 +7,9 @@ // #include "TapeUEF.hpp" -#include -#include +#include +#include +#include using namespace Storage::Tape; @@ -123,6 +124,7 @@ Storage::Tape::Tape::Pulse UEF::get_next_pulse() _bit_position = (_bit_position+1)&(_current_bit ? 3 : 1); break; + case 0x0111: // TODO: insert dummy byte case 0x0110: next_pulse.type = (_bit_position&1) ? Pulse::High : Pulse::Low; next_pulse.length.length = 1; @@ -219,9 +221,14 @@ void UEF::find_next_tape_chunk() _chunk_duration.length |= (uint16_t)(gzgetc(_file) << 8); gzseek(_file, _chunk_length - 2, SEEK_CUR); return; -// case 0x0111: // carrier tone with dummy byte - // TODO: read lengths -// return; + case 0x0111: // carrier tone with dummy byte + _high_tone_with_dummy.pre_length = (uint16_t)gzgetc(_file); + _high_tone_with_dummy.pre_length |= (uint16_t)(gzgetc(_file) << 8); + _high_tone_with_dummy.post_length = (uint16_t)gzgetc(_file); + _high_tone_with_dummy.post_length |= (uint16_t)(gzgetc(_file) << 8); + _chunk_duration.length = _high_tone_with_dummy.post_length + _high_tone_with_dummy.pre_length + 10; + gzseek(_file, _chunk_length - 4, SEEK_CUR); + return; case 0x0114: // security cycles { // read number of cycles @@ -244,6 +251,7 @@ void UEF::find_next_tape_chunk() break; default: + printf("!!! Skipping %04x\n", _chunk_id); gzseek(_file, _chunk_length, SEEK_CUR); break; } @@ -257,6 +265,7 @@ bool UEF::chunk_is_finished() case 0x0100: return (_implicit_data_chunk.position / 10) == _chunk_length; case 0x0102: return (_explicit_data_chunk.position / 8) == _chunk_length; case 0x0114: + case 0x0111: case 0x0110: return _chunk_position == _chunk_duration.length; case 0x0112: @@ -310,6 +319,8 @@ bool UEF::get_next_bit() } break; + case 0x0111: + case 0x0110: _chunk_position++; return true; diff --git a/Storage/Tape/Formats/TapeUEF.hpp b/Storage/Tape/Formats/TapeUEF.hpp index 2b507d1b6..a4079b0fb 100644 --- a/Storage/Tape/Formats/TapeUEF.hpp +++ b/Storage/Tape/Formats/TapeUEF.hpp @@ -56,6 +56,10 @@ class UEF : public Tape { uint8_t current_byte; uint32_t position; } _explicit_data_chunk; + + struct { + unsigned int pre_length, post_length; + } _high_tone_with_dummy; }; uint8_t _current_byte;