1
0
mirror of https://github.com/open-simh/simh.git synced 2026-04-30 13:41:55 +00:00

NOVA: Add parity generation for input characters on the TTI device

John Kichury revived Startrek II running under DCC Basic which originally ran on  the Digital Computer Controls (DCC) D-116 DG Nova clone

This program (or the Basic interpreter) requires console input with even parity.

SET TTI EVEN

will now enable that.
This commit is contained in:
Mark Pizzolato
2015-01-16 12:03:07 -08:00
parent 136f5867b6
commit 191566fdd8
3 changed files with 47 additions and 5 deletions

View File

@@ -1844,6 +1844,10 @@ int32 sim_tt_inpcvt (int32 c, uint32 mode)
uint32 md = mode & TTUF_M_MODE;
if (md != TTUF_MODE_8B) {
uint32 par_bit = 0;
uint32 par_mode = (mode >> TTUF_W_MODE) & TTUF_M_PAR;
static int32 nibble_even_parity = 0x699600; /* bit array indicating the even parity for each index (offset by 8) */
c = c & 0177;
if (md == TTUF_MODE_UC) {
if (islower (c))
@@ -1851,6 +1855,17 @@ if (md != TTUF_MODE_8B) {
if (mode & TTUF_KSR)
c = c | 0200;
}
switch (par_mode) {
case TTUF_PAR_EVEN:
c |= (((nibble_even_parity >> ((c & 0xF) + 1)) ^ (nibble_even_parity >> (((c >> 4) & 0xF) + 1))) & 0x80);
break;
case TTUF_PAR_ODD:
c |= ((~((nibble_even_parity >> ((c & 0xF) + 1)) ^ (nibble_even_parity >> (((c >> 4) & 0xF) + 1)))) & 0x80);
break;
case TTUF_PAR_MARK:
c = c | 0x80;
break;
}
}
else c = c & 0377;
return c;