SDS: Add different 6-bit internal to/from ASCII character conversion tables for 940 mode

The existing conversion tables were for the 930 and earlier models of SDS computers. The SDS 940 altered these tables. This change selects the appropriate table based upon the current CPU mode -- whether operating as a 930 or a 940. See Appendix A of both the 930 and 940 reference manuals for detailed character conversion information.  Correct 930 ASCII to internal table for ASCII input value 0140.
This commit is contained in:
Mark Emmer 2015-01-31 23:18:04 -06:00
parent af713b78e1
commit 84e816dfaa
3 changed files with 68 additions and 16 deletions

View file

@ -40,7 +40,6 @@
#define SET_EOR 2 /* print, set eor */
#define SET_SPC 4 /* space */
extern char sds_to_ascii[64];
extern uint32 xfr_req;
extern int32 stop_invins, stop_invdev, stop_inviop;
int32 lpt_spc = 0; /* space instr */
@ -69,6 +68,7 @@ t_stat lpt_status (UNIT *uptr);
t_stat lpt_bufout (UNIT *uptr);
void lpt_end_op (int32 fl);
t_stat lpt (uint32 fnc, uint32 inst, uint32 *dat);
int8 sds_to_ascii(int8 c);
/* LPT data structures
@ -182,7 +182,7 @@ switch (fnc) { /* case function */
break;
case IO_WRITE: /* write */
asc = sds_to_ascii[(*dat) & 077]; /* convert data */
asc = sds_to_ascii(*dat); /* convert data */
xfr_req = xfr_req & ~XFR_LPT; /* clr xfr flag */
if (lpt_bptr < LPT_WIDTH) /* store data */
lpt_buf[lpt_bptr++] = asc;

View file

@ -64,9 +64,8 @@ t_stat tti_reset (DEVICE *dptr);
t_stat tto (uint32 fnc, uint32 inst, uint32 *dat);
t_stat tto_svc (UNIT *uptr);
t_stat tto_reset (DEVICE *dptr);
extern const int8 ascii_to_sds[128];
extern const int8 sds_to_ascii[64];
int8 ascii_to_sds(int8 ch);
int8 sds_to_ascii(int8 ch);
extern const int8 odd_par[64];
/* PTR data structures
@ -506,8 +505,8 @@ if (temp & SCPE_BREAK) /* ignore break */
return SCPE_OK;
temp = temp & 0177;
tti_unit.pos = tti_unit.pos + 1;
if (ascii_to_sds[temp] >= 0) {
tti_unit.buf = ascii_to_sds[temp]; /* internal rep */
if (ascii_to_sds(temp) >= 0) {
tti_unit.buf = ascii_to_sds(temp); /* internal rep */
sim_putchar (temp); /* echo */
if (temp == '\r') /* lf after cr */
sim_putchar ('\n');
@ -590,7 +589,7 @@ else if (uptr->buf == TT_BS)
asc = '\b';
else if (uptr->buf == TT_TB)
asc = '\t';
else asc = sds_to_ascii[uptr->buf]; /* translate */
else asc = sds_to_ascii(uptr->buf); /* translate */
if ((r = sim_putchar_s (asc)) != SCPE_OK) { /* output; error? */
sim_activate (uptr, uptr->wait); /* retry */
return ((r == SCPE_STALL)? SCPE_OK: r); /* !stall? report */

View file

@ -45,6 +45,7 @@ extern DEVICE mt_dev;
extern DEVICE mux_dev, muxl_dev;
extern UNIT cpu_unit;
extern REG cpu_reg[];
extern uint32 cpu_mode;
extern uint32 M[MAXMEMSIZE];
/* SCP data structures and interface routines
@ -103,9 +104,9 @@ const char *sim_stop_messages[] = {
"Next expired"
};
/* Character conversion tables */
/* SDS 930 character conversion tables. Per 930 Ref Man Appendix A */
const int8 sds_to_ascii[64] = {
const int8 sds930_to_ascii[64] = {
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', ' ', '=', '\'', ':', '>', '%', /* 17 = check mark */
'+', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
@ -116,8 +117,8 @@ const int8 sds_to_ascii[64] = {
'Y', 'Z', '?', ',', '(', '~', '\\', '#' /* 72 = rec mark */
}; /* 75 = squiggle, 77 = del */
const int8 ascii_to_sds[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, /* 0 - 37 */
const int8 ascii_to_sds930[128] = {
-1, -1, -1, -1, -1, -1, -1, -1, /* 00 - 37 */
032, 072, -1, -1, -1, 052, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
@ -129,12 +130,44 @@ const int8 ascii_to_sds[128] = {
030, 031, 041, 042, 043, 044, 045, 046,
047, 050, 051, 062, 063, 064, 065, 066,
067, 070, 071, 035, 076, 055, 057, 060,
000, 021, 022, 023, 024, 025, 026, 027, /* 140 - 177 */
030, 031, 041, 042, 043, 044, 045, 046,
-1, 021, 022, 023, 024, 025, 026, 027, /* 140 - 177 */
030, 031, 041, 042, 043, 044, 045, 046, /* fold lower case to upper */
047, 050, 051, 062, 063, 064, 065, 066,
067, 070, 071, -1, -1, -1, -1, -1
};
/* SDS 940 character conversion tables. Per 940 Ref Man Appendix A */
const int8 sds940_to_ascii[64] = {
' ', '!', '"', '#', '$', '%', '&', '\'', /* 00 - 17 */
'(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7', /* 20 - 37 */
'8', '9', ':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', /* 40 - 57 */
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', /* 60 - 77 */
'X', 'Y', 'Z', '[', '\\', ']', '^', '_'
};
const int8 ascii_to_sds940[128] = {
-1, 141, 142, 143, 144, 145, 146, 147, /* 00 - 37 */
-1, 151, 152, 153, 154, 155, -1, -1,
-1, 161, 162, 163, 164, 165, 166, 167,
170, 171, 172, -1, -1, -1, -1, -1,
000, 001, 002, 003, 004, 005, 006, 007, /* 40 - 77 */
010, 011, 012, 013, 014, 015, 016, 017,
020, 021, 022, 023, 024, 025, 026, 027,
030, 031, 032, 033, 034, 035, 036, 037,
040, 041, 042, 043, 044, 045, 046, 047, /* 100 - 137 */
050, 051, 052, 053, 054, 055, 056, 057,
060, 061, 062, 063, 064, 065, 066, 067,
070, 071, 072, 073, 074, 075, 076, 077,
-1, 041, 042, 043, 044, 045, 046, 047, /* 140 - 177 */
050, 051, 052, 053, 054, 055, 056, 057, /* fold lower case to upper */
060, 061, 062, 063, 064, 065, 066, 067,
070, 071, 072, -1, -1, -1, -1, -1
};
const int8 odd_par[64] = {
0100, 0001, 0002, 0103, 0004, 0105, 0106, 0007,
0010, 0111, 0112, 0013, 0114, 0015, 0016, 0117,
@ -456,6 +489,26 @@ for (i = sp = 0; opc_val[i] >= 0; i++) { /* loop thru ops */
return;
}
/* Convert from SDS internal character code to ASCII depending upon cpu mode. */
int8 sds_to_ascii(int8 ch)
{
ch &= 077;
if (cpu_mode == NML_MODE)
return sds930_to_ascii[ch];
else
return sds940_to_ascii[ch];
}
/* Convert from ASCII to SDS internal character code depending upon cpu mode. */
int8 ascii_to_sds(int8 ch)
{
ch &= 0177;
if (cpu_mode == NML_MODE)
return ascii_to_sds930[ch];
else
return ascii_to_sds940[ch];
}
/* Symbolic decode
Inputs:
@ -494,7 +547,7 @@ if (sw & SWMASK ('A')) { /* SDS internal ASCII? *
}
if (sw & SWMASK ('C')) { /* six-bit character? */
for (i = 18; i >= 0; i -= 6)
fprintf (of, "%c", sds_to_ascii[(inst >> i) & 077]);
fprintf (of, "%c", sds_to_ascii(inst >> i));
return SCPE_OK;
}
if (!(sw & SWMASK ('M'))) return SCPE_ARG;
@ -634,7 +687,7 @@ if ((sw & SWMASK ('C')) || ((*cptr == '"') && cptr++)) { /* string of 6-bit char
for (i = j = 0, val[0] = 0; i < 4; i++) {
if (cptr[i] == 0) /* latch str end */
j = 1;
k = ascii_to_sds[cptr[i] & 0177]; /* cvt char */
k = ascii_to_sds(cptr[i]); /* cvt char */
if (j || (k < 0)) /* bad, end? spc */
k = 0;
val[0] = (val[0] << 6) | k;