mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-21 20:29:06 +00:00
Further documented interface, fixed a potential parsing blockage.
This commit is contained in:
parent
963e307d0c
commit
cfe8251166
@ -101,8 +101,10 @@ class Acorn1200BaudTapeParser: public StaticAnalyer::TapeParser<WaveType, Symbol
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( waves.size() >= 4 &&
|
if(waves.size() >= 4)
|
||||||
waves[0] == WaveType::Short &&
|
{
|
||||||
|
// If this makes a 1, post it.
|
||||||
|
if( waves[0] == WaveType::Short &&
|
||||||
waves[1] == WaveType::Short &&
|
waves[1] == WaveType::Short &&
|
||||||
waves[2] == WaveType::Short &&
|
waves[2] == WaveType::Short &&
|
||||||
waves[3] == WaveType::Short)
|
waves[3] == WaveType::Short)
|
||||||
@ -110,6 +112,11 @@ class Acorn1200BaudTapeParser: public StaticAnalyer::TapeParser<WaveType, Symbol
|
|||||||
push_symbol(SymbolType::One, 4);
|
push_symbol(SymbolType::One, 4);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Otherwise, eject at least one wave as all options are exhausted.
|
||||||
|
remove_waves(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_to_crc(uint8_t value)
|
void add_to_crc(uint8_t value)
|
||||||
|
@ -83,7 +83,18 @@ template <typename WaveType, typename SymbolType> class TapeParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/*!
|
||||||
|
Should be implemented by subclasses. Consumes @c pulse. Is likely either to call @c push_wave
|
||||||
|
or to take no action.
|
||||||
|
*/
|
||||||
virtual void process_pulse(Storage::Tape::Tape::Pulse pulse) = 0;
|
virtual void process_pulse(Storage::Tape::Tape::Pulse pulse) = 0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Should be implemented by subclasses. Inspects @c waves for a potential new symbol. If one is
|
||||||
|
found should call @c push_symbol. May wish alternatively to call @c remove_waves to have entries
|
||||||
|
removed from the start of @c waves that cannot form a valid symbol. Need not do anything while
|
||||||
|
the waves at the start of @c waves may end up forming a symbol but the symbol is not yet complete.
|
||||||
|
*/
|
||||||
virtual void inspect_waves(const std::vector<WaveType> &waves) = 0;
|
virtual void inspect_waves(const std::vector<WaveType> &waves) = 0;
|
||||||
|
|
||||||
std::vector<WaveType> _wave_queue;
|
std::vector<WaveType> _wave_queue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user