1
0
mirror of https://github.com/simh/simh.git synced 2026-01-26 04:01:38 +00:00

DISPLAY: Latest version of display code from Phil Budne and Doug Gwyn including initial pdp1_dpy and pdp11_vt

This commit is contained in:
Mark Pizzolato
2013-10-16 01:02:12 -07:00
parent 026dd98d83
commit 1e3586ec91
42 changed files with 21636 additions and 8327 deletions

View File

@@ -25,13 +25,14 @@
cpu PDP-1 central processor
210Mar-12 RMS Fixed & vs && in Ea_ch (Michael Bloom)
21-Mar-12 RMS Fixed & vs && in Ea_ch (Michael Bloom)
30-May-07 RMS Fixed typo in SBS clear (Norm Lastovica)
28-Dec-06 RMS Added 16-channel SBS support, PDP-1D support
28-Jun-06 RMS Fixed bugs in MUS and DIV
22-Sep-05 RMS Fixed declarations (Sterling Garwood)
16-Aug-05 RMS Fixed C++ declaration and cast problems
09-Nov-04 RMS Added instruction history
08-Feb-04 PLB Added display device spacewar/test switches
07-Sep-03 RMS Added additional explanation on I/O simulation
01-Sep-03 RMS Added address switches for hardware readin
23-Jul-03 RMS Revised to detect I/O wait hang
@@ -360,6 +361,10 @@ extern int32 dt (int32 inst, int32 dev, int32 dat);
extern int32 drm (int32 inst, int32 dev, int32 dat);
extern int32 clk (int32 inst, int32 dev, int32 dat);
extern int32 dcs (int32 inst, int32 dev, int32 dat);
#ifdef USE_DISPLAY
extern int32 dpy (int32 inst, int32 dev, int32 dat, int32 dat2);
extern int32 spacewar (int32 inst, int32 dev, int32 dat);
#endif
const int32 sc_map[512] = {
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, /* 00000xxxx */
@@ -1203,6 +1208,11 @@ while (reason == 0) { /* loop until halted */
io_data = ptp (IR, dev, IO);
break;
#ifdef USE_DISPLAY
case 007: /* display */
io_data = dpy (IR, dev, IO, AC);
break;
#endif
case 010: /* leave ring mode */
if (cpu_unit.flags & UNIT_1D)
PF = PF & ~PF_RNG;
@@ -1212,7 +1222,12 @@ while (reason == 0) { /* loop until halted */
case 011: /* enter ring mode */
if (cpu_unit.flags & UNIT_1D)
PF = PF | PF_RNG;
else reason = stop_inst;
else
#ifdef USE_DISPLAY
io_data = spacewar (IR, dev, IO);
#else
reason = stop_inst;
#endif
break;
case 022: /* data comm sys */
@@ -1685,3 +1700,19 @@ for (k = 0; k < lnt; k++) { /* print specified */
} /* end for */
return SCPE_OK;
}
#ifdef USE_DISPLAY
/* set "test switches"; from display code */
void
cpu_set_switches(unsigned long bits)
{
/* just what we want; smaller CPUs might want to shift down? */
TW = bits;
}
unsigned long
cpu_get_switches(void)
{
return TW;
}
#endif

153
PDP1/pdp1_dpy.c Normal file
View File

@@ -0,0 +1,153 @@
/* pdp1_dpy.c: PDP-1 display simulator
Copyright (c) 2004, Philip L. Budne
Copyright (c) 1993-2003, Robert M. Supnik
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the names of the authors shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the authors.
dpy Type 30 Display for the PDP-1
02-Feb-04 PLB Revamp intensity levels
02-Jan-04 DAG Provide dummy global when display not supported
16-Sep-03 PLB Update for SIMH 3.0-2
12-Sep-03 PLB Add spacewar switch support
04-Sep-03 PLB Start from pdp1_lp.c
*/
#ifdef USE_DISPLAY
#include "pdp1_defs.h"
#include "display/display.h"
extern int32 ios, cpls, iosta, PF;
extern int32 stop_inst;
t_stat dpy_svc (UNIT *uptr);
t_stat dpy_reset (DEVICE *dptr);
/* DPY data structures
dpy_dev DPY device descriptor
dpy_unit DPY unit
dpy_reg DPY register list
*/
#define CYCLE_TIME 5 /* 5us memory cycle */
#define DPY_WAIT (50/CYCLE_TIME) /* 50us */
UNIT dpy_unit = {
UDATA (&dpy_svc, UNIT_ATTABLE, 0), DPY_WAIT };
DEVICE dpy_dev = {
"DPY", &dpy_unit, NULL, NULL,
1, 10, 31, 1, 8, 8,
NULL, NULL, &dpy_reset,
NULL, NULL, NULL,
NULL, DEV_DIS | DEV_DISABLE };
/* Display IOT routine */
int32 dpy (int32 inst, int32 dev, int32 io, int32 ac)
{
int32 x, y;
int level;
if (dpy_dev.flags & DEV_DIS) /* disabled? */
return (stop_inst << IOT_V_REASON) | io; /* stop if requested */
if (GEN_CPLS (inst)) { /* comp pulse? */
ios = 0; /* clear flop */
cpls = cpls | CPLS_DPY; } /* request completion */
else cpls = cpls & ~CPLS_DPY;
x = (ac >> 8) & 01777; /* high ten bits of ac */
y = (io >> 8) & 01777; /* high ten bits of io */
/*
* convert one's complement -511..+511 center origin
* to 0..1022 (lower left origin)
*/
if (x & 01000)
x ^= 01000;
else
x += 511;
if (y & 01000)
y ^= 01000;
else
y += 511;
/* intensity, from values seen in spacewar (40,00,01,02,03) */
switch ((inst >> 6) & 077) {
case 01: level = DISPLAY_INT_MAX-5; break;
case 02: level = DISPLAY_INT_MAX-4; break;
case 03: level = DISPLAY_INT_MAX-2; break;
case 040: /* super bright? */
default: level = DISPLAY_INT_MAX; break;
}
if (display_point(x,y,level,0)) {
/* here with light pen hit */
PF = PF | 010; /* set prog flag 3 */
iosta |= IOS_TTI; /* set io status flag */
}
else
iosta &= ~IOS_TTI; /* clear io status flag */
sim_activate (&dpy_unit, dpy_unit.wait); /* activate */
return io;
}
/*
* Unit service routine
*
* Under X11 this includes polling for events, so it can't be
* call TOO infrequently...
*/
t_stat dpy_svc (UNIT *uptr)
{
if (cpls & CPLS_DPY) { /* completion pulse? */
ios = 1; /* restart */
cpls = cpls & ~CPLS_DPY; } /* clr pulse pending */
display_age(dpy_unit.wait*CYCLE_TIME, 1);
sim_activate (&dpy_unit, dpy_unit.wait); /* requeue! */
return SCPE_OK;
}
/* Reset routine */
t_stat dpy_reset (DEVICE *dptr)
{
if (!(dptr->flags & DEV_DIS)) {
display_reset();
cpls = cpls & ~CPLS_DPY;
iosta = iosta & ~(IOS_PNT | IOS_SPC); /* clear flags */
}
sim_cancel (&dpy_unit); /* deactivate unit */
return SCPE_OK;
}
int32 spacewar (int32 inst, int32 dev, int32 io)
{
if (dpy_dev.flags & DEV_DIS) /* disabled? */
return (stop_inst << IOT_V_REASON) | io; /* stop if requested */
return spacewar_switches;
}
#else /* USE_DISPLAY not defined */
char pdp1_dpy_unused; /* sometimes empty object modules cause problems */
#endif /* USE_DISPLAY not defined */

View File

@@ -58,7 +58,9 @@ extern DEVICE dt_dev;
extern DEVICE drm_dev;
extern DEVICE drp_dev;
extern DEVICE dcs_dev, dcsl_dev;
#if defined(USE_DISPLAY)
extern DEVICE dpy_dev;
#endif
extern UNIT cpu_unit;
extern REG cpu_reg[];
extern int32 M[];
@@ -95,7 +97,9 @@ DEVICE *sim_devices[] = {
&drp_dev,
&dcs_dev,
&dcsl_dev,
/* &dpy_dev, */
#if defined(USE_DISPLAY)
&dpy_dev,
#endif
NULL
};

64
PDP1/spacewar1/README Normal file
View File

@@ -0,0 +1,64 @@
Preliminary PDP-1 Spacewar README
Phil Budne
February 9, 2004
Both spacewar.mac and macro1.c are available from Phil's CVS server.
see http://www.ultimate.com/phil/xy
cvs -d :pserver:anonymous@cvs.ultimate.com:/home/cvs login
Password: anonymous
cvs -d :pserver:anonymous@cvs.ultimate.com:/home/cvs co history/pdp1
README.MIT
readme from MIT
contains history, and instructions
spacewar.mac
spacewar 3.1 (24 sep 62) retyped at MIT from a listing,
originally assembled using a Perl macro-expander and assembler,
and run under a Java PDP-1 emulator.
This version modified by Phil Budne to assemble under his
version of "macro1" (see below)
Note that low memory (locations 6 thru 31) contains various
manifest constants which can be tweaked to alter the game's
behavior!
spacewar.rim
above assembled by Phil Budne's macro1
PDP-1 RIM of "loader" followed by loader blocks:
PDP-1 simulator V4.0
sim> set dpy enable
sim> attach ptr spacewar.rim
sim> boot ptr
controls compatible with MIT Java simulation, see README.LCS
or display/README from your SIMH distribution
munch.mac
"munching squares" display hack, reconstructed
from world.std.com/~dpbsmith/munch.html
munch.rim
binary of munching squares.
reads console switches:
Upto 18 simulated console switches, toggled by hitting keys:
123 456 789 qwe rty uio
space bar clears all switches.
assembled with '-r' option, so it can be "loaded" directly:
PDP-1 simulator V4.0
sim> set dpy enable
sim> load munch.rim
sim> run
macro1.c
Phil Budne's version of the MACRO cross-assembler

25
PDP1/spacewar1/README.MIT Normal file
View File

@@ -0,0 +1,25 @@
Spacewar! was conceived in 1961 by Martin Graetz, Stephen Russell, and
Wayne Wiitanen. It was first realized on the PDP-1 in 1962 by Stephen
Russell, Peter Samson, Dan Edwards, and Martin Graetz, together with
Alan Kotok, Steve Piner, and Robert A Saunders. Spacewar! is in the
public domain, but this credit paragraph must accompany all
distributed versions of the program.
This is the original version! Martin Graetz provided us with a printed
version of the source. We typed in in again - it was about 40 pages
long - and re-assembled it with a PDP-1 assembler written in PERL. The
resulting binary runs on a PDP-1 emulator written as a Java applet.
The code is extremely faithful to the original. There are only two
changes. 1)The spaceships have been made bigger and 2) The overall
timing has been special cased to deal with varying machine speeds.
The sources are available in a subdirectory called "sources".
The "a", "s", "d", "f" keys control one of the spaceships. The "k",
"l", ";", "'" keys control the other. The controls are spin one way,
spin the other, thrust, and fire.
Barry Silverman
Brian Silverman
Vadim Gerasimov

3068
PDP1/spacewar1/macro1.c Normal file

File diff suppressed because it is too large Load Diff

21
PDP1/spacewar1/munch.mac Normal file
View File

@@ -0,0 +1,21 @@
munching squares
1000/
// from dpbsmith's web page:
// http://world.std.com/~dpbsmith/munch.html
// classic: 04000
// fun: 1, 4014, 4016, 100000
foo, lat
add \v
dac v
rcl 9s
xor v
dpy-4000
jmp foo
variables
start foo

BIN
PDP1/spacewar1/munch.rim Normal file

Binary file not shown.

1857
PDP1/spacewar1/spacewar.mac Normal file

File diff suppressed because it is too large Load Diff

BIN
PDP1/spacewar1/spacewar.rim Normal file

Binary file not shown.