1
0
mirror of https://github.com/jscrane/r65emu.git synced 2024-12-07 09:50:31 +00:00

serial framing config

This commit is contained in:
Stephen Crane 2018-09-13 12:56:54 +01:00
parent ad947c887c
commit c4ee594a1c
2 changed files with 38 additions and 1 deletions

View File

@ -8,8 +8,36 @@ void acia::operator=(uint8_t b) {
_device->write(b);
return;
}
if ((b & cd_mask) == 0x03)
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
}

9
acia.h
View File

@ -1,10 +1,19 @@
#ifndef __ACIA_H__
#define __ACIA_H__
enum parity {
none,
even,
odd,
};
class SerialDevice {
public:
virtual void reset() {}
virtual void framing(unsigned data_bits, unsigned stop_bits, parity p) {}
virtual void write(uint8_t) {}
virtual uint8_t read() {}
virtual bool more() { return false; }
};