1
0
mirror of https://github.com/jscrane/r65emu.git synced 2024-07-22 09:29:02 +00:00
r65emu/acia.cpp
Stephen Crane 984692ad95 bugfix
2018-12-18 08:28:53 +00:00

50 lines
800 B
C++

#include <stdint.h>
#include "memory.h"
#include "acia.h"
void acia::operator=(uint8_t b) {
if (_acc & 1) {
_device->write(b);
return;
}
if ((b & cd_mask) == reset) {
_device->reset();
return;
}
switch (b & ws_mask) {
case ws7e2:
_device->framing(7, 2, even);
break;
case ws7o2:
_device->framing(7, 2, odd);
break;
case ws7e1:
_device->framing(7, 1, even);
break;
case ws7o1:
_device->framing(7, 1, odd);
break;
case ws8n2:
_device->framing(8, 2, none);
break;
case ws8n1:
_device->framing(8, 1, none);
break;
case ws8e1:
_device->framing(8, 1, even);
break;
case ws8o1:
_device->framing(8, 1, odd);
break;
};
// FIXME: more
}
acia::operator uint8_t() {
if (_acc & 1)
return _device->read();
return _device->more()? rdrf | tdre: tdre;
}