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:
parent
af713b78e1
commit
84e816dfaa
3 changed files with 68 additions and 16 deletions
|
@ -40,7 +40,6 @@
|
||||||
#define SET_EOR 2 /* print, set eor */
|
#define SET_EOR 2 /* print, set eor */
|
||||||
#define SET_SPC 4 /* space */
|
#define SET_SPC 4 /* space */
|
||||||
|
|
||||||
extern char sds_to_ascii[64];
|
|
||||||
extern uint32 xfr_req;
|
extern uint32 xfr_req;
|
||||||
extern int32 stop_invins, stop_invdev, stop_inviop;
|
extern int32 stop_invins, stop_invdev, stop_inviop;
|
||||||
int32 lpt_spc = 0; /* space instr */
|
int32 lpt_spc = 0; /* space instr */
|
||||||
|
@ -69,6 +68,7 @@ t_stat lpt_status (UNIT *uptr);
|
||||||
t_stat lpt_bufout (UNIT *uptr);
|
t_stat lpt_bufout (UNIT *uptr);
|
||||||
void lpt_end_op (int32 fl);
|
void lpt_end_op (int32 fl);
|
||||||
t_stat lpt (uint32 fnc, uint32 inst, uint32 *dat);
|
t_stat lpt (uint32 fnc, uint32 inst, uint32 *dat);
|
||||||
|
int8 sds_to_ascii(int8 c);
|
||||||
|
|
||||||
/* LPT data structures
|
/* LPT data structures
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ switch (fnc) { /* case function */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IO_WRITE: /* write */
|
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 */
|
xfr_req = xfr_req & ~XFR_LPT; /* clr xfr flag */
|
||||||
if (lpt_bptr < LPT_WIDTH) /* store data */
|
if (lpt_bptr < LPT_WIDTH) /* store data */
|
||||||
lpt_buf[lpt_bptr++] = asc;
|
lpt_buf[lpt_bptr++] = asc;
|
||||||
|
|
|
@ -64,9 +64,8 @@ t_stat tti_reset (DEVICE *dptr);
|
||||||
t_stat tto (uint32 fnc, uint32 inst, uint32 *dat);
|
t_stat tto (uint32 fnc, uint32 inst, uint32 *dat);
|
||||||
t_stat tto_svc (UNIT *uptr);
|
t_stat tto_svc (UNIT *uptr);
|
||||||
t_stat tto_reset (DEVICE *dptr);
|
t_stat tto_reset (DEVICE *dptr);
|
||||||
|
int8 ascii_to_sds(int8 ch);
|
||||||
extern const int8 ascii_to_sds[128];
|
int8 sds_to_ascii(int8 ch);
|
||||||
extern const int8 sds_to_ascii[64];
|
|
||||||
extern const int8 odd_par[64];
|
extern const int8 odd_par[64];
|
||||||
|
|
||||||
/* PTR data structures
|
/* PTR data structures
|
||||||
|
@ -506,8 +505,8 @@ if (temp & SCPE_BREAK) /* ignore break */
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
temp = temp & 0177;
|
temp = temp & 0177;
|
||||||
tti_unit.pos = tti_unit.pos + 1;
|
tti_unit.pos = tti_unit.pos + 1;
|
||||||
if (ascii_to_sds[temp] >= 0) {
|
if (ascii_to_sds(temp) >= 0) {
|
||||||
tti_unit.buf = ascii_to_sds[temp]; /* internal rep */
|
tti_unit.buf = ascii_to_sds(temp); /* internal rep */
|
||||||
sim_putchar (temp); /* echo */
|
sim_putchar (temp); /* echo */
|
||||||
if (temp == '\r') /* lf after cr */
|
if (temp == '\r') /* lf after cr */
|
||||||
sim_putchar ('\n');
|
sim_putchar ('\n');
|
||||||
|
@ -590,7 +589,7 @@ else if (uptr->buf == TT_BS)
|
||||||
asc = '\b';
|
asc = '\b';
|
||||||
else if (uptr->buf == TT_TB)
|
else if (uptr->buf == TT_TB)
|
||||||
asc = '\t';
|
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? */
|
if ((r = sim_putchar_s (asc)) != SCPE_OK) { /* output; error? */
|
||||||
sim_activate (uptr, uptr->wait); /* retry */
|
sim_activate (uptr, uptr->wait); /* retry */
|
||||||
return ((r == SCPE_STALL)? SCPE_OK: r); /* !stall? report */
|
return ((r == SCPE_STALL)? SCPE_OK: r); /* !stall? report */
|
||||||
|
|
|
@ -45,6 +45,7 @@ extern DEVICE mt_dev;
|
||||||
extern DEVICE mux_dev, muxl_dev;
|
extern DEVICE mux_dev, muxl_dev;
|
||||||
extern UNIT cpu_unit;
|
extern UNIT cpu_unit;
|
||||||
extern REG cpu_reg[];
|
extern REG cpu_reg[];
|
||||||
|
extern uint32 cpu_mode;
|
||||||
extern uint32 M[MAXMEMSIZE];
|
extern uint32 M[MAXMEMSIZE];
|
||||||
|
|
||||||
/* SCP data structures and interface routines
|
/* SCP data structures and interface routines
|
||||||
|
@ -103,9 +104,9 @@ const char *sim_stop_messages[] = {
|
||||||
"Next expired"
|
"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',
|
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||||
'8', '9', ' ', '=', '\'', ':', '>', '%', /* 17 = check mark */
|
'8', '9', ' ', '=', '\'', ':', '>', '%', /* 17 = check mark */
|
||||||
'+', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
|
'+', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
|
||||||
|
@ -116,8 +117,8 @@ const int8 sds_to_ascii[64] = {
|
||||||
'Y', 'Z', '?', ',', '(', '~', '\\', '#' /* 72 = rec mark */
|
'Y', 'Z', '?', ',', '(', '~', '\\', '#' /* 72 = rec mark */
|
||||||
}; /* 75 = squiggle, 77 = del */
|
}; /* 75 = squiggle, 77 = del */
|
||||||
|
|
||||||
const int8 ascii_to_sds[128] = {
|
const int8 ascii_to_sds930[128] = {
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, /* 0 - 37 */
|
-1, -1, -1, -1, -1, -1, -1, -1, /* 00 - 37 */
|
||||||
032, 072, -1, -1, -1, 052, -1, -1,
|
032, 072, -1, -1, -1, 052, -1, -1,
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1,
|
-1, -1, -1, -1, -1, -1, -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,
|
030, 031, 041, 042, 043, 044, 045, 046,
|
||||||
047, 050, 051, 062, 063, 064, 065, 066,
|
047, 050, 051, 062, 063, 064, 065, 066,
|
||||||
067, 070, 071, 035, 076, 055, 057, 060,
|
067, 070, 071, 035, 076, 055, 057, 060,
|
||||||
000, 021, 022, 023, 024, 025, 026, 027, /* 140 - 177 */
|
-1, 021, 022, 023, 024, 025, 026, 027, /* 140 - 177 */
|
||||||
030, 031, 041, 042, 043, 044, 045, 046,
|
030, 031, 041, 042, 043, 044, 045, 046, /* fold lower case to upper */
|
||||||
047, 050, 051, 062, 063, 064, 065, 066,
|
047, 050, 051, 062, 063, 064, 065, 066,
|
||||||
067, 070, 071, -1, -1, -1, -1, -1
|
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] = {
|
const int8 odd_par[64] = {
|
||||||
0100, 0001, 0002, 0103, 0004, 0105, 0106, 0007,
|
0100, 0001, 0002, 0103, 0004, 0105, 0106, 0007,
|
||||||
0010, 0111, 0112, 0013, 0114, 0015, 0016, 0117,
|
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;
|
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
|
/* Symbolic decode
|
||||||
|
|
||||||
Inputs:
|
Inputs:
|
||||||
|
@ -494,7 +547,7 @@ if (sw & SWMASK ('A')) { /* SDS internal ASCII? *
|
||||||
}
|
}
|
||||||
if (sw & SWMASK ('C')) { /* six-bit character? */
|
if (sw & SWMASK ('C')) { /* six-bit character? */
|
||||||
for (i = 18; i >= 0; i -= 6)
|
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;
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
if (!(sw & SWMASK ('M'))) return SCPE_ARG;
|
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++) {
|
for (i = j = 0, val[0] = 0; i < 4; i++) {
|
||||||
if (cptr[i] == 0) /* latch str end */
|
if (cptr[i] == 0) /* latch str end */
|
||||||
j = 1;
|
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 */
|
if (j || (k < 0)) /* bad, end? spc */
|
||||||
k = 0;
|
k = 0;
|
||||||
val[0] = (val[0] << 6) | k;
|
val[0] = (val[0] << 6) | k;
|
||||||
|
|
Loading…
Add table
Reference in a new issue