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

1
.gitattributes vendored
View file

@ -3,5 +3,6 @@
*.vcproj binary *.vcproj binary
*.exe binary *.exe binary
*.bin binary *.bin binary
*.rim binary
sim_rev.h export-subst sim_rev.h export-subst

View file

@ -25,13 +25,14 @@
cpu PDP-1 central processor 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) 30-May-07 RMS Fixed typo in SBS clear (Norm Lastovica)
28-Dec-06 RMS Added 16-channel SBS support, PDP-1D support 28-Dec-06 RMS Added 16-channel SBS support, PDP-1D support
28-Jun-06 RMS Fixed bugs in MUS and DIV 28-Jun-06 RMS Fixed bugs in MUS and DIV
22-Sep-05 RMS Fixed declarations (Sterling Garwood) 22-Sep-05 RMS Fixed declarations (Sterling Garwood)
16-Aug-05 RMS Fixed C++ declaration and cast problems 16-Aug-05 RMS Fixed C++ declaration and cast problems
09-Nov-04 RMS Added instruction history 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 07-Sep-03 RMS Added additional explanation on I/O simulation
01-Sep-03 RMS Added address switches for hardware readin 01-Sep-03 RMS Added address switches for hardware readin
23-Jul-03 RMS Revised to detect I/O wait hang 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 drm (int32 inst, int32 dev, int32 dat);
extern int32 clk (int32 inst, int32 dev, int32 dat); extern int32 clk (int32 inst, int32 dev, int32 dat);
extern int32 dcs (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] = { const int32 sc_map[512] = {
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, /* 00000xxxx */ 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); io_data = ptp (IR, dev, IO);
break; break;
#ifdef USE_DISPLAY
case 007: /* display */
io_data = dpy (IR, dev, IO, AC);
break;
#endif
case 010: /* leave ring mode */ case 010: /* leave ring mode */
if (cpu_unit.flags & UNIT_1D) if (cpu_unit.flags & UNIT_1D)
PF = PF & ~PF_RNG; PF = PF & ~PF_RNG;
@ -1212,7 +1222,12 @@ while (reason == 0) { /* loop until halted */
case 011: /* enter ring mode */ case 011: /* enter ring mode */
if (cpu_unit.flags & UNIT_1D) if (cpu_unit.flags & UNIT_1D)
PF = PF | PF_RNG; PF = PF | PF_RNG;
else reason = stop_inst; else
#ifdef USE_DISPLAY
io_data = spacewar (IR, dev, IO);
#else
reason = stop_inst;
#endif
break; break;
case 022: /* data comm sys */ case 022: /* data comm sys */
@ -1685,3 +1700,19 @@ for (k = 0; k < lnt; k++) { /* print specified */
} /* end for */ } /* end for */
return SCPE_OK; 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 drm_dev;
extern DEVICE drp_dev; extern DEVICE drp_dev;
extern DEVICE dcs_dev, dcsl_dev; extern DEVICE dcs_dev, dcsl_dev;
#if defined(USE_DISPLAY)
extern DEVICE dpy_dev; extern DEVICE dpy_dev;
#endif
extern UNIT cpu_unit; extern UNIT cpu_unit;
extern REG cpu_reg[]; extern REG cpu_reg[];
extern int32 M[]; extern int32 M[];
@ -95,7 +97,9 @@ DEVICE *sim_devices[] = {
&drp_dev, &drp_dev,
&dcs_dev, &dcs_dev,
&dcsl_dev, &dcsl_dev,
/* &dpy_dev, */ #if defined(USE_DISPLAY)
&dpy_dev,
#endif
NULL 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.

52
PDP11/lunar11/README.txt Normal file
View file

@ -0,0 +1,52 @@
VT11/GT40 Lunar Lander files
preliminary README phil
Phil Budne
February 9, 2004
Lunar lander startup can take forever (lander uses spin loop to count
down time for display of starting screen. This may be due to the fact
that SIMH only tracks cycles in terms of instructions, not execution
time). To speed up display of the startup screen, deposit a 1 in
location 32530 after loading the lander program, and before starting
it;
sim> ! Set CPU to a Unibus system type
sim> set cpu 11/70
sim> ! Enable DLI device so VT device autoconfigures
sim> ! with a starting vector of 320
sim> set dli enable
sim> set dli line=2
sim> ! Enable VT device
sim> set vt enable
sim> load lunar.lda
sim> dep 32530 1
sim> run
Lunar lander only needs a small screen area, and can run using a
simulated "VR14" display, which can fit on many computer screens
without scaling:
sim> set vt crt=vr14
sim> set vt scale=1
For more information on the VT11/GT40 see
http://www.brouhaha.com/~eric/retrocomputing/dec/gt40/
lunar.txt
Lunar lander instructions
(from ???)
lunar.lda
PDP-11 Paper Tape (LDA) format
http://www.brouhaha.com/~eric/retrocomputing/dec/gt40/software/moonlander/lunar.lda
lunar.dag
PDP-11 Paper Tape (LDA) format
above(?) as patched by Doug Gwyn to fix a spelling error?
load fails with bad checksum under 3.2-preview2?
gtlem.mac
Does not match above binaries??
http://www.brouhaha.com/~eric/retrocomputing/dec/gt40/software/moonlander/gtlem.mac

5102
PDP11/lunar11/gtlem.mac Normal file

File diff suppressed because it is too large Load diff

BIN
PDP11/lunar11/lunar.dag Normal file

Binary file not shown.

BIN
PDP11/lunar11/lunar.lda Normal file

Binary file not shown.

114
PDP11/lunar11/lunar.txt Normal file
View file

@ -0,0 +1,114 @@
PLAYING MOONLANDER (LEM)
The object of moonlander is to land a lunar module on the
surface of the moon. The program will run on any 8K GT40
with a light pen and a clock. If you are attached to a PDP-10
you may use the ROM bootstrap to bring over the assembled
binary. If you are not "talking" to a PDP-10, you may load
in the binary loader (absolute loader) and load in the paper
tape version of the program. Note: the program will destroy
the binary loader when it starts running.
When the program is loaded, it will automatically start and
display an "introductory message" on the screen. Future
restart of the program will not cause this message to be
displayed. Should any problems occur, the program may be
restarted at any time at location zero (000000). Power fail
protection is also provided. After starting (or restarting),
you then start playing the actual game. All numbers, speeds,
weights, etc., are actual numbers. They are for real. To
make the game more possible for an average person to play, I
have given him about 25 to 50% more fuel in the final stages
of landing than he would actually have.
What the user sees on the screen is a broad and extremely
mountainous view of the moon. On the right is a list of data
parameters which the user may examine. They are height,
altitude, angle, fuel left, thrust, weight, horizontal velocity,
vertical velocity, horizontal acceleration, vertical accelera-
tion, distance and seconds. At the top of the screen, any
four of the values may be displayed. To display an item, the
user points the light pen at the item he wishes to display.
The item will then start blinking, to indicate that this is the
item to be displayed. The user then points the light pen at
one of the previously displayed items at the top of the screen.
The old item disappears and is replaced by the new item.
Note that it is possible to display any item anywhere, and even
possible to display one item four times at the top. Anyway,
the parameters mean the following. Height is the height in
feet above the surface (terrain) of the moon. It is the "radar"
height. Altitude is the height above the "mean" height of the
moon ( I guess you would call it "mare" level). Thus altitude
is not affected by terrain. Angle is the angle of the ship in
relationship to the vertical. 10 degrees, -70 degrees, etc.
Fuel left is the amount of fuel left in pounds. Thrust is the
amount of thrust (pounds) currently being produced by the engine.
Weight is the current earth weight of the ship. As fuel is
burned off, the acceleration will increase due to a lessening of
weight. The horizontal velocity is the current horizontal speed
of the ship, in feet per second. It is necessary to land at
under 10 fps horizontal, or else the ship will tip over.
Vertical velocity is the downward speed of the ship. Try to
keep it under 30 for the first few landings, until you get
better. A perfect landing is under 8 fps. The horizontal
and vertical accelerations are just those, in f/sec/sec.
With no power, the vertical acceleration is about 5 fp/s/s
down (-5). Distance is the horizontal distance (X direction)
you are from the projected landing site. Try to stay within
500 feet of this distance, because there are not too many
spots suitable for landing on the moon. Seconds is just the
time since you started trying to land. Thus you now know how
to display information and what they mean.
To control the ship, two controls are provided. The first
controls the rolling or turning of the ship. This is accom-
plished by four arrows just above the display menu. Two point
left and two point right. The two pointing left mean rotate
left and the two pointing right mean rotate right. There is
a big and a little one in each direction. The big one means
to rotate "fast" and the small one means to rotate "slow".
Thus to rotate fast left, you point the light pen at
left arrow. To rotate slow right, you point the light pen at
the small arrow pointing to the right. The arrow will get
slightly brighter to indicate you have chosen it. Above the
arrow there is a bright, solid bar. This bar is your throttle
bar. To its left there is a number in percent (say 50%). This
number indicates the percentage of full thrust your rocket
engine is developing. The engine can develop anywhere from
10% to 100% thrust - full thrust is 10,500 pounds. The
engine thrust cannot fall below 10%. That is the way Grumman
built it (actually the subcontractor). To increase or decrease
your thrust, you merely slide the light pen up and down the bar.
The indicated percentage thrust will change accordingly.
Now we come to actually flying the beast. The module appears
in the upper left hand corner of the screen and is traveling
down and to the right. Your job is to land at the correct
spot (for the time being, we will say this is when the
distance and height both reach zero). The first picture you
see, with the module in the upper left hand corner, is not
drawn to scale (the module appears too big in relationship
to the mountains). Should you successfully get below around
400 feet altitude, the view will now change to a closeup
view of the landing site, and everything will be in scale.
Remember, it is not easy to land the first few times, but
don't be disappointed, you'll do it. Be careful, the game
is extremely addictive. It is also quite dynamic.
Incorporated in the game are just about everything the GT40
can do. Letters, italics, light pen letters, a light bar,
dynamic motion, various line types and intensities (the moon
is not all the same brightness you know). It also shows that
the GT40 can do a lot of calculations while maintaining a
reasonable display.
There are three possible landing sites on the Moon:
1. On the extreme left of the landscape
2. A small flat area to the right of the mountains
3. In the large "flat" area on the right
Good Luck!

View file

@ -620,6 +620,14 @@ typedef struct pdp_dib DIB;
#define INT_V_DLO 10 #define INT_V_DLO 10
#define INT_V_DCI 11 #define INT_V_DCI 11
#define INT_V_DCO 12 #define INT_V_DCO 12
/* VT simulation is sequential, so only
one interrupt is posted at a time. */
#define INT_V_VTLP 13 /* XXX - Manual says VTLP, VTST have opposite */
#define INT_V_VTST 14 /* XXX precedence, but that breaks LUNAR! */
/* XXX How this happens is an utter mystery. */
#define INT_V_VTCH 15
#define INT_V_VTNM 16
#define INT_V_LK 17
#define INT_V_PIR3 0 /* BR3 */ #define INT_V_PIR3 0 /* BR3 */
#define INT_V_PIR2 0 /* BR2 */ #define INT_V_PIR2 0 /* BR2 */
@ -667,6 +675,11 @@ typedef struct pdp_dib DIB;
#define INT_DLO (1u << INT_V_DLO) #define INT_DLO (1u << INT_V_DLO)
#define INT_DCI (1u << INT_V_DCI) #define INT_DCI (1u << INT_V_DCI)
#define INT_DCO (1u << INT_V_DCO) #define INT_DCO (1u << INT_V_DCO)
#define INT_VTLP (1u << INT_V_VTLP)
#define INT_VTST (1u << INT_V_VTST)
#define INT_VTCH (1u << INT_V_VTCH)
#define INT_VTNM (1u << INT_V_VTNM)
#define INT_LK (1u << INT_V_LK)
#define INT_PIR3 (1u << INT_V_PIR3) #define INT_PIR3 (1u << INT_V_PIR3)
#define INT_PIR2 (1u << INT_V_PIR2) #define INT_PIR2 (1u << INT_V_PIR2)
#define INT_PIR1 (1u << INT_V_PIR1) #define INT_PIR1 (1u << INT_V_PIR1)
@ -717,6 +730,11 @@ typedef struct pdp_dib DIB;
#define IPL_DLO 4 #define IPL_DLO 4
#define IPL_DCI 4 #define IPL_DCI 4
#define IPL_DCO 4 #define IPL_DCO 4
#define IPL_VTLP 4
#define IPL_VTST 4
#define IPL_VTCH 4
#define IPL_VTNM 4
#define IPL_LK 4 /* XXX just a guess */
#define IPL_PIR7 7 #define IPL_PIR7 7
#define IPL_PIR6 6 #define IPL_PIR6 6

View file

@ -528,8 +528,8 @@ AUTO_CON auto_tab[] = {/*c #v am vm fxa fxv */
{ { NULL }, 1, 2, 0, 8, { 0 } }, /* DLV11J - fx CSRs */ { { NULL }, 1, 2, 0, 8, { 0 } }, /* DLV11J - fx CSRs */
{ { NULL }, 1, 2, 8, 8 }, /* DJ11 */ { { NULL }, 1, 2, 8, 8 }, /* DJ11 */
{ { NULL }, 1, 2, 16, 8 }, /* DH11 */ { { NULL }, 1, 2, 16, 8 }, /* DH11 */
{ { NULL }, 1, 4, 0, 8, { { "VT" }, 1, 4, 0, 8,
{012000, 012010, 012020, 012030} }, /* GT40 */ {012000, 012010, 012020, 012030} }, /* VT11/GT40 - fx CSRs */
{ { NULL }, 1, 2, 0, 8, { { NULL }, 1, 2, 0, 8,
{010400} }, /* LPS11 */ {010400} }, /* LPS11 */
{ { NULL }, 1, 2, 8, 8 }, /* DQ11 */ { { NULL }, 1, 2, 8, 8 }, /* DQ11 */

View file

@ -41,6 +41,7 @@
22-Jul-05 RMS Fixed missing , in initializer (Doug Gwyn) 22-Jul-05 RMS Fixed missing , in initializer (Doug Gwyn)
22-Dec-03 RMS Added second DEUNA/DELUA support 22-Dec-03 RMS Added second DEUNA/DELUA support
18-Oct-03 RMS Added DECtape off reel message 18-Oct-03 RMS Added DECtape off reel message
14-Sep-03 PLB Added VT11 support
06-May-03 RMS Added support for second DEQNA/DELQA 06-May-03 RMS Added support for second DEQNA/DELQA
09-Jan-03 RMS Added DELUA/DEUNA support 09-Jan-03 RMS Added DELUA/DEUNA support
17-Oct-02 RMS Fixed bugs in branch, SOB address parsing 17-Oct-02 RMS Fixed bugs in branch, SOB address parsing
@ -100,6 +101,9 @@ extern DEVICE tq_dev;
extern DEVICE ts_dev; extern DEVICE ts_dev;
extern DEVICE tu_dev; extern DEVICE tu_dev;
extern DEVICE ta_dev; extern DEVICE ta_dev;
#ifdef USE_DISPLAY
extern DEVICE vt_dev;
#endif
extern DEVICE xq_dev, xqb_dev; extern DEVICE xq_dev, xqb_dev;
extern DEVICE xu_dev, xub_dev; extern DEVICE xu_dev, xub_dev;
extern DEVICE ke_dev; extern DEVICE ke_dev;
@ -167,6 +171,9 @@ DEVICE *sim_devices[] = {
&tq_dev, &tq_dev,
&tu_dev, &tu_dev,
&ta_dev, &ta_dev,
#ifdef USE_DISPLAY
&vt_dev,
#endif
&xq_dev, &xq_dev,
&xqb_dev, &xqb_dev,
&xu_dev, &xu_dev,

433
PDP11/pdp11_vt.c Normal file
View file

@ -0,0 +1,433 @@
#ifdef USE_DISPLAY
/* pdp11_vt.c: PDP-11 VT11/VS60 Display Processor Simulation
Copyright (c) 2003-2004, Philip L. Budne, Douglas A. Gwyn
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.
vt VT11/VS60 Display Processor
05-Feb-04 DAG Improved VT11 emulation
Added VS60 support
14-Sep-03 PLB Start from pdp11_lp.c
*/
/*
* this file is just a thin layer of glue to the simulator-
* independent XY Display simulation
*/
#if defined (VM_VAX) /* VAX version */
#include "vax_defs.h"
#elif defined(VM_PDP11) /* PDP-11 version */
#include "pdp11_defs.h"
#else
#error "VT11/VS60 is supported only on the PDP-11 and VAX"
#endif
#include "display/display.h"
#include "display/vt11.h"
/*
* Timing parameters. Should allow some runtime adjustment,
* since several different configurations were shipped, including:
*
* GT40: PDP-11/05 with VT11 display processor
* GT44: PDP-11/40 with VT11 display processor
* GT46: PDP-11/34 with VT11 display processor
* GT62: PDP-11/34a with VS60 display system
*/
/*
* run a VT11/VS60 cycle every this many PDP-11 "cycle" times;
*
* Under the X Window System (X11), this includes polling
* for events (mouse movement)!
*/
#define VT11_DELAY 1
/*
* memory cycle time
*/
#define MEMORY_CYCLE 1 /* either .98 or 1.2 us? */
/*
* delay in microseconds between VT11/VS60 cycles:
* VT11/VS60 and PDP-11 CPU's share the same memory bus,
* and each VT11/VS60 instruction requires a memory reference;
* figure each PDP11 instruction requires two memory references
*/
#define CYCLE_US (MEMORY_CYCLE*(VT11_DELAY*2+1))
extern int32 int_req[IPL_HLVL];
extern int32 int_vec[IPL_HLVL][32];
DEVICE vt_dev;
t_stat vt_rd(int32 *data, int32 PA, int32 access);
t_stat vt_wr(int32 data, int32 PA, int32 access);
t_stat vt_svc(UNIT *uptr);
t_stat vt_reset(DEVICE *dptr);
t_stat vt_boot(int32 unit, DEVICE *dptr);
t_stat vt_set_crt(UNIT *uptr, int32 val, char *cptr, void *desc);
t_stat vt_show_crt(FILE *st, UNIT *uptr, int32 val, void *desc);
t_stat vt_set_scale(UNIT *uptr, int32 val, char *cptr, void *desc);
t_stat vt_show_scale(FILE *st, UNIT *uptr, int32 val, void *desc);
t_stat vt_set_hspace(UNIT *uptr, int32 val, char *cptr, void *desc);
t_stat vt_show_hspace(FILE *st, UNIT *uptr, int32 val, void *desc);
t_stat vt_set_vspace(UNIT *uptr, int32 val, char *cptr, void *desc);
t_stat vt_show_vspace(FILE *st, UNIT *uptr, int32 val, void *desc);
t_stat vt_help (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr);
char *vt_description (DEVICE *dptr);
/* VT11/VS60 data structures
vt_dev VT11 device descriptor
vt_unit VT11 unit descriptor
vt_reg VT11 register list
vt_mod VT11 modifier list
*/
#define IOLN_VT11 010 /* VT11 */
#define IOLN_VS60 040 /* VS60 */
DIB vt_dib = { IOBA_AUTO, IOLN_VT11, &vt_rd, &vt_wr,
4, IVCL(VTST), VEC_AUTO, {NULL} };
/* (VT11 uses only the first 3 interrupt vectors) */
UNIT vt_unit = {
UDATA (&vt_svc, UNIT_SEQ, 0), VT11_DELAY};
REG vt_reg[] = {
{ GRDATA (DEVADDR, vt_dib.ba, DEV_RDX, 32, 0), REG_HRO },
{ GRDATA (DEVVEC, vt_dib.vec, DEV_RDX, 16, 0), REG_HRO },
{ NULL } };
MTAB vt_mod[] = {
{ MTAB_XTD|MTAB_VDV|MTAB_VALR, 0, "CRT", "CRT={VR14|VR17|VR48}",
&vt_set_crt, &vt_show_crt, NULL, "CRT Type" },
{ MTAB_XTD|MTAB_VDV|MTAB_VALR, 0, "SCALE", "SCALE={1|2|4|8}",
&vt_set_scale, &vt_show_scale, NULL, "Pixel Scale Factor" },
{ MTAB_XTD|MTAB_VDV|MTAB_VALR, 0, "HSPACE", "HSPACE={NARROW|NORMAL}",
&vt_set_hspace, &vt_show_hspace, NULL, "Horizontal Spacing" },
{ MTAB_XTD|MTAB_VDV|MTAB_VALR, 0, "VSPACE", "VSPACE={TALL|NORMAL}",
&vt_set_vspace, &vt_show_vspace, NULL, "Vertical Spacing" },
{ MTAB_XTD|MTAB_VDV|MTAB_VALR, 020, "ADDRESS", "ADDRESS",
&set_addr, &show_addr, NULL, "Bus address" },
{ MTAB_XTD|MTAB_VDV|MTAB_VALR, 0, "VECTOR", "VECTOR",
&set_vec, &show_vec, NULL, "Interrupt vector" },
{ MTAB_XTD|MTAB_VDV, 0, NULL, "AUTOCONFIGURE",
&set_addr_flt, NULL, NULL, "Enable autoconfiguration of address & vector" },
{ 0 } };
DEVICE vt_dev = {
"VT", &vt_unit, vt_reg, vt_mod,
1, 8, 31, 1, DEV_RDX, 16,
NULL, NULL, &vt_reset,
&vt_boot, NULL, NULL,
&vt_dib, DEV_DIS | DEV_DISABLE | DEV_UBUS | DEV_Q18,
0, 0, NULL, NULL, NULL, NULL, NULL,
&vt_description
};
/* VT11/VS60 routines
vt_rd I/O page read
vt_wr I/O page write
vt_svc process event
vt_reset process reset
vt_boot bootstrap device
*/
t_stat
vt_rd(int32 *data, int32 PA, int32 access)
{
switch (PA & 036) {
case 000: *data = vt11_get_dpc(); return SCPE_OK;
case 002: *data = vt11_get_mpr(); return SCPE_OK;
case 004: *data = vt11_get_xpr(); return SCPE_OK;
case 006: *data = vt11_get_ypr(); return SCPE_OK;
case 010: if (!VS60) break; *data = vt11_get_rr(); return SCPE_OK;
case 012: if (!VS60) break; *data = vt11_get_spr(); return SCPE_OK;
case 014: if (!VS60) break; *data = vt11_get_xor(); return SCPE_OK;
case 016: if (!VS60) break; *data = vt11_get_yor(); return SCPE_OK;
case 020: if (!VS60) break; *data = vt11_get_anr(); return SCPE_OK;
case 022: if (!VS60) break; *data = vt11_get_scr(); return SCPE_OK;
case 024: if (!VS60) break; *data = vt11_get_nr(); return SCPE_OK;
case 026: if (!VS60) break; *data = vt11_get_sdr(); return SCPE_OK;
case 030: if (!VS60) break; *data = vt11_get_str(); return SCPE_OK;
case 032: if (!VS60) break; *data = vt11_get_sar(); return SCPE_OK;
case 034: if (!VS60) break; *data = vt11_get_zpr(); return SCPE_OK;
case 036: if (!VS60) break; *data = vt11_get_zor(); return SCPE_OK;
}
return SCPE_NXM;
}
t_stat
vt_wr(int32 data, int32 PA, int32 access)
{
uint16 d = data & 0177777; /* mask just in case */
switch (PA & 037) {
case 000: /* DPC */
/* set the simulator PC */
vt11_set_dpc(d);
/* clear interrupt request (only one will be simulated at a time) */
CLR_INT (VTST);
CLR_INT (VTLP);
CLR_INT (VTCH);
CLR_INT (VTNM);
/* start the display processor by running a cycle */
return vt_svc(&vt_unit);
case 002: vt11_set_mpr(d); return SCPE_OK;
case 004: vt11_set_xpr(d); return SCPE_OK;
case 006: vt11_set_ypr(d); return SCPE_OK;
case 010: if (!VS60) break; vt11_set_rr(d); return SCPE_OK;
case 012: if (!VS60) break; vt11_set_spr(d); return SCPE_OK;
case 014: if (!VS60) break; vt11_set_xor(d); return SCPE_OK;
case 016: if (!VS60) break; vt11_set_yor(d); return SCPE_OK;
case 020: if (!VS60) break; vt11_set_anr(d); return SCPE_OK;
case 022: if (!VS60) break; vt11_set_scr(d); return SCPE_OK;
case 024: if (!VS60) break; vt11_set_nr(d); return SCPE_OK;
case 026: if (!VS60) break; vt11_set_sdr(d); return SCPE_OK;
case 030: if (!VS60) break; vt11_set_str(d); return SCPE_OK;
case 032: if (!VS60) break; vt11_set_sar(d); return SCPE_OK;
case 034: if (!VS60) break; vt11_set_zpr(d); return SCPE_OK;
case 036: if (!VS60) break; vt11_set_zor(d); return SCPE_OK;
}
return SCPE_NXM;
}
/*
* here to run a display processor cycle, called as a SIMH
* "device service routine".
*
* Under X11 this includes polling for events, so it can't be
* call TOO infrequently...
*/
t_stat
vt_svc(UNIT *uptr)
{
if (vt11_cycle(CYCLE_US, 1))
sim_activate (&vt_unit, vt_unit.wait); /* running; reschedule */
return SCPE_OK;
}
t_stat
vt_reset(DEVICE *dptr)
{
if (!(dptr->flags & DEV_DIS))
vt11_reset();
CLR_INT (VTST);
CLR_INT (VTLP);
CLR_INT (VTCH);
CLR_INT (VTNM);
sim_cancel (&vt_unit); /* deactivate unit */
return auto_config ("VT", (dptr->flags & DEV_DIS) ? 0 : 1);
}
/*
* GT4x/GT62 bootstrap (acts as remote terminal)
*/
t_stat
vt_boot(int32 unit, DEVICE *dptr)
{
/* XXX should do something like vt11_set_dpc(&appropriate_ROM_image) */
return SCPE_NOFNC; /* not yet implemented */
}
/* SET/SHOW VT options: */
t_stat
vt_set_crt(UNIT *uptr, int32 val, char *cptr, void *desc)
{
char gbuf[CBUFSIZE];
if (vt11_init)
return SCPE_ALATT; /* should be "changes locked out" */
if (cptr == NULL)
return SCPE_ARG;
get_glyph(cptr, gbuf, 0);
if (strcmp(gbuf, "VR14") == 0)
vt11_display = DIS_VR14;
else if (strcmp(gbuf, "VR17") == 0)
vt11_display = DIS_VR17;
else if (strcmp(gbuf, "VR48") == 0)
vt11_display = DIS_VR48;
else
return SCPE_ARG;
vt_dib.lnt = (VS60) ? IOLN_VS60 : IOLN_VT11;
return SCPE_OK;
}
t_stat
vt_show_crt(FILE *st, UNIT *uptr, int32 val, void *desc)
{
fprintf(st, "crt=VR%d", (int)vt11_display);
return SCPE_OK;
}
t_stat
vt_set_scale(UNIT *uptr, int32 val, char *cptr, void *desc)
{
t_stat r;
t_value v;
if (vt11_init)
return SCPE_ALATT; /* should be "changes locked out" */
if (cptr == NULL)
return SCPE_ARG;
v = get_uint(cptr, 10, 8, &r);
if (r != SCPE_OK)
return r;
if (v != 1 && v != 2 && v != 4 && v != 8)
return SCPE_ARG;
vt11_scale = v;
return SCPE_OK;
}
t_stat
vt_show_scale(FILE *st, UNIT *uptr, int32 val, void *desc)
{
fprintf(st, "scale=%d", (int)vt11_scale);
return SCPE_OK;
}
t_stat
vt_set_hspace(UNIT *uptr, int32 val, char *cptr, void *desc)
{
char gbuf[CBUFSIZE];
if (vt11_init)
return SCPE_ALATT; /* should be "changes locked out" */
if (cptr == NULL)
return SCPE_ARG;
get_glyph(cptr, gbuf, 0);
if (strcmp(gbuf, "NARROW") == 0)
vt11_csp_w = 12;
else if (strcmp(gbuf, "NORMAL") == 0)
vt11_csp_w = 14;
else
return SCPE_ARG;
return SCPE_OK;
}
t_stat
vt_show_hspace(FILE *st, UNIT *uptr, int32 val, void *desc)
{
fprintf(st, "hspace=%s", vt11_csp_w==12 ? "narrow" : "normal");
return SCPE_OK;
}
t_stat
vt_set_vspace(UNIT *uptr, int32 val, char *cptr, void *desc)
{
char gbuf[CBUFSIZE];
if (vt11_init)
return SCPE_ALATT; /* should be "changes locked out" */
if (cptr == NULL)
return SCPE_ARG;
get_glyph(cptr, gbuf, 0);
if (strcmp(gbuf, "TALL") == 0)
vt11_csp_h = 26;
else if (strcmp(gbuf, "NORMAL") == 0)
vt11_csp_h = 24;
else
return SCPE_ARG;
return SCPE_OK;
}
t_stat
vt_show_vspace(FILE *st, UNIT *uptr, int32 val, void *desc)
{
fprintf(st, "vspace=%s", vt11_csp_h==26 ? "tall" : "normal");
return SCPE_OK;
}
/* interface routines (called from display simulator) */
void
vt_stop_intr(void)
{
SET_INT (VTST);
}
void
vt_lpen_intr(void)
{
SET_INT (VTLP);
}
void
vt_char_intr(void)
{
SET_INT (VTCH);
}
void
vt_name_intr(void)
{
SET_INT (VTNM);
}
/* fetch memory */
int
vt_fetch(uint32 addr, vt11word *wp)
{
/* On PDP-11 Unibus 22-bit systems, the VT11/VS60 behaves as
an 18-bit Unibus peripheral and must go through the I/O map. */
/* apply Unibus map, when appropriate */
if (Map_ReadW(addr, 2, wp) == 0)
return 0; /* no problem */
/* else mapped address lies outside configured memory range */
*wp = 0164000; /* DNOP; just updates DPC if used */
/* which shouldn't happen */
return 1; /* used to set "time_out" flag */
}
char *vt_description (DEVICE *dptr)
{
return (VS60) ? "VS60 Display processor"
: "VT11 Display processor";
}
#ifdef VM_PDP11
/* PDP-11 simulation provides this */
extern int32 SR; /* switch register */
#else
int32 SR; /* switch register */
#endif
void
cpu_set_switches(unsigned long val)
{
SR = val;
}
unsigned long
cpu_get_switches(void)
{
return SR;
}
#else /* USE_DISPLAY not defined */
char pdp11_vt_unused; /* sometimes empty object modules cause problems */
#endif /* USE_DISPLAY not defined */

View file

@ -45,7 +45,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="./;../;../PDP1/" AdditionalIncludeDirectories="./;../;../PDP1/"
PreprocessorDefinitions="_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;SIM_NEED_GIT_COMMIT_ID" PreprocessorDefinitions="_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;SIM_NEED_GIT_COMMIT_ID;USE_DISPLAY"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@ -128,7 +128,7 @@
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OmitFramePointers="true" OmitFramePointers="true"
AdditionalIncludeDirectories="./;../;../PDP1/" AdditionalIncludeDirectories="./;../;../PDP1/"
PreprocessorDefinitions="_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;SIM_NEED_GIT_COMMIT_ID" PreprocessorDefinitions="_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;SIM_NEED_GIT_COMMIT_ID;USE_DISPLAY"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
EnableFunctionLevelLinking="true" EnableFunctionLevelLinking="true"
@ -189,6 +189,10 @@
Name="Source Files" Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
> >
<File
RelativePath="..\display\display.c"
>
</File>
<File <File
RelativePath="..\PDP1\pdp1_clk.c" RelativePath="..\PDP1\pdp1_clk.c"
> >
@ -201,6 +205,10 @@
RelativePath="..\PDP1\pdp1_dcs.c" RelativePath="..\PDP1\pdp1_dcs.c"
> >
</File> </File>
<File
RelativePath="..\PDP1\pdp1_dpy.c"
>
</File>
<File <File
RelativePath="..\PDP1\pdp1_drm.c" RelativePath="..\PDP1\pdp1_drm.c"
> >
@ -261,11 +269,19 @@
RelativePath="..\sim_tmxr.c" RelativePath="..\sim_tmxr.c"
> >
</File> </File>
<File
RelativePath="..\display\win32.c"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="Header Files" Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc" Filter="h;hpp;hxx;hm;inl;inc"
> >
<File
RelativePath="..\display\display.h"
>
</File>
<File <File
RelativePath="..\PDP1\pdp1_defs.h" RelativePath="..\PDP1\pdp1_defs.h"
> >
@ -318,6 +334,10 @@
RelativePath="..\sim_tmxr.h" RelativePath="..\sim_tmxr.h"
> >
</File> </File>
<File
RelativePath="..\display\ws.h"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="Resource Files" Name="Resource Files"

View file

@ -45,7 +45,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="./;../;../PDP11/;&quot;../../windows-build/winpcap/Wpdpack/Include&quot;;&quot;../../windows-build/pthreads&quot;" AdditionalIncludeDirectories="./;../;../PDP11/;&quot;../../windows-build/winpcap/Wpdpack/Include&quot;;&quot;../../windows-build/pthreads&quot;"
PreprocessorDefinitions="USE_SHARED;VM_PDP11;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;PTW32_STATIC_LIB;SIM_ASYNCH_IO;USE_READER_THREAD;SIM_NEED_GIT_COMMIT_ID" PreprocessorDefinitions="USE_SHARED;USE_DISPLAY;VM_PDP11;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;PTW32_STATIC_LIB;SIM_ASYNCH_IO;USE_READER_THREAD;SIM_NEED_GIT_COMMIT_ID"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@ -129,7 +129,7 @@
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OmitFramePointers="true" OmitFramePointers="true"
AdditionalIncludeDirectories="./;../;../PDP11/;&quot;../../windows-build/winpcap/Wpdpack/Include&quot;;&quot;../../windows-build/pthreads&quot;" AdditionalIncludeDirectories="./;../;../PDP11/;&quot;../../windows-build/winpcap/Wpdpack/Include&quot;;&quot;../../windows-build/pthreads&quot;"
PreprocessorDefinitions="USE_SHARED;VM_PDP11;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;PTW32_STATIC_LIB;SIM_ASYNCH_IO;USE_READER_THREAD;SIM_NEED_GIT_COMMIT_ID" PreprocessorDefinitions="USE_SHARED;USE_DISPLAY;VM_PDP11;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;PTW32_STATIC_LIB;SIM_ASYNCH_IO;USE_READER_THREAD;SIM_NEED_GIT_COMMIT_ID"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
EnableFunctionLevelLinking="true" EnableFunctionLevelLinking="true"
@ -191,6 +191,10 @@
Name="Source Files" Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
> >
<File
RelativePath="..\display\display.c"
>
</File>
<File <File
RelativePath="..\PDP11\pdp11_cis.c" RelativePath="..\PDP11\pdp11_cis.c"
> >
@ -339,6 +343,10 @@
RelativePath="..\PDP11\pdp11_vh.c" RelativePath="..\PDP11\pdp11_vh.c"
> >
</File> </File>
<File
RelativePath="..\PDP11\pdp11_vt.c"
>
</File>
<File <File
RelativePath="..\PDP11\pdp11_xq.c" RelativePath="..\PDP11\pdp11_xq.c"
> >
@ -407,11 +415,23 @@
RelativePath="..\sim_tmxr.c" RelativePath="..\sim_tmxr.c"
> >
</File> </File>
<File
RelativePath="..\display\vt11.c"
>
</File>
<File
RelativePath="..\display\win32.c"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="Header Files" Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc" Filter="h;hpp;hxx;hm;inl;inc"
> >
<File
RelativePath="..\display\display.h"
>
</File>
<File <File
RelativePath="..\PDP11\pdp11_cpumod.h" RelativePath="..\PDP11\pdp11_cpumod.h"
> >
@ -504,6 +524,14 @@
RelativePath="..\sim_tmxr.h" RelativePath="..\sim_tmxr.h"
> >
</File> </File>
<File
RelativePath="..\display\vt11.h"
>
</File>
<File
RelativePath="..\display\ws.h"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="Resource Files" Name="Resource Files"

View file

@ -483,7 +483,8 @@ PDP1_LIB = $(LIB_DIR)PDP1-$(ARCH).OLB
PDP1_SOURCE = $(PDP1_DIR)PDP1_LP.C,$(PDP1_DIR)PDP1_CPU.C,\ PDP1_SOURCE = $(PDP1_DIR)PDP1_LP.C,$(PDP1_DIR)PDP1_CPU.C,\
$(PDP1_DIR)PDP1_STDDEV.C,$(PDP1_DIR)PDP1_SYS.C,\ $(PDP1_DIR)PDP1_STDDEV.C,$(PDP1_DIR)PDP1_SYS.C,\
$(PDP1_DIR)PDP1_DT.C,$(PDP1_DIR)PDP1_DRM.C,\ $(PDP1_DIR)PDP1_DT.C,$(PDP1_DIR)PDP1_DRM.C,\
$(PDP1_DIR)PDP1_CLK.C,$(PDP1_DIR)PDP1_DCS.C $(PDP1_DIR)PDP1_CLK.C,$(PDP1_DIR)PDP1_DCS.C, \
$(PDP1_DIR)PDP1_DPY.C
PDP1_OPTIONS = /INCL=($(SIMH_DIR),$(PDP1_DIR))/DEF=($(CC_DEFS)) PDP1_OPTIONS = /INCL=($(SIMH_DIR),$(PDP1_DIR))/DEF=($(CC_DEFS))
# #
@ -535,7 +536,7 @@ PDP11_SOURCE1 = $(PDP11_DIR)PDP11_FP.C,$(PDP11_DIR)PDP11_CPU.C,\
$(PDP11_DIR)PDP11_CPUMOD.C,$(PDP11_DIR)PDP11_CR.C,\ $(PDP11_DIR)PDP11_CPUMOD.C,$(PDP11_DIR)PDP11_CR.C,\
$(PDP11_DIR)PDP11_TA.C,$(PDP11_DIR)PDP11_DMC.C,\ $(PDP11_DIR)PDP11_TA.C,$(PDP11_DIR)PDP11_DMC.C,\
$(PDP11_DIR)PDP11_DUP.C,$(PDP11_DIR)PDP11_RS.C,\ $(PDP11_DIR)PDP11_DUP.C,$(PDP11_DIR)PDP11_RS.C,\
$(PDP11_DIR)PDP11_IO_LIB.C $(PDP11_DIR)PDP11_VT.C,$(PDP11_DIR)PDP11_IO_LIB.C
PDP11_LIB2 = $(LIB_DIR)PDP11L2-$(ARCH).OLB PDP11_LIB2 = $(LIB_DIR)PDP11L2-$(ARCH).OLB
PDP11_SOURCE2 = $(PDP11_DIR)PDP11_TM.C,$(PDP11_DIR)PDP11_TS.C,\ PDP11_SOURCE2 = $(PDP11_DIR)PDP11_TM.C,$(PDP11_DIR)PDP11_TS.C,\
$(PDP11_DIR)PDP11_IO.C,$(PDP11_DIR)PDP11_RQ.C,\ $(PDP11_DIR)PDP11_IO.C,$(PDP11_DIR)PDP11_RQ.C,\

View file

@ -1,166 +1,166 @@
$Id: README,v 1.15 2004/02/09 07:20:18 phil Exp $ $Id: README,v 1.15 2004/02/09 07:20:18 phil Exp $
XY Display Simulation XY Display Simulation
Simulates XY plotting displays used on DEC PDP systems. Simulates XY plotting displays used on DEC PDP systems.
Copyright (c) 2003-2004, Philip L. Budne and Douglas A. Gwyn Copyright (c) 2003-2004, Philip L. Budne and Douglas A. Gwyn
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the 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: Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 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 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. 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 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 not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization other dealings in this Software without prior written authorization
from the authors. from the authors.
Phil Budne <phil@ultimate.com> Phil Budne <phil@ultimate.com>
Douglas A Gwyn <gwyn@arl.army.mil> Douglas A Gwyn <gwyn@arl.army.mil>
February 5, 2004 February 5, 2004
Designed for use with Bob Supnik's SIMH, but the code should be easily Designed for use with Bob Supnik's SIMH, but the code should be easily
portable, and usable standalone (see vttest.c for an example). portable, and usable standalone (see vttest.c for an example).
Display code is provided for X11 (Unix/VMS) and Win32. Display code is provided for X11 (Unix/VMS) and Win32.
We're not GUI programmers, so the code is PRIMITIVE!! We're not GUI programmers, so the code is PRIMITIVE!!
Started from VC8E simulator by Douglas W. Jones Started from VC8E simulator by Douglas W. Jones
(distribution 5, of Feb 4, 1997); (distribution 5, of Feb 4, 1997);
This PDP8 Emulator was written by Douglas W. Jones at the This PDP8 Emulator was written by Douglas W. Jones at the
University of Iowa. It is distributed as freeware, of University of Iowa. It is distributed as freeware, of
uncertain function and uncertain utility. uncertain function and uncertain utility.
Original phosphor decay constants for Type 30 display from XMame 0.72.1 Original phosphor decay constants for Type 30 display from XMame 0.72.1
VT11 support GREATLY enhanced (and VT48 support added) and VT11 support GREATLY enhanced (and VT48 support added) and
other general improvements from Douglas A Gwyn. other general improvements from Douglas A Gwyn.
In the interest of fair play we have supplied two makefiles (neither In the interest of fair play we have supplied two makefiles (neither
of which is named Makefile nor makefile), one which works under all of which is named Makefile nor makefile), one which works under all
flavors of "make" (after necessary editing, in the traditional manner), flavors of "make" (after necessary editing, in the traditional manner),
and one which functions only under the GNU version of make (sometimes and one which functions only under the GNU version of make (sometimes
installed as "gmake", but the default "make" on many systems). We have installed as "gmake", but the default "make" on many systems). We have
not added a third flavor which uses BSD make enhancements, because our not added a third flavor which uses BSD make enhancements, because our
deeply held roots (over 40 combined years of Unix experience by the deeply held roots (over 40 combined years of Unix experience by the
authors) demand that things should work on all platforms. Both the authors) demand that things should work on all platforms. Both the
Linux and Windows worlds violate this simple credo (everything works so Linux and Windows worlds violate this simple credo (everything works so
long as you use OUR preferred software), and many current users may not long as you use OUR preferred software), and many current users may not
even realize that editing Makefiles used to be de rigeur. Since the even realize that editing Makefiles used to be de rigeur. Since the
GNU environment is widely available and "gmake" has features that GNU environment is widely available and "gmake" has features that
support automatic configuration for multiple platforms, we have support automatic configuration for multiple platforms, we have
supplied thr GNU-specific variant with the expectation that many users supplied thr GNU-specific variant with the expectation that many users
will find it more convenient. You can copy or link whichever flavor of will find it more convenient. You can copy or link whichever flavor of
makefile suits your taste to whichever spelling of "makefile" suits makefile suits your taste to whichever spelling of "makefile" suits
your fancy, or invoke "make" with the -f flag specifying the desired your fancy, or invoke "make" with the -f flag specifying the desired
makefile. makefile.
To compile test programs: To compile test programs:
======================== ========================
On Unix: On Unix:
# edit smakefile to match your environment # edit smakefile to match your environment
make -f smakefile make -f smakefile
or or
gmake -f gmakefile gmake -f gmakefile
On Win32 (using Cygwin); On Win32 (using Cygwin);
make -f gmakefile WIN32=1 make -f gmakefile WIN32=1
On Win32 (using MINGW): On Win32 (using MINGW):
# edit smakefile to match your environment # edit smakefile to match your environment
make -f smakefile make -f smakefile
or or
mingw32-make -f gmakefile WIN32=1 mingw32-make -f gmakefile WIN32=1
or or
execute build-mingw.bat in a DOS command window execute build-mingw.bat in a DOS command window
creates: creates:
munch: standalone simulation of PDP-1 munching squares; munch: standalone simulation of PDP-1 munching squares;
examines console "test switches" (see next section) examines console "test switches" (see next section)
vt11: sequences through VT11/VS60 simulator test displays; vt11: sequences through VT11/VS60 simulator test displays;
shows how the diplay-processor simulator can be used shows how the diplay-processor simulator can be used
from applications other than PDP-11 simulators from applications other than PDP-11 simulators
Console switches: Console switches:
================ ================
Upto 18 simulated console switches, toggled by hitting keys: Upto 18 simulated console switches, toggled by hitting keys:
123 456 789 qwe rty uio 123 456 789 qwe rty uio
space bar clears all switches. space bar clears all switches.
Spacewar Switches: Spacewar Switches:
================= =================
Key presses for simulated Spacewar control box switches; Key presses for simulated Spacewar control box switches;
action player action player
1 2 1 2
rotate clockwise a k rotate clockwise a k
rotate counter clockwise s l rotate counter clockwise s l
fire engines d ; fire engines d ;
launch torpedo f ' launch torpedo f '
hyperspace (both at once) as kl hyperspace (both at once) as kl
Light pen: Light pen:
========= =========
The light pen is active when any mouse button is held down. The light pen is active when any mouse button is held down.
Mouse button 1 acts as a "tip switch" for models so equipped (VS60). Mouse button 1 acts as a "tip switch" for models so equipped (VS60).
The light pen may be dragged while active. The light pen may be dragged while active.
Too many compile time parameters: Too many compile time parameters:
================================ ================================
Read the comments in display.c for more explanations!! Read the comments in display.c for more explanations!!
DISPLAY_TYPE default display type, one of: DISPLAY_TYPE default display type, one of:
DIS_VR14, DIS_VR17, DIS_VR20, DIS_VR48, DIS_TYPE30, DIS_TYPE340 DIS_VR14, DIS_VR17, DIS_VR20, DIS_VR48, DIS_TYPE30, DIS_TYPE340
selects screen characteristics (phosphor, dimensions). selects screen characteristics (phosphor, dimensions).
Only affects programs which do not make an expicit Only affects programs which do not make an expicit
display_init() call. display_init() call.
PIX_SCALE one of RES_FULL, RES_HALF, RES_QUARTER, RES_EIGHTH PIX_SCALE one of RES_FULL, RES_HALF, RES_QUARTER, RES_EIGHTH
selects default display scaling factor. selects default display scaling factor.
PEN_RADIUS default radius of light pen in (scaled) pixels PEN_RADIUS default radius of light pen in (scaled) pixels
MAXELAPSED Upper limit in real microseconds between polls/delays MAXELAPSED Upper limit in real microseconds between polls/delays
MINELAPSED Lower limit in real microseconds between polls/delays MINELAPSED Lower limit in real microseconds between polls/delays
MINDELAY Lower limit in real microseconds for attempted delay MINDELAY Lower limit in real microseconds for attempted delay
MAXDELAY Upper limit in real microseconds for attempted delay MAXDELAY Upper limit in real microseconds for attempted delay
GAINSHIFT delay_check increment/decrement gain factor GAINSHIFT delay_check increment/decrement gain factor
In display system support (x11.c, win32.c); In display system support (x11.c, win32.c);
PIX_SIZE selects displayed pixel size (default 1) PIX_SIZE selects displayed pixel size (default 1)
makes screen larger, useful when display scaled to small size makes screen larger, useful when display scaled to small size
Programming interface: Programming interface:
===================== =====================
see display.h see display.h
Source repository: Source repository:
================= =================
Up-to-date Sources are available by anonymous CVS. Up-to-date Sources are available by anonymous CVS.
See http://www.ultimate.com/phil/xy/ See http://www.ultimate.com/phil/xy/

View file

@ -1,12 +1,12 @@
@echo off @echo off
rem $Id: build_mingw.bat,v 1.1 2004/01/25 17:48:03 phil Exp $ rem $Id: build_mingw.bat,v 1.1 2004/01/25 17:48:03 phil Exp $
rem Compile all test programs using MINGW make and gcc environment rem Compile all test programs using MINGW make and gcc environment
rem rem
rem If needed, define the path for the MINGW bin directory. rem If needed, define the path for the MINGW bin directory.
rem (this should already be set if MINGW was installed correctly) rem (this should already be set if MINGW was installed correctly)
rem rem
gcc -v 1>NUL 2>NUL gcc -v 1>NUL 2>NUL
if ERRORLEVEL 1 path C:\MinGW\bin;D:\MinGW\bin;E:\MinGW\bin;%path% if ERRORLEVEL 1 path C:\MinGW\bin;D:\MinGW\bin;E:\MinGW\bin;%path%
gcc -v 1>NUL 2>NUL gcc -v 1>NUL 2>NUL
if ERRORLEVEL 1 echo "MinGW Environment Unavailable" if ERRORLEVEL 1 echo "MinGW Environment Unavailable"
mingw32-make WIN32=1 -f gmakefile %1 %2 %3 %4 mingw32-make WIN32=1 -f gmakefile %1 %2 %3 %4

328
display/carbon.c Normal file
View file

@ -0,0 +1,328 @@
/*
* $Id: carbon.c,v 1.2 2005/08/06 21:09:03 phil Exp $
* Mac OS X Carbon support for XY display simulator
* John Dundas <dundas@caltech.edu>
* December 2004
*
* This is a simplistic driver under Mac OS Carbon for the XY display
* simulator.
*
* A more interesting driver would use OpenGL directly.
*/
#include <Carbon/Carbon.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ws.h"
#include "xy.h"
#include <sys/types.h>
#include <sys/time.h>
#define ARRAYLEN(a) (sizeof (a) / sizeof (a[0]))
#ifndef PIX_SIZE
#define PIX_SIZE 1
#endif
/*
* light pen location
* see ws.h for full description
*/
int ws_lp_x = -1;
int ws_lp_y = -1;
static RGBColor blckColor = { 0x0000, 0x0000, 0x0000 };
static RGBColor whteColor = { 0xFFFF, 0xFFFF, 0xFFFF };
static WindowRef mainWind;
static RgnHandle rgn;
static MouseTrackingRef mouseRef;
static int xpixels, ypixels;
static int buttons = 0; /* tracks state of all buttons */
static EventTargetRef EventDispatchTarget;
void MyEventWait ( EventTimeout timeout ) /* double */
{
EventRef theEvent;
if (ReceiveNextEvent (0, NULL, timeout, true, &theEvent) == noErr) {
SendEventToEventTarget (theEvent, EventDispatchTarget);
ReleaseEvent (theEvent);
}
}
static pascal OSStatus doMouseEvent ( EventHandlerCallRef handlerRef,
EventRef event,
void *userData )
{
OSStatus err = eventNotHandledErr;
Point start;
GrafPtr prevPort;
/* make sure the display is the current grafport */
if (!QDSwapPort (GetWindowPort (mainWind), &prevPort))
prevPort = NULL;
switch (GetEventKind (event)) {
case kEventMouseEntered:
if (ActiveNonFloatingWindow () != mainWind)
break;
SetThemeCursor (kThemeCrossCursor);
break;
case kEventMouseExited:
if (ActiveNonFloatingWindow () != mainWind)
break;
SetThemeCursor (kThemeArrowCursor);
break;
case kEventMouseDown:
GetEventParameter (event, kEventParamMouseLocation,
typeQDPoint, NULL, sizeof (typeQDPoint), NULL, &start);
GlobalToLocal (&start);
ws_lp_x = start.h;
ws_lp_y = ypixels - start.v;
display_lp_sw = 1;
break;
case kEventMouseUp:
display_lp_sw = 0;
ws_lp_x = ws_lp_y = -1;
break;
default:
break;
}
if (prevPort)
SetPort (prevPort);
return (err);
}
static pascal OSStatus updateWindow ( EventHandlerCallRef handlerRef,
EventRef event,
void *userData )
{
OSStatus err = eventNotHandledErr;
switch (GetEventKind (event)) {
case kEventWindowActivated:
/* update menus */
break;
case kEventWindowClose: /* Override window close */
err = noErr;
break;
case kEventWindowDrawContent:
display_repaint ();
err = noErr;
default:
break;
}
return (err);
}
static pascal OSStatus doKbdEvent ( EventHandlerCallRef handlerRef,
EventRef event,
void *userData )
{
UInt32 c, m;
char key;
GetEventParameter (event, kEventParamKeyCode,
typeUInt32, NULL, sizeof (typeUInt32), NULL, &c);
GetEventParameter (event, kEventParamKeyMacCharCodes,
typeChar, NULL, sizeof (typeChar), NULL, &key);
GetEventParameter (event, kEventParamKeyModifiers,
typeUInt32, NULL, sizeof (typeUInt32), NULL, &m);
/* Keys with meta-modifiers are not allowed at this time. */
#define KEY_MODIFIERS (cmdKey | optionKey | kEventKeyModifierFnMask)
if (m & KEY_MODIFIERS)
return (eventNotHandledErr);
switch (GetEventKind (event)) {
case kEventRawKeyRepeat:
case kEventRawKeyDown:
display_keydown (key);
break;
case kEventRawKeyUp:
display_keyup (key);
break;
default:
break;
}
return (noErr);
}
int ws_init ( char *crtname, /* crt type name */
int xp, /* screen size in pixels */
int yp,
int colors ) /* colors to support (not used) */
{
WindowAttributes windowAttrs;
Rect r;
CFStringRef str;
static MouseTrackingRegionID mouseID = { 'AAPL', 0 };
static const EventTypeSpec moEvent[] = {
{ kEventClassMouse, kEventMouseEntered },
{ kEventClassMouse, kEventMouseExited },
{ kEventClassMouse, kEventMouseDown },
{ kEventClassMouse, kEventMouseUp },
};
static const EventTypeSpec wuEvent[] = {
{ kEventClassWindow, kEventWindowDrawContent },
{ kEventClassWindow, kEventWindowClose },
{ kEventClassWindow, kEventWindowActivated},
};
static const EventTypeSpec kdEvent[] = {
{ kEventClassKeyboard, kEventRawKeyDown },
{ kEventClassKeyboard, kEventRawKeyRepeat },
{ kEventClassKeyboard, kEventRawKeyUp},
};
xpixels = xp; /* save screen size */
ypixels = yp;
r.top = 100; r.left = 100; r.bottom = r.top + yp; r.right = r.left + xp;
/* should check this r against GetQDGlobalsScreenBits (&screen); */
windowAttrs = kWindowCollapseBoxAttribute | kWindowStandardHandlerAttribute;
if (CreateNewWindow (kDocumentWindowClass, windowAttrs, &r, &mainWind) != noErr)
return (0);
if (str = CFStringCreateWithCString (kCFAllocatorDefault, crtname,
kCFStringEncodingASCII)) {
SetWindowTitleWithCFString (mainWind, str);
CFRelease (str);
}
SetPortWindowPort (mainWind);
/*
* Setup to handle events
*/
EventDispatchTarget = GetEventDispatcherTarget ();
InstallEventHandler (GetWindowEventTarget (mainWind),
NewEventHandlerUPP (doMouseEvent), ARRAYLEN(moEvent),
(EventTypeSpec *) &moEvent, NULL, NULL);
InstallEventHandler (GetWindowEventTarget (mainWind),
NewEventHandlerUPP (updateWindow), ARRAYLEN(wuEvent),
(EventTypeSpec *) &wuEvent, NULL, NULL);
InstallEventHandler (GetWindowEventTarget (mainWind),
NewEventHandlerUPP (doKbdEvent), ARRAYLEN(kdEvent),
(EventTypeSpec *) &kdEvent, NULL, NULL);
/* create region to track cursor shape */
r.top = 0; r.left = 0; r.bottom = yp; r.right = xp;
rgn = NewRgn ();
RectRgn (rgn, &r);
CloseRgn (rgn);
CreateMouseTrackingRegion (mainWind, rgn, NULL,
kMouseTrackingOptionsLocalClip, mouseID, NULL, NULL, &mouseRef);
ShowWindow (mainWind);
RGBForeColor (&blckColor);
PaintRect (&r);
RGBBackColor (&blckColor);
return (1);
}
void *ws_color_black (void)
{
return (&blckColor);
}
void *ws_color_white (void)
{
return (&whteColor);
}
void *ws_color_rgb ( int r,
int g,
int b )
{
RGBColor *color;
if ((color = malloc (sizeof (RGBColor))) != NULL) {
color->red = r;
color->green = g;
color->blue = b;
}
return (color);
}
/* put a point on the screen */
void ws_display_point ( int x,
int y,
void *color )
{
#if PIX_SIZE != 1
Rect r;
#endif
if (x > xpixels || y > ypixels)
return;
y = ypixels - y /* - 1 */;
#if PIX_SIZE == 1
SetCPixel (x, y, (color == NULL) ? &blckColor : color);
#else
r.top = y * PIX_SIZE;
r.left = x * PIX_SIZE;
r.bottom = (y + 1) * PIX_SIZE;
r.right = (x + 1) * PIX_SIZE;
RGBForeColor ((color == NULL) ? &blckColor : color);
PaintRect (&r);
#endif
}
void ws_sync (void)
{
;
}
/*
* elapsed wall clock time since last call
* +INF on first call
*/
struct elapsed_state {
struct timeval tvs[2];
int new;
};
static unsigned long
elapsed(struct elapsed_state *ep)
{
unsigned long val;
gettimeofday(&ep->tvs[ep->new], NULL);
if (ep->tvs[!ep->new].tv_sec == 0)
val = ~0L;
else
val = ((ep->tvs[ep->new].tv_sec - ep->tvs[!ep->new].tv_sec) * 1000000 +
(ep->tvs[ep->new].tv_usec - ep->tvs[!ep->new].tv_usec));
ep->new = !ep->new;
return val;
}
/* called periodically */
int ws_poll ( int *valp,
int maxusec )
{
static struct elapsed_state es; /* static to avoid clearing! */
elapsed(&es); /* start clock */
do {
unsigned long e;
MyEventWait (maxusec * kEventDurationMicrosecond);
e = elapsed(&es);
maxusec -= e;
} while (maxusec > 10000); /* 10ms */
return (1);
}
void ws_beep (void)
{
SysBeep (3);
}
/* public version, used by delay code */
unsigned long os_elapsed (void)
{
static struct elapsed_state es;
return (elapsed (&es));
}

File diff suppressed because it is too large Load diff

View file

@ -1,143 +1,143 @@
/* /*
* $Id: display.h,v 1.13 2004/01/24 08:34:33 phil Exp $ * $Id: display.h,v 1.13 2004/01/24 08:34:33 phil Exp $
* interface to O/S independent layer of XY display simulator * interface to O/S independent layer of XY display simulator
* Phil Budne <phil@ultimate.com> * Phil Budne <phil@ultimate.com>
* September 2003 * September 2003
* *
* Changes from Douglas A. Gwyn, Jan 12, 2004 * Changes from Douglas A. Gwyn, Jan 12, 2004
*/ */
/* /*
* Copyright (c) 2003-2004, Philip L. Budne * Copyright (c) 2003-2004, Philip L. Budne
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * 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 * 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. * 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 * 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 * not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization * other dealings in this Software without prior written authorization
* from the authors. * from the authors.
*/ */
/* /*
* known display types * known display types
*/ */
enum display_type { enum display_type {
DIS_VR14 = 14, DIS_VR14 = 14,
DIS_VR17 = 17, DIS_VR17 = 17,
DIS_VR20 = 20, DIS_VR20 = 20,
DIS_TYPE30 = 30, DIS_TYPE30 = 30,
DIS_TX0 = 33, DIS_TX0 = 33,
DIS_VR48 = 48, DIS_VR48 = 48,
DIS_TYPE340 = 340 DIS_TYPE340 = 340
}; };
/* /*
* display scale factors * display scale factors
*/ */
#define RES_FULL 1 #define RES_FULL 1
#define RES_HALF 2 #define RES_HALF 2
#define RES_QUARTER 4 #define RES_QUARTER 4
#define RES_EIGHTH 8 #define RES_EIGHTH 8
/* /*
* must be called before first call to display_age() * must be called before first call to display_age()
* (but called implicitly by display_point()) * (but called implicitly by display_point())
*/ */
extern int display_init(enum display_type, int scale); extern int display_init(enum display_type, int scale);
/* return size of virtual display */ /* return size of virtual display */
extern int display_xpoints(void); extern int display_xpoints(void);
extern int display_ypoints(void); extern int display_ypoints(void);
/* virtual points between display and menu sections */ /* virtual points between display and menu sections */
#define VR48_GUTTER 8 /* just a guess */ #define VR48_GUTTER 8 /* just a guess */
/* conversion factor from virtual points and displayed pixels */ /* conversion factor from virtual points and displayed pixels */
extern int display_scale(void); extern int display_scale(void);
/* /*
* simulate passage of time; first argument is simulated microseconds elapsed, * simulate passage of time; first argument is simulated microseconds elapsed,
* second argument is flag to slow down simulated speed * second argument is flag to slow down simulated speed
* see comments in display.c for why you should call it often!! * see comments in display.c for why you should call it often!!
* Under X11 polls for window events!! * Under X11 polls for window events!!
*/ */
extern int display_age(int,int); extern int display_age(int,int);
/* /*
* display intensity levels. * display intensity levels.
* always at least 8 (for VT11/VS60) -- may be mapped internally * always at least 8 (for VT11/VS60) -- may be mapped internally
*/ */
#define DISPLAY_INT_MAX 7 #define DISPLAY_INT_MAX 7
#define DISPLAY_INT_MIN 0 /* lowest "on" level */ #define DISPLAY_INT_MIN 0 /* lowest "on" level */
/* /*
* plot a point; argumen ts are x, y, intensity, color (0/1) * plot a point; argumen ts are x, y, intensity, color (0/1)
* returns true if light pen active (mouse button down) * returns true if light pen active (mouse button down)
* at (or very near) this location. * at (or very near) this location.
* *
* Display initialized on first call. * Display initialized on first call.
*/ */
extern int display_point(int,int,int,int); extern int display_point(int,int,int,int);
/* /*
* force window system to output bits to screen; * force window system to output bits to screen;
* call after adding points, or aging the screen * call after adding points, or aging the screen
*/ */
extern void display_sync(void); extern void display_sync(void);
/* /*
* currently a noop * currently a noop
*/ */
extern void display_reset(void); extern void display_reset(void);
/* /*
* ring the bell * ring the bell
*/ */
extern void display_beep(void); extern void display_beep(void);
/* /*
* Set light-pen radius; maximum radius in display coordinates * Set light-pen radius; maximum radius in display coordinates
* from a "lit" location that the light pen will see. * from a "lit" location that the light pen will see.
*/ */
extern void display_lp_radius(int); extern void display_lp_radius(int);
/* /*
* set by simulated spacewar switch box switches * set by simulated spacewar switch box switches
* 18 bits (only high 4 and low 4 used) * 18 bits (only high 4 and low 4 used)
*/ */
extern unsigned long spacewar_switches; extern unsigned long spacewar_switches;
/* /*
* light pen "tip switch" activated (for VS60 emulation etc.) * light pen "tip switch" activated (for VS60 emulation etc.)
* should only be set from "driver" (window system layer) * should only be set from "driver" (window system layer)
*/ */
extern unsigned char display_lp_sw; extern unsigned char display_lp_sw;
/* /*
* deactivates light pen * deactivates light pen
* (SIMH DR11-C simulation when initialized sets this and * (SIMH DR11-C simulation when initialized sets this and
* then reports mouse coordinates as Talos digitizer data) * then reports mouse coordinates as Talos digitizer data)
*/ */
extern unsigned char display_tablet; extern unsigned char display_tablet;
/* /*
* users of this library are expected to provide these calls. * users of this library are expected to provide these calls.
* simulator will set 18 simulated switches. * simulator will set 18 simulated switches.
*/ */
extern unsigned long cpu_get_switches(void); /* get current switch state */ extern unsigned long cpu_get_switches(void); /* get current switch state */
extern void cpu_set_switches(unsigned long); /* set switches */ extern void cpu_set_switches(unsigned long); /* set switches */

View file

@ -1,77 +1,86 @@
# $Id: gmakefile,v 1.17 2004/01/24 08:31:56 phil Exp - revised by DAG # $Id: gmakefile,v 1.24 2005/11/05 02:06:14 phil Exp $
# (GNU) Makefile for test programs under Unix/X11 and Win32 # (GNU) Makefile for test programs under Unix/X11 and Win32
# #
# Unix: # Unix:
# edit Unix defs to fit your compiler/library environment, then # edit Unix defs to fit your compiler/library environment, then
# gmake -f gmakefile # gmake -f gmakefile
# or if GNU make is the default: # or if GNU make is the default:
# make -f gmakefile # make -f gmakefile
# #
# Win32 (Cygwin) # OS X (Carbon)
# make WIN32=1 # make -f gmakefile OSX=1
# #
# Win32 (MINGW): # Win32 (Cygwin)
# mingw32-make -f gmakefile WIN32=1 # make -f gmakefile WIN32=1
#
DISP_DEFS=-DTEST_DIS=DIS_VR48 -DTEST_RES=RES_HALF # -DDEBUG_VT11 # Win32 (MINGW):
# mingw32-make -f gmakefile WIN32=1
ifeq ($(WIN32),)
#Unix environments DISP_DEFS=-DTEST_DIS=DIS_VR48 -DTEST_RES=RES_HALF # -DDEBUG_VT11
X11BASE=/usr/X11R6
X11LIBDIR=$(X11BASE)/lib ifeq ($(WIN32),)
X11INCDIR=$(X11BASE)/include ifeq ($(OSX),)
LIBS=-L$(X11LIBDIR) -lXt -lX11 -lm #Unix environments
OSFLAGS=-I$(X11INCDIR) X11BASE=/usr/X11R6
DRIVER=x11.o X11LIBDIR=$(X11BASE)/lib
EXT= X11INCDIR=$(X11BASE)/include
else LIBS=-L$(X11LIBDIR) -lXt -lX11 -lm
#Win32 environments OSFLAGS=-I$(X11INCDIR)
LIBS=-lgdi32 DRIVER=x11.o
OSFLAGS= EXT=
DRIVER=win32.o else
EXT=.exe DRIVER=carbon.o
endif LIBS=-framework Carbon
endif
#PROF=-g # -pg else
OPT=-O2 #Win32 environments
CFLAGS=$(OPT) $(PROF) $(OSFLAGS) $(DISP_DEFS) LIBS=-lgdi32
CC=gcc -Wunused OSFLAGS=
LDFLAGS=$(PROF) DRIVER=win32.o
EXT=.exe
ALL= munch$(EXT) vt11$(EXT) endif
ALL: $(ALL)
#PROF=-g # -pg
# munching squares; see README file for OPT=-O2
# how to use console switches CFLAGS=$(OPT) $(PROF) $(OSFLAGS) $(DISP_DEFS)
CC=gcc -Wunused
MUNCH=$(DRIVER) display.o test.o LDFLAGS=$(PROF)
munch$(EXT): $(MUNCH)
$(CC) $(LDFLAGS) -o munch$(EXT) $(MUNCH) $(LIBS) ALL= munch$(EXT) vt11$(EXT)
ALL: $(ALL)
VT11=$(DRIVER) vt11.o vttest.o display.o
vt11$(EXT): $(VT11) # munching squares; see README file for
$(CC) $(LDFLAGS) -o vt11$(EXT) $(VT11) $(LIBS) # how to use console switches
display.o: display.h ws.h MUNCH=$(DRIVER) xy.o test.o
vt11.o: display.h vt11.h munch$(EXT): $(MUNCH)
x11.o: ws.h display.h $(CC) $(LDFLAGS) -o munch$(EXT) $(MUNCH) $(LIBS)
win32.o: ws.h
test.o: display.h vt11.h VT11=$(DRIVER) vt11.o vttest.o xy.o
vttest.o: display.h vt11.h vtmacs.h vt11$(EXT): $(VT11)
$(CC) $(LDFLAGS) -o vt11$(EXT) $(VT11) $(LIBS)
clean:
ifeq ($(WIN32),) xy.o: xy.h ws.h
rm -f *.o *~ .#* vt11.o: xy.h vt11.h
else x11.o: ws.h xy.h
if exist *.o del /q *.o carbon.o: ws.h
if exist *~ del /q *~ win32.o: ws.h
if exist .#* del /q .#* test.o: xy.h vt11.h
endif vttest.o: xy.h vt11.h vtmacs.h
clobber: clean clean:
ifeq ($(WIN32),) ifeq ($(WIN32),)
rm -f $(ALL) rm -f *.o *~ .#*
else else
if exist *.exe del /q *.exe if exist *.o del /q *.o
endif if exist *~ del /q *~
if exist .#* del /q .#*
endif
clobber: clean
ifeq ($(WIN32),)
rm -f $(ALL)
else
if exist *.exe del /q *.exe
endif

View file

@ -1,75 +1,91 @@
# $Id: smakefile,v 1.17 2004/01/24 08:31:56 phil Exp - revised by DAG # $Id: smakefile,v 1.6 2005/11/05 02:06:14 phil Exp $
# Makefile for test programs (standard Unix "make" version) # Makefile for test programs (standard Unix "make" version)
# Unix: # Unix:
# comment out Windows defs, uncomment Unix defs, # comment out OS X, Windows defs, uncomment Unix defs,
# edit Unix defs to fit your compiler/library environment, then # edit Unix defs to fit your compiler/library environment, then
# (g)make # make -f smakefile
# #
# Win32 (Cygwin) # OS X (Carbon)
# comment out Unix defs, uncomment Windows defs, then # comment out Unix, Windows defs, uncomment OS X defs
# make # make -f smakefile
# #
# Win32 (MINGW) # Win32 (Cygwin)
# comment out Unix defs, uncomment Windows defs, then # comment out Unix defs, uncomment Windows defs, then
# mingw32-make # make -f smakefile
#
DISP_DEFS=-DTEST_DIS=DIS_VR48 -DTEST_RES=RES_HALF # -DDEBUG_VT11 # Win32 (MINGW)
# comment out Unix defs, uncomment Windows defs, then
#Unix environments # mingw32-make
CC=cc # gcc -Wunused
#X11BASE=/usr/X11R6 DISP_DEFS=-DTEST_DIS=DIS_VR48 -DTEST_RES=RES_HALF # -DDEBUG_VT11
#X11LIBDIR=$(X11BASE)/lib
#X11INCDIR=$(X11BASE)/include #Unix environments
LIBS=-lXt -lX11 -lm # -L$(X11LIBDIR) CC=cc
OSFLAGS=-I$(X11INCDIR) #CC=gcc -Wunused
DRIVER=x11.o #X11BASE=/usr/X11R6
EXT= #X11LIBDIR=$(X11BASE)/lib
PROF=-g # -pg #X11INCDIR=$(X11BASE)/include
OPT=-O # -O2 LIBS=-lXt -lX11 -lm # -L$(X11LIBDIR)
CFLAGS=$(OPT) $(PROF) $(OSFLAGS) $(DISP_DEFS) OSFLAGS=-I$(X11INCDIR)
CC=cc # gcc -Wunused DRIVER=x11.o
LDFLAGS=$(PROF) EXT=
PROF=-g # -pg
##Win32 environments OPT=-O # -O2
#LIBS=-lgdi32 CFLAGS=$(OPT) $(PROF) $(OSFLAGS) $(DISP_DEFS)
#OSFLAGS= LDFLAGS=$(PROF)
#DRIVER=win32.o
#EXT=.exe ##OS X
#PROF=-g # -pg #CC=cc -Wunused
#OPT=-O2 #LIBS=-framework Carbon
#CFLAGS=$(OPT) $(PROF) $(OSFLAGS) $(DISP_DEFS) #OSFLAGS=
#CC=gcc -Wunused #DRIVER=carbon.o
LDFLAGS=$(PROF) #EXT=
#PROF=-g # -pg
ALL= munch$(EXT) vt11$(EXT) #OPT=-O # -O2
ALL: $(ALL) #CFLAGS=$(OPT) $(PROF) $(OSFLAGS) $(DISP_DEFS)
#LDFLAGS=$(PROF)
# munching squares; see README file for
# how to use console switches ##Win32 environments
#LIBS=-lgdi32
MUNCH=$(DRIVER) display.o test.o #OSFLAGS=
munch$(EXT): $(MUNCH) #DRIVER=win32.o
$(CC) $(LDFLAGS) -o munch$(EXT) $(MUNCH) $(LIBS) #EXT=.exe
#PROF=-g # -pg
VT11=$(DRIVER) vt11.o vttest.o display.o #OPT=-O2
vt11$(EXT): $(VT11) #CFLAGS=$(OPT) $(PROF) $(OSFLAGS) $(DISP_DEFS)
$(CC) $(LDFLAGS) -o vt11$(EXT) $(VT11) $(LIBS) #CC=gcc -Wunused
LDFLAGS=$(PROF)
display.o: display.h ws.h
vt11.o: display.h vt11.h ALL= munch$(EXT) vt11$(EXT)
x11.o: ws.h display.h ALL: $(ALL)
win32.o: ws.h
test.o: display.h vt11.h # munching squares; see README file for
vttest.o: display.h vt11.h vtmacs.h # how to use console switches
clean: MUNCH=$(DRIVER) xy.o test.o
rm -f *.o *~ .#* # Unix munch$(EXT): $(MUNCH)
# if exist *.o del /q *.o # Win32 $(CC) $(LDFLAGS) -o munch$(EXT) $(MUNCH) $(LIBS)
# if exist *~ del /q *~ # Win32
# if exist .#* del /q .#* # Win32 VT11=$(DRIVER) vt11.o vttest.o xy.o
vt11$(EXT): $(VT11)
clobber: clean $(CC) $(LDFLAGS) -o vt11$(EXT) $(VT11) $(LIBS)
rm -f $(ALL) # Unix
# if exist *.exe del /q *.exe # Win32 xy.o: xy.h ws.h
vt11.o: xy.h vt11.h
x11.o: ws.h xy.h
carbon.o: ws.h
win32.o: ws.h
test.o: xy.h vt11.h
vttest.o: xy.h vt11.h vtmacs.h
clean:
rm -f *.o *~ .#* # Unix
# if exist *.o del /q *.o # Win32
# if exist *~ del /q *~ # Win32
# if exist .#* del /q .#* # Win32
clobber: clean
rm -f $(ALL) # Unix
# if exist *.exe del /q *.exe # Win32

View file

@ -1,192 +1,192 @@
/* /*
* $Id: test.c,v 1.23 2004/02/07 06:31:20 phil Exp $ * $Id: test.c,v 1.24 2005/01/14 18:58:00 phil Exp $
* XY Display simulator test program (PDP-1 Munching Squares) * XY Display simulator test program (PDP-1 Munching Squares)
* Phil Budne <phil@ultimate.com> * Phil Budne <phil@ultimate.com>
* September 2003 * September 2003
* *
* Updates from Douglas A. Gwyn, 12 Jan. 2004 * Updates from Douglas A. Gwyn, 12 Jan. 2004
* *
* With thanks to Daniel Smith for his web page: * With thanks to Daniel Smith for his web page:
* http://world.std.com/~dpbsmith/munch.html * http://world.std.com/~dpbsmith/munch.html
*/ */
/* /*
* Copyright (c) 2003-2004, Philip L. Budne * Copyright (c) 2003-2004, Philip L. Budne
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * 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 * 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. * 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 * 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 * not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization * other dealings in this Software without prior written authorization
* from the authors. * from the authors.
*/ */
#ifndef TEST_DIS #ifndef TEST_DIS
#define TEST_DIS DIS_TYPE30 #define TEST_DIS DIS_TYPE30
#endif #endif
#ifndef TEST_RES #ifndef TEST_RES
#define TEST_RES RES_HALF #define TEST_RES RES_HALF
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#ifndef EXIT_FAILURE #ifndef EXIT_FAILURE
/* SunOS4 <stdlib.h> doesn't define this */ /* SunOS4 <stdlib.h> doesn't define this */
#define EXIT_FAILURE 1 #define EXIT_FAILURE 1
#endif #endif
#include "display.h" #include "xy.h"
static unsigned long test_switches = 0; static unsigned long test_switches = 0;
/* called from display code: */ /* called from display code: */
unsigned long unsigned long
cpu_get_switches(void) { cpu_get_switches(void) {
return test_switches; return test_switches;
} }
/* called from display code: */ /* called from display code: */
void void
cpu_set_switches(bits) cpu_set_switches(bits)
unsigned long bits; unsigned long bits;
{ {
printf("switches: %06lo\n", bits); printf("switches: %06lo\n", bits);
test_switches = bits; test_switches = bits;
} }
void void
munch(void) { munch(void) {
static long us = 0; static long us = 0;
static long io = 0, v = 0; static long io = 0, v = 0;
long ac; long ac;
int x, y; int x, y;
ac = test_switches; ac = test_switches;
ac += v; /* add v */ ac += v; /* add v */
if (ac & ~0777777) { if (ac & ~0777777) {
ac++; ac++;
ac &= 0777777; ac &= 0777777;
} }
v = ac; /* dac v */ v = ac; /* dac v */
ac <<= 9; /* rcl 9s */ ac <<= 9; /* rcl 9s */
io <<= 9; io <<= 9;
io |= ac>>18; io |= ac>>18;
ac &= 0777777; ac &= 0777777;
ac |= io>>18; ac |= io>>18;
io &= 0777777; io &= 0777777;
ac ^= v; /* xor v */ ac ^= v; /* xor v */
/* convert +/-512 one's complement to 0..1022, origin in lower left */ /* convert +/-512 one's complement to 0..1022, origin in lower left */
y = (io >> 8) & 01777; /* hi 10 */ y = (io >> 8) & 01777; /* hi 10 */
if (y & 01000) if (y & 01000)
y ^= 01000; y ^= 01000;
else else
y += 511; y += 511;
x = (ac >> 8) & 01777; /* hi 10 */ x = (ac >> 8) & 01777; /* hi 10 */
if (x & 01000) /* negative */ if (x & 01000) /* negative */
x ^= 01000; x ^= 01000;
else else
x += 511; x += 511;
if (display_point(x, y, DISPLAY_INT_MAX, 0)) if (display_point(x, y, DISPLAY_INT_MAX, 0))
printf("light pen hit at (%d,%d)\n", x, y); printf("light pen hit at (%d,%d)\n", x, y);
/*#define US 100000 /* 100ms (10/sec) */ /*#define US 100000 /* 100ms (10/sec) */
/*#define US 50000 /* 50ms (20/sec) */ /*#define US 50000 /* 50ms (20/sec) */
/*#define US 20000 /* 20ms (50/sec) */ /*#define US 20000 /* 20ms (50/sec) */
/*#define US 10000 /* 10ms (100/sec) */ /*#define US 10000 /* 10ms (100/sec) */
#define US 0 #define US 0
us += 50; /* 10 5us PDP-1 memory cycles */ us += 50; /* 10 5us PDP-1 memory cycles */
if (us >= US) { if (us >= US) {
display_age(us, 1); display_age(us, 1);
us = 0; us = 0;
} }
display_sync(); /* XXX push down */ display_sync(); /* XXX push down */
} }
#ifdef T2 #ifdef T2
/* display all window system level intensities; /* display all window system level intensities;
* must be compiled with -DINTENSITIES=<n> -DT2 * must be compiled with -DINTENSITIES=<n> -DT2
*/ */
void void
t2(void) { t2(void) {
int x, y; int x, y;
display_init(TEST_DIS, TEST_RES); display_init(TEST_DIS, TEST_RES);
for (x = INTENSITIES-1; x >= 0; x--) { for (x = INTENSITIES-1; x >= 0; x--) {
for (y = 0; y < 20; y++) { for (y = 0; y < 20; y++) {
ws_display_point(x*4, y, x, 0); ws_display_point(x*4, y, x, 0);
ws_display_point(x*4+1, y, x, 0); ws_display_point(x*4+1, y, x, 0);
ws_display_point(x*4+2, y, x, 0); ws_display_point(x*4+2, y, x, 0);
ws_display_point(x*4+3, y, x, 0); ws_display_point(x*4+3, y, x, 0);
} }
display_sync(); display_sync();
} }
fflush(stdout); fflush(stdout);
for (;;) for (;;)
/* wait */ ; /* wait */ ;
} }
#endif #endif
#ifdef T3 #ifdef T3
/* display all "user" level intensities; /* display all "user" level intensities;
* must be compiled with -DINTENSITIES=<n> -DT3 * must be compiled with -DINTENSITIES=<n> -DT3
* *
* skip every other virtual point on both axes * skip every other virtual point on both axes
* default scaling maps adjacent pixels and * default scaling maps adjacent pixels and
* causes re-intensification! * causes re-intensification!
*/ */
void void
t3(void) { t3(void) {
int x, y; int x, y;
display_init(TEST_DIS, TEST_RES); display_init(TEST_DIS, TEST_RES);
for (x = DISPLAY_INT_MAX; x >= 0; x--) { for (x = DISPLAY_INT_MAX; x >= 0; x--) {
for (y = 0; y < 20; y++) { for (y = 0; y < 20; y++) {
display_point(x*2, y*2, x, 0); display_point(x*2, y*2, x, 0);
} }
display_sync(); display_sync();
} }
fflush(stdout); fflush(stdout);
for (;;) for (;;)
/* wait */ ; /* wait */ ;
} }
#endif #endif
int int
main(void) { main(void) {
if (!display_init(TEST_DIS, TEST_RES)) if (!display_init(TEST_DIS, TEST_RES))
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
cpu_set_switches(04000UL); /* classic starting value */ cpu_set_switches(04000UL); /* classic starting value */
for (;;) { for (;;) {
#ifdef T2 #ifdef T2
t2(); t2();
#endif #endif
#ifdef T3 #ifdef T3
t3(); t3();
#endif #endif
munch(); munch();
} }
/*NOTREACHED*/ /*NOTREACHED*/
} }

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,137 +1,137 @@
/* /*
* $Id: vt11.h,v 1.7 2004/01/25 17:20:51 phil Exp $ * $Id: vt11.h,v 1.8 2005/01/14 18:58:02 phil Exp $
* interface to VT11 simulator * interface to VT11 simulator
* Phil Budne <phil@ultimate.com> * Phil Budne <phil@ultimate.com>
* September 16, 2003 * September 16, 2003
* Substantially revised by Douglas A. Gwyn, 14 Jan. 2004 * Substantially revised by Douglas A. Gwyn, 14 Jan. 2004
* *
* prerequisite: display.h * prerequisite: xy.h
*/ */
/* /*
* Copyright (c) 2003-2004, Philip L. Budne and Douglas A. Gwyn * Copyright (c) 2003-2004, Philip L. Budne and Douglas A. Gwyn
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * 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 * 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. * 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 * 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 * not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization * other dealings in this Software without prior written authorization
* from the authors. * from the authors.
*/ */
#ifndef SIM_DEFS_H_ #ifndef SIM_DEFS_H_
typedef unsigned short uint16; typedef unsigned short uint16;
typedef long int32; typedef long int32;
typedef unsigned long uint32; typedef unsigned long uint32;
#endif /* SIM_DEFS_H_ */ #endif /* SIM_DEFS_H_ */
/* /*
* VT11 jumpers control character spacing; VS60 always uses VT11 normal. * VT11 jumpers control character spacing; VS60 always uses VT11 normal.
* The VT11_CSP_{W,H} #defines establish the initial default character * The VT11_CSP_{W,H} #defines establish the initial default character
* spacing; to change the VT11 simulation from these default values, * spacing; to change the VT11 simulation from these default values,
* set vt11_csp_{w,h} before calling any function named vt11_*. * set vt11_csp_{w,h} before calling any function named vt11_*.
*/ */
extern unsigned char vt11_csp_w; /* horizontal character spacing */ extern unsigned char vt11_csp_w; /* horizontal character spacing */
#ifdef VT11_NARROW_OPT /* W3 or W6 installed */ #ifdef VT11_NARROW_OPT /* W3 or W6 installed */
#define VT11_CSP_W 12 #define VT11_CSP_W 12
#else /* VT11 normal; W4 or W5 installed */ #else /* VT11 normal; W4 or W5 installed */
#define VT11_CSP_W 14 #define VT11_CSP_W 14
#endif #endif
extern unsigned char vt11_csp_h; /* vertical character spacing */ extern unsigned char vt11_csp_h; /* vertical character spacing */
#ifdef VT11_TALL_OPT /* W3 or W4 installed */ #ifdef VT11_TALL_OPT /* W3 or W4 installed */
#define VT11_CSP_H 26 #define VT11_CSP_H 26
#else /* VT11 normal; W5 or W6 installed */ #else /* VT11 normal; W5 or W6 installed */
#define VT11_CSP_H 24 #define VT11_CSP_H 24
#endif #endif
/* /*
* The DISPLAY_TYPE #define establishes the initial default display * The DISPLAY_TYPE #define establishes the initial default display
* type; to change from the default display type, set vt11_display * type; to change from the default display type, set vt11_display
* before calling any function named vt11_* (other than vt11_reset()). * before calling any function named vt11_* (other than vt11_reset()).
*/ */
#ifndef DISPLAY_TYPE #ifndef DISPLAY_TYPE
#define DISPLAY_TYPE DIS_VR17 /* default display type */ #define DISPLAY_TYPE DIS_VR17 /* default display type */
#endif #endif
extern enum display_type vt11_display; /* DIS_VR{14,17,48} */ extern enum display_type vt11_display; /* DIS_VR{14,17,48} */
/* /*
* The PIX_SCALE #define establishes the initial default display scale * The PIX_SCALE #define establishes the initial default display scale
* factor; to change from the default scale factor, set vt11_scale * factor; to change from the default scale factor, set vt11_scale
* before calling any function named vt11_* (other than vt11_reset()). * before calling any function named vt11_* (other than vt11_reset()).
*/ */
#ifndef PIX_SCALE #ifndef PIX_SCALE
#define PIX_SCALE RES_HALF /* default display scale factor */ #define PIX_SCALE RES_HALF /* default display scale factor */
#endif #endif
extern int vt11_scale; /* RES_{FULL,HALF,QUARTER,EIGHTH} */ extern int vt11_scale; /* RES_{FULL,HALF,QUARTER,EIGHTH} */
/* /*
* When vt11_init (READONLY) is nonzero, it indicates that it is too late * When vt11_init (READONLY) is nonzero, it indicates that it is too late
* to change display parameters (type, scale, character spacing, etc.). * to change display parameters (type, scale, character spacing, etc.).
*/ */
extern unsigned char vt11_init; /* set after display_init() called */ extern unsigned char vt11_init; /* set after display_init() called */
/* vt11.c simulates either a VT11 or a VT48(VS60), according to display type: */ /* vt11.c simulates either a VT11 or a VT48(VS60), according to display type: */
#define VS60 (vt11_display == DIS_VR48) #define VS60 (vt11_display == DIS_VR48)
#define VT11 (!VS60) #define VT11 (!VS60)
/* The display file is an array of 16-bit words. */ /* The display file is an array of 16-bit words. */
typedef uint16 vt11word; typedef uint16 vt11word;
extern int32 vt11_get_dpc(void); /* read Display PC */ extern int32 vt11_get_dpc(void); /* read Display PC */
extern int32 vt11_get_mpr(void); /* read mode parameter register */ extern int32 vt11_get_mpr(void); /* read mode parameter register */
extern int32 vt11_get_xpr(void); /* read graphplot incr/X pos register */ extern int32 vt11_get_xpr(void); /* read graphplot incr/X pos register */
extern int32 vt11_get_ypr(void); /* read char code/Y pos register */ extern int32 vt11_get_ypr(void); /* read char code/Y pos register */
extern int32 vt11_get_rr(void); /* read relocate register */ extern int32 vt11_get_rr(void); /* read relocate register */
extern int32 vt11_get_spr(void); /* read status parameter register */ extern int32 vt11_get_spr(void); /* read status parameter register */
extern int32 vt11_get_xor(void); /* read X offset register */ extern int32 vt11_get_xor(void); /* read X offset register */
extern int32 vt11_get_yor(void); /* read Y offset register */ extern int32 vt11_get_yor(void); /* read Y offset register */
extern int32 vt11_get_anr(void); /* read associative name register */ extern int32 vt11_get_anr(void); /* read associative name register */
extern int32 vt11_get_scr(void); /* read slave console/color register */ extern int32 vt11_get_scr(void); /* read slave console/color register */
extern int32 vt11_get_nr(void); /* read name register */ extern int32 vt11_get_nr(void); /* read name register */
extern int32 vt11_get_sdr(void); /* read stack data register */ extern int32 vt11_get_sdr(void); /* read stack data register */
extern int32 vt11_get_str(void); /* read char string term register */ extern int32 vt11_get_str(void); /* read char string term register */
extern int32 vt11_get_sar(void); /* read stack address/maint register */ extern int32 vt11_get_sar(void); /* read stack address/maint register */
extern int32 vt11_get_zpr(void); /* read Z position register */ extern int32 vt11_get_zpr(void); /* read Z position register */
extern int32 vt11_get_zor(void); /* read Z offset register */ extern int32 vt11_get_zor(void); /* read Z offset register */
extern void vt11_set_dpc(uint16); /* write Display PC */ extern void vt11_set_dpc(uint16); /* write Display PC */
extern void vt11_set_mpr(uint16); /* write mode parameter register */ extern void vt11_set_mpr(uint16); /* write mode parameter register */
extern void vt11_set_xpr(uint16); /* write graphplot inc/X pos register */ extern void vt11_set_xpr(uint16); /* write graphplot inc/X pos register */
extern void vt11_set_ypr(uint16); /* write char code/Y pos register */ extern void vt11_set_ypr(uint16); /* write char code/Y pos register */
extern void vt11_set_rr(uint16); /* write relocate register */ extern void vt11_set_rr(uint16); /* write relocate register */
extern void vt11_set_spr(uint16); /* write status parameter register */ extern void vt11_set_spr(uint16); /* write status parameter register */
extern void vt11_set_xor(uint16); /* write X offset register */ extern void vt11_set_xor(uint16); /* write X offset register */
extern void vt11_set_yor(uint16); /* write Y offset register */ extern void vt11_set_yor(uint16); /* write Y offset register */
extern void vt11_set_anr(uint16); /* write associative name register */ extern void vt11_set_anr(uint16); /* write associative name register */
extern void vt11_set_scr(uint16); /* write slave console/color register */ extern void vt11_set_scr(uint16); /* write slave console/color register */
extern void vt11_set_nr(uint16); /* write name register */ extern void vt11_set_nr(uint16); /* write name register */
extern void vt11_set_sdr(uint16); /* write stack data register */ extern void vt11_set_sdr(uint16); /* write stack data register */
extern void vt11_set_str(uint16); /* write char string term register */ extern void vt11_set_str(uint16); /* write char string term register */
extern void vt11_set_sar(uint16); /* write stack address/maint register */ extern void vt11_set_sar(uint16); /* write stack address/maint register */
extern void vt11_set_zpr(uint16); /* write Z position register */ extern void vt11_set_zpr(uint16); /* write Z position register */
extern void vt11_set_zor(uint16); /* write Z offset register */ extern void vt11_set_zor(uint16); /* write Z offset register */
extern void vt11_reset(void); /* reset the display processor */ extern void vt11_reset(void); /* reset the display processor */
extern int vt11_cycle(int,int); /* perform a display processor cycle */ extern int vt11_cycle(int,int); /* perform a display processor cycle */
/* /*
* callbacks from VT11/VS60 simulator (to SIMH PDP-11 VT driver, for example) * callbacks from VT11/VS60 simulator (to SIMH PDP-11 VT driver, for example)
*/ */
extern int vt_fetch(uint32, vt11word *); /* get a display-file word */ extern int vt_fetch(uint32, vt11word *); /* get a display-file word */
extern void vt_stop_intr(void); /* post a display-stop interrupt */ extern void vt_stop_intr(void); /* post a display-stop interrupt */
extern void vt_lpen_intr(void); /* post a surface-related interrupt */ extern void vt_lpen_intr(void); /* post a surface-related interrupt */
extern void vt_char_intr(void); /* post a bad-char./timeout interrupt */ extern void vt_char_intr(void); /* post a bad-char./timeout interrupt */
extern void vt_name_intr(void); /* post a name-match interrupt */ extern void vt_name_intr(void); /* post a name-match interrupt */

View file

@ -1,291 +1,297 @@
/* /*
* $Id: vtmacs.h,v 1.4 2004/02/07 06:26:47 phil Exp $ * $Id: vtmacs.h,v 1.5 2005/01/12 18:10:13 phil Exp $
* macros for coding a VT11/VS60 display file (instructions and data) * macros for coding a VT11/VS60 display file (instructions and data)
* Douglas A. Gwyn <gwyn@arl.army.mil> * for standalone use of vt11.c (not embedded in PDP-11 simulator)
* January 31, 2004 * Douglas A. Gwyn <gwyn@arl.army.mil>
* * September 03, 2004
* XXX -- assumes ASCII host character set *
*/ * XXX -- assumes ASCII host character set
*/
/* helper macros (not for use outside this header): */
#define SGN_(x) ((x) < 0) /* helper macros (not for use outside this header): */
#define MAG_(x) ((x) >= 0 ? (x) : -(x)) /* -0 not expressible directly in C */ #define SGN_(x) ((x) < 0)
#define MAG_(x) ((x) >= 0 ? (x) : -(x)) /* -0 not expressible directly in C */
/* control instructions: */ #if 0 /* manual seems to say this; wrong! */
#define JDL_(x) ((SGN_(raddr) << 8) | MAG_(raddr))
/* load status register A: */ #else /* sign extend, 9-bit twos complement */
#define LSRA(stop,stop_intr,lp_hit_chg,ital,refresh,menu) \ #define JDL_(x) ((x) >= 0 ? (x) : ((~(unsigned)-(x))+1) & 0777)
0170000 | stop | stop_intr | lp_hit_chg | ital | refresh | menu #endif
/* display stop: */
#define ST_SAME 00000 /* don't stop display */ /* control instructions: */
#define ST_STOP 02000 /* stop display */
/* stop interrupt: */ /* load status register A: */
#define SI_SAME 00000 /* no change */ #define LSRA(stop,stop_intr,lp_hit_chg,ital,refresh,menu) \
#define SI_INHIBIT 01000 /* inhibit interrupt on stop */ 0170000 | stop | stop_intr | lp_hit_chg | ital | refresh | menu
#define SI_GENERATE 01400 /* generate interrupt on stop */ /* display stop: */
/* light pen hit intensify (bright-down on VS60): */ #define ST_SAME 00000 /* don't stop display */
#define LI_SAME 0000 /* no change */ #define ST_STOP 02000 /* stop display */
#define LI_INTENSIFY 0200 /* enable intensify on hit (VT11) */ /* stop interrupt: */
#define LI_BRIGHTDOWN 0200 /* enable bright down on hit (VS60) */ #define SI_SAME 00000 /* no change */
#define LI_NOINTENSIFY 0300 /* inhibit intensify on hit (VT11) */ #define SI_INHIBIT 01000 /* inhibit interrupt on stop */
#define LI_NOBRIGHTDOWN 0300 /* inhibit bright down on hit (VS60) */ #define SI_GENERATE 01400 /* generate interrupt on stop */
/* italic font: */ /* light pen hit intensify (bright-down on VS60): */
#define IT_SAME 000 /* no change */ #define LI_SAME 0000 /* no change */
#define IT_NORMAL 040 /* normal font */ #define LI_INTENSIFY 0200 /* enable intensify on hit (VT11) */
#define IT_ITALIC 060 /* italic font */ #define LI_BRIGHTDOWN 0200 /* enable bright down on hit (VS60) */
/* refresh rate: */ #define LI_NOINTENSIFY 0300 /* inhibit intensify on hit (VT11) */
#define RF_UNSYNC 000 /* unsynchronized */ #define LI_NOBRIGHTDOWN 0300 /* inhibit bright down on hit (VS60) */
#define RF_SAME 000 /* (happens to work like that) */ /* italic font: */
#define RF_LINE 004 /* sync with line (VT11) */ #define IT_SAME 000 /* no change */
#define RF_30 004 /* 30 frames/sec (VS60) */ #define IT_NORMAL 040 /* normal font */
#define RF_40 010 /* 40 frames/sec (VS60) */ #define IT_ITALIC 060 /* italic font */
#define RF_EXT 014 /* external sync (VS60) */ /* refresh rate: */
/* menu/main area (VS60): */ #define RF_UNSYNC 000 /* unsynchronized */
#define MN_SAME 0 /* no change */ #define RF_SAME 000 /* (happens to work like that) */
#define MN_MAIN 2 /* major screen area */ #define RF_LINE 004 /* sync with line (VT11) */
#define MN_MENU 3 /* menu area */ #define RF_30 004 /* 30 frames/sec (VS60) */
#define RF_40 010 /* 40 frames/sec (VS60) */
/* load status register B: */ #define RF_EXT 014 /* external sync (VS60) */
#define LSRB(color,set_step,step) \ /* menu/main area (VS60): */
0174000 | color | set_step | (step) #define MN_SAME 0 /* no change */
/* color select (VS60): */ #define MN_MAIN 2 /* major screen area */
#define CL_SAME 00000 /* no change */ #define MN_MENU 3 /* menu area */
#define CL_GREEN 01000 /* green */
#define CL_YELLOW 01200 /* yellow */ /* load status register B: */
#define CL_ORANGE 01400 /* orange */ #define LSRB(color,set_step,step) \
#define CL_RED 01600 /* red */ 0174000 | color | set_step | (step)
/* graphplot increment register change enable: */ /* color select (VS60): */
#define SS_SAME 0000 /* no change (step value ignored) */ #define CL_SAME 00000 /* no change */
#define SS_CHANGE 0100 /* write step value into register */ #define CL_GREEN 01000 /* green */
#define CL_YELLOW 01200 /* yellow */
/* load status register BB (VS60): */ #define CL_ORANGE 01400 /* orange */
#define LSRBB(z_data,edge_intr,depth_cue,char_esc) \ #define CL_RED 01600 /* red */
0176000 | z_data | edge_intr | depth_cue | char_esc /* graphplot increment register change enable: */
/* file Z data: */ #define SS_SAME 0000 /* no change (step value ignored) */
#define ZD_SAME 000 /* no change */ #define SS_CHANGE 0100 /* write step value into register */
#define ZD_NO 010 /* d.file does not contain Z coords. */
#define ZD_YES 014 /* d.file contains Z coordinates */ /* load status register BB (VS60): */
/* edge interrupts enable: */ #define LSRBB(z_data,edge_intr,depth_cue,char_esc) \
#define ED_SAME 000 /* no change */ 0176000 | z_data | edge_intr | depth_cue | char_esc
#define ED_DIS 040 /* disable intr. on edge transition */ /* file Z data: */
#define ED_ENA 060 /* enable intr. on edge transition */ #define ZD_SAME 000 /* no change */
/* depth cue processing: */ #define ZD_NO 010 /* d.file does not contain Z coords. */
#define DQ_SAME 0000 /* no change */ #define ZD_YES 014 /* d.file contains Z coordinates */
#define DQ_OFF 0200 /* disable depth cueing (Z intensity) */ /* edge interrupts enable: */
#define DQ_ON 0300 /* enable depth cueing (Z intensity) */ #define ED_SAME 000 /* no change */
/* escape on terminating character: */ #define ED_DIS 040 /* disable intr. on edge transition */
#define ES_SAME 0 /* no change */ #define ED_ENA 060 /* enable intr. on edge transition */
#define ES_NO 2 /* disable POPR on terminating char. */ /* depth cue processing: */
#define ES_YES 3 /* enable POPR on terminating char. */ #define DQ_SAME 0000 /* no change */
#define DQ_OFF 0200 /* disable depth cueing (Z intensity) */
/* load status register C (VS60): */ #define DQ_ON 0300 /* enable depth cueing (Z intensity) */
#define LSRC(rotate,cs_change,cscale,vs_change,vscale) \ /* escape on terminating character: */
0154000 | rotate | cs_change | ((cscale)<<5) | \ #define ES_SAME 0 /* no change */
vs_change | (vscale) #define ES_NO 2 /* disable POPR on terminating char. */
/* character rotation: */ #define ES_YES 3 /* enable POPR on terminating char. */
#define RO_SAME 00000 /* no change */
#define RO_HORIZONTAL 01000 /* no text rotation */ /* load status register C (VS60): */
#define RO_VERTICAL 01400 /* rotate text 90 degrees CCW */ #define LSRC(rotate,cs_change,cscale,vs_change,vscale) \
/* character scale change enable: */ 0154000 | rotate | cs_change | ((cscale)<<5) | \
#define CS_SAME 0000 /* no change (cscale value ignored) */ vs_change | (vscale)
#define CS_CHANGE 0200 /* set character scale */ /* character rotation: */
/* vector scale change enable: */ #define RO_SAME 00000 /* no change */
#define VS_SAME 000 /* no change (vscale value ignored) */ #define RO_HORIZONTAL 01000 /* no text rotation */
#define VS_CHANGE 020 /* set vector scale */ #define RO_VERTICAL 01400 /* rotate text 90 degrees CCW */
/* character scale change enable: */
/* load scope selection register (VS60): */ #define CS_SAME 0000 /* no change (cscale value ignored) */
#define LSSR(console,disp,lp_intr,sw_intr) \ #define CS_CHANGE 0200 /* set character scale */
0164000 | console | disp | lp_intr | sw_intr /* vector scale change enable: */
/* console to which this instruction applies: */ #define VS_SAME 000 /* no change (vscale value ignored) */
#define CN_0 0000 /* console # 0 */ #define VS_CHANGE 020 /* set vector scale */
#define CN_1 0400 /* console # 1 */
/* display enable: */ /* load scope selection register (VS60): */
#define DS_SAME 0000 /* no change */ #define LSSR(console,disp,lp_intr,sw_intr) \
#define DS_DIS 0200 /* disable display (blank CRT) */ 0164000 | console | disp | lp_intr | sw_intr
#define DS_ENA 0300 /* enable display (use CRT) */ /* console to which this instruction applies: */
/* light-pen hit interrupt enable: */ #define CN_0 0000 /* console # 0 */
#define LH_SAME 0000 /* no change */ #define CN_1 0400 /* console # 1 */
#define LH_DIS 0040 /* light-pen hit interrupt disabled */ /* display enable: */
#define LH_ENA 0060 /* light-pen hit interrupt enabled */ #define DS_SAME 0000 /* no change */
/* tip-switch transition interrupt enable: */ #define DS_DIS 0200 /* disable display (blank CRT) */
#define SW_SAME 0000 /* no change */ #define DS_ENA 0300 /* enable display (use CRT) */
#define SW_DIS 0010 /* tip-switch interrupt disabled */ /* light-pen hit interrupt enable: */
#define SW_ENA 0014 /* tip-switch hit interrupt enabled */ #define LH_SAME 0000 /* no change */
#define LH_DIS 0040 /* light-pen hit interrupt disabled */
/* load name register (VS60): */ #define LH_ENA 0060 /* light-pen hit interrupt enabled */
#define LNR(name) \ /* tip-switch transition interrupt enable: */
0150000 | (name) #define SW_SAME 0000 /* no change */
#define SW_DIS 0010 /* tip-switch interrupt disabled */
/* set graphic mode: */ #define SW_ENA 0014 /* tip-switch hit interrupt enabled */
#define SGM(mode,intens,lp_intr,blink,line_type) \
0100000 | mode | intens | lp_intr | blink | line_type /* load name register (VS60): */
/* graphic mode: */ #define LNR(name) \
#define GM_CHAR 000000 /* character */ 0150000 | (name)
#define GM_SVECT 004000 /* short vector */
#define GM_LVECT 010000 /* long vector */ /* set graphic mode: */
#define GM_APOINT 014000 /* absolute point, or offset */ #define SGM(mode,intens,lp_intr,blink,line_type) \
#define GM_GRAPHX 020000 /* graphplot X, or basic long vector */ 0100000 | mode | intens | lp_intr | blink | line_type
#define GM_GRAPHY 024000 /* graphplot Y, or basic long vector */ /* graphic mode: */
#define GM_RPOINT 030000 /* relative point */ #define GM_CHAR 000000 /* character */
#define GM_BSVECT 034000 /* basic short vector */ #define GM_SVECT 004000 /* short vector */
#define GM_ARC 040000 /* circle/arc */ #define GM_LVECT 010000 /* long vector */
#define GM_AVECT 044000 /* absolute vector */ #define GM_APOINT 014000 /* absolute point, or offset */
/* intensity: */ #define GM_GRAPHX 020000 /* graphplot X, or basic long vector */
#define IN_SAME 00000 /* no change */ #define GM_GRAPHY 024000 /* graphplot Y, or basic long vector */
#define IN_0 02000 /* intensity level 0 (dimmest) */ #define GM_RPOINT 030000 /* relative point */
#define IN_1 02200 /* intensity level 1 */ #define GM_BSVECT 034000 /* basic short vector */
#define IN_2 02400 /* intensity level 2 */ #define GM_ARC 040000 /* circle/arc */
#define IN_3 02600 /* intensity level 3 */ #define GM_AVECT 044000 /* absolute vector */
#define IN_4 03000 /* intensity level 4 */ /* intensity: */
#define IN_5 03200 /* intensity level 5 */ #define IN_SAME 00000 /* no change */
#define IN_6 03400 /* intensity level 6 */ #define IN_0 02000 /* intensity level 0 (dimmest) */
#define IN_7 03600 /* intensity level 7 (brightest) */ #define IN_1 02200 /* intensity level 1 */
/* light pen interrupt: */ #define IN_2 02400 /* intensity level 2 */
#define LP_SAME 0000 /* no change */ #define IN_3 02600 /* intensity level 3 */
#define LP_DIS 0100 /* light-pen hit interrupt disabled */ #define IN_4 03000 /* intensity level 4 */
#define LP_ENA 0140 /* light-pen hit interrupt enabled */ #define IN_5 03200 /* intensity level 5 */
/* blink: */ #define IN_6 03400 /* intensity level 6 */
#define BL_SAME 000 /* no change */ #define IN_7 03600 /* intensity level 7 (brightest) */
#define BL_OFF 020 /* blink off */ /* light pen interrupt: */
#define BL_ON 030 /* blink on */ #define LP_SAME 0000 /* no change */
/* line type: */ #define LP_DIS 0100 /* light-pen hit interrupt disabled */
#define LT_SAME 00 /* no change */ #define LP_ENA 0140 /* light-pen hit interrupt enabled */
#define LT_SOLID 04 /* solid */ /* blink: */
#define LT_LDASH 05 /* long dash */ #define BL_SAME 000 /* no change */
#define LT_SDASH 06 /* short dash */ #define BL_OFF 020 /* blink off */
#define LT_DDASH 07 /* dot dash */ #define BL_ON 030 /* blink on */
/* line type: */
/* display jump absolute: */ #define LT_SAME 00 /* no change */
#define DJMP_ABS(addr) \ #define LT_SOLID 04 /* solid */
0160000, \ #define LT_LDASH 05 /* long dash */
(addr) & ~1 #define LT_SDASH 06 /* short dash */
#define LT_DDASH 07 /* dot dash */
/* display jump relative (VS60): */
#define DJMP_REL(raddr) \ /* display jump absolute: */
0161000 | (SGN_(raddr) << 8) | MAG_(raddr) #define DJMP_ABS(addr) \
0160000, \
/* display jump to subroutine absolute (VS60): */ (addr) & ~1
#define DJSR_ABS(addr) \
0162000, \ /* display jump relative (VS60) [raddr in words]: */
(addr) & ~1 #define DJMP_REL(raddr) \
0161000 | JDL_(raddr)
/* display jump to subroutine relative (VS60): */
#define DJSR_REL(raddr) \ /* display jump to subroutine absolute (VS60): */
0163000 | (SGN_(raddr) << 8) | MAG_(raddr) #define DJSR_ABS(addr) \
0162000, \
/* display no-op: */ (addr) & ~1
#define DNOP \
0164000 /* display jump to subroutine relative (VS60) [raddr in words]: */
#define DJSR_REL(raddr) \
/* display pop, no restore (VS60): */ 0163000 | JDL_(raddr)
#define DPOP_NR \
0165000 /* display no-op: */
#define DNOP \
/* display pop, restore (VS60): */ 0164000
#define DPOP_R \
0165000 /* display pop, no restore (VS60): */
#define DPOP_NR \
/* display stop: */ 0165000
#define DSTOP LSRA(ST_STOP,SI_SAME,LI_SAME,IT_SAME,RF_UNSYNC,MN_SAME)
/* display pop, restore (VS60): */
/* graphic data: */ #define DPOP_R \
0165000
/* intensify enable (common to all modes exept CHAR and OFFSET): */
#define I_OFF 000000 /* beam off */ /* display stop: */
#define I_ON 040000 /* beam on */ #define DSTOP LSRA(ST_STOP,SI_SAME,LI_SAME,IT_SAME,RF_UNSYNC,MN_SAME)
/* Note: when VS60 "file Z data" is enabled, /* graphic data: */
use the *3() macros instead of the corresponding normal ones. */
/* intensify enable (common to all modes exept CHAR and OFFSET): */
/* character data: */ #define I_OFF 000000 /* beam off */
#define CHAR(c1,c2) \ #define I_ON 040000 /* beam on */
((c2) << 8) | (c1) /* 7-bit ASCII assumed */
/* Note: when VS60 "file Z data" is enabled,
/* short vector data: */ use the *3() macros instead of the corresponding normal ones. */
#define SVECT(i,dx,dy) \
i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy) /* character data: */
#define SVECT3(i,dx,dy,dz) \ #define CHAR(c1,c2) \
i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy), \ ((c2) << 8) | (c1) /* 7-bit ASCII assumed */
(SGN_(dz) << 13) | (MAG_(dz) << 2)
/* short vector data: */
/* long vector data: */ #define SVECT(i,dx,dy) \
#define LVECT(i,dx,dy) \ i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy)
i | (SGN_(dx) << 13) | MAG_(dx), \ #define SVECT3(i,dx,dy,dz) \
(SGN_(dy) << 13) | MAG_(dy) i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy), \
#define LVECT3(i,dx,dy,dz) \ (SGN_(dz) << 13) | (MAG_(dz) << 2)
i | (SGN_(dx) << 13) | MAG_(dx), \
(SGN_(dy) << 13) | MAG_(dy), \ /* long vector data: */
(SGN_(dz) << 13) | (MAG_(dz) << 2) #define LVECT(i,dx,dy) \
i | (SGN_(dx) << 13) | MAG_(dx), \
/* rotation data (VS60, probably unimplemented): */ (SGN_(dy) << 13) | MAG_(dy)
#define ROTATE(i,a,b) \ #define LVECT3(i,dx,dy,dz) \
i | (SGN_(a) << 13) | 010000 | MAG_(a), \ i | (SGN_(dx) << 13) | MAG_(dx), \
(SGN_(b) << 13) | MAG_(b) (SGN_(dy) << 13) | MAG_(dy), \
#define ROTATE3(i,a,b,c) \ (SGN_(dz) << 13) | (MAG_(dz) << 2)
i | (SGN_(a) << 13) | 010000 | MAG_(a), \
(SGN_(b) << 13) | MAG_(b), \ /* rotation data (VS60, probably unimplemented): */
(SGN_(c) << 13) | (MAG_(c) << 2) #define ROTATE(i,a,b) \
i | (SGN_(a) << 13) | 010000 | MAG_(a), \
/* absolute point data: */ (SGN_(b) << 13) | MAG_(b)
#define APOINT(i,x,y) \ #define ROTATE3(i,a,b,c) \
i | (SGN_(x) << 13) | MAG_(x), \ i | (SGN_(a) << 13) | 010000 | MAG_(a), \
(SGN_(y) << 13) | MAG_(y) (SGN_(b) << 13) | MAG_(b), \
#define APOINT3(i,x,y,z) \ (SGN_(c) << 13) | (MAG_(c) << 2)
i | (SGN_(x) << 13) | MAG_(x), \
(SGN_(y) << 13) | MAG_(y), \ /* absolute point data: */
(SGN_(z) << 13) | (MAG_(z) << 2) #define APOINT(i,x,y) \
i | (SGN_(x) << 13) | MAG_(x), \
/* offset data (VS60): */ (SGN_(y) << 13) | MAG_(y)
#define OFFSET(x,y) \ #define APOINT3(i,x,y,z) \
(SGN_(x) << 13) | 010000 | MAG_(x), \ i | (SGN_(x) << 13) | MAG_(x), \
(SGN_(y) << 13) | 010000 | MAG_(y) (SGN_(y) << 13) | MAG_(y), \
#define OFFSET3(x,y,z) \ (SGN_(z) << 13) | (MAG_(z) << 2)
(SGN_(x) << 13) | 010000 | MAG_(x), \
(SGN_(y) << 13) | 010000 | MAG_(y), \ /* offset data (VS60): */
(SGN_(z) << 13) | 010000 | (MAG_(z) << 2) #define OFFSET(x,y) \
(SGN_(x) << 13) | 010000 | MAG_(x), \
/* graphplot X data: */ (SGN_(y) << 13) | 010000 | MAG_(y)
#define GRAPHX(i,x) \ #define OFFSET3(x,y,z) \
i | (x) (SGN_(x) << 13) | 010000 | MAG_(x), \
(SGN_(y) << 13) | 010000 | MAG_(y), \
/* graphplot Y data: */ (SGN_(z) << 13) | 010000 | (MAG_(z) << 2)
#define GRAPHY(i,y) \
i | (y) /* graphplot X data: */
#define GRAPHX(i,x) \
/* basic long vector data (VS60): */ i | (x)
#define BLVECT(i,dir,len) \
i | ((dir) << 11) | 02000 | (len) /* graphplot Y data: */
#define GRAPHY(i,y) \
/* relative point data: */ i | (y)
#define RPOINT(i,dx,dy) \
i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy) /* basic long vector data (VS60): */
#define RPOINT3(i,dx,dy,dz) \ #define BLVECT(i,dir,len) \
i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy), \ i | ((dir) << 11) | 02000 | (len)
(SGN_(dz) << 13) | (MAG_(dz) << 2)
/* relative point data: */
/* basic short vector data (VS60): */ #define RPOINT(i,dx,dy) \
#define BSVECT(i,dir1,len1,dir2,len2) \ i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy)
i | ((dir2) << 11) | ((len2) << 7) | ((dir1) << 4) | (len1) #define RPOINT3(i,dx,dy,dz) \
i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy), \
/* circle/arc data (VS60, option): */ (SGN_(dz) << 13) | (MAG_(dz) << 2)
#define ARC(i,dcx,dcy,dex,dey) \
i | (SGN_(dcx) << 13) | MAG_(dcx), \ /* basic short vector data (VS60): */
(SGN_(dcy) << 13) | MAG_(dcy), \ #define BSVECT(i,dir1,len1,dir2,len2) \
(SGN_(dex) << 13) | MAG_(dex), \ i | ((dir2) << 11) | ((len2) << 7) | ((dir1) << 4) | (len1)
(SGN_(dey) << 13) | MAG_(dey)
#define ARC3(i,dcx,dcy,cz,dex,dey,ez) \ /* circle/arc data (VS60, option): */
i | (SGN_(dcx) << 13) | MAG_(dcx), \ #define ARC(i,dcx,dcy,dex,dey) \
(SGN_(dcy) << 13) | MAG_(dcy), \ i | (SGN_(dcx) << 13) | MAG_(dcx), \
(SGN_(cz) << 13) | (MAG_(cz) << 2), \ (SGN_(dcy) << 13) | MAG_(dcy), \
(SGN_(dex) << 13) | MAG_(dex), \ (SGN_(dex) << 13) | MAG_(dex), \
(SGN_(dey) << 13) | MAG_(dey), \ (SGN_(dey) << 13) | MAG_(dey)
(SGN_(ez) << 13) | (MAG_(ez) << 2) #define ARC3(i,dcx,dcy,cz,dex,dey,ez) \
i | (SGN_(dcx) << 13) | MAG_(dcx), \
/* absolute vector data (VS60): */ (SGN_(dcy) << 13) | MAG_(dcy), \
#define AVECT(i,x,y) \ (SGN_(cz) << 13) | (MAG_(cz) << 2), \
i | (SGN_(x) << 13) | MAG_(x), \ (SGN_(dex) << 13) | MAG_(dex), \
(SGN_(y) << 13) | MAG_(y) (SGN_(dey) << 13) | MAG_(dey), \
#define AVECT3(i,x,y,z) \ (SGN_(ez) << 13) | (MAG_(ez) << 2)
i | (SGN_(x) << 13) | MAG_(x), \
(SGN_(y) << 13) | MAG_(y), \ /* absolute vector data (VS60): */
(SGN_(z) << 13) | (MAG_(z) << 2) #define AVECT(i,x,y) \
i | (SGN_(x) << 13) | MAG_(x), \
(SGN_(y) << 13) | MAG_(y)
#define AVECT3(i,x,y,z) \
i | (SGN_(x) << 13) | MAG_(x), \
(SGN_(y) << 13) | MAG_(y), \
(SGN_(z) << 13) | (MAG_(z) << 2)

File diff suppressed because it is too large Load diff

View file

@ -1,418 +1,418 @@
/* /*
* $Id: win32.c,v 1.38 2004/02/07 06:32:01 phil Exp $ * $Id: win32.c,v 1.39 2005/01/14 18:58:03 phil Exp $
* Win32 support for XY display simulator * Win32 support for XY display simulator
* Phil Budne <phil@ultimate.com> * Phil Budne <phil@ultimate.com>
* September 2003 * September 2003
* Revised by Douglas A. Gwyn, 05 Feb. 2004 * Revised by Douglas A. Gwyn, 05 Feb. 2004
*/ */
/* /*
* Copyright (c) 2003-2004, Philip L. Budne * Copyright (c) 2003-2004, Philip L. Budne
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * 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 * 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. * 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 * 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 * not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization * other dealings in this Software without prior written authorization
* from the authors. * from the authors.
*/ */
/* use a thread to handle windows messages; */ /* use a thread to handle windows messages; */
#define THREADS #define THREADS
/* /*
* BUGS: * BUGS:
* Does not allow you to close display window; * Does not allow you to close display window;
* would need to tear down both system, and system independent data. * would need to tear down both system, and system independent data.
* *
* now tries to handle PAINT message, as yet untested!! * now tries to handle PAINT message, as yet untested!!
*/ */
#include <windows.h> #include <windows.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "ws.h" #include "ws.h"
#include "display.h" #include "xy.h"
#ifndef PIX_SIZE #ifndef PIX_SIZE
#define PIX_SIZE 1 #define PIX_SIZE 1
#endif #endif
#define APP_CLASS "XYAppClass" #define APP_CLASS "XYAppClass"
#define APP_MENU "XYAppMenu" /* ?? */ #define APP_MENU "XYAppMenu" /* ?? */
/* /*
* light pen location * light pen location
* see ws.h for full description * see ws.h for full description
*/ */
int ws_lp_x = -1; int ws_lp_x = -1;
int ws_lp_y = -1; int ws_lp_y = -1;
static HWND static_wh; static HWND static_wh;
static HINSTANCE static_inst; static HINSTANCE static_inst;
static int xpixels, ypixels; static int xpixels, ypixels;
static char *window_name; static char *window_name;
static HBRUSH white_brush; static HBRUSH white_brush;
static HBRUSH black_brush; static HBRUSH black_brush;
#ifdef SWITCH_CURSORS #ifdef SWITCH_CURSORS
static HCURSOR cross, arrow; static HCURSOR cross, arrow;
#endif #endif
static __inline int static __inline int
map_key(int k) map_key(int k)
{ {
switch (k) { switch (k) {
case 186: return ';'; /* VK_OEM_1? */ case 186: return ';'; /* VK_OEM_1? */
case 222: return '\''; /* VK_OEM_7? */ case 222: return '\''; /* VK_OEM_7? */
} }
return k; return k;
} }
static void static void
keydown(int k) keydown(int k)
{ {
display_keydown(map_key(k)); display_keydown(map_key(k));
} }
static void static void
keyup(int k) keyup(int k)
{ {
display_keyup(map_key(k)); display_keyup(map_key(k));
} }
/* /*
* here on any button click, or if mouse dragged while a button down * here on any button click, or if mouse dragged while a button down
*/ */
static void static void
mousepos(DWORD lp) mousepos(DWORD lp)
{ {
int x, y; int x, y;
x = LOWORD(lp); x = LOWORD(lp);
y = HIWORD(lp); y = HIWORD(lp);
/* convert to display coordinates */ /* convert to display coordinates */
#if PIX_SIZE > 1 #if PIX_SIZE > 1
x /= PIX_SIZE; x /= PIX_SIZE;
y /= PIX_SIZE; y /= PIX_SIZE;
#endif #endif
y = ypixels - 1 - y; y = ypixels - 1 - y;
/* if window has been stretched, can get out of range bits!! */ /* if window has been stretched, can get out of range bits!! */
if (x >= 0 && x < xpixels && y >= 0 && y < ypixels) { if (x >= 0 && x < xpixels && y >= 0 && y < ypixels) {
/* checked by display_add_point() */ /* checked by display_add_point() */
ws_lp_x = x; ws_lp_x = x;
ws_lp_y = y; ws_lp_y = y;
} }
} }
/* thoingggg!! "message for you sir!!!" */ /* thoingggg!! "message for you sir!!!" */
static LRESULT CALLBACK static LRESULT CALLBACK
patsy(HWND wh, UINT msg, WPARAM wp, LPARAM lp) /* "WndProc" */ patsy(HWND wh, UINT msg, WPARAM wp, LPARAM lp) /* "WndProc" */
{ {
/* printf("msg %d\n", msg); */ /* printf("msg %d\n", msg); */
switch (msg) { switch (msg) {
case WM_DESTROY: case WM_DESTROY:
PostQuitMessage(0); PostQuitMessage(0);
return 0; return 0;
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
if (wp & (MK_LBUTTON|MK_MBUTTON|MK_RBUTTON)) { if (wp & (MK_LBUTTON|MK_MBUTTON|MK_RBUTTON)) {
#ifdef SWITCH_CURSORS #ifdef SWITCH_CURSORS
if (ws_lp_x == -1 && !display_tablet) if (ws_lp_x == -1 && !display_tablet)
SetCursor(cross); SetCursor(cross);
#endif #endif
mousepos(lp); mousepos(lp);
} }
#ifdef SWITCH_CURSORS #ifdef SWITCH_CURSORS
else if (ws_lp_x != -1 && !display_tablet) else if (ws_lp_x != -1 && !display_tablet)
SetCursor(arrow); SetCursor(arrow);
#endif #endif
break; /* return?? */ break; /* return?? */
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
display_lp_sw = 1; display_lp_sw = 1;
case WM_MBUTTONDOWN: case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
#ifdef SWITCH_CURSORS #ifdef SWITCH_CURSORS
if (!display_tablet) if (!display_tablet)
SetCursor(cross); SetCursor(cross);
#endif #endif
mousepos(lp); mousepos(lp);
break; /* return?? */ break; /* return?? */
case WM_LBUTTONUP: case WM_LBUTTONUP:
display_lp_sw = 0; display_lp_sw = 0;
case WM_MBUTTONUP: case WM_MBUTTONUP:
case WM_RBUTTONUP: case WM_RBUTTONUP:
#ifdef SWITCH_CURSORS #ifdef SWITCH_CURSORS
if (!display_tablet) if (!display_tablet)
SetCursor(arrow); SetCursor(arrow);
#endif #endif
ws_lp_x = ws_lp_y = -1; ws_lp_x = ws_lp_y = -1;
break; /* return?? */ break; /* return?? */
case WM_KEYDOWN: case WM_KEYDOWN:
keydown(wp); keydown(wp);
break; break;
case WM_KEYUP: case WM_KEYUP:
keyup(wp); keyup(wp);
break; break;
case WM_PAINT: case WM_PAINT:
display_repaint(); display_repaint();
break; /* return?? */ break; /* return?? */
} }
return DefWindowProc(wh, msg, wp, lp); return DefWindowProc(wh, msg, wp, lp);
} }
int int
ws_poll(int *valp, int maxus) ws_poll(int *valp, int maxus)
{ {
#ifdef THREADS #ifdef THREADS
/* msgthread handles window events; just delay simulator */ /* msgthread handles window events; just delay simulator */
if (maxus > 0) if (maxus > 0)
Sleep((maxus+999)/1000); Sleep((maxus+999)/1000);
#else #else
MSG msg; MSG msg;
DWORD start; DWORD start;
int maxms = (maxus + 999) / 1000; int maxms = (maxus + 999) / 1000;
for (start = GetTickCount(); GetTickCount() - start < maxms; Sleep(1)) { for (start = GetTickCount(); GetTickCount() - start < maxms; Sleep(1)) {
/* empty message queue without blocking */ /* empty message queue without blocking */
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
} }
#endif #endif
return 1; return 1;
} }
/* called from non-threaded main program */ /* called from non-threaded main program */
int int
ws_loop(void (*func)(void *), void *arg) ws_loop(void (*func)(void *), void *arg)
{ {
int val; int val;
while (ws_poll(&val, 0)) while (ws_poll(&val, 0))
(*func)(arg); (*func)(arg);
return val; return val;
} }
/* worker for display init */ /* worker for display init */
static void static void
ws_init2(void) { ws_init2(void) {
WNDCLASS wc; WNDCLASS wc;
int h, w; int h, w;
#ifdef SWITCH_CURSORS #ifdef SWITCH_CURSORS
if (!display_tablet) { if (!display_tablet) {
arrow = LoadCursor(NULL, IDC_ARROW); arrow = LoadCursor(NULL, IDC_ARROW);
cross = LoadCursor(NULL, IDC_CROSS); cross = LoadCursor(NULL, IDC_CROSS);
} }
#endif #endif
black_brush = GetStockObject(BLACK_BRUSH); black_brush = GetStockObject(BLACK_BRUSH);
white_brush = GetStockObject(WHITE_BRUSH); white_brush = GetStockObject(WHITE_BRUSH);
wc.lpszClassName = APP_CLASS; wc.lpszClassName = APP_CLASS;
wc.lpfnWndProc = patsy; wc.lpfnWndProc = patsy;
wc.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW; wc.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
/* also CS_NOCLOSE? CS_SAVEBITS? */ /* also CS_NOCLOSE? CS_SAVEBITS? */
wc.hInstance = static_inst = GetModuleHandleA(0); wc.hInstance = static_inst = GetModuleHandleA(0);
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
#ifdef SWITCH_CURSORS #ifdef SWITCH_CURSORS
wc.hCursor = NULL; wc.hCursor = NULL;
#else #else
wc.hCursor = display_tablet ? NULL : LoadCursor(NULL, IDC_CROSS); wc.hCursor = display_tablet ? NULL : LoadCursor(NULL, IDC_CROSS);
#endif #endif
wc.hbrBackground = black_brush; wc.hbrBackground = black_brush;
wc.lpszMenuName = APP_MENU; wc.lpszMenuName = APP_MENU;
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
wc.cbWndExtra = 0; wc.cbWndExtra = 0;
/* WNDCLASSEX/RegisterClassEx include hIconSm (small icon) */ /* WNDCLASSEX/RegisterClassEx include hIconSm (small icon) */
RegisterClass(&wc); RegisterClass(&wc);
/* /*
* WS_OVERLAPPEDWINDOW=> * WS_OVERLAPPEDWINDOW=>
* WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, * WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME,
* WS_MINIMIZEBOX, WS_MAXIMIZEBOX * WS_MINIMIZEBOX, WS_MAXIMIZEBOX
* *
* WS_CHILD (no menu bar), WS_POPUP (mutually exclusive) * WS_CHILD (no menu bar), WS_POPUP (mutually exclusive)
*/ */
/* empirical crocks to get entire screen; */ /* empirical crocks to get entire screen; */
w = (xpixels*PIX_SIZE)+6; w = (xpixels*PIX_SIZE)+6;
h = (ypixels*PIX_SIZE)+32; h = (ypixels*PIX_SIZE)+32;
/* XXX -- above values work with XP; Phil had +10,+30 */ /* XXX -- above values work with XP; Phil had +10,+30 */
static_wh = CreateWindow(APP_CLASS, /* registered class name */ static_wh = CreateWindow(APP_CLASS, /* registered class name */
window_name, /* window name */ window_name, /* window name */
WS_OVERLAPPED, /* style */ WS_OVERLAPPED, /* style */
CW_USEDEFAULT, CW_USEDEFAULT, /* X,Y */ CW_USEDEFAULT, CW_USEDEFAULT, /* X,Y */
w, h, w, h,
NULL, /* HWND hWndParent */ NULL, /* HWND hWndParent */
NULL, /* HMENU hMenu */ NULL, /* HMENU hMenu */
static_inst, /* application instance */ static_inst, /* application instance */
NULL); /* lpParam */ NULL); /* lpParam */
ShowWindow(static_wh, SW_SHOW); ShowWindow(static_wh, SW_SHOW);
UpdateWindow(static_wh); UpdateWindow(static_wh);
} }
#ifdef THREADS #ifdef THREADS
static volatile int init_done; static volatile int init_done;
static DWORD msgthread_id; static DWORD msgthread_id;
static DWORD WINAPI static DWORD WINAPI
msgthread(LPVOID arg) msgthread(LPVOID arg)
{ {
MSG msg; MSG msg;
ws_init2(); ws_init2();
/* XXX use a mutex? */ /* XXX use a mutex? */
init_done = 1; init_done = 1;
while (GetMessage(&msg, NULL, 0, 0) > 0) { while (GetMessage(&msg, NULL, 0, 0) > 0) {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
return msg.wParam; return msg.wParam;
} }
static void static void
ws_thread_init(void) ws_thread_init(void)
{ {
HANDLE th = CreateThread(NULL, /* sec. attr. */ HANDLE th = CreateThread(NULL, /* sec. attr. */
0, /* stack size */ 0, /* stack size */
msgthread, msgthread,
NULL, /* param */ NULL, /* param */
0, /* flags */ 0, /* flags */
&msgthread_id); &msgthread_id);
CloseHandle(th); CloseHandle(th);
/* XXX use a mutex; don't wait forever!! */ /* XXX use a mutex; don't wait forever!! */
while (!init_done) while (!init_done)
; Sleep(200);
} }
#endif /* THREADS */ #endif /* THREADS */
/* called from display layer on first display op */ /* called from display layer on first display op */
int int
ws_init(char *name, int xp, int yp, int colors) ws_init(char *name, int xp, int yp, int colors)
{ {
xpixels = xp; xpixels = xp;
ypixels = yp; ypixels = yp;
window_name = name; window_name = name;
#ifdef THREADS #ifdef THREADS
ws_thread_init(); ws_thread_init();
#else #else
ws_init2(); ws_init2();
#endif #endif
return 1; /* XXX return errors!! */ return 1; /* XXX return errors!! */
} }
void * void *
ws_color_rgb(int r, int g, int b) ws_color_rgb(int r, int g, int b)
{ {
/* XXX check for failure??? try GetNearestColor??? */ /* XXX check for failure??? try GetNearestColor??? */
return CreateSolidBrush(RGB(r/256, g/256, b/256)); return CreateSolidBrush(RGB(r/256, g/256, b/256));
} }
void * void *
ws_color_black(void) ws_color_black(void)
{ {
return black_brush; return black_brush;
} }
void * void *
ws_color_white(void) ws_color_white(void)
{ {
return white_brush; return white_brush;
} }
void void
ws_display_point(int x, int y, void *color) ws_display_point(int x, int y, void *color)
{ {
HDC dc; HDC dc;
RECT r; RECT r;
HBRUSH brush = color; HBRUSH brush = color;
if (x > xpixels || y > ypixels) if (x > xpixels || y > ypixels)
return; return;
y = ypixels - 1 - y; /* invert y, top left origin */ y = ypixels - 1 - y; /* invert y, top left origin */
/* top left corner */ /* top left corner */
r.left = x*PIX_SIZE; r.left = x*PIX_SIZE;
r.top = y*PIX_SIZE; r.top = y*PIX_SIZE;
/* bottom right corner, non-inclusive */ /* bottom right corner, non-inclusive */
r.right = (x+1)*PIX_SIZE; r.right = (x+1)*PIX_SIZE;
r.bottom = (y+1)*PIX_SIZE; r.bottom = (y+1)*PIX_SIZE;
if (brush == NULL) if (brush == NULL)
brush = black_brush; brush = black_brush;
dc = GetDC(static_wh); dc = GetDC(static_wh);
FillRect(dc, &r, brush); FillRect(dc, &r, brush);
ReleaseDC(static_wh, dc); ReleaseDC(static_wh, dc);
} }
void void
ws_sync(void) { ws_sync(void) {
/* noop */ /* noop */
} }
void void
ws_beep(void) { ws_beep(void) {
#if 0 #if 0
/* play SystemDefault sound; does not work over terminal service */ /* play SystemDefault sound; does not work over terminal service */
MessageBeep(MB_OK); MessageBeep(MB_OK);
#else #else
/* works over terminal service? Plays default sound/beep on Win9x/ME */ /* works over terminal service? Plays default sound/beep on Win9x/ME */
Beep(440, 500); /* Hz, ms. */ Beep(440, 500); /* Hz, ms. */
#endif #endif
} }
unsigned long unsigned long
os_elapsed(void) os_elapsed(void)
{ {
static int new; static int new;
unsigned long ret; unsigned long ret;
static DWORD t[2]; static DWORD t[2];
/* /*
* only returns milliseconds, but Sleep() * only returns milliseconds, but Sleep()
* only takes milliseconds. * only takes milliseconds.
* *
* wraps after 49.7 days of uptime. * wraps after 49.7 days of uptime.
* DWORD is an unsigned long, so this should be OK * DWORD is an unsigned long, so this should be OK
*/ */
t[new] = GetTickCount(); t[new] = GetTickCount();
if (t[!new] == 0) if (t[!new] == 0)
ret = ~0L; /* +INF */ ret = ~0L; /* +INF */
else else
ret = (t[new] - t[!new]) * 1000; ret = (t[new] - t[!new]) * 1000;
new = !new; /* Ecclesiastes III */ new = !new; /* Ecclesiastes III */
return ret; return ret;
} }

View file

@ -1,66 +1,65 @@
/* /*
* $Id: ws.h,v 1.17 2004/02/03 21:23:51 phil Exp $ * $Id: ws.h,v 1.17 2004/02/03 21:23:51 phil Exp $
* Interfaces to window-system specific code for XY display simulation * Interfaces to window-system specific code for XY display simulation
*/ */
/* /*
* Copyright (c) 2003-2004, Philip L. Budne * Copyright (c) 2003-2004, Philip L. Budne
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the * 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: * Software is furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software. * all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * 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 * 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. * 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 * 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 * not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization * other dealings in this Software without prior written authorization
* from the authors. * from the authors.
*/ */
/* unless you're writing a new driver, you shouldn't be looking here! */ /* unless you're writing a new driver, you shouldn't be looking here! */
extern int ws_init(char *, int, int, int); extern int ws_init(char *, int, int, int);
extern void ws_close(void); // 2006-07-19 SAI extern void *ws_color_rgb(int, int, int);
extern void *ws_color_rgb(int, int, int); extern void *ws_color_black(void);
extern void *ws_color_black(void); extern void *ws_color_white(void);
extern void *ws_color_white(void); extern void ws_display_point(int, int, void *);
extern void ws_display_point(int, int, void *); extern void ws_sync(void);
extern void ws_sync(void); extern int ws_loop(void (*)(void *), void *);
extern int ws_loop(void (*)(void *), void *); extern int ws_poll(int *, int);
extern int ws_poll(int *, int); extern void ws_beep(void);
extern void ws_beep(void);
/* entries into display.c from below: */
/* entries into display.c from below: */ extern void display_keyup(int);
extern void display_keyup(int); extern void display_keydown(int);
extern void display_keydown(int); extern void display_repaint(void);
extern void display_repaint(void);
/*
/* * Globals set by O/S display level to SCALED location in display
* Globals set by O/S display level to SCALED location in display * coordinate system in order to save an upcall on every mouse
* coordinate system in order to save an upcall on every mouse * movement.
* movement. *
* * *NOT* for consumption by clients of display.c; although display
* *NOT* for consumption by clients of display.c; although display * clients can now get the scaling factor, real displays only give you
* clients can now get the scaling factor, real displays only give you * a light pen "hit" when the beam passes under the light pen.
* a light pen "hit" when the beam passes under the light pen. */
*/
extern int ws_lp_x, ws_lp_y;
extern int ws_lp_x, ws_lp_y;
/*
/* * O/S services in theory independent of window system,
* O/S services in theory independent of window system, * but in (current) practice not!
* but in (current) practice not! */
*/ extern unsigned long os_elapsed(void);
extern unsigned long os_elapsed(void);

File diff suppressed because it is too large Load diff

1036
display/xy.c Normal file

File diff suppressed because it is too large Load diff

142
display/xy.h Normal file
View file

@ -0,0 +1,142 @@
/*
* $Id: xy.h,v 1.13 2004/01/24 08:34:33 phil Exp $
* interface to O/S independent layer of XY display simulator
* Phil Budne <phil@ultimate.com>
* September 2003
*
* Changes from Douglas A. Gwyn, Jan 12, 2004
*/
/*
* Copyright (c) 2003-2004, Philip L. Budne
*
* 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.
*/
/*
* known display types
*/
enum display_type {
DIS_VR14 = 14,
DIS_VR17 = 17,
DIS_VR20 = 20,
DIS_TYPE30 = 30,
DIS_VR48 = 48,
DIS_TYPE340 = 340
};
/*
* display scale factors
*/
#define RES_FULL 1
#define RES_HALF 2
#define RES_QUARTER 4
#define RES_EIGHTH 8
/*
* must be called before first call to display_age()
* (but called implicitly by display_point())
*/
extern int display_init(enum display_type, int scale);
/* return size of virtual display */
extern int display_xpoints(void);
extern int display_ypoints(void);
/* virtual points between display and menu sections */
#define VR48_GUTTER 8 /* just a guess */
/* conversion factor from virtual points and displayed pixels */
extern int display_scale(void);
/*
* simulate passage of time; first argument is simulated microseconds elapsed,
* second argument is flag to slow down simulated speed
* see comments in display.c for why you should call it often!!
* Under X11 polls for window events!!
*/
extern int display_age(int,int);
/*
* display intensity levels.
* always at least 8 (for VT11/VS60) -- may be mapped internally
*/
#define DISPLAY_INT_MAX 7
#define DISPLAY_INT_MIN 0 /* lowest "on" level */
/*
* plot a point; arguments are x, y, intensity, color (0/1)
* returns true if light pen active (mouse button down)
* at (or very near) this location.
*
* Display initialized on first call.
*/
extern int display_point(int,int,int,int);
/*
* force window system to output bits to screen;
* call after adding points, or aging the screen
*/
extern void display_sync(void);
/*
* currently a noop
*/
extern void display_reset(void);
/*
* ring the bell
*/
extern void display_beep(void);
/*
* Set light-pen radius; maximum radius in display coordinates
* from a "lit" location that the light pen will see.
*/
extern void display_lp_radius(int);
/*
* set by simulated spacewar switch box switches
* 18 bits (only high 4 and low 4 used)
*/
extern unsigned long spacewar_switches;
/*
* light pen "tip switch" activated (for VS60 emulation etc.)
* should only be set from "driver" (window system layer)
*/
extern unsigned char display_lp_sw;
/*
* deactivates light pen
* (SIMH DR11-C simulation when initialized sets this and
* then reports mouse coordinates as Talos digitizer data)
*/
extern unsigned char display_tablet;
/*
* users of this library are expected to provide these calls.
* simulator will set 18 simulated switches.
*/
extern unsigned long cpu_get_switches(void); /* get current switch state */
extern void cpu_set_switches(unsigned long); /* set switches */

View file

@ -677,15 +677,31 @@ SIM = scp.c sim_console.c sim_fio.c sim_timer.c sim_sock.c \
sim_tmxr.c sim_ether.c sim_tape.c sim_disk.c sim_serial.c \ sim_tmxr.c sim_ether.c sim_tape.c sim_disk.c sim_serial.c \
sim_video.c sim_video.c
DISPLAYD = display
ifeq ($(WIN32),)
ifeq (x11,$(shell if $(TEST) -e /usr/include/X11/Intrinsic.h ; then echo x11; fi))
DISPLAYL = ${DISPLAYD}/display.c $(DISPLAYD)/x11.c
DISPLAYVT = ${DISPLAYD}/vt11.c
DISPLAY_OPT = -DUSE_DISPLAY -I/usr/X11/include -lXt -lX11 -lm
else
DISPLAYL =
DISPLAYVT =
DISPLAY_OPT =
endif
else
DISPLAYL = ${DISPLAYD}/display.c $(DISPLAYD)/win32.c
DISPLAYVT = ${DISPLAYD}/vt11.c
DISPLAY_OPT = -DUSE_DISPLAY -lgdi32
endif
# #
# Emulator source files and compile time options # Emulator source files and compile time options
# #
PDP1D = PDP1 PDP1D = PDP1
PDP1 = ${PDP1D}/pdp1_lp.c ${PDP1D}/pdp1_cpu.c ${PDP1D}/pdp1_stddev.c \ PDP1 = ${PDP1D}/pdp1_lp.c ${PDP1D}/pdp1_cpu.c ${PDP1D}/pdp1_stddev.c \
${PDP1D}/pdp1_sys.c ${PDP1D}/pdp1_dt.c ${PDP1D}/pdp1_drm.c \ ${PDP1D}/pdp1_sys.c ${PDP1D}/pdp1_dt.c ${PDP1D}/pdp1_drm.c \
${PDP1D}/pdp1_clk.c ${PDP1D}/pdp1_dcs.c ${PDP1D}/pdp1_clk.c ${PDP1D}/pdp1_dcs.c ${PDP1D}/pdp1_dpy.c ${DISPLAYL}
PDP1_OPT = -I ${PDP1D} PDP1_OPT = -I ${PDP1D} $(DISPLAY_OPT)
NOVAD = NOVA NOVAD = NOVA
@ -727,8 +743,9 @@ PDP11 = ${PDP11D}/pdp11_fp.c ${PDP11D}/pdp11_cpu.c ${PDP11D}/pdp11_dz.c \
${PDP11D}/pdp11_cr.c ${PDP11D}/pdp11_rf.c ${PDP11D}/pdp11_dl.c \ ${PDP11D}/pdp11_cr.c ${PDP11D}/pdp11_rf.c ${PDP11D}/pdp11_dl.c \
${PDP11D}/pdp11_ta.c ${PDP11D}/pdp11_rc.c ${PDP11D}/pdp11_kg.c \ ${PDP11D}/pdp11_ta.c ${PDP11D}/pdp11_rc.c ${PDP11D}/pdp11_kg.c \
${PDP11D}/pdp11_ke.c ${PDP11D}/pdp11_dc.c ${PDP11D}/pdp11_dmc.c \ ${PDP11D}/pdp11_ke.c ${PDP11D}/pdp11_dc.c ${PDP11D}/pdp11_dmc.c \
${PDP11D}/pdp11_dup.c ${PDP11D}/pdp11_rs.c ${PDP11D}/pdp11_io_lib.c ${PDP11D}/pdp11_dup.c ${PDP11D}/pdp11_rs.c ${PDP11D}/pdp11_vt.c \
PDP11_OPT = -DVM_PDP11 -I ${PDP11D} ${NETWORK_OPT} ${PDP11D}/pdp11_io_lib.c $(DISPLAYL) $(DISPLAYVT)
PDP11_OPT = -DVM_PDP11 -I ${PDP11D} ${NETWORK_OPT} $(DISPLAY_OPT)
VAXD = VAX VAXD = VAX
@ -978,20 +995,6 @@ SWTP6800MP-A2 = ${SWTP6800C}/mp-a2.c ${SWTP6800C}/m6800.c ${SWTP6800C}/m6810.c \
${SWTP6800C}/mp-b2.c ${SWTP6800C}/mp-8m.c ${SWTP6800C}/i2716.c ${SWTP6800C}/mp-b2.c ${SWTP6800C}/mp-8m.c ${SWTP6800C}/i2716.c
SWTP6800_OPT = -I ${SWTP6800D} SWTP6800_OPT = -I ${SWTP6800D}
DISPLAYD = display
ifeq ($(WIN32),)
ifeq (x11,$(shell if $(TEST) -e /usr/include/X11/Intrinsic.h ; then echo x11; fi))
DISPLAYL = ${DISPLAYD}/display.c $(DISPLAYD)/x11.c
DISPLAY_OPT = -DUSE_DISPLAY -I/usr/X11/include -lXt -lX11 -lm
else
DISPLAYL =
DISPLAY_OPT =
endif
else
DISPLAYL = ${DISPLAYD}/display.c $(DISPLAYD)/win32.c
DISPLAY_OPT = -DUSE_DISPLAY
endif
TX0D = TX-0 TX0D = TX-0
TX0 = ${TX0D}/tx0_cpu.c ${TX0D}/tx0_dpy.c ${TX0D}/tx0_stddev.c \ TX0 = ${TX0D}/tx0_cpu.c ${TX0D}/tx0_dpy.c ${TX0D}/tx0_stddev.c \
${TX0D}/tx0_sys.c ${TX0D}/tx0_sys_orig.c ${DISPLAYL} ${TX0D}/tx0_sys.c ${TX0D}/tx0_sys_orig.c ${DISPLAYL}