1. New Features 1.1 Directory and documentation - Only common files (SCP and libraries) are in the top level directory. Individual simulator files are in their individual directories. - simh_doc.txt has been split up. simh_doc.txt now documents only SCP. The individual simulators are documented in separate text files in their own directories. - mingw_build.bat is a batch file for the MINGW/gcc environment that will build all the simulators, assuming the root directory structure is at c:\sim. - Makefile is a UNIX make file for the gcc environment that will build all the simulators, assuming the root directory is at c:\sim. 1.2 SCP - DO <file name> executes the SCP commands in the specified file. - Replicated registers in unit structures can now be declared as arrays for examine, modify, save, and restore. Most replicated unit registers (for example, mag tape position registers) have been changed to arrays. - The ADD/REMOVE commands have been replaced by SET unit ONLINE and SET unit OFFLINE, respectively. - Register names that are unique within an entire simulator do not have to be prefaced with the device name. - The ATTACH command can attach files read only, either under user option (-r), or because the attached file is ready only. - The SET/SHOW capabilities have been extended. New forms include: SET <dev> param{=value}{ param ...} SET <unit> param{=value}{ param ...} SHOW <dev> {param param ...} SHOW <unit> {param param ...} - Multiple breakpoints have been implemented. Breakpoints are set/cleared/displayed by: BREAK addr_list{[count]} NOBREAK addr_list SHOW BREAK addr_list 1.3 PDP-11 simulator - Unibus map implemented, with 22b RP controller (URH70) or 18b RP controller (URH11) (in debug). - All DMA peripherals rewritten to use map. - Many peripherals modified for source sharing with VAX. - RQDX3 implemented. - Bugs fixed in RK11 and RL11 write check. 1.4 PDP-10 simulator - ITS 1-proceed implemented. - Bugs fixed in ITS PC sampling and LPMR 1.5 18b PDP simulator - Interrupts split out to multiple levels to allow easier expansion. 1.5 IBM System 3 Simulator - Written by Charles (Dutch) Owen. 1.6 VAX Simulator (in debug) - Simulates MicroVAX 3800 (KA655) with 16MB-64MB memory, RQDX3, RLV12, TSV11, DZV11, LPV11, PCV11. - CDROM capability has been added to the RQDX3, to allow testing with VMS hobbyist images. 1.7 SDS 940 Simulator (not tested) - Simulates SDS 940, 16K-64K memory, fixed and moving head disk, magtape, line printer, console. 1.8 Altair Z80 - Revised from Charles (Dutch) Owen's original by Peter Schorn. - MITS 8080 with full Z80 simulation. - 4K and 8K BASIC packages, Prolog package. 1.9 Interdata The I4 simulator has been withdrawn for major rework. Look for a complete 16b/32b Interdata simulator sometime next year. 2. Release Notes 2.1 SCP SCP now allows replicated registers in unit structures to be modelled as arrays. All replicated register declarations have been replaced by register array declarations. As a result, save files from prior revisions will generate errors after restoring main memory. 2.2 PDP-11 The Unibus map code is in debug. The map was implemented primarily to allow source sharing with the VAX, which requires a DMA map. DMA devices work correctly with the Unibus map disabled. The RQDX3 simulator has run a complete RSTS/E SYSGEN, with multiple drives, and booted the completed system from scratch. 2.3 VAX The VAX simulator will run the boot code up to the >>> prompt. It can successfully process a SHOW DEVICE command. It runs the HCORE instruction diagnostic. It can boot the hobbyist CD through SYSBOOT and through the date/time dialog and restore the hobbyist CD, using standalone backup. On the boot of the restored disk, it gets to the date/time dialog, and then crashes. 2.4 SDS 940 The SDS 940 is untested, awaiting real code. 2.5 GCC Optimization At -O2 and above, GCC does not correctly compile the simulators which use setjmp-longjmp (PDP-11, PDP-10, VAX). A working hypothesis is that optimized state maintained in registers is being used in the setjmp processing routine. On the PDP-11 and PDP-10, all of this state has been either made global, or volatile, to encourage GCC to keep the state up to date in memory. The VAX is still vulnerable. 3. Work list 3.1 SCP - Better ENABLE/DISABLE. 3.2 PDP-11 RQDX3 Software mapped mode, RCT read simulation, VMS debug.
382 lines
10 KiB
C
382 lines
10 KiB
C
/* eclipse_tt.c: Eclipse console terminal simulator
|
||
|
||
Copyright (c) 1993-1997,
|
||
Robert M Supnik, Digital Equipment Corporation
|
||
Commercial use prohibited
|
||
|
||
tti terminal input
|
||
tto terminal output
|
||
*/
|
||
|
||
#include "nova_defs.h"
|
||
|
||
#define UNIT_V_DASHER (UNIT_V_UF + 0) /* Dasher mode */
|
||
#define UNIT_DASHER (1 << UNIT_V_DASHER)
|
||
extern int32 int_req, dev_busy, dev_done, dev_disable;
|
||
t_stat tti_svc (UNIT *uptr);
|
||
t_stat tto_svc (UNIT *uptr);
|
||
t_stat tti_reset (DEVICE *dptr);
|
||
t_stat tto_reset (DEVICE *dptr);
|
||
t_stat ttx_setmod (UNIT *uptr, int32 value);
|
||
extern t_stat sim_activate (UNIT *uptr, int32 delay);
|
||
extern t_stat sim_cancel (UNIT *uptr);
|
||
extern t_stat sim_poll_kbd (void);
|
||
extern t_stat sim_putchar (int32 out);
|
||
|
||
/* TTI data structures
|
||
|
||
tti_dev TTI device descriptor
|
||
tti_unit TTI unit descriptor
|
||
tti_reg TTI register list
|
||
ttx_mod TTI/TTO modifiers list
|
||
*/
|
||
|
||
UNIT tti_unit = { UDATA (&tti_svc, 0, 0), KBD_POLL_WAIT };
|
||
|
||
REG tti_reg[] = {
|
||
{ ORDATA (BUF, tti_unit.buf, 8) },
|
||
{ FLDATA (BUSY, dev_busy, INT_V_TTI) },
|
||
{ FLDATA (DONE, dev_done, INT_V_TTI) },
|
||
{ FLDATA (DISABLE, dev_disable, INT_V_TTI) },
|
||
{ FLDATA (INT, int_req, INT_V_TTI) },
|
||
{ DRDATA (POS, tti_unit.pos, 31), PV_LEFT },
|
||
{ DRDATA (TIME, tti_unit.wait, 24), REG_NZ + PV_LEFT },
|
||
{ FLDATA (MODE, tti_unit.flags, UNIT_V_DASHER), REG_HRO },
|
||
{ NULL } };
|
||
|
||
MTAB ttx_mod[] = {
|
||
{ UNIT_DASHER, 0, "ANSI", "ANSI", &ttx_setmod },
|
||
{ UNIT_DASHER, UNIT_DASHER, "Dasher", "DASHER", &ttx_setmod },
|
||
{ 0 } };
|
||
|
||
DEVICE tti_dev = {
|
||
"TTI", &tti_unit, tti_reg, ttx_mod,
|
||
1, 10, 31, 1, 8, 8,
|
||
NULL, NULL, &tti_reset,
|
||
NULL, NULL, NULL };
|
||
|
||
/* TTO data structures
|
||
|
||
tto_dev TTO device descriptor
|
||
tto_unit TTO unit descriptor
|
||
tto_reg TTO register list
|
||
*/
|
||
|
||
UNIT tto_unit = { UDATA (&tto_svc, 0, 0), SERIAL_OUT_WAIT };
|
||
|
||
REG tto_reg[] = {
|
||
{ ORDATA (BUF, tto_unit.buf, 8) },
|
||
{ FLDATA (BUSY, dev_busy, INT_V_TTO) },
|
||
{ FLDATA (DONE, dev_done, INT_V_TTO) },
|
||
{ FLDATA (DISABLE, dev_disable, INT_V_TTO) },
|
||
{ FLDATA (INT, int_req, INT_V_TTO) },
|
||
{ DRDATA (POS, tto_unit.pos, 31), PV_LEFT },
|
||
{ DRDATA (TIME, tto_unit.wait, 24), PV_LEFT },
|
||
{ FLDATA (MODE, tto_unit.flags, UNIT_V_DASHER), REG_HRO },
|
||
{ NULL } };
|
||
|
||
DEVICE tto_dev = {
|
||
"TTO", &tto_unit, tto_reg, ttx_mod,
|
||
1, 10, 31, 1, 8, 8,
|
||
NULL, NULL, &tto_reset,
|
||
NULL, NULL, NULL };
|
||
|
||
|
||
|
||
/* Terminal input: IOT routine */
|
||
|
||
int32 tti (int32 pulse, int32 code, int32 AC)
|
||
{
|
||
int32 iodata;
|
||
|
||
iodata = (code == ioDIA)? tti_unit.buf & 0377: 0;
|
||
switch (pulse) { /* decode IR<8:9> */
|
||
case iopS: /* start */
|
||
dev_busy = dev_busy | INT_TTI; /* set busy */
|
||
dev_done = dev_done & ~INT_TTI; /* clear done, int */
|
||
int_req = int_req & ~INT_TTI;
|
||
break;
|
||
case iopC: /* clear */
|
||
dev_busy = dev_busy & ~INT_TTI; /* clear busy */
|
||
dev_done = dev_done & ~INT_TTI; /* clear done, int */
|
||
int_req = int_req & ~INT_TTI;
|
||
break; } /* end switch */
|
||
return iodata;
|
||
}
|
||
|
||
/* Unit service */
|
||
|
||
t_stat tti_svc (UNIT *uptr)
|
||
{
|
||
int32 temp;
|
||
|
||
sim_activate (&tti_unit, tti_unit.wait); /* continue poll */
|
||
if ((temp = sim_poll_kbd ()) < SCPE_KFLAG) return temp; /* no char or error? */
|
||
tti_unit.buf = temp & 0177;
|
||
/* --- BEGIN MODIFIED CODE --- */
|
||
if (tti_unit.flags & UNIT_DASHER) /* translate input */
|
||
translate_in();
|
||
/* --- END MODIFIED CODE --- */
|
||
dev_busy = dev_busy & ~INT_TTI; /* clear busy */
|
||
dev_done = dev_done | INT_TTI; /* set done */
|
||
int_req = (int_req & ~INT_DEV) | (dev_done & ~dev_disable);
|
||
tti_unit.pos = tti_unit.pos + 1;
|
||
return SCPE_OK;
|
||
}
|
||
|
||
/* -------------------- BEGIN INSERTION -----------------------*/
|
||
|
||
int curpos = 0; /* used by translate_out() */
|
||
int row = 0, col = 0; /* ditto - for cursor positioning */
|
||
int spec200 = 0; /* signals next char is 'special' */
|
||
|
||
/* Translation: Vt100 input to D200 keycodes. */
|
||
|
||
int32 translate_in()
|
||
{
|
||
char rev = 0;
|
||
|
||
if (tti_unit.buf == '\r')
|
||
rev = '\n';
|
||
if (tti_unit.buf == '\n')
|
||
rev = '\r';
|
||
if (rev)
|
||
tti_unit.buf = rev;
|
||
}
|
||
|
||
/* -------------------- END INSERTION -----------------------*/
|
||
|
||
/* Reset routine */
|
||
|
||
t_stat tti_reset (DEVICE *dptr)
|
||
{
|
||
tti_unit.buf = 0;
|
||
dev_busy = dev_busy & ~INT_TTI; /* clear busy */
|
||
dev_done = dev_done & ~INT_TTI; /* clear done, int */
|
||
int_req = int_req & ~INT_TTI;
|
||
sim_activate (&tti_unit, tti_unit.wait); /* activate unit */
|
||
return SCPE_OK;
|
||
}
|
||
|
||
/* Terminal output: IOT routine */
|
||
|
||
int32 tto (int32 pulse, int32 code, int32 AC)
|
||
{
|
||
if (code == ioDOA) tto_unit.buf = AC & 0377;
|
||
switch (pulse) { /* decode IR<8:9> */
|
||
case iopS: /* start */
|
||
dev_busy = dev_busy | INT_TTO; /* set busy */
|
||
dev_done = dev_done & ~INT_TTO; /* clear done, int */
|
||
int_req = int_req & ~INT_TTO;
|
||
sim_activate (&tto_unit, tto_unit.wait); /* activate unit */
|
||
break;
|
||
case iopC: /* clear */
|
||
dev_busy = dev_busy & ~INT_TTO; /* clear busy */
|
||
dev_done = dev_done & ~INT_TTO; /* clear done, int */
|
||
int_req = int_req & ~INT_TTO;
|
||
sim_cancel (&tto_unit); /* deactivate unit */
|
||
break; } /* end switch */
|
||
return 0;
|
||
}
|
||
|
||
/* Unit service */
|
||
|
||
t_stat tto_svc (UNIT *uptr)
|
||
{
|
||
int32 c, temp;
|
||
|
||
dev_busy = dev_busy & ~INT_TTO; /* clear busy */
|
||
dev_done = dev_done | INT_TTO; /* set done */
|
||
int_req = (int_req & ~INT_DEV) | (dev_done & ~dev_disable);
|
||
c = tto_unit.buf & 0177;
|
||
/* --- BEGIN MODIFIED CODE --- */
|
||
if (tto_unit.flags & UNIT_DASHER) {
|
||
if ((temp = translate_out(c)) != SCPE_OK) return temp;
|
||
} else {
|
||
if ((temp = sim_putchar (c)) != SCPE_OK) return temp;
|
||
tto_unit.pos = tto_unit.pos + 1;
|
||
}
|
||
/* --- END MODIFIED CODE --- */
|
||
return SCPE_OK;
|
||
}
|
||
|
||
/* -------------------- BEGIN INSERTION -----------------------*/
|
||
|
||
/* Translation routine - D200 screen controls to VT-100 controls. */
|
||
|
||
int32 translate_out(int32 c)
|
||
{
|
||
int32 temp;
|
||
char outstr[32];
|
||
|
||
if (spec200 == 1) { /* Special terminal control seq */
|
||
spec200 = 0;
|
||
switch (c) {
|
||
case 'C': /* read model ID */
|
||
return SCPE_OK;
|
||
case 'E': /* Reverse video off */
|
||
return SCPE_OK;
|
||
case 'D': /* Reverse video on */
|
||
return SCPE_OK;
|
||
default:
|
||
return SCPE_OK;
|
||
}
|
||
}
|
||
if (curpos == 1) { /* 2nd char of cursor position */
|
||
col = c & 0x7f;
|
||
curpos++;
|
||
return (SCPE_OK);
|
||
}
|
||
if (curpos == 2) { /* 3rd char of cursor position */
|
||
row = c & 0x7f;
|
||
curpos = 0;
|
||
sprintf(outstr, "\033[%d;%dH", row+1, col+1);
|
||
if ((temp = putseq(outstr)) != SCPE_OK) return temp;
|
||
return (SCPE_OK);
|
||
}
|
||
switch (c) { /* Single-char command or data */
|
||
case 003: /* Blink enable */
|
||
break;
|
||
case 004: /* Blink disable */
|
||
break;
|
||
case 005: /* Read cursor address */
|
||
break;
|
||
case 010: /* Cursor home */
|
||
sprintf(outstr, "\033[1;1H");
|
||
if ((temp = putseq(outstr)) != SCPE_OK) return temp;
|
||
row = col = 0;
|
||
return (SCPE_OK);
|
||
case 012: /* Newline */
|
||
if ((temp = sim_putchar('\r')) != SCPE_OK) return temp;
|
||
tto_unit.pos += 1;
|
||
if ((temp = sim_putchar(c)) != SCPE_OK) return temp;
|
||
tto_unit.pos += 1;
|
||
col = 1;
|
||
row++;
|
||
if (row > 24) row = 1;
|
||
return (SCPE_OK);
|
||
case 013: /* Erase EOL */
|
||
sprintf(outstr, "\033[K");
|
||
if ((temp = putseq(outstr)) != SCPE_OK) return temp;
|
||
return (SCPE_OK);
|
||
case 014: /* Erase screen */
|
||
sprintf(outstr, "\033[1;1H\033[2J");
|
||
if ((temp = putseq(outstr)) != SCPE_OK) return temp;
|
||
row = col = 0;
|
||
return (SCPE_OK);
|
||
case 015: /* CR */
|
||
if ((temp = sim_putchar(c)) != SCPE_OK) return temp;
|
||
tto_unit.pos += 1;
|
||
col = 1;
|
||
return (SCPE_OK);
|
||
case 016: /* Blink On */
|
||
sprintf(outstr, "\033[5m");
|
||
if ((temp = putseq(outstr)) != SCPE_OK) return temp;
|
||
return (SCPE_OK);
|
||
case 017: /* Blink off */
|
||
sprintf(outstr, "\033[25m");
|
||
if ((temp = putseq(outstr)) != SCPE_OK) return temp;
|
||
return (SCPE_OK);
|
||
case 020: /* Write cursor address */
|
||
curpos = 1;
|
||
return SCPE_OK;
|
||
case 024: /* underscore on */
|
||
sprintf(outstr, "\033[4m");
|
||
if ((temp = putseq(outstr)) != SCPE_OK) return temp;
|
||
return (SCPE_OK);
|
||
case 025: /* underscore off */
|
||
sprintf(outstr, "\033[24m");
|
||
if ((temp = putseq(outstr)) != SCPE_OK) return temp;
|
||
return (SCPE_OK);
|
||
break;
|
||
case 027: /* cursor up */
|
||
sprintf(outstr, "\033[A");
|
||
if ((temp = putseq(outstr)) != SCPE_OK) return temp;
|
||
row--;
|
||
if (row < 1) row = 24;
|
||
return (SCPE_OK);
|
||
case 030: /* cursor right */
|
||
sprintf(outstr, "\033[C");
|
||
if ((temp = putseq(outstr)) != SCPE_OK) return temp;
|
||
col++;
|
||
if (col > 80) {
|
||
col = 1;
|
||
row++;
|
||
if (row > 24) row = 1;
|
||
}
|
||
return (SCPE_OK);
|
||
case 031: /* Cursor left */
|
||
sprintf(outstr, "\033[D");
|
||
if ((temp = putseq(outstr)) != SCPE_OK) return temp;
|
||
tto_unit.pos += 1;
|
||
col--;
|
||
if (col < 1) {
|
||
col = 80;
|
||
row--;
|
||
if (row < 1) row = 24;
|
||
}
|
||
return (SCPE_OK);
|
||
case 032: /* Cursor down */
|
||
sprintf(outstr, "\033[B");
|
||
if ((temp = putseq(outstr)) != SCPE_OK) return temp;
|
||
row++;
|
||
if (row > 24) row = 1;
|
||
return (SCPE_OK);
|
||
case 034: /* Dim on */
|
||
sprintf(outstr, "\033[22m");
|
||
if ((temp = putseq(outstr)) != SCPE_OK) return temp;
|
||
return (SCPE_OK);
|
||
case 035: /* Dim off */
|
||
sprintf(outstr, "\033[1m");
|
||
if ((temp = putseq(outstr)) != SCPE_OK) return temp;
|
||
return (SCPE_OK);
|
||
case 036: /* Special sequence */
|
||
spec200 = 1;
|
||
return SCPE_OK;
|
||
default: /* ..A character of data */
|
||
if ((temp = sim_putchar(c)) != SCPE_OK) return temp;
|
||
tto_unit.pos += 1;
|
||
col++;
|
||
if (col > 80) {
|
||
col = 1;
|
||
row++;
|
||
if (row > 24) row = 24;
|
||
}
|
||
return (SCPE_OK);
|
||
}
|
||
return SCPE_OK;
|
||
}
|
||
|
||
int32 putseq(char *seq)
|
||
{
|
||
int i, len, temp;
|
||
|
||
len = strlen(seq);
|
||
for (i = 0; i < len; i++) {
|
||
if ((temp = sim_putchar(seq[i])) != SCPE_OK)
|
||
return temp;
|
||
tto_unit.pos += 1;
|
||
}
|
||
return SCPE_OK;
|
||
}
|
||
|
||
/* -------------------- END INSERTION -----------------------*/
|
||
|
||
/* Reset routine */
|
||
|
||
t_stat tto_reset (DEVICE *dptr)
|
||
{
|
||
tto_unit.buf = 0;
|
||
dev_busy = dev_busy & ~INT_TTO; /* clear busy */
|
||
dev_done = dev_done & ~INT_TTO; /* clear done, int */
|
||
int_req = int_req & ~INT_TTO;
|
||
sim_cancel (&tto_unit); /* deactivate unit */
|
||
return SCPE_OK;
|
||
}
|
||
|
||
t_stat ttx_setmod (UNIT *uptr, int32 value)
|
||
{
|
||
tti_unit.flags = (tti_unit.flags & ~UNIT_DASHER) | value;
|
||
tto_unit.flags = (tto_unit.flags & ~UNIT_DASHER) | value;
|
||
return SCPE_OK;
|
||
}
|