1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-23 20:29:42 +00:00

Thus did the first UEF load.

This commit is contained in:
Thomas Harte 2016-01-19 23:03:27 -05:00
parent e65cd4cf06
commit 9036cf3b7c
2 changed files with 20 additions and 16 deletions

View File

@ -103,7 +103,9 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
case 0x4:
if(isReadOperation(operation))
{
*value = (uint8_t)_tape.dataRegister;
*value = (uint8_t)(_tape.dataRegister >> 2);
_interruptStatus &= ~InterruptTransmitDataEmpty;
evaluate_interrupts();
}
printf("Cassette\n");
break;
@ -328,29 +330,30 @@ inline void Machine::get_next_tape_pulse()
inline void Machine::push_tape_bit(uint16_t bit)
{
_tape.dataRegister = (uint16_t)((_tape.dataRegister >> 1) | (bit << 9));
_tape.dataRegister = (uint16_t)((_tape.dataRegister >> 1) | (bit << 10));
if(_tape.dataRegister == 0x3ff)
_interruptStatus |= InterruptHighToneDetect;
else
_interruptStatus &= !InterruptHighToneDetect;
if(_tape.bits_since_start > 0)
if(_tape.bits_since_start)
{
_tape.bits_since_start--;
if(_tape.bits_since_start == 0)
if(_tape.bits_since_start == 7)
{
printf("%02x [%c]\n", _tape.dataRegister&0xff, _tape.dataRegister&0x7f);
_interruptStatus |= InterruptTransmitDataEmpty;
_interruptStatus &= ~InterruptTransmitDataEmpty;
}
}
if(!bit && !_tape.bits_since_start)
else
{
_tape.bits_since_start = 10;
}
if((_tape.dataRegister&0x3) == 0x1)
{
_interruptStatus |= InterruptTransmitDataEmpty;
_tape.bits_since_start = 9;
}
if(_tape.dataRegister == 0x3ff)
_interruptStatus |= InterruptHighToneDetect;
else
_interruptStatus &= ~InterruptHighToneDetect;
}
printf(".");
evaluate_interrupts();

View File

@ -114,9 +114,10 @@ class Machine: public CPU6502::Processor<Machine> {
std::shared_ptr<SignalProcessing::Stepper> pulseStepper;
uint32_t time_into_pulse;
bool is_running;
uint16_t dataRegister;
int bits_since_start;
uint16_t dataRegister;
enum {
Long, Short, Unrecognised
} crossings[4];