mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-10 11:25:23 +00:00
Reintroduced gap as a string of 1s, made an attempt to look up bit ordering. Still unclear on high/low versus low/high.
This commit is contained in:
@@ -93,6 +93,14 @@ Tape::Pulse OricTAP::virtual_get_next_pulse()
|
||||
|
||||
_phase_counter++;
|
||||
if(_phase_counter > 12 && !next_byte) // advance after the filename-ending NULL byte
|
||||
{
|
||||
_next_phase = Gap;
|
||||
}
|
||||
break;
|
||||
|
||||
case Gap:
|
||||
_phase_counter++;
|
||||
if(_phase_counter == 8)
|
||||
{
|
||||
_next_phase = Data;
|
||||
}
|
||||
@@ -119,12 +127,11 @@ Tape::Pulse OricTAP::virtual_get_next_pulse()
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: which way round are bytes streamed?
|
||||
uint8_t parity = next_byte;
|
||||
parity ^= (parity >> 4);
|
||||
parity ^= (parity >> 2);
|
||||
parity ^= (parity >> 1); // TODO: parity odd or even?
|
||||
_current_value = (uint16_t)(((uint16_t)next_byte << 1) | (7 << 10) | ((parity&1) << 9));
|
||||
parity ^= (parity >> 1);
|
||||
_current_value = (uint16_t)(((uint16_t)next_byte << 1) | ((parity&1) << 9) | (7 << 10));
|
||||
}
|
||||
|
||||
// In slow mode, a 0 is 4 periods of 1200 Hz, a 1 is 8 periods at 2400 Hz.
|
||||
@@ -132,6 +139,7 @@ Tape::Pulse OricTAP::virtual_get_next_pulse()
|
||||
// This code models fast mode.
|
||||
Tape::Pulse pulse;
|
||||
pulse.length.clock_rate = 4800;
|
||||
int next_bit;
|
||||
|
||||
switch(_phase)
|
||||
{
|
||||
@@ -140,8 +148,16 @@ Tape::Pulse OricTAP::virtual_get_next_pulse()
|
||||
pulse.length.length = 4800;
|
||||
return pulse;
|
||||
|
||||
case Gap:
|
||||
next_bit = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
if(_current_value & 1)
|
||||
next_bit = _current_value & 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if(next_bit)
|
||||
{
|
||||
pulse.length.length = 1;
|
||||
}
|
||||
@@ -159,7 +175,6 @@ Tape::Pulse OricTAP::virtual_get_next_pulse()
|
||||
}
|
||||
return pulse;
|
||||
}
|
||||
}
|
||||
|
||||
bool OricTAP::is_at_end()
|
||||
{
|
||||
|
@@ -48,7 +48,7 @@ class OricTAP: public Tape {
|
||||
int _phase_counter;
|
||||
|
||||
enum Phase {
|
||||
LeadIn, Header, Data, End
|
||||
LeadIn, Header, Data, Gap, End
|
||||
} _phase, _next_phase;
|
||||
uint16_t _data_end_address, _data_start_address;
|
||||
};
|
||||
|
Reference in New Issue
Block a user