DISPLAY: Latest version of display code from Phil Budne and Doug Gwyn including initial pdp1_dpy and pdp11_vt
This commit is contained in:
parent
026dd98d83
commit
1e3586ec91
42 changed files with 21636 additions and 8327 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -3,5 +3,6 @@
|
|||
*.vcproj binary
|
||||
*.exe binary
|
||||
*.bin binary
|
||||
*.rim binary
|
||||
sim_rev.h export-subst
|
||||
|
||||
|
|
|
@ -25,13 +25,14 @@
|
|||
|
||||
cpu PDP-1 central processor
|
||||
|
||||
210Mar-12 RMS Fixed & vs && in Ea_ch (Michael Bloom)
|
||||
21-Mar-12 RMS Fixed & vs && in Ea_ch (Michael Bloom)
|
||||
30-May-07 RMS Fixed typo in SBS clear (Norm Lastovica)
|
||||
28-Dec-06 RMS Added 16-channel SBS support, PDP-1D support
|
||||
28-Jun-06 RMS Fixed bugs in MUS and DIV
|
||||
22-Sep-05 RMS Fixed declarations (Sterling Garwood)
|
||||
16-Aug-05 RMS Fixed C++ declaration and cast problems
|
||||
09-Nov-04 RMS Added instruction history
|
||||
08-Feb-04 PLB Added display device spacewar/test switches
|
||||
07-Sep-03 RMS Added additional explanation on I/O simulation
|
||||
01-Sep-03 RMS Added address switches for hardware readin
|
||||
23-Jul-03 RMS Revised to detect I/O wait hang
|
||||
|
@ -360,6 +361,10 @@ extern int32 dt (int32 inst, int32 dev, int32 dat);
|
|||
extern int32 drm (int32 inst, int32 dev, int32 dat);
|
||||
extern int32 clk (int32 inst, int32 dev, int32 dat);
|
||||
extern int32 dcs (int32 inst, int32 dev, int32 dat);
|
||||
#ifdef USE_DISPLAY
|
||||
extern int32 dpy (int32 inst, int32 dev, int32 dat, int32 dat2);
|
||||
extern int32 spacewar (int32 inst, int32 dev, int32 dat);
|
||||
#endif
|
||||
|
||||
const int32 sc_map[512] = {
|
||||
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, /* 00000xxxx */
|
||||
|
@ -1203,6 +1208,11 @@ while (reason == 0) { /* loop until halted */
|
|||
io_data = ptp (IR, dev, IO);
|
||||
break;
|
||||
|
||||
#ifdef USE_DISPLAY
|
||||
case 007: /* display */
|
||||
io_data = dpy (IR, dev, IO, AC);
|
||||
break;
|
||||
#endif
|
||||
case 010: /* leave ring mode */
|
||||
if (cpu_unit.flags & UNIT_1D)
|
||||
PF = PF & ~PF_RNG;
|
||||
|
@ -1212,7 +1222,12 @@ while (reason == 0) { /* loop until halted */
|
|||
case 011: /* enter ring mode */
|
||||
if (cpu_unit.flags & UNIT_1D)
|
||||
PF = PF | PF_RNG;
|
||||
else reason = stop_inst;
|
||||
else
|
||||
#ifdef USE_DISPLAY
|
||||
io_data = spacewar (IR, dev, IO);
|
||||
#else
|
||||
reason = stop_inst;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 022: /* data comm sys */
|
||||
|
@ -1685,3 +1700,19 @@ for (k = 0; k < lnt; k++) { /* print specified */
|
|||
} /* end for */
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
#ifdef USE_DISPLAY
|
||||
/* set "test switches"; from display code */
|
||||
void
|
||||
cpu_set_switches(unsigned long bits)
|
||||
{
|
||||
/* just what we want; smaller CPUs might want to shift down? */
|
||||
TW = bits;
|
||||
}
|
||||
|
||||
unsigned long
|
||||
cpu_get_switches(void)
|
||||
{
|
||||
return TW;
|
||||
}
|
||||
#endif
|
||||
|
|
153
PDP1/pdp1_dpy.c
Normal file
153
PDP1/pdp1_dpy.c
Normal 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 */
|
|
@ -58,7 +58,9 @@ extern DEVICE dt_dev;
|
|||
extern DEVICE drm_dev;
|
||||
extern DEVICE drp_dev;
|
||||
extern DEVICE dcs_dev, dcsl_dev;
|
||||
#if defined(USE_DISPLAY)
|
||||
extern DEVICE dpy_dev;
|
||||
#endif
|
||||
extern UNIT cpu_unit;
|
||||
extern REG cpu_reg[];
|
||||
extern int32 M[];
|
||||
|
@ -95,7 +97,9 @@ DEVICE *sim_devices[] = {
|
|||
&drp_dev,
|
||||
&dcs_dev,
|
||||
&dcsl_dev,
|
||||
/* &dpy_dev, */
|
||||
#if defined(USE_DISPLAY)
|
||||
&dpy_dev,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
64
PDP1/spacewar1/README
Normal file
64
PDP1/spacewar1/README
Normal 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
25
PDP1/spacewar1/README.MIT
Normal 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
3068
PDP1/spacewar1/macro1.c
Normal file
File diff suppressed because it is too large
Load diff
21
PDP1/spacewar1/munch.mac
Normal file
21
PDP1/spacewar1/munch.mac
Normal 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
BIN
PDP1/spacewar1/munch.rim
Normal file
Binary file not shown.
1857
PDP1/spacewar1/spacewar.mac
Normal file
1857
PDP1/spacewar1/spacewar.mac
Normal file
File diff suppressed because it is too large
Load diff
BIN
PDP1/spacewar1/spacewar.rim
Normal file
BIN
PDP1/spacewar1/spacewar.rim
Normal file
Binary file not shown.
52
PDP11/lunar11/README.txt
Normal file
52
PDP11/lunar11/README.txt
Normal 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
5102
PDP11/lunar11/gtlem.mac
Normal file
File diff suppressed because it is too large
Load diff
BIN
PDP11/lunar11/lunar.dag
Normal file
BIN
PDP11/lunar11/lunar.dag
Normal file
Binary file not shown.
BIN
PDP11/lunar11/lunar.lda
Normal file
BIN
PDP11/lunar11/lunar.lda
Normal file
Binary file not shown.
114
PDP11/lunar11/lunar.txt
Normal file
114
PDP11/lunar11/lunar.txt
Normal 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!
|
|
@ -620,6 +620,14 @@ typedef struct pdp_dib DIB;
|
|||
#define INT_V_DLO 10
|
||||
#define INT_V_DCI 11
|
||||
#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_PIR2 0 /* BR2 */
|
||||
|
@ -667,6 +675,11 @@ typedef struct pdp_dib DIB;
|
|||
#define INT_DLO (1u << INT_V_DLO)
|
||||
#define INT_DCI (1u << INT_V_DCI)
|
||||
#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_PIR2 (1u << INT_V_PIR2)
|
||||
#define INT_PIR1 (1u << INT_V_PIR1)
|
||||
|
@ -717,6 +730,11 @@ typedef struct pdp_dib DIB;
|
|||
#define IPL_DLO 4
|
||||
#define IPL_DCI 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_PIR6 6
|
||||
|
|
|
@ -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, 8, 8 }, /* DJ11 */
|
||||
{ { NULL }, 1, 2, 16, 8 }, /* DH11 */
|
||||
{ { NULL }, 1, 4, 0, 8,
|
||||
{012000, 012010, 012020, 012030} }, /* GT40 */
|
||||
{ { "VT" }, 1, 4, 0, 8,
|
||||
{012000, 012010, 012020, 012030} }, /* VT11/GT40 - fx CSRs */
|
||||
{ { NULL }, 1, 2, 0, 8,
|
||||
{010400} }, /* LPS11 */
|
||||
{ { NULL }, 1, 2, 8, 8 }, /* DQ11 */
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
22-Jul-05 RMS Fixed missing , in initializer (Doug Gwyn)
|
||||
22-Dec-03 RMS Added second DEUNA/DELUA support
|
||||
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
|
||||
09-Jan-03 RMS Added DELUA/DEUNA support
|
||||
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 tu_dev;
|
||||
extern DEVICE ta_dev;
|
||||
#ifdef USE_DISPLAY
|
||||
extern DEVICE vt_dev;
|
||||
#endif
|
||||
extern DEVICE xq_dev, xqb_dev;
|
||||
extern DEVICE xu_dev, xub_dev;
|
||||
extern DEVICE ke_dev;
|
||||
|
@ -167,6 +171,9 @@ DEVICE *sim_devices[] = {
|
|||
&tq_dev,
|
||||
&tu_dev,
|
||||
&ta_dev,
|
||||
#ifdef USE_DISPLAY
|
||||
&vt_dev,
|
||||
#endif
|
||||
&xq_dev,
|
||||
&xqb_dev,
|
||||
&xu_dev,
|
||||
|
|
433
PDP11/pdp11_vt.c
Normal file
433
PDP11/pdp11_vt.c
Normal 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 */
|
|
@ -45,7 +45,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
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"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
|
@ -128,7 +128,7 @@
|
|||
InlineFunctionExpansion="1"
|
||||
OmitFramePointers="true"
|
||||
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"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
|
@ -189,6 +189,10 @@
|
|||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\display\display.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PDP1\pdp1_clk.c"
|
||||
>
|
||||
|
@ -201,6 +205,10 @@
|
|||
RelativePath="..\PDP1\pdp1_dcs.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PDP1\pdp1_dpy.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PDP1\pdp1_drm.c"
|
||||
>
|
||||
|
@ -261,11 +269,19 @@
|
|||
RelativePath="..\sim_tmxr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\display\win32.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\display\display.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PDP1\pdp1_defs.h"
|
||||
>
|
||||
|
@ -318,6 +334,10 @@
|
|||
RelativePath="..\sim_tmxr.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\display\ws.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="./;../;../PDP11/;"../../windows-build/winpcap/Wpdpack/Include";"../../windows-build/pthreads""
|
||||
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"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
|
@ -129,7 +129,7 @@
|
|||
InlineFunctionExpansion="1"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="./;../;../PDP11/;"../../windows-build/winpcap/Wpdpack/Include";"../../windows-build/pthreads""
|
||||
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"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
|
@ -191,6 +191,10 @@
|
|||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\display\display.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PDP11\pdp11_cis.c"
|
||||
>
|
||||
|
@ -339,6 +343,10 @@
|
|||
RelativePath="..\PDP11\pdp11_vh.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PDP11\pdp11_vt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PDP11\pdp11_xq.c"
|
||||
>
|
||||
|
@ -407,11 +415,23 @@
|
|||
RelativePath="..\sim_tmxr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\display\vt11.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\display\win32.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\display\display.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PDP11\pdp11_cpumod.h"
|
||||
>
|
||||
|
@ -504,6 +524,14 @@
|
|||
RelativePath="..\sim_tmxr.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\display\vt11.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\display\ws.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
|
|
|
@ -483,7 +483,8 @@ PDP1_LIB = $(LIB_DIR)PDP1-$(ARCH).OLB
|
|||
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_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))
|
||||
|
||||
#
|
||||
|
@ -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_TA.C,$(PDP11_DIR)PDP11_DMC.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_SOURCE2 = $(PDP11_DIR)PDP11_TM.C,$(PDP11_DIR)PDP11_TS.C,\
|
||||
$(PDP11_DIR)PDP11_IO.C,$(PDP11_DIR)PDP11_RQ.C,\
|
||||
|
|
332
display/README
332
display/README
|
@ -1,166 +1,166 @@
|
|||
$Id: README,v 1.15 2004/02/09 07:20:18 phil Exp $
|
||||
|
||||
XY Display Simulation
|
||||
Simulates XY plotting displays used on DEC PDP systems.
|
||||
|
||||
Copyright (c) 2003-2004, Philip L. Budne and Douglas A. Gwyn
|
||||
|
||||
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.
|
||||
|
||||
Phil Budne <phil@ultimate.com>
|
||||
Douglas A Gwyn <gwyn@arl.army.mil>
|
||||
February 5, 2004
|
||||
|
||||
Designed for use with Bob Supnik's SIMH, but the code should be easily
|
||||
portable, and usable standalone (see vttest.c for an example).
|
||||
|
||||
Display code is provided for X11 (Unix/VMS) and Win32.
|
||||
We're not GUI programmers, so the code is PRIMITIVE!!
|
||||
|
||||
Started from VC8E simulator by Douglas W. Jones
|
||||
(distribution 5, of Feb 4, 1997);
|
||||
|
||||
This PDP8 Emulator was written by Douglas W. Jones at the
|
||||
University of Iowa. It is distributed as freeware, of
|
||||
uncertain function and uncertain utility.
|
||||
|
||||
Original phosphor decay constants for Type 30 display from XMame 0.72.1
|
||||
|
||||
VT11 support GREATLY enhanced (and VT48 support added) and
|
||||
other general improvements from Douglas A Gwyn.
|
||||
|
||||
In the interest of fair play we have supplied two makefiles (neither
|
||||
of which is named Makefile nor makefile), one which works under all
|
||||
flavors of "make" (after necessary editing, in the traditional manner),
|
||||
and one which functions only under the GNU version of make (sometimes
|
||||
installed as "gmake", but the default "make" on many systems). We have
|
||||
not added a third flavor which uses BSD make enhancements, because our
|
||||
deeply held roots (over 40 combined years of Unix experience by the
|
||||
authors) demand that things should work on all platforms. Both the
|
||||
Linux and Windows worlds violate this simple credo (everything works so
|
||||
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
|
||||
GNU environment is widely available and "gmake" has features that
|
||||
support automatic configuration for multiple platforms, we have
|
||||
supplied thr GNU-specific variant with the expectation that many users
|
||||
will find it more convenient. You can copy or link whichever flavor of
|
||||
makefile suits your taste to whichever spelling of "makefile" suits
|
||||
your fancy, or invoke "make" with the -f flag specifying the desired
|
||||
makefile.
|
||||
|
||||
To compile test programs:
|
||||
========================
|
||||
On Unix:
|
||||
# edit smakefile to match your environment
|
||||
make -f smakefile
|
||||
or
|
||||
gmake -f gmakefile
|
||||
|
||||
On Win32 (using Cygwin);
|
||||
make -f gmakefile WIN32=1
|
||||
|
||||
On Win32 (using MINGW):
|
||||
# edit smakefile to match your environment
|
||||
make -f smakefile
|
||||
or
|
||||
mingw32-make -f gmakefile WIN32=1
|
||||
or
|
||||
execute build-mingw.bat in a DOS command window
|
||||
|
||||
creates:
|
||||
|
||||
munch: standalone simulation of PDP-1 munching squares;
|
||||
examines console "test switches" (see next section)
|
||||
|
||||
vt11: sequences through VT11/VS60 simulator test displays;
|
||||
shows how the diplay-processor simulator can be used
|
||||
from applications other than PDP-11 simulators
|
||||
|
||||
Console switches:
|
||||
================
|
||||
|
||||
Upto 18 simulated console switches, toggled by hitting keys:
|
||||
|
||||
123 456 789 qwe rty uio
|
||||
|
||||
space bar clears all switches.
|
||||
|
||||
Spacewar Switches:
|
||||
=================
|
||||
|
||||
Key presses for simulated Spacewar control box switches;
|
||||
|
||||
action player
|
||||
1 2
|
||||
rotate clockwise a k
|
||||
rotate counter clockwise s l
|
||||
fire engines d ;
|
||||
launch torpedo f '
|
||||
hyperspace (both at once) as kl
|
||||
|
||||
Light pen:
|
||||
=========
|
||||
|
||||
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).
|
||||
The light pen may be dragged while active.
|
||||
|
||||
Too many compile time parameters:
|
||||
================================
|
||||
|
||||
Read the comments in display.c for more explanations!!
|
||||
|
||||
DISPLAY_TYPE default display type, one of:
|
||||
DIS_VR14, DIS_VR17, DIS_VR20, DIS_VR48, DIS_TYPE30, DIS_TYPE340
|
||||
selects screen characteristics (phosphor, dimensions).
|
||||
|
||||
Only affects programs which do not make an expicit
|
||||
display_init() call.
|
||||
|
||||
PIX_SCALE one of RES_FULL, RES_HALF, RES_QUARTER, RES_EIGHTH
|
||||
selects default display scaling factor.
|
||||
|
||||
PEN_RADIUS default radius of light pen in (scaled) pixels
|
||||
|
||||
MAXELAPSED Upper 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
|
||||
MAXDELAY Upper limit in real microseconds for attempted delay
|
||||
GAINSHIFT delay_check increment/decrement gain factor
|
||||
|
||||
In display system support (x11.c, win32.c);
|
||||
|
||||
PIX_SIZE selects displayed pixel size (default 1)
|
||||
makes screen larger, useful when display scaled to small size
|
||||
|
||||
Programming interface:
|
||||
=====================
|
||||
|
||||
see display.h
|
||||
|
||||
Source repository:
|
||||
=================
|
||||
|
||||
Up-to-date Sources are available by anonymous CVS.
|
||||
See http://www.ultimate.com/phil/xy/
|
||||
$Id: README,v 1.15 2004/02/09 07:20:18 phil Exp $
|
||||
|
||||
XY Display Simulation
|
||||
Simulates XY plotting displays used on DEC PDP systems.
|
||||
|
||||
Copyright (c) 2003-2004, Philip L. Budne and Douglas A. Gwyn
|
||||
|
||||
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.
|
||||
|
||||
Phil Budne <phil@ultimate.com>
|
||||
Douglas A Gwyn <gwyn@arl.army.mil>
|
||||
February 5, 2004
|
||||
|
||||
Designed for use with Bob Supnik's SIMH, but the code should be easily
|
||||
portable, and usable standalone (see vttest.c for an example).
|
||||
|
||||
Display code is provided for X11 (Unix/VMS) and Win32.
|
||||
We're not GUI programmers, so the code is PRIMITIVE!!
|
||||
|
||||
Started from VC8E simulator by Douglas W. Jones
|
||||
(distribution 5, of Feb 4, 1997);
|
||||
|
||||
This PDP8 Emulator was written by Douglas W. Jones at the
|
||||
University of Iowa. It is distributed as freeware, of
|
||||
uncertain function and uncertain utility.
|
||||
|
||||
Original phosphor decay constants for Type 30 display from XMame 0.72.1
|
||||
|
||||
VT11 support GREATLY enhanced (and VT48 support added) and
|
||||
other general improvements from Douglas A Gwyn.
|
||||
|
||||
In the interest of fair play we have supplied two makefiles (neither
|
||||
of which is named Makefile nor makefile), one which works under all
|
||||
flavors of "make" (after necessary editing, in the traditional manner),
|
||||
and one which functions only under the GNU version of make (sometimes
|
||||
installed as "gmake", but the default "make" on many systems). We have
|
||||
not added a third flavor which uses BSD make enhancements, because our
|
||||
deeply held roots (over 40 combined years of Unix experience by the
|
||||
authors) demand that things should work on all platforms. Both the
|
||||
Linux and Windows worlds violate this simple credo (everything works so
|
||||
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
|
||||
GNU environment is widely available and "gmake" has features that
|
||||
support automatic configuration for multiple platforms, we have
|
||||
supplied thr GNU-specific variant with the expectation that many users
|
||||
will find it more convenient. You can copy or link whichever flavor of
|
||||
makefile suits your taste to whichever spelling of "makefile" suits
|
||||
your fancy, or invoke "make" with the -f flag specifying the desired
|
||||
makefile.
|
||||
|
||||
To compile test programs:
|
||||
========================
|
||||
On Unix:
|
||||
# edit smakefile to match your environment
|
||||
make -f smakefile
|
||||
or
|
||||
gmake -f gmakefile
|
||||
|
||||
On Win32 (using Cygwin);
|
||||
make -f gmakefile WIN32=1
|
||||
|
||||
On Win32 (using MINGW):
|
||||
# edit smakefile to match your environment
|
||||
make -f smakefile
|
||||
or
|
||||
mingw32-make -f gmakefile WIN32=1
|
||||
or
|
||||
execute build-mingw.bat in a DOS command window
|
||||
|
||||
creates:
|
||||
|
||||
munch: standalone simulation of PDP-1 munching squares;
|
||||
examines console "test switches" (see next section)
|
||||
|
||||
vt11: sequences through VT11/VS60 simulator test displays;
|
||||
shows how the diplay-processor simulator can be used
|
||||
from applications other than PDP-11 simulators
|
||||
|
||||
Console switches:
|
||||
================
|
||||
|
||||
Upto 18 simulated console switches, toggled by hitting keys:
|
||||
|
||||
123 456 789 qwe rty uio
|
||||
|
||||
space bar clears all switches.
|
||||
|
||||
Spacewar Switches:
|
||||
=================
|
||||
|
||||
Key presses for simulated Spacewar control box switches;
|
||||
|
||||
action player
|
||||
1 2
|
||||
rotate clockwise a k
|
||||
rotate counter clockwise s l
|
||||
fire engines d ;
|
||||
launch torpedo f '
|
||||
hyperspace (both at once) as kl
|
||||
|
||||
Light pen:
|
||||
=========
|
||||
|
||||
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).
|
||||
The light pen may be dragged while active.
|
||||
|
||||
Too many compile time parameters:
|
||||
================================
|
||||
|
||||
Read the comments in display.c for more explanations!!
|
||||
|
||||
DISPLAY_TYPE default display type, one of:
|
||||
DIS_VR14, DIS_VR17, DIS_VR20, DIS_VR48, DIS_TYPE30, DIS_TYPE340
|
||||
selects screen characteristics (phosphor, dimensions).
|
||||
|
||||
Only affects programs which do not make an expicit
|
||||
display_init() call.
|
||||
|
||||
PIX_SCALE one of RES_FULL, RES_HALF, RES_QUARTER, RES_EIGHTH
|
||||
selects default display scaling factor.
|
||||
|
||||
PEN_RADIUS default radius of light pen in (scaled) pixels
|
||||
|
||||
MAXELAPSED Upper 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
|
||||
MAXDELAY Upper limit in real microseconds for attempted delay
|
||||
GAINSHIFT delay_check increment/decrement gain factor
|
||||
|
||||
In display system support (x11.c, win32.c);
|
||||
|
||||
PIX_SIZE selects displayed pixel size (default 1)
|
||||
makes screen larger, useful when display scaled to small size
|
||||
|
||||
Programming interface:
|
||||
=====================
|
||||
|
||||
see display.h
|
||||
|
||||
Source repository:
|
||||
=================
|
||||
|
||||
Up-to-date Sources are available by anonymous CVS.
|
||||
See http://www.ultimate.com/phil/xy/
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
@echo off
|
||||
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
|
||||
rem If needed, define the path for the MINGW bin directory.
|
||||
rem (this should already be set if MINGW was installed correctly)
|
||||
rem
|
||||
gcc -v 1>NUL 2>NUL
|
||||
if ERRORLEVEL 1 path C:\MinGW\bin;D:\MinGW\bin;E:\MinGW\bin;%path%
|
||||
gcc -v 1>NUL 2>NUL
|
||||
if ERRORLEVEL 1 echo "MinGW Environment Unavailable"
|
||||
mingw32-make WIN32=1 -f gmakefile %1 %2 %3 %4
|
||||
@echo off
|
||||
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
|
||||
rem If needed, define the path for the MINGW bin directory.
|
||||
rem (this should already be set if MINGW was installed correctly)
|
||||
rem
|
||||
gcc -v 1>NUL 2>NUL
|
||||
if ERRORLEVEL 1 path C:\MinGW\bin;D:\MinGW\bin;E:\MinGW\bin;%path%
|
||||
gcc -v 1>NUL 2>NUL
|
||||
if ERRORLEVEL 1 echo "MinGW Environment Unavailable"
|
||||
mingw32-make WIN32=1 -f gmakefile %1 %2 %3 %4
|
||||
|
|
328
display/carbon.c
Normal file
328
display/carbon.c
Normal 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));
|
||||
}
|
2112
display/display.c
2112
display/display.c
File diff suppressed because it is too large
Load diff
|
@ -1,143 +1,143 @@
|
|||
/*
|
||||
* $Id: display.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_TX0 = 33,
|
||||
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; argumen ts 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 */
|
||||
/*
|
||||
* $Id: display.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_TX0 = 33,
|
||||
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; argumen ts 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 */
|
||||
|
|
|
@ -1,77 +1,86 @@
|
|||
# $Id: gmakefile,v 1.17 2004/01/24 08:31:56 phil Exp - revised by DAG
|
||||
|
||||
# (GNU) Makefile for test programs under Unix/X11 and Win32
|
||||
#
|
||||
# Unix:
|
||||
# edit Unix defs to fit your compiler/library environment, then
|
||||
# gmake -f gmakefile
|
||||
# or if GNU make is the default:
|
||||
# make -f gmakefile
|
||||
#
|
||||
# Win32 (Cygwin)
|
||||
# make WIN32=1
|
||||
#
|
||||
# Win32 (MINGW):
|
||||
# mingw32-make -f gmakefile WIN32=1
|
||||
|
||||
DISP_DEFS=-DTEST_DIS=DIS_VR48 -DTEST_RES=RES_HALF # -DDEBUG_VT11
|
||||
|
||||
ifeq ($(WIN32),)
|
||||
#Unix environments
|
||||
X11BASE=/usr/X11R6
|
||||
X11LIBDIR=$(X11BASE)/lib
|
||||
X11INCDIR=$(X11BASE)/include
|
||||
LIBS=-L$(X11LIBDIR) -lXt -lX11 -lm
|
||||
OSFLAGS=-I$(X11INCDIR)
|
||||
DRIVER=x11.o
|
||||
EXT=
|
||||
else
|
||||
#Win32 environments
|
||||
LIBS=-lgdi32
|
||||
OSFLAGS=
|
||||
DRIVER=win32.o
|
||||
EXT=.exe
|
||||
endif
|
||||
|
||||
#PROF=-g # -pg
|
||||
OPT=-O2
|
||||
CFLAGS=$(OPT) $(PROF) $(OSFLAGS) $(DISP_DEFS)
|
||||
CC=gcc -Wunused
|
||||
LDFLAGS=$(PROF)
|
||||
|
||||
ALL= munch$(EXT) vt11$(EXT)
|
||||
ALL: $(ALL)
|
||||
|
||||
# munching squares; see README file for
|
||||
# how to use console switches
|
||||
|
||||
MUNCH=$(DRIVER) display.o test.o
|
||||
munch$(EXT): $(MUNCH)
|
||||
$(CC) $(LDFLAGS) -o munch$(EXT) $(MUNCH) $(LIBS)
|
||||
|
||||
VT11=$(DRIVER) vt11.o vttest.o display.o
|
||||
vt11$(EXT): $(VT11)
|
||||
$(CC) $(LDFLAGS) -o vt11$(EXT) $(VT11) $(LIBS)
|
||||
|
||||
display.o: display.h ws.h
|
||||
vt11.o: display.h vt11.h
|
||||
x11.o: ws.h display.h
|
||||
win32.o: ws.h
|
||||
test.o: display.h vt11.h
|
||||
vttest.o: display.h vt11.h vtmacs.h
|
||||
|
||||
clean:
|
||||
ifeq ($(WIN32),)
|
||||
rm -f *.o *~ .#*
|
||||
else
|
||||
if exist *.o del /q *.o
|
||||
if exist *~ del /q *~
|
||||
if exist .#* del /q .#*
|
||||
endif
|
||||
|
||||
clobber: clean
|
||||
ifeq ($(WIN32),)
|
||||
rm -f $(ALL)
|
||||
else
|
||||
if exist *.exe del /q *.exe
|
||||
endif
|
||||
# $Id: gmakefile,v 1.24 2005/11/05 02:06:14 phil Exp $
|
||||
|
||||
# (GNU) Makefile for test programs under Unix/X11 and Win32
|
||||
#
|
||||
# Unix:
|
||||
# edit Unix defs to fit your compiler/library environment, then
|
||||
# gmake -f gmakefile
|
||||
# or if GNU make is the default:
|
||||
# make -f gmakefile
|
||||
#
|
||||
# OS X (Carbon)
|
||||
# make -f gmakefile OSX=1
|
||||
#
|
||||
# Win32 (Cygwin)
|
||||
# make -f gmakefile WIN32=1
|
||||
#
|
||||
# Win32 (MINGW):
|
||||
# mingw32-make -f gmakefile WIN32=1
|
||||
|
||||
DISP_DEFS=-DTEST_DIS=DIS_VR48 -DTEST_RES=RES_HALF # -DDEBUG_VT11
|
||||
|
||||
ifeq ($(WIN32),)
|
||||
ifeq ($(OSX),)
|
||||
#Unix environments
|
||||
X11BASE=/usr/X11R6
|
||||
X11LIBDIR=$(X11BASE)/lib
|
||||
X11INCDIR=$(X11BASE)/include
|
||||
LIBS=-L$(X11LIBDIR) -lXt -lX11 -lm
|
||||
OSFLAGS=-I$(X11INCDIR)
|
||||
DRIVER=x11.o
|
||||
EXT=
|
||||
else
|
||||
DRIVER=carbon.o
|
||||
LIBS=-framework Carbon
|
||||
endif
|
||||
else
|
||||
#Win32 environments
|
||||
LIBS=-lgdi32
|
||||
OSFLAGS=
|
||||
DRIVER=win32.o
|
||||
EXT=.exe
|
||||
endif
|
||||
|
||||
#PROF=-g # -pg
|
||||
OPT=-O2
|
||||
CFLAGS=$(OPT) $(PROF) $(OSFLAGS) $(DISP_DEFS)
|
||||
CC=gcc -Wunused
|
||||
LDFLAGS=$(PROF)
|
||||
|
||||
ALL= munch$(EXT) vt11$(EXT)
|
||||
ALL: $(ALL)
|
||||
|
||||
# munching squares; see README file for
|
||||
# how to use console switches
|
||||
|
||||
MUNCH=$(DRIVER) xy.o test.o
|
||||
munch$(EXT): $(MUNCH)
|
||||
$(CC) $(LDFLAGS) -o munch$(EXT) $(MUNCH) $(LIBS)
|
||||
|
||||
VT11=$(DRIVER) vt11.o vttest.o xy.o
|
||||
vt11$(EXT): $(VT11)
|
||||
$(CC) $(LDFLAGS) -o vt11$(EXT) $(VT11) $(LIBS)
|
||||
|
||||
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:
|
||||
ifeq ($(WIN32),)
|
||||
rm -f *.o *~ .#*
|
||||
else
|
||||
if exist *.o del /q *.o
|
||||
if exist *~ del /q *~
|
||||
if exist .#* del /q .#*
|
||||
endif
|
||||
|
||||
clobber: clean
|
||||
ifeq ($(WIN32),)
|
||||
rm -f $(ALL)
|
||||
else
|
||||
if exist *.exe del /q *.exe
|
||||
endif
|
||||
|
|
|
@ -1,75 +1,91 @@
|
|||
# $Id: smakefile,v 1.17 2004/01/24 08:31:56 phil Exp - revised by DAG
|
||||
|
||||
# Makefile for test programs (standard Unix "make" version)
|
||||
|
||||
# Unix:
|
||||
# comment out Windows defs, uncomment Unix defs,
|
||||
# edit Unix defs to fit your compiler/library environment, then
|
||||
# (g)make
|
||||
#
|
||||
# Win32 (Cygwin)
|
||||
# comment out Unix defs, uncomment Windows defs, then
|
||||
# make
|
||||
#
|
||||
# Win32 (MINGW)
|
||||
# comment out Unix defs, uncomment Windows defs, then
|
||||
# mingw32-make
|
||||
|
||||
DISP_DEFS=-DTEST_DIS=DIS_VR48 -DTEST_RES=RES_HALF # -DDEBUG_VT11
|
||||
|
||||
#Unix environments
|
||||
CC=cc # gcc -Wunused
|
||||
#X11BASE=/usr/X11R6
|
||||
#X11LIBDIR=$(X11BASE)/lib
|
||||
#X11INCDIR=$(X11BASE)/include
|
||||
LIBS=-lXt -lX11 -lm # -L$(X11LIBDIR)
|
||||
OSFLAGS=-I$(X11INCDIR)
|
||||
DRIVER=x11.o
|
||||
EXT=
|
||||
PROF=-g # -pg
|
||||
OPT=-O # -O2
|
||||
CFLAGS=$(OPT) $(PROF) $(OSFLAGS) $(DISP_DEFS)
|
||||
CC=cc # gcc -Wunused
|
||||
LDFLAGS=$(PROF)
|
||||
|
||||
##Win32 environments
|
||||
#LIBS=-lgdi32
|
||||
#OSFLAGS=
|
||||
#DRIVER=win32.o
|
||||
#EXT=.exe
|
||||
#PROF=-g # -pg
|
||||
#OPT=-O2
|
||||
#CFLAGS=$(OPT) $(PROF) $(OSFLAGS) $(DISP_DEFS)
|
||||
#CC=gcc -Wunused
|
||||
LDFLAGS=$(PROF)
|
||||
|
||||
ALL= munch$(EXT) vt11$(EXT)
|
||||
ALL: $(ALL)
|
||||
|
||||
# munching squares; see README file for
|
||||
# how to use console switches
|
||||
|
||||
MUNCH=$(DRIVER) display.o test.o
|
||||
munch$(EXT): $(MUNCH)
|
||||
$(CC) $(LDFLAGS) -o munch$(EXT) $(MUNCH) $(LIBS)
|
||||
|
||||
VT11=$(DRIVER) vt11.o vttest.o display.o
|
||||
vt11$(EXT): $(VT11)
|
||||
$(CC) $(LDFLAGS) -o vt11$(EXT) $(VT11) $(LIBS)
|
||||
|
||||
display.o: display.h ws.h
|
||||
vt11.o: display.h vt11.h
|
||||
x11.o: ws.h display.h
|
||||
win32.o: ws.h
|
||||
test.o: display.h vt11.h
|
||||
vttest.o: display.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
|
||||
# $Id: smakefile,v 1.6 2005/11/05 02:06:14 phil Exp $
|
||||
|
||||
# Makefile for test programs (standard Unix "make" version)
|
||||
|
||||
# Unix:
|
||||
# comment out OS X, Windows defs, uncomment Unix defs,
|
||||
# edit Unix defs to fit your compiler/library environment, then
|
||||
# make -f smakefile
|
||||
#
|
||||
# OS X (Carbon)
|
||||
# comment out Unix, Windows defs, uncomment OS X defs
|
||||
# make -f smakefile
|
||||
#
|
||||
# Win32 (Cygwin)
|
||||
# comment out Unix defs, uncomment Windows defs, then
|
||||
# make -f smakefile
|
||||
#
|
||||
# Win32 (MINGW)
|
||||
# comment out Unix defs, uncomment Windows defs, then
|
||||
# mingw32-make
|
||||
|
||||
DISP_DEFS=-DTEST_DIS=DIS_VR48 -DTEST_RES=RES_HALF # -DDEBUG_VT11
|
||||
|
||||
#Unix environments
|
||||
CC=cc
|
||||
#CC=gcc -Wunused
|
||||
#X11BASE=/usr/X11R6
|
||||
#X11LIBDIR=$(X11BASE)/lib
|
||||
#X11INCDIR=$(X11BASE)/include
|
||||
LIBS=-lXt -lX11 -lm # -L$(X11LIBDIR)
|
||||
OSFLAGS=-I$(X11INCDIR)
|
||||
DRIVER=x11.o
|
||||
EXT=
|
||||
PROF=-g # -pg
|
||||
OPT=-O # -O2
|
||||
CFLAGS=$(OPT) $(PROF) $(OSFLAGS) $(DISP_DEFS)
|
||||
LDFLAGS=$(PROF)
|
||||
|
||||
##OS X
|
||||
#CC=cc -Wunused
|
||||
#LIBS=-framework Carbon
|
||||
#OSFLAGS=
|
||||
#DRIVER=carbon.o
|
||||
#EXT=
|
||||
#PROF=-g # -pg
|
||||
#OPT=-O # -O2
|
||||
#CFLAGS=$(OPT) $(PROF) $(OSFLAGS) $(DISP_DEFS)
|
||||
#LDFLAGS=$(PROF)
|
||||
|
||||
##Win32 environments
|
||||
#LIBS=-lgdi32
|
||||
#OSFLAGS=
|
||||
#DRIVER=win32.o
|
||||
#EXT=.exe
|
||||
#PROF=-g # -pg
|
||||
#OPT=-O2
|
||||
#CFLAGS=$(OPT) $(PROF) $(OSFLAGS) $(DISP_DEFS)
|
||||
#CC=gcc -Wunused
|
||||
LDFLAGS=$(PROF)
|
||||
|
||||
ALL= munch$(EXT) vt11$(EXT)
|
||||
ALL: $(ALL)
|
||||
|
||||
# munching squares; see README file for
|
||||
# how to use console switches
|
||||
|
||||
MUNCH=$(DRIVER) xy.o test.o
|
||||
munch$(EXT): $(MUNCH)
|
||||
$(CC) $(LDFLAGS) -o munch$(EXT) $(MUNCH) $(LIBS)
|
||||
|
||||
VT11=$(DRIVER) vt11.o vttest.o xy.o
|
||||
vt11$(EXT): $(VT11)
|
||||
$(CC) $(LDFLAGS) -o vt11$(EXT) $(VT11) $(LIBS)
|
||||
|
||||
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
|
||||
|
|
384
display/test.c
384
display/test.c
|
@ -1,192 +1,192 @@
|
|||
/*
|
||||
* $Id: test.c,v 1.23 2004/02/07 06:31:20 phil Exp $
|
||||
* XY Display simulator test program (PDP-1 Munching Squares)
|
||||
* Phil Budne <phil@ultimate.com>
|
||||
* September 2003
|
||||
*
|
||||
* Updates from Douglas A. Gwyn, 12 Jan. 2004
|
||||
*
|
||||
* With thanks to Daniel Smith for his web page:
|
||||
* http://world.std.com/~dpbsmith/munch.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TEST_DIS
|
||||
#define TEST_DIS DIS_TYPE30
|
||||
#endif
|
||||
|
||||
#ifndef TEST_RES
|
||||
#define TEST_RES RES_HALF
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef EXIT_FAILURE
|
||||
/* SunOS4 <stdlib.h> doesn't define this */
|
||||
#define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
||||
#include "display.h"
|
||||
|
||||
static unsigned long test_switches = 0;
|
||||
|
||||
/* called from display code: */
|
||||
unsigned long
|
||||
cpu_get_switches(void) {
|
||||
return test_switches;
|
||||
}
|
||||
|
||||
/* called from display code: */
|
||||
void
|
||||
cpu_set_switches(bits)
|
||||
unsigned long bits;
|
||||
{
|
||||
printf("switches: %06lo\n", bits);
|
||||
test_switches = bits;
|
||||
}
|
||||
|
||||
void
|
||||
munch(void) {
|
||||
static long us = 0;
|
||||
static long io = 0, v = 0;
|
||||
long ac;
|
||||
int x, y;
|
||||
|
||||
ac = test_switches;
|
||||
ac += v; /* add v */
|
||||
if (ac & ~0777777) {
|
||||
ac++;
|
||||
ac &= 0777777;
|
||||
}
|
||||
v = ac; /* dac v */
|
||||
|
||||
ac <<= 9; /* rcl 9s */
|
||||
io <<= 9;
|
||||
io |= ac>>18;
|
||||
ac &= 0777777;
|
||||
ac |= io>>18;
|
||||
io &= 0777777;
|
||||
|
||||
ac ^= v; /* xor v */
|
||||
|
||||
/* convert +/-512 one's complement to 0..1022, origin in lower left */
|
||||
y = (io >> 8) & 01777; /* hi 10 */
|
||||
if (y & 01000)
|
||||
y ^= 01000;
|
||||
else
|
||||
y += 511;
|
||||
|
||||
x = (ac >> 8) & 01777; /* hi 10 */
|
||||
if (x & 01000) /* negative */
|
||||
x ^= 01000;
|
||||
else
|
||||
x += 511;
|
||||
|
||||
if (display_point(x, y, DISPLAY_INT_MAX, 0))
|
||||
printf("light pen hit at (%d,%d)\n", x, y);
|
||||
|
||||
/*#define US 100000 /* 100ms (10/sec) */
|
||||
/*#define US 50000 /* 50ms (20/sec) */
|
||||
/*#define US 20000 /* 20ms (50/sec) */
|
||||
/*#define US 10000 /* 10ms (100/sec) */
|
||||
#define US 0
|
||||
us += 50; /* 10 5us PDP-1 memory cycles */
|
||||
if (us >= US) {
|
||||
display_age(us, 1);
|
||||
us = 0;
|
||||
}
|
||||
display_sync(); /* XXX push down */
|
||||
}
|
||||
|
||||
#ifdef T2
|
||||
/* display all window system level intensities;
|
||||
* must be compiled with -DINTENSITIES=<n> -DT2
|
||||
*/
|
||||
void
|
||||
t2(void) {
|
||||
int x, y;
|
||||
|
||||
display_init(TEST_DIS, TEST_RES);
|
||||
for (x = INTENSITIES-1; x >= 0; x--) {
|
||||
for (y = 0; y < 20; y++) {
|
||||
ws_display_point(x*4, 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+3, y, x, 0);
|
||||
}
|
||||
display_sync();
|
||||
}
|
||||
fflush(stdout);
|
||||
for (;;)
|
||||
/* wait */ ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef T3
|
||||
/* display all "user" level intensities;
|
||||
* must be compiled with -DINTENSITIES=<n> -DT3
|
||||
*
|
||||
* skip every other virtual point on both axes
|
||||
* default scaling maps adjacent pixels and
|
||||
* causes re-intensification!
|
||||
*/
|
||||
void
|
||||
t3(void) {
|
||||
int x, y;
|
||||
|
||||
display_init(TEST_DIS, TEST_RES);
|
||||
for (x = DISPLAY_INT_MAX; x >= 0; x--) {
|
||||
for (y = 0; y < 20; y++) {
|
||||
display_point(x*2, y*2, x, 0);
|
||||
}
|
||||
display_sync();
|
||||
}
|
||||
fflush(stdout);
|
||||
for (;;)
|
||||
/* wait */ ;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main(void) {
|
||||
if (!display_init(TEST_DIS, TEST_RES))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
cpu_set_switches(04000UL); /* classic starting value */
|
||||
for (;;) {
|
||||
#ifdef T2
|
||||
t2();
|
||||
#endif
|
||||
#ifdef T3
|
||||
t3();
|
||||
#endif
|
||||
munch();
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
/*
|
||||
* $Id: test.c,v 1.24 2005/01/14 18:58:00 phil Exp $
|
||||
* XY Display simulator test program (PDP-1 Munching Squares)
|
||||
* Phil Budne <phil@ultimate.com>
|
||||
* September 2003
|
||||
*
|
||||
* Updates from Douglas A. Gwyn, 12 Jan. 2004
|
||||
*
|
||||
* With thanks to Daniel Smith for his web page:
|
||||
* http://world.std.com/~dpbsmith/munch.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TEST_DIS
|
||||
#define TEST_DIS DIS_TYPE30
|
||||
#endif
|
||||
|
||||
#ifndef TEST_RES
|
||||
#define TEST_RES RES_HALF
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef EXIT_FAILURE
|
||||
/* SunOS4 <stdlib.h> doesn't define this */
|
||||
#define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
||||
#include "xy.h"
|
||||
|
||||
static unsigned long test_switches = 0;
|
||||
|
||||
/* called from display code: */
|
||||
unsigned long
|
||||
cpu_get_switches(void) {
|
||||
return test_switches;
|
||||
}
|
||||
|
||||
/* called from display code: */
|
||||
void
|
||||
cpu_set_switches(bits)
|
||||
unsigned long bits;
|
||||
{
|
||||
printf("switches: %06lo\n", bits);
|
||||
test_switches = bits;
|
||||
}
|
||||
|
||||
void
|
||||
munch(void) {
|
||||
static long us = 0;
|
||||
static long io = 0, v = 0;
|
||||
long ac;
|
||||
int x, y;
|
||||
|
||||
ac = test_switches;
|
||||
ac += v; /* add v */
|
||||
if (ac & ~0777777) {
|
||||
ac++;
|
||||
ac &= 0777777;
|
||||
}
|
||||
v = ac; /* dac v */
|
||||
|
||||
ac <<= 9; /* rcl 9s */
|
||||
io <<= 9;
|
||||
io |= ac>>18;
|
||||
ac &= 0777777;
|
||||
ac |= io>>18;
|
||||
io &= 0777777;
|
||||
|
||||
ac ^= v; /* xor v */
|
||||
|
||||
/* convert +/-512 one's complement to 0..1022, origin in lower left */
|
||||
y = (io >> 8) & 01777; /* hi 10 */
|
||||
if (y & 01000)
|
||||
y ^= 01000;
|
||||
else
|
||||
y += 511;
|
||||
|
||||
x = (ac >> 8) & 01777; /* hi 10 */
|
||||
if (x & 01000) /* negative */
|
||||
x ^= 01000;
|
||||
else
|
||||
x += 511;
|
||||
|
||||
if (display_point(x, y, DISPLAY_INT_MAX, 0))
|
||||
printf("light pen hit at (%d,%d)\n", x, y);
|
||||
|
||||
/*#define US 100000 /* 100ms (10/sec) */
|
||||
/*#define US 50000 /* 50ms (20/sec) */
|
||||
/*#define US 20000 /* 20ms (50/sec) */
|
||||
/*#define US 10000 /* 10ms (100/sec) */
|
||||
#define US 0
|
||||
us += 50; /* 10 5us PDP-1 memory cycles */
|
||||
if (us >= US) {
|
||||
display_age(us, 1);
|
||||
us = 0;
|
||||
}
|
||||
display_sync(); /* XXX push down */
|
||||
}
|
||||
|
||||
#ifdef T2
|
||||
/* display all window system level intensities;
|
||||
* must be compiled with -DINTENSITIES=<n> -DT2
|
||||
*/
|
||||
void
|
||||
t2(void) {
|
||||
int x, y;
|
||||
|
||||
display_init(TEST_DIS, TEST_RES);
|
||||
for (x = INTENSITIES-1; x >= 0; x--) {
|
||||
for (y = 0; y < 20; y++) {
|
||||
ws_display_point(x*4, 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+3, y, x, 0);
|
||||
}
|
||||
display_sync();
|
||||
}
|
||||
fflush(stdout);
|
||||
for (;;)
|
||||
/* wait */ ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef T3
|
||||
/* display all "user" level intensities;
|
||||
* must be compiled with -DINTENSITIES=<n> -DT3
|
||||
*
|
||||
* skip every other virtual point on both axes
|
||||
* default scaling maps adjacent pixels and
|
||||
* causes re-intensification!
|
||||
*/
|
||||
void
|
||||
t3(void) {
|
||||
int x, y;
|
||||
|
||||
display_init(TEST_DIS, TEST_RES);
|
||||
for (x = DISPLAY_INT_MAX; x >= 0; x--) {
|
||||
for (y = 0; y < 20; y++) {
|
||||
display_point(x*2, y*2, x, 0);
|
||||
}
|
||||
display_sync();
|
||||
}
|
||||
fflush(stdout);
|
||||
for (;;)
|
||||
/* wait */ ;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main(void) {
|
||||
if (!display_init(TEST_DIS, TEST_RES))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
cpu_set_switches(04000UL); /* classic starting value */
|
||||
for (;;) {
|
||||
#ifdef T2
|
||||
t2();
|
||||
#endif
|
||||
#ifdef T3
|
||||
t3();
|
||||
#endif
|
||||
munch();
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
|
1412
display/type340.c
1412
display/type340.c
File diff suppressed because it is too large
Load diff
6920
display/vt11.c
6920
display/vt11.c
File diff suppressed because it is too large
Load diff
274
display/vt11.h
274
display/vt11.h
|
@ -1,137 +1,137 @@
|
|||
/*
|
||||
* $Id: vt11.h,v 1.7 2004/01/25 17:20:51 phil Exp $
|
||||
* interface to VT11 simulator
|
||||
* Phil Budne <phil@ultimate.com>
|
||||
* September 16, 2003
|
||||
* Substantially revised by Douglas A. Gwyn, 14 Jan. 2004
|
||||
*
|
||||
* prerequisite: display.h
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003-2004, Philip L. Budne and Douglas A. Gwyn
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef SIM_DEFS_H_
|
||||
typedef unsigned short uint16;
|
||||
typedef long int32;
|
||||
typedef unsigned long uint32;
|
||||
#endif /* SIM_DEFS_H_ */
|
||||
|
||||
/*
|
||||
* VT11 jumpers control character spacing; VS60 always uses VT11 normal.
|
||||
* The VT11_CSP_{W,H} #defines establish the initial default character
|
||||
* spacing; to change the VT11 simulation from these default values,
|
||||
* set vt11_csp_{w,h} before calling any function named vt11_*.
|
||||
*/
|
||||
extern unsigned char vt11_csp_w; /* horizontal character spacing */
|
||||
#ifdef VT11_NARROW_OPT /* W3 or W6 installed */
|
||||
#define VT11_CSP_W 12
|
||||
#else /* VT11 normal; W4 or W5 installed */
|
||||
#define VT11_CSP_W 14
|
||||
#endif
|
||||
extern unsigned char vt11_csp_h; /* vertical character spacing */
|
||||
#ifdef VT11_TALL_OPT /* W3 or W4 installed */
|
||||
#define VT11_CSP_H 26
|
||||
#else /* VT11 normal; W5 or W6 installed */
|
||||
#define VT11_CSP_H 24
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The DISPLAY_TYPE #define establishes the initial default display
|
||||
* type; to change from the default display type, set vt11_display
|
||||
* before calling any function named vt11_* (other than vt11_reset()).
|
||||
*/
|
||||
#ifndef DISPLAY_TYPE
|
||||
#define DISPLAY_TYPE DIS_VR17 /* default display type */
|
||||
#endif
|
||||
extern enum display_type vt11_display; /* DIS_VR{14,17,48} */
|
||||
/*
|
||||
* The PIX_SCALE #define establishes the initial default display scale
|
||||
* factor; to change from the default scale factor, set vt11_scale
|
||||
* before calling any function named vt11_* (other than vt11_reset()).
|
||||
*/
|
||||
#ifndef PIX_SCALE
|
||||
#define PIX_SCALE RES_HALF /* default display scale factor */
|
||||
#endif
|
||||
extern int vt11_scale; /* RES_{FULL,HALF,QUARTER,EIGHTH} */
|
||||
/*
|
||||
* When vt11_init (READONLY) is nonzero, it indicates that it is too late
|
||||
* to change display parameters (type, scale, character spacing, etc.).
|
||||
*/
|
||||
extern unsigned char vt11_init; /* set after display_init() called */
|
||||
|
||||
/* vt11.c simulates either a VT11 or a VT48(VS60), according to display type: */
|
||||
#define VS60 (vt11_display == DIS_VR48)
|
||||
#define VT11 (!VS60)
|
||||
|
||||
/* The display file is an array of 16-bit words. */
|
||||
typedef uint16 vt11word;
|
||||
|
||||
extern int32 vt11_get_dpc(void); /* read Display PC */
|
||||
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_ypr(void); /* read char code/Y pos register */
|
||||
extern int32 vt11_get_rr(void); /* read relocate 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_yor(void); /* read Y offset 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_nr(void); /* read name 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_sar(void); /* read stack address/maint register */
|
||||
extern int32 vt11_get_zpr(void); /* read Z position register */
|
||||
extern int32 vt11_get_zor(void); /* read Z offset register */
|
||||
|
||||
extern void vt11_set_dpc(uint16); /* write Display PC */
|
||||
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_ypr(uint16); /* write char code/Y pos register */
|
||||
extern void vt11_set_rr(uint16); /* write relocate 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_yor(uint16); /* write Y offset 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_nr(uint16); /* write name 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_sar(uint16); /* write stack address/maint register */
|
||||
extern void vt11_set_zpr(uint16); /* write Z position register */
|
||||
extern void vt11_set_zor(uint16); /* write Z offset register */
|
||||
|
||||
extern void vt11_reset(void); /* reset the display processor */
|
||||
extern int vt11_cycle(int,int); /* perform a display processor cycle */
|
||||
|
||||
/*
|
||||
* 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 void vt_stop_intr(void); /* post a display-stop 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_name_intr(void); /* post a name-match interrupt */
|
||||
/*
|
||||
* $Id: vt11.h,v 1.8 2005/01/14 18:58:02 phil Exp $
|
||||
* interface to VT11 simulator
|
||||
* Phil Budne <phil@ultimate.com>
|
||||
* September 16, 2003
|
||||
* Substantially revised by Douglas A. Gwyn, 14 Jan. 2004
|
||||
*
|
||||
* prerequisite: xy.h
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003-2004, Philip L. Budne and Douglas A. Gwyn
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef SIM_DEFS_H_
|
||||
typedef unsigned short uint16;
|
||||
typedef long int32;
|
||||
typedef unsigned long uint32;
|
||||
#endif /* SIM_DEFS_H_ */
|
||||
|
||||
/*
|
||||
* VT11 jumpers control character spacing; VS60 always uses VT11 normal.
|
||||
* The VT11_CSP_{W,H} #defines establish the initial default character
|
||||
* spacing; to change the VT11 simulation from these default values,
|
||||
* set vt11_csp_{w,h} before calling any function named vt11_*.
|
||||
*/
|
||||
extern unsigned char vt11_csp_w; /* horizontal character spacing */
|
||||
#ifdef VT11_NARROW_OPT /* W3 or W6 installed */
|
||||
#define VT11_CSP_W 12
|
||||
#else /* VT11 normal; W4 or W5 installed */
|
||||
#define VT11_CSP_W 14
|
||||
#endif
|
||||
extern unsigned char vt11_csp_h; /* vertical character spacing */
|
||||
#ifdef VT11_TALL_OPT /* W3 or W4 installed */
|
||||
#define VT11_CSP_H 26
|
||||
#else /* VT11 normal; W5 or W6 installed */
|
||||
#define VT11_CSP_H 24
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The DISPLAY_TYPE #define establishes the initial default display
|
||||
* type; to change from the default display type, set vt11_display
|
||||
* before calling any function named vt11_* (other than vt11_reset()).
|
||||
*/
|
||||
#ifndef DISPLAY_TYPE
|
||||
#define DISPLAY_TYPE DIS_VR17 /* default display type */
|
||||
#endif
|
||||
extern enum display_type vt11_display; /* DIS_VR{14,17,48} */
|
||||
/*
|
||||
* The PIX_SCALE #define establishes the initial default display scale
|
||||
* factor; to change from the default scale factor, set vt11_scale
|
||||
* before calling any function named vt11_* (other than vt11_reset()).
|
||||
*/
|
||||
#ifndef PIX_SCALE
|
||||
#define PIX_SCALE RES_HALF /* default display scale factor */
|
||||
#endif
|
||||
extern int vt11_scale; /* RES_{FULL,HALF,QUARTER,EIGHTH} */
|
||||
/*
|
||||
* When vt11_init (READONLY) is nonzero, it indicates that it is too late
|
||||
* to change display parameters (type, scale, character spacing, etc.).
|
||||
*/
|
||||
extern unsigned char vt11_init; /* set after display_init() called */
|
||||
|
||||
/* vt11.c simulates either a VT11 or a VT48(VS60), according to display type: */
|
||||
#define VS60 (vt11_display == DIS_VR48)
|
||||
#define VT11 (!VS60)
|
||||
|
||||
/* The display file is an array of 16-bit words. */
|
||||
typedef uint16 vt11word;
|
||||
|
||||
extern int32 vt11_get_dpc(void); /* read Display PC */
|
||||
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_ypr(void); /* read char code/Y pos register */
|
||||
extern int32 vt11_get_rr(void); /* read relocate 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_yor(void); /* read Y offset 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_nr(void); /* read name 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_sar(void); /* read stack address/maint register */
|
||||
extern int32 vt11_get_zpr(void); /* read Z position register */
|
||||
extern int32 vt11_get_zor(void); /* read Z offset register */
|
||||
|
||||
extern void vt11_set_dpc(uint16); /* write Display PC */
|
||||
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_ypr(uint16); /* write char code/Y pos register */
|
||||
extern void vt11_set_rr(uint16); /* write relocate 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_yor(uint16); /* write Y offset 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_nr(uint16); /* write name 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_sar(uint16); /* write stack address/maint register */
|
||||
extern void vt11_set_zpr(uint16); /* write Z position register */
|
||||
extern void vt11_set_zor(uint16); /* write Z offset register */
|
||||
|
||||
extern void vt11_reset(void); /* reset the display processor */
|
||||
extern int vt11_cycle(int,int); /* perform a display processor cycle */
|
||||
|
||||
/*
|
||||
* 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 void vt_stop_intr(void); /* post a display-stop 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_name_intr(void); /* post a name-match interrupt */
|
||||
|
|
588
display/vtmacs.h
588
display/vtmacs.h
|
@ -1,291 +1,297 @@
|
|||
/*
|
||||
* $Id: vtmacs.h,v 1.4 2004/02/07 06:26:47 phil Exp $
|
||||
* macros for coding a VT11/VS60 display file (instructions and data)
|
||||
* Douglas A. Gwyn <gwyn@arl.army.mil>
|
||||
* January 31, 2004
|
||||
*
|
||||
* XXX -- assumes ASCII host character set
|
||||
*/
|
||||
|
||||
/* helper macros (not for use outside this header): */
|
||||
#define SGN_(x) ((x) < 0)
|
||||
#define MAG_(x) ((x) >= 0 ? (x) : -(x)) /* -0 not expressible directly in C */
|
||||
|
||||
/* control instructions: */
|
||||
|
||||
/* load status register A: */
|
||||
#define LSRA(stop,stop_intr,lp_hit_chg,ital,refresh,menu) \
|
||||
0170000 | stop | stop_intr | lp_hit_chg | ital | refresh | menu
|
||||
/* display stop: */
|
||||
#define ST_SAME 00000 /* don't stop display */
|
||||
#define ST_STOP 02000 /* stop display */
|
||||
/* stop interrupt: */
|
||||
#define SI_SAME 00000 /* no change */
|
||||
#define SI_INHIBIT 01000 /* inhibit interrupt on stop */
|
||||
#define SI_GENERATE 01400 /* generate interrupt on stop */
|
||||
/* light pen hit intensify (bright-down on VS60): */
|
||||
#define LI_SAME 0000 /* no change */
|
||||
#define LI_INTENSIFY 0200 /* enable intensify on hit (VT11) */
|
||||
#define LI_BRIGHTDOWN 0200 /* enable bright down on hit (VS60) */
|
||||
#define LI_NOINTENSIFY 0300 /* inhibit intensify on hit (VT11) */
|
||||
#define LI_NOBRIGHTDOWN 0300 /* inhibit bright down on hit (VS60) */
|
||||
/* italic font: */
|
||||
#define IT_SAME 000 /* no change */
|
||||
#define IT_NORMAL 040 /* normal font */
|
||||
#define IT_ITALIC 060 /* italic font */
|
||||
/* refresh rate: */
|
||||
#define RF_UNSYNC 000 /* unsynchronized */
|
||||
#define RF_SAME 000 /* (happens to work like that) */
|
||||
#define RF_LINE 004 /* sync with line (VT11) */
|
||||
#define RF_30 004 /* 30 frames/sec (VS60) */
|
||||
#define RF_40 010 /* 40 frames/sec (VS60) */
|
||||
#define RF_EXT 014 /* external sync (VS60) */
|
||||
/* menu/main area (VS60): */
|
||||
#define MN_SAME 0 /* no change */
|
||||
#define MN_MAIN 2 /* major screen area */
|
||||
#define MN_MENU 3 /* menu area */
|
||||
|
||||
/* load status register B: */
|
||||
#define LSRB(color,set_step,step) \
|
||||
0174000 | color | set_step | (step)
|
||||
/* color select (VS60): */
|
||||
#define CL_SAME 00000 /* no change */
|
||||
#define CL_GREEN 01000 /* green */
|
||||
#define CL_YELLOW 01200 /* yellow */
|
||||
#define CL_ORANGE 01400 /* orange */
|
||||
#define CL_RED 01600 /* red */
|
||||
/* graphplot increment register change enable: */
|
||||
#define SS_SAME 0000 /* no change (step value ignored) */
|
||||
#define SS_CHANGE 0100 /* write step value into register */
|
||||
|
||||
/* load status register BB (VS60): */
|
||||
#define LSRBB(z_data,edge_intr,depth_cue,char_esc) \
|
||||
0176000 | z_data | edge_intr | depth_cue | char_esc
|
||||
/* file Z data: */
|
||||
#define ZD_SAME 000 /* no change */
|
||||
#define ZD_NO 010 /* d.file does not contain Z coords. */
|
||||
#define ZD_YES 014 /* d.file contains Z coordinates */
|
||||
/* edge interrupts enable: */
|
||||
#define ED_SAME 000 /* no change */
|
||||
#define ED_DIS 040 /* disable intr. on edge transition */
|
||||
#define ED_ENA 060 /* enable intr. on edge transition */
|
||||
/* depth cue processing: */
|
||||
#define DQ_SAME 0000 /* no change */
|
||||
#define DQ_OFF 0200 /* disable depth cueing (Z intensity) */
|
||||
#define DQ_ON 0300 /* enable depth cueing (Z intensity) */
|
||||
/* escape on terminating character: */
|
||||
#define ES_SAME 0 /* no change */
|
||||
#define ES_NO 2 /* disable POPR on terminating char. */
|
||||
#define ES_YES 3 /* enable POPR on terminating char. */
|
||||
|
||||
/* load status register C (VS60): */
|
||||
#define LSRC(rotate,cs_change,cscale,vs_change,vscale) \
|
||||
0154000 | rotate | cs_change | ((cscale)<<5) | \
|
||||
vs_change | (vscale)
|
||||
/* character rotation: */
|
||||
#define RO_SAME 00000 /* no change */
|
||||
#define RO_HORIZONTAL 01000 /* no text rotation */
|
||||
#define RO_VERTICAL 01400 /* rotate text 90 degrees CCW */
|
||||
/* character scale change enable: */
|
||||
#define CS_SAME 0000 /* no change (cscale value ignored) */
|
||||
#define CS_CHANGE 0200 /* set character scale */
|
||||
/* vector scale change enable: */
|
||||
#define VS_SAME 000 /* no change (vscale value ignored) */
|
||||
#define VS_CHANGE 020 /* set vector scale */
|
||||
|
||||
/* load scope selection register (VS60): */
|
||||
#define LSSR(console,disp,lp_intr,sw_intr) \
|
||||
0164000 | console | disp | lp_intr | sw_intr
|
||||
/* console to which this instruction applies: */
|
||||
#define CN_0 0000 /* console # 0 */
|
||||
#define CN_1 0400 /* console # 1 */
|
||||
/* display enable: */
|
||||
#define DS_SAME 0000 /* no change */
|
||||
#define DS_DIS 0200 /* disable display (blank CRT) */
|
||||
#define DS_ENA 0300 /* enable display (use CRT) */
|
||||
/* light-pen hit interrupt enable: */
|
||||
#define LH_SAME 0000 /* no change */
|
||||
#define LH_DIS 0040 /* light-pen hit interrupt disabled */
|
||||
#define LH_ENA 0060 /* light-pen hit interrupt enabled */
|
||||
/* tip-switch transition interrupt enable: */
|
||||
#define SW_SAME 0000 /* no change */
|
||||
#define SW_DIS 0010 /* tip-switch interrupt disabled */
|
||||
#define SW_ENA 0014 /* tip-switch hit interrupt enabled */
|
||||
|
||||
/* load name register (VS60): */
|
||||
#define LNR(name) \
|
||||
0150000 | (name)
|
||||
|
||||
/* set graphic mode: */
|
||||
#define SGM(mode,intens,lp_intr,blink,line_type) \
|
||||
0100000 | mode | intens | lp_intr | blink | line_type
|
||||
/* graphic mode: */
|
||||
#define GM_CHAR 000000 /* character */
|
||||
#define GM_SVECT 004000 /* short vector */
|
||||
#define GM_LVECT 010000 /* long vector */
|
||||
#define GM_APOINT 014000 /* absolute point, or offset */
|
||||
#define GM_GRAPHX 020000 /* graphplot X, or basic long vector */
|
||||
#define GM_GRAPHY 024000 /* graphplot Y, or basic long vector */
|
||||
#define GM_RPOINT 030000 /* relative point */
|
||||
#define GM_BSVECT 034000 /* basic short vector */
|
||||
#define GM_ARC 040000 /* circle/arc */
|
||||
#define GM_AVECT 044000 /* absolute vector */
|
||||
/* intensity: */
|
||||
#define IN_SAME 00000 /* no change */
|
||||
#define IN_0 02000 /* intensity level 0 (dimmest) */
|
||||
#define IN_1 02200 /* intensity level 1 */
|
||||
#define IN_2 02400 /* intensity level 2 */
|
||||
#define IN_3 02600 /* intensity level 3 */
|
||||
#define IN_4 03000 /* intensity level 4 */
|
||||
#define IN_5 03200 /* intensity level 5 */
|
||||
#define IN_6 03400 /* intensity level 6 */
|
||||
#define IN_7 03600 /* intensity level 7 (brightest) */
|
||||
/* light pen interrupt: */
|
||||
#define LP_SAME 0000 /* no change */
|
||||
#define LP_DIS 0100 /* light-pen hit interrupt disabled */
|
||||
#define LP_ENA 0140 /* light-pen hit interrupt enabled */
|
||||
/* blink: */
|
||||
#define BL_SAME 000 /* no change */
|
||||
#define BL_OFF 020 /* blink off */
|
||||
#define BL_ON 030 /* blink on */
|
||||
/* line type: */
|
||||
#define LT_SAME 00 /* no change */
|
||||
#define LT_SOLID 04 /* solid */
|
||||
#define LT_LDASH 05 /* long dash */
|
||||
#define LT_SDASH 06 /* short dash */
|
||||
#define LT_DDASH 07 /* dot dash */
|
||||
|
||||
/* display jump absolute: */
|
||||
#define DJMP_ABS(addr) \
|
||||
0160000, \
|
||||
(addr) & ~1
|
||||
|
||||
/* display jump relative (VS60): */
|
||||
#define DJMP_REL(raddr) \
|
||||
0161000 | (SGN_(raddr) << 8) | MAG_(raddr)
|
||||
|
||||
/* display jump to subroutine absolute (VS60): */
|
||||
#define DJSR_ABS(addr) \
|
||||
0162000, \
|
||||
(addr) & ~1
|
||||
|
||||
/* display jump to subroutine relative (VS60): */
|
||||
#define DJSR_REL(raddr) \
|
||||
0163000 | (SGN_(raddr) << 8) | MAG_(raddr)
|
||||
|
||||
/* display no-op: */
|
||||
#define DNOP \
|
||||
0164000
|
||||
|
||||
/* display pop, no restore (VS60): */
|
||||
#define DPOP_NR \
|
||||
0165000
|
||||
|
||||
/* display pop, restore (VS60): */
|
||||
#define DPOP_R \
|
||||
0165000
|
||||
|
||||
/* display stop: */
|
||||
#define DSTOP LSRA(ST_STOP,SI_SAME,LI_SAME,IT_SAME,RF_UNSYNC,MN_SAME)
|
||||
|
||||
/* graphic data: */
|
||||
|
||||
/* intensify enable (common to all modes exept CHAR and OFFSET): */
|
||||
#define I_OFF 000000 /* beam off */
|
||||
#define I_ON 040000 /* beam on */
|
||||
|
||||
/* Note: when VS60 "file Z data" is enabled,
|
||||
use the *3() macros instead of the corresponding normal ones. */
|
||||
|
||||
/* character data: */
|
||||
#define CHAR(c1,c2) \
|
||||
((c2) << 8) | (c1) /* 7-bit ASCII assumed */
|
||||
|
||||
/* short vector data: */
|
||||
#define SVECT(i,dx,dy) \
|
||||
i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy)
|
||||
#define SVECT3(i,dx,dy,dz) \
|
||||
i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy), \
|
||||
(SGN_(dz) << 13) | (MAG_(dz) << 2)
|
||||
|
||||
/* long vector data: */
|
||||
#define LVECT(i,dx,dy) \
|
||||
i | (SGN_(dx) << 13) | MAG_(dx), \
|
||||
(SGN_(dy) << 13) | MAG_(dy)
|
||||
#define LVECT3(i,dx,dy,dz) \
|
||||
i | (SGN_(dx) << 13) | MAG_(dx), \
|
||||
(SGN_(dy) << 13) | MAG_(dy), \
|
||||
(SGN_(dz) << 13) | (MAG_(dz) << 2)
|
||||
|
||||
/* rotation data (VS60, probably unimplemented): */
|
||||
#define ROTATE(i,a,b) \
|
||||
i | (SGN_(a) << 13) | 010000 | MAG_(a), \
|
||||
(SGN_(b) << 13) | MAG_(b)
|
||||
#define ROTATE3(i,a,b,c) \
|
||||
i | (SGN_(a) << 13) | 010000 | MAG_(a), \
|
||||
(SGN_(b) << 13) | MAG_(b), \
|
||||
(SGN_(c) << 13) | (MAG_(c) << 2)
|
||||
|
||||
/* absolute point data: */
|
||||
#define APOINT(i,x,y) \
|
||||
i | (SGN_(x) << 13) | MAG_(x), \
|
||||
(SGN_(y) << 13) | MAG_(y)
|
||||
#define APOINT3(i,x,y,z) \
|
||||
i | (SGN_(x) << 13) | MAG_(x), \
|
||||
(SGN_(y) << 13) | MAG_(y), \
|
||||
(SGN_(z) << 13) | (MAG_(z) << 2)
|
||||
|
||||
/* offset data (VS60): */
|
||||
#define OFFSET(x,y) \
|
||||
(SGN_(x) << 13) | 010000 | MAG_(x), \
|
||||
(SGN_(y) << 13) | 010000 | MAG_(y)
|
||||
#define OFFSET3(x,y,z) \
|
||||
(SGN_(x) << 13) | 010000 | MAG_(x), \
|
||||
(SGN_(y) << 13) | 010000 | MAG_(y), \
|
||||
(SGN_(z) << 13) | 010000 | (MAG_(z) << 2)
|
||||
|
||||
/* graphplot X data: */
|
||||
#define GRAPHX(i,x) \
|
||||
i | (x)
|
||||
|
||||
/* graphplot Y data: */
|
||||
#define GRAPHY(i,y) \
|
||||
i | (y)
|
||||
|
||||
/* basic long vector data (VS60): */
|
||||
#define BLVECT(i,dir,len) \
|
||||
i | ((dir) << 11) | 02000 | (len)
|
||||
|
||||
/* relative point data: */
|
||||
#define RPOINT(i,dx,dy) \
|
||||
i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy)
|
||||
#define RPOINT3(i,dx,dy,dz) \
|
||||
i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy), \
|
||||
(SGN_(dz) << 13) | (MAG_(dz) << 2)
|
||||
|
||||
/* basic short vector data (VS60): */
|
||||
#define BSVECT(i,dir1,len1,dir2,len2) \
|
||||
i | ((dir2) << 11) | ((len2) << 7) | ((dir1) << 4) | (len1)
|
||||
|
||||
/* circle/arc data (VS60, option): */
|
||||
#define ARC(i,dcx,dcy,dex,dey) \
|
||||
i | (SGN_(dcx) << 13) | MAG_(dcx), \
|
||||
(SGN_(dcy) << 13) | MAG_(dcy), \
|
||||
(SGN_(dex) << 13) | MAG_(dex), \
|
||||
(SGN_(dey) << 13) | MAG_(dey)
|
||||
#define ARC3(i,dcx,dcy,cz,dex,dey,ez) \
|
||||
i | (SGN_(dcx) << 13) | MAG_(dcx), \
|
||||
(SGN_(dcy) << 13) | MAG_(dcy), \
|
||||
(SGN_(cz) << 13) | (MAG_(cz) << 2), \
|
||||
(SGN_(dex) << 13) | MAG_(dex), \
|
||||
(SGN_(dey) << 13) | MAG_(dey), \
|
||||
(SGN_(ez) << 13) | (MAG_(ez) << 2)
|
||||
|
||||
/* absolute vector data (VS60): */
|
||||
#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)
|
||||
/*
|
||||
* $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)
|
||||
* for standalone use of vt11.c (not embedded in PDP-11 simulator)
|
||||
* Douglas A. Gwyn <gwyn@arl.army.mil>
|
||||
* September 03, 2004
|
||||
*
|
||||
* XXX -- assumes ASCII host character set
|
||||
*/
|
||||
|
||||
/* helper macros (not for use outside this header): */
|
||||
#define SGN_(x) ((x) < 0)
|
||||
#define MAG_(x) ((x) >= 0 ? (x) : -(x)) /* -0 not expressible directly in C */
|
||||
#if 0 /* manual seems to say this; wrong! */
|
||||
#define JDL_(x) ((SGN_(raddr) << 8) | MAG_(raddr))
|
||||
#else /* sign extend, 9-bit twos complement */
|
||||
#define JDL_(x) ((x) >= 0 ? (x) : ((~(unsigned)-(x))+1) & 0777)
|
||||
#endif
|
||||
|
||||
/* control instructions: */
|
||||
|
||||
/* load status register A: */
|
||||
#define LSRA(stop,stop_intr,lp_hit_chg,ital,refresh,menu) \
|
||||
0170000 | stop | stop_intr | lp_hit_chg | ital | refresh | menu
|
||||
/* display stop: */
|
||||
#define ST_SAME 00000 /* don't stop display */
|
||||
#define ST_STOP 02000 /* stop display */
|
||||
/* stop interrupt: */
|
||||
#define SI_SAME 00000 /* no change */
|
||||
#define SI_INHIBIT 01000 /* inhibit interrupt on stop */
|
||||
#define SI_GENERATE 01400 /* generate interrupt on stop */
|
||||
/* light pen hit intensify (bright-down on VS60): */
|
||||
#define LI_SAME 0000 /* no change */
|
||||
#define LI_INTENSIFY 0200 /* enable intensify on hit (VT11) */
|
||||
#define LI_BRIGHTDOWN 0200 /* enable bright down on hit (VS60) */
|
||||
#define LI_NOINTENSIFY 0300 /* inhibit intensify on hit (VT11) */
|
||||
#define LI_NOBRIGHTDOWN 0300 /* inhibit bright down on hit (VS60) */
|
||||
/* italic font: */
|
||||
#define IT_SAME 000 /* no change */
|
||||
#define IT_NORMAL 040 /* normal font */
|
||||
#define IT_ITALIC 060 /* italic font */
|
||||
/* refresh rate: */
|
||||
#define RF_UNSYNC 000 /* unsynchronized */
|
||||
#define RF_SAME 000 /* (happens to work like that) */
|
||||
#define RF_LINE 004 /* sync with line (VT11) */
|
||||
#define RF_30 004 /* 30 frames/sec (VS60) */
|
||||
#define RF_40 010 /* 40 frames/sec (VS60) */
|
||||
#define RF_EXT 014 /* external sync (VS60) */
|
||||
/* menu/main area (VS60): */
|
||||
#define MN_SAME 0 /* no change */
|
||||
#define MN_MAIN 2 /* major screen area */
|
||||
#define MN_MENU 3 /* menu area */
|
||||
|
||||
/* load status register B: */
|
||||
#define LSRB(color,set_step,step) \
|
||||
0174000 | color | set_step | (step)
|
||||
/* color select (VS60): */
|
||||
#define CL_SAME 00000 /* no change */
|
||||
#define CL_GREEN 01000 /* green */
|
||||
#define CL_YELLOW 01200 /* yellow */
|
||||
#define CL_ORANGE 01400 /* orange */
|
||||
#define CL_RED 01600 /* red */
|
||||
/* graphplot increment register change enable: */
|
||||
#define SS_SAME 0000 /* no change (step value ignored) */
|
||||
#define SS_CHANGE 0100 /* write step value into register */
|
||||
|
||||
/* load status register BB (VS60): */
|
||||
#define LSRBB(z_data,edge_intr,depth_cue,char_esc) \
|
||||
0176000 | z_data | edge_intr | depth_cue | char_esc
|
||||
/* file Z data: */
|
||||
#define ZD_SAME 000 /* no change */
|
||||
#define ZD_NO 010 /* d.file does not contain Z coords. */
|
||||
#define ZD_YES 014 /* d.file contains Z coordinates */
|
||||
/* edge interrupts enable: */
|
||||
#define ED_SAME 000 /* no change */
|
||||
#define ED_DIS 040 /* disable intr. on edge transition */
|
||||
#define ED_ENA 060 /* enable intr. on edge transition */
|
||||
/* depth cue processing: */
|
||||
#define DQ_SAME 0000 /* no change */
|
||||
#define DQ_OFF 0200 /* disable depth cueing (Z intensity) */
|
||||
#define DQ_ON 0300 /* enable depth cueing (Z intensity) */
|
||||
/* escape on terminating character: */
|
||||
#define ES_SAME 0 /* no change */
|
||||
#define ES_NO 2 /* disable POPR on terminating char. */
|
||||
#define ES_YES 3 /* enable POPR on terminating char. */
|
||||
|
||||
/* load status register C (VS60): */
|
||||
#define LSRC(rotate,cs_change,cscale,vs_change,vscale) \
|
||||
0154000 | rotate | cs_change | ((cscale)<<5) | \
|
||||
vs_change | (vscale)
|
||||
/* character rotation: */
|
||||
#define RO_SAME 00000 /* no change */
|
||||
#define RO_HORIZONTAL 01000 /* no text rotation */
|
||||
#define RO_VERTICAL 01400 /* rotate text 90 degrees CCW */
|
||||
/* character scale change enable: */
|
||||
#define CS_SAME 0000 /* no change (cscale value ignored) */
|
||||
#define CS_CHANGE 0200 /* set character scale */
|
||||
/* vector scale change enable: */
|
||||
#define VS_SAME 000 /* no change (vscale value ignored) */
|
||||
#define VS_CHANGE 020 /* set vector scale */
|
||||
|
||||
/* load scope selection register (VS60): */
|
||||
#define LSSR(console,disp,lp_intr,sw_intr) \
|
||||
0164000 | console | disp | lp_intr | sw_intr
|
||||
/* console to which this instruction applies: */
|
||||
#define CN_0 0000 /* console # 0 */
|
||||
#define CN_1 0400 /* console # 1 */
|
||||
/* display enable: */
|
||||
#define DS_SAME 0000 /* no change */
|
||||
#define DS_DIS 0200 /* disable display (blank CRT) */
|
||||
#define DS_ENA 0300 /* enable display (use CRT) */
|
||||
/* light-pen hit interrupt enable: */
|
||||
#define LH_SAME 0000 /* no change */
|
||||
#define LH_DIS 0040 /* light-pen hit interrupt disabled */
|
||||
#define LH_ENA 0060 /* light-pen hit interrupt enabled */
|
||||
/* tip-switch transition interrupt enable: */
|
||||
#define SW_SAME 0000 /* no change */
|
||||
#define SW_DIS 0010 /* tip-switch interrupt disabled */
|
||||
#define SW_ENA 0014 /* tip-switch hit interrupt enabled */
|
||||
|
||||
/* load name register (VS60): */
|
||||
#define LNR(name) \
|
||||
0150000 | (name)
|
||||
|
||||
/* set graphic mode: */
|
||||
#define SGM(mode,intens,lp_intr,blink,line_type) \
|
||||
0100000 | mode | intens | lp_intr | blink | line_type
|
||||
/* graphic mode: */
|
||||
#define GM_CHAR 000000 /* character */
|
||||
#define GM_SVECT 004000 /* short vector */
|
||||
#define GM_LVECT 010000 /* long vector */
|
||||
#define GM_APOINT 014000 /* absolute point, or offset */
|
||||
#define GM_GRAPHX 020000 /* graphplot X, or basic long vector */
|
||||
#define GM_GRAPHY 024000 /* graphplot Y, or basic long vector */
|
||||
#define GM_RPOINT 030000 /* relative point */
|
||||
#define GM_BSVECT 034000 /* basic short vector */
|
||||
#define GM_ARC 040000 /* circle/arc */
|
||||
#define GM_AVECT 044000 /* absolute vector */
|
||||
/* intensity: */
|
||||
#define IN_SAME 00000 /* no change */
|
||||
#define IN_0 02000 /* intensity level 0 (dimmest) */
|
||||
#define IN_1 02200 /* intensity level 1 */
|
||||
#define IN_2 02400 /* intensity level 2 */
|
||||
#define IN_3 02600 /* intensity level 3 */
|
||||
#define IN_4 03000 /* intensity level 4 */
|
||||
#define IN_5 03200 /* intensity level 5 */
|
||||
#define IN_6 03400 /* intensity level 6 */
|
||||
#define IN_7 03600 /* intensity level 7 (brightest) */
|
||||
/* light pen interrupt: */
|
||||
#define LP_SAME 0000 /* no change */
|
||||
#define LP_DIS 0100 /* light-pen hit interrupt disabled */
|
||||
#define LP_ENA 0140 /* light-pen hit interrupt enabled */
|
||||
/* blink: */
|
||||
#define BL_SAME 000 /* no change */
|
||||
#define BL_OFF 020 /* blink off */
|
||||
#define BL_ON 030 /* blink on */
|
||||
/* line type: */
|
||||
#define LT_SAME 00 /* no change */
|
||||
#define LT_SOLID 04 /* solid */
|
||||
#define LT_LDASH 05 /* long dash */
|
||||
#define LT_SDASH 06 /* short dash */
|
||||
#define LT_DDASH 07 /* dot dash */
|
||||
|
||||
/* display jump absolute: */
|
||||
#define DJMP_ABS(addr) \
|
||||
0160000, \
|
||||
(addr) & ~1
|
||||
|
||||
/* display jump relative (VS60) [raddr in words]: */
|
||||
#define DJMP_REL(raddr) \
|
||||
0161000 | JDL_(raddr)
|
||||
|
||||
/* display jump to subroutine absolute (VS60): */
|
||||
#define DJSR_ABS(addr) \
|
||||
0162000, \
|
||||
(addr) & ~1
|
||||
|
||||
/* display jump to subroutine relative (VS60) [raddr in words]: */
|
||||
#define DJSR_REL(raddr) \
|
||||
0163000 | JDL_(raddr)
|
||||
|
||||
/* display no-op: */
|
||||
#define DNOP \
|
||||
0164000
|
||||
|
||||
/* display pop, no restore (VS60): */
|
||||
#define DPOP_NR \
|
||||
0165000
|
||||
|
||||
/* display pop, restore (VS60): */
|
||||
#define DPOP_R \
|
||||
0165000
|
||||
|
||||
/* display stop: */
|
||||
#define DSTOP LSRA(ST_STOP,SI_SAME,LI_SAME,IT_SAME,RF_UNSYNC,MN_SAME)
|
||||
|
||||
/* graphic data: */
|
||||
|
||||
/* intensify enable (common to all modes exept CHAR and OFFSET): */
|
||||
#define I_OFF 000000 /* beam off */
|
||||
#define I_ON 040000 /* beam on */
|
||||
|
||||
/* Note: when VS60 "file Z data" is enabled,
|
||||
use the *3() macros instead of the corresponding normal ones. */
|
||||
|
||||
/* character data: */
|
||||
#define CHAR(c1,c2) \
|
||||
((c2) << 8) | (c1) /* 7-bit ASCII assumed */
|
||||
|
||||
/* short vector data: */
|
||||
#define SVECT(i,dx,dy) \
|
||||
i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy)
|
||||
#define SVECT3(i,dx,dy,dz) \
|
||||
i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy), \
|
||||
(SGN_(dz) << 13) | (MAG_(dz) << 2)
|
||||
|
||||
/* long vector data: */
|
||||
#define LVECT(i,dx,dy) \
|
||||
i | (SGN_(dx) << 13) | MAG_(dx), \
|
||||
(SGN_(dy) << 13) | MAG_(dy)
|
||||
#define LVECT3(i,dx,dy,dz) \
|
||||
i | (SGN_(dx) << 13) | MAG_(dx), \
|
||||
(SGN_(dy) << 13) | MAG_(dy), \
|
||||
(SGN_(dz) << 13) | (MAG_(dz) << 2)
|
||||
|
||||
/* rotation data (VS60, probably unimplemented): */
|
||||
#define ROTATE(i,a,b) \
|
||||
i | (SGN_(a) << 13) | 010000 | MAG_(a), \
|
||||
(SGN_(b) << 13) | MAG_(b)
|
||||
#define ROTATE3(i,a,b,c) \
|
||||
i | (SGN_(a) << 13) | 010000 | MAG_(a), \
|
||||
(SGN_(b) << 13) | MAG_(b), \
|
||||
(SGN_(c) << 13) | (MAG_(c) << 2)
|
||||
|
||||
/* absolute point data: */
|
||||
#define APOINT(i,x,y) \
|
||||
i | (SGN_(x) << 13) | MAG_(x), \
|
||||
(SGN_(y) << 13) | MAG_(y)
|
||||
#define APOINT3(i,x,y,z) \
|
||||
i | (SGN_(x) << 13) | MAG_(x), \
|
||||
(SGN_(y) << 13) | MAG_(y), \
|
||||
(SGN_(z) << 13) | (MAG_(z) << 2)
|
||||
|
||||
/* offset data (VS60): */
|
||||
#define OFFSET(x,y) \
|
||||
(SGN_(x) << 13) | 010000 | MAG_(x), \
|
||||
(SGN_(y) << 13) | 010000 | MAG_(y)
|
||||
#define OFFSET3(x,y,z) \
|
||||
(SGN_(x) << 13) | 010000 | MAG_(x), \
|
||||
(SGN_(y) << 13) | 010000 | MAG_(y), \
|
||||
(SGN_(z) << 13) | 010000 | (MAG_(z) << 2)
|
||||
|
||||
/* graphplot X data: */
|
||||
#define GRAPHX(i,x) \
|
||||
i | (x)
|
||||
|
||||
/* graphplot Y data: */
|
||||
#define GRAPHY(i,y) \
|
||||
i | (y)
|
||||
|
||||
/* basic long vector data (VS60): */
|
||||
#define BLVECT(i,dir,len) \
|
||||
i | ((dir) << 11) | 02000 | (len)
|
||||
|
||||
/* relative point data: */
|
||||
#define RPOINT(i,dx,dy) \
|
||||
i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy)
|
||||
#define RPOINT3(i,dx,dy,dz) \
|
||||
i | (SGN_(dx) << 13) | (MAG_(dx) << 7) | (SGN_(dy) << 6) | MAG_(dy), \
|
||||
(SGN_(dz) << 13) | (MAG_(dz) << 2)
|
||||
|
||||
/* basic short vector data (VS60): */
|
||||
#define BSVECT(i,dir1,len1,dir2,len2) \
|
||||
i | ((dir2) << 11) | ((len2) << 7) | ((dir1) << 4) | (len1)
|
||||
|
||||
/* circle/arc data (VS60, option): */
|
||||
#define ARC(i,dcx,dcy,dex,dey) \
|
||||
i | (SGN_(dcx) << 13) | MAG_(dcx), \
|
||||
(SGN_(dcy) << 13) | MAG_(dcy), \
|
||||
(SGN_(dex) << 13) | MAG_(dex), \
|
||||
(SGN_(dey) << 13) | MAG_(dey)
|
||||
#define ARC3(i,dcx,dcy,cz,dex,dey,ez) \
|
||||
i | (SGN_(dcx) << 13) | MAG_(dcx), \
|
||||
(SGN_(dcy) << 13) | MAG_(dcy), \
|
||||
(SGN_(cz) << 13) | (MAG_(cz) << 2), \
|
||||
(SGN_(dex) << 13) | MAG_(dex), \
|
||||
(SGN_(dey) << 13) | MAG_(dey), \
|
||||
(SGN_(ez) << 13) | (MAG_(ez) << 2)
|
||||
|
||||
/* absolute vector data (VS60): */
|
||||
#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)
|
||||
|
|
2766
display/vttest.c
2766
display/vttest.c
File diff suppressed because it is too large
Load diff
836
display/win32.c
836
display/win32.c
|
@ -1,418 +1,418 @@
|
|||
/*
|
||||
* $Id: win32.c,v 1.38 2004/02/07 06:32:01 phil Exp $
|
||||
* Win32 support for XY display simulator
|
||||
* Phil Budne <phil@ultimate.com>
|
||||
* September 2003
|
||||
* Revised by Douglas A. Gwyn, 05 Feb. 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.
|
||||
*/
|
||||
|
||||
/* use a thread to handle windows messages; */
|
||||
#define THREADS
|
||||
|
||||
/*
|
||||
* BUGS:
|
||||
* Does not allow you to close display window;
|
||||
* would need to tear down both system, and system independent data.
|
||||
*
|
||||
* now tries to handle PAINT message, as yet untested!!
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "ws.h"
|
||||
#include "display.h"
|
||||
|
||||
#ifndef PIX_SIZE
|
||||
#define PIX_SIZE 1
|
||||
#endif
|
||||
|
||||
#define APP_CLASS "XYAppClass"
|
||||
#define APP_MENU "XYAppMenu" /* ?? */
|
||||
|
||||
/*
|
||||
* light pen location
|
||||
* see ws.h for full description
|
||||
*/
|
||||
int ws_lp_x = -1;
|
||||
int ws_lp_y = -1;
|
||||
|
||||
static HWND static_wh;
|
||||
static HINSTANCE static_inst;
|
||||
static int xpixels, ypixels;
|
||||
static char *window_name;
|
||||
static HBRUSH white_brush;
|
||||
static HBRUSH black_brush;
|
||||
#ifdef SWITCH_CURSORS
|
||||
static HCURSOR cross, arrow;
|
||||
#endif
|
||||
|
||||
static __inline int
|
||||
map_key(int k)
|
||||
{
|
||||
switch (k) {
|
||||
case 186: return ';'; /* VK_OEM_1? */
|
||||
case 222: return '\''; /* VK_OEM_7? */
|
||||
}
|
||||
return k;
|
||||
}
|
||||
|
||||
static void
|
||||
keydown(int k)
|
||||
{
|
||||
display_keydown(map_key(k));
|
||||
}
|
||||
|
||||
static void
|
||||
keyup(int k)
|
||||
{
|
||||
display_keyup(map_key(k));
|
||||
}
|
||||
|
||||
/*
|
||||
* here on any button click, or if mouse dragged while a button down
|
||||
*/
|
||||
static void
|
||||
mousepos(DWORD lp)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
x = LOWORD(lp);
|
||||
y = HIWORD(lp);
|
||||
|
||||
/* convert to display coordinates */
|
||||
#if PIX_SIZE > 1
|
||||
x /= PIX_SIZE;
|
||||
y /= PIX_SIZE;
|
||||
#endif
|
||||
y = ypixels - 1 - y;
|
||||
|
||||
/* if window has been stretched, can get out of range bits!! */
|
||||
if (x >= 0 && x < xpixels && y >= 0 && y < ypixels) {
|
||||
/* checked by display_add_point() */
|
||||
ws_lp_x = x;
|
||||
ws_lp_y = y;
|
||||
}
|
||||
}
|
||||
|
||||
/* thoingggg!! "message for you sir!!!" */
|
||||
static LRESULT CALLBACK
|
||||
patsy(HWND wh, UINT msg, WPARAM wp, LPARAM lp) /* "WndProc" */
|
||||
{
|
||||
/* printf("msg %d\n", msg); */
|
||||
switch (msg) {
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
if (wp & (MK_LBUTTON|MK_MBUTTON|MK_RBUTTON)) {
|
||||
#ifdef SWITCH_CURSORS
|
||||
if (ws_lp_x == -1 && !display_tablet)
|
||||
SetCursor(cross);
|
||||
#endif
|
||||
mousepos(lp);
|
||||
}
|
||||
#ifdef SWITCH_CURSORS
|
||||
else if (ws_lp_x != -1 && !display_tablet)
|
||||
SetCursor(arrow);
|
||||
#endif
|
||||
break; /* return?? */
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
display_lp_sw = 1;
|
||||
case WM_MBUTTONDOWN:
|
||||
case WM_RBUTTONDOWN:
|
||||
#ifdef SWITCH_CURSORS
|
||||
if (!display_tablet)
|
||||
SetCursor(cross);
|
||||
#endif
|
||||
mousepos(lp);
|
||||
break; /* return?? */
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
display_lp_sw = 0;
|
||||
case WM_MBUTTONUP:
|
||||
case WM_RBUTTONUP:
|
||||
#ifdef SWITCH_CURSORS
|
||||
if (!display_tablet)
|
||||
SetCursor(arrow);
|
||||
#endif
|
||||
ws_lp_x = ws_lp_y = -1;
|
||||
break; /* return?? */
|
||||
|
||||
case WM_KEYDOWN:
|
||||
keydown(wp);
|
||||
break;
|
||||
|
||||
case WM_KEYUP:
|
||||
keyup(wp);
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
display_repaint();
|
||||
break; /* return?? */
|
||||
}
|
||||
return DefWindowProc(wh, msg, wp, lp);
|
||||
}
|
||||
|
||||
int
|
||||
ws_poll(int *valp, int maxus)
|
||||
{
|
||||
#ifdef THREADS
|
||||
/* msgthread handles window events; just delay simulator */
|
||||
if (maxus > 0)
|
||||
Sleep((maxus+999)/1000);
|
||||
#else
|
||||
MSG msg;
|
||||
DWORD start;
|
||||
int maxms = (maxus + 999) / 1000;
|
||||
|
||||
for (start = GetTickCount(); GetTickCount() - start < maxms; Sleep(1)) {
|
||||
/* empty message queue without blocking */
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* called from non-threaded main program */
|
||||
int
|
||||
ws_loop(void (*func)(void *), void *arg)
|
||||
{
|
||||
int val;
|
||||
while (ws_poll(&val, 0))
|
||||
(*func)(arg);
|
||||
return val;
|
||||
}
|
||||
|
||||
/* worker for display init */
|
||||
static void
|
||||
ws_init2(void) {
|
||||
WNDCLASS wc;
|
||||
int h, w;
|
||||
|
||||
#ifdef SWITCH_CURSORS
|
||||
if (!display_tablet) {
|
||||
arrow = LoadCursor(NULL, IDC_ARROW);
|
||||
cross = LoadCursor(NULL, IDC_CROSS);
|
||||
}
|
||||
#endif
|
||||
|
||||
black_brush = GetStockObject(BLACK_BRUSH);
|
||||
white_brush = GetStockObject(WHITE_BRUSH);
|
||||
|
||||
wc.lpszClassName = APP_CLASS;
|
||||
wc.lpfnWndProc = patsy;
|
||||
wc.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
|
||||
/* also CS_NOCLOSE? CS_SAVEBITS? */
|
||||
|
||||
wc.hInstance = static_inst = GetModuleHandleA(0);
|
||||
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||
#ifdef SWITCH_CURSORS
|
||||
wc.hCursor = NULL;
|
||||
#else
|
||||
wc.hCursor = display_tablet ? NULL : LoadCursor(NULL, IDC_CROSS);
|
||||
#endif
|
||||
wc.hbrBackground = black_brush;
|
||||
wc.lpszMenuName = APP_MENU;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
/* WNDCLASSEX/RegisterClassEx include hIconSm (small icon) */
|
||||
RegisterClass(&wc);
|
||||
|
||||
/*
|
||||
* WS_OVERLAPPEDWINDOW=>
|
||||
* WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME,
|
||||
* WS_MINIMIZEBOX, WS_MAXIMIZEBOX
|
||||
*
|
||||
* WS_CHILD (no menu bar), WS_POPUP (mutually exclusive)
|
||||
*/
|
||||
|
||||
/* empirical crocks to get entire screen; */
|
||||
w = (xpixels*PIX_SIZE)+6;
|
||||
h = (ypixels*PIX_SIZE)+32;
|
||||
/* XXX -- above values work with XP; Phil had +10,+30 */
|
||||
|
||||
static_wh = CreateWindow(APP_CLASS, /* registered class name */
|
||||
window_name, /* window name */
|
||||
WS_OVERLAPPED, /* style */
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, /* X,Y */
|
||||
w, h,
|
||||
NULL, /* HWND hWndParent */
|
||||
NULL, /* HMENU hMenu */
|
||||
static_inst, /* application instance */
|
||||
NULL); /* lpParam */
|
||||
|
||||
ShowWindow(static_wh, SW_SHOW);
|
||||
UpdateWindow(static_wh);
|
||||
}
|
||||
|
||||
#ifdef THREADS
|
||||
static volatile int init_done;
|
||||
static DWORD msgthread_id;
|
||||
|
||||
static DWORD WINAPI
|
||||
msgthread(LPVOID arg)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
ws_init2();
|
||||
|
||||
/* XXX use a mutex? */
|
||||
init_done = 1;
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0) > 0) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
return msg.wParam;
|
||||
}
|
||||
|
||||
static void
|
||||
ws_thread_init(void)
|
||||
{
|
||||
HANDLE th = CreateThread(NULL, /* sec. attr. */
|
||||
0, /* stack size */
|
||||
msgthread,
|
||||
NULL, /* param */
|
||||
0, /* flags */
|
||||
&msgthread_id);
|
||||
CloseHandle(th);
|
||||
|
||||
/* XXX use a mutex; don't wait forever!! */
|
||||
while (!init_done)
|
||||
;
|
||||
}
|
||||
#endif /* THREADS */
|
||||
|
||||
/* called from display layer on first display op */
|
||||
int
|
||||
ws_init(char *name, int xp, int yp, int colors)
|
||||
{
|
||||
xpixels = xp;
|
||||
ypixels = yp;
|
||||
window_name = name;
|
||||
|
||||
#ifdef THREADS
|
||||
ws_thread_init();
|
||||
#else
|
||||
ws_init2();
|
||||
#endif
|
||||
return 1; /* XXX return errors!! */
|
||||
}
|
||||
|
||||
void *
|
||||
ws_color_rgb(int r, int g, int b)
|
||||
{
|
||||
/* XXX check for failure??? try GetNearestColor??? */
|
||||
return CreateSolidBrush(RGB(r/256, g/256, b/256));
|
||||
}
|
||||
|
||||
void *
|
||||
ws_color_black(void)
|
||||
{
|
||||
return black_brush;
|
||||
}
|
||||
|
||||
void *
|
||||
ws_color_white(void)
|
||||
{
|
||||
return white_brush;
|
||||
}
|
||||
|
||||
void
|
||||
ws_display_point(int x, int y, void *color)
|
||||
{
|
||||
HDC dc;
|
||||
RECT r;
|
||||
HBRUSH brush = color;
|
||||
|
||||
if (x > xpixels || y > ypixels)
|
||||
return;
|
||||
|
||||
y = ypixels - 1 - y; /* invert y, top left origin */
|
||||
|
||||
/* top left corner */
|
||||
r.left = x*PIX_SIZE;
|
||||
r.top = y*PIX_SIZE;
|
||||
|
||||
/* bottom right corner, non-inclusive */
|
||||
r.right = (x+1)*PIX_SIZE;
|
||||
r.bottom = (y+1)*PIX_SIZE;
|
||||
|
||||
if (brush == NULL)
|
||||
brush = black_brush;
|
||||
|
||||
dc = GetDC(static_wh);
|
||||
FillRect(dc, &r, brush);
|
||||
ReleaseDC(static_wh, dc);
|
||||
}
|
||||
|
||||
void
|
||||
ws_sync(void) {
|
||||
/* noop */
|
||||
}
|
||||
|
||||
void
|
||||
ws_beep(void) {
|
||||
#if 0
|
||||
/* play SystemDefault sound; does not work over terminal service */
|
||||
MessageBeep(MB_OK);
|
||||
#else
|
||||
/* works over terminal service? Plays default sound/beep on Win9x/ME */
|
||||
Beep(440, 500); /* Hz, ms. */
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned long
|
||||
os_elapsed(void)
|
||||
{
|
||||
static int new;
|
||||
unsigned long ret;
|
||||
static DWORD t[2];
|
||||
|
||||
/*
|
||||
* only returns milliseconds, but Sleep()
|
||||
* only takes milliseconds.
|
||||
*
|
||||
* wraps after 49.7 days of uptime.
|
||||
* DWORD is an unsigned long, so this should be OK
|
||||
*/
|
||||
t[new] = GetTickCount();
|
||||
if (t[!new] == 0)
|
||||
ret = ~0L; /* +INF */
|
||||
else
|
||||
ret = (t[new] - t[!new]) * 1000;
|
||||
new = !new; /* Ecclesiastes III */
|
||||
return ret;
|
||||
}
|
||||
/*
|
||||
* $Id: win32.c,v 1.39 2005/01/14 18:58:03 phil Exp $
|
||||
* Win32 support for XY display simulator
|
||||
* Phil Budne <phil@ultimate.com>
|
||||
* September 2003
|
||||
* Revised by Douglas A. Gwyn, 05 Feb. 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.
|
||||
*/
|
||||
|
||||
/* use a thread to handle windows messages; */
|
||||
#define THREADS
|
||||
|
||||
/*
|
||||
* BUGS:
|
||||
* Does not allow you to close display window;
|
||||
* would need to tear down both system, and system independent data.
|
||||
*
|
||||
* now tries to handle PAINT message, as yet untested!!
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "ws.h"
|
||||
#include "xy.h"
|
||||
|
||||
#ifndef PIX_SIZE
|
||||
#define PIX_SIZE 1
|
||||
#endif
|
||||
|
||||
#define APP_CLASS "XYAppClass"
|
||||
#define APP_MENU "XYAppMenu" /* ?? */
|
||||
|
||||
/*
|
||||
* light pen location
|
||||
* see ws.h for full description
|
||||
*/
|
||||
int ws_lp_x = -1;
|
||||
int ws_lp_y = -1;
|
||||
|
||||
static HWND static_wh;
|
||||
static HINSTANCE static_inst;
|
||||
static int xpixels, ypixels;
|
||||
static char *window_name;
|
||||
static HBRUSH white_brush;
|
||||
static HBRUSH black_brush;
|
||||
#ifdef SWITCH_CURSORS
|
||||
static HCURSOR cross, arrow;
|
||||
#endif
|
||||
|
||||
static __inline int
|
||||
map_key(int k)
|
||||
{
|
||||
switch (k) {
|
||||
case 186: return ';'; /* VK_OEM_1? */
|
||||
case 222: return '\''; /* VK_OEM_7? */
|
||||
}
|
||||
return k;
|
||||
}
|
||||
|
||||
static void
|
||||
keydown(int k)
|
||||
{
|
||||
display_keydown(map_key(k));
|
||||
}
|
||||
|
||||
static void
|
||||
keyup(int k)
|
||||
{
|
||||
display_keyup(map_key(k));
|
||||
}
|
||||
|
||||
/*
|
||||
* here on any button click, or if mouse dragged while a button down
|
||||
*/
|
||||
static void
|
||||
mousepos(DWORD lp)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
x = LOWORD(lp);
|
||||
y = HIWORD(lp);
|
||||
|
||||
/* convert to display coordinates */
|
||||
#if PIX_SIZE > 1
|
||||
x /= PIX_SIZE;
|
||||
y /= PIX_SIZE;
|
||||
#endif
|
||||
y = ypixels - 1 - y;
|
||||
|
||||
/* if window has been stretched, can get out of range bits!! */
|
||||
if (x >= 0 && x < xpixels && y >= 0 && y < ypixels) {
|
||||
/* checked by display_add_point() */
|
||||
ws_lp_x = x;
|
||||
ws_lp_y = y;
|
||||
}
|
||||
}
|
||||
|
||||
/* thoingggg!! "message for you sir!!!" */
|
||||
static LRESULT CALLBACK
|
||||
patsy(HWND wh, UINT msg, WPARAM wp, LPARAM lp) /* "WndProc" */
|
||||
{
|
||||
/* printf("msg %d\n", msg); */
|
||||
switch (msg) {
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
if (wp & (MK_LBUTTON|MK_MBUTTON|MK_RBUTTON)) {
|
||||
#ifdef SWITCH_CURSORS
|
||||
if (ws_lp_x == -1 && !display_tablet)
|
||||
SetCursor(cross);
|
||||
#endif
|
||||
mousepos(lp);
|
||||
}
|
||||
#ifdef SWITCH_CURSORS
|
||||
else if (ws_lp_x != -1 && !display_tablet)
|
||||
SetCursor(arrow);
|
||||
#endif
|
||||
break; /* return?? */
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
display_lp_sw = 1;
|
||||
case WM_MBUTTONDOWN:
|
||||
case WM_RBUTTONDOWN:
|
||||
#ifdef SWITCH_CURSORS
|
||||
if (!display_tablet)
|
||||
SetCursor(cross);
|
||||
#endif
|
||||
mousepos(lp);
|
||||
break; /* return?? */
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
display_lp_sw = 0;
|
||||
case WM_MBUTTONUP:
|
||||
case WM_RBUTTONUP:
|
||||
#ifdef SWITCH_CURSORS
|
||||
if (!display_tablet)
|
||||
SetCursor(arrow);
|
||||
#endif
|
||||
ws_lp_x = ws_lp_y = -1;
|
||||
break; /* return?? */
|
||||
|
||||
case WM_KEYDOWN:
|
||||
keydown(wp);
|
||||
break;
|
||||
|
||||
case WM_KEYUP:
|
||||
keyup(wp);
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
display_repaint();
|
||||
break; /* return?? */
|
||||
}
|
||||
return DefWindowProc(wh, msg, wp, lp);
|
||||
}
|
||||
|
||||
int
|
||||
ws_poll(int *valp, int maxus)
|
||||
{
|
||||
#ifdef THREADS
|
||||
/* msgthread handles window events; just delay simulator */
|
||||
if (maxus > 0)
|
||||
Sleep((maxus+999)/1000);
|
||||
#else
|
||||
MSG msg;
|
||||
DWORD start;
|
||||
int maxms = (maxus + 999) / 1000;
|
||||
|
||||
for (start = GetTickCount(); GetTickCount() - start < maxms; Sleep(1)) {
|
||||
/* empty message queue without blocking */
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* called from non-threaded main program */
|
||||
int
|
||||
ws_loop(void (*func)(void *), void *arg)
|
||||
{
|
||||
int val;
|
||||
while (ws_poll(&val, 0))
|
||||
(*func)(arg);
|
||||
return val;
|
||||
}
|
||||
|
||||
/* worker for display init */
|
||||
static void
|
||||
ws_init2(void) {
|
||||
WNDCLASS wc;
|
||||
int h, w;
|
||||
|
||||
#ifdef SWITCH_CURSORS
|
||||
if (!display_tablet) {
|
||||
arrow = LoadCursor(NULL, IDC_ARROW);
|
||||
cross = LoadCursor(NULL, IDC_CROSS);
|
||||
}
|
||||
#endif
|
||||
|
||||
black_brush = GetStockObject(BLACK_BRUSH);
|
||||
white_brush = GetStockObject(WHITE_BRUSH);
|
||||
|
||||
wc.lpszClassName = APP_CLASS;
|
||||
wc.lpfnWndProc = patsy;
|
||||
wc.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
|
||||
/* also CS_NOCLOSE? CS_SAVEBITS? */
|
||||
|
||||
wc.hInstance = static_inst = GetModuleHandleA(0);
|
||||
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||
#ifdef SWITCH_CURSORS
|
||||
wc.hCursor = NULL;
|
||||
#else
|
||||
wc.hCursor = display_tablet ? NULL : LoadCursor(NULL, IDC_CROSS);
|
||||
#endif
|
||||
wc.hbrBackground = black_brush;
|
||||
wc.lpszMenuName = APP_MENU;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
/* WNDCLASSEX/RegisterClassEx include hIconSm (small icon) */
|
||||
RegisterClass(&wc);
|
||||
|
||||
/*
|
||||
* WS_OVERLAPPEDWINDOW=>
|
||||
* WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME,
|
||||
* WS_MINIMIZEBOX, WS_MAXIMIZEBOX
|
||||
*
|
||||
* WS_CHILD (no menu bar), WS_POPUP (mutually exclusive)
|
||||
*/
|
||||
|
||||
/* empirical crocks to get entire screen; */
|
||||
w = (xpixels*PIX_SIZE)+6;
|
||||
h = (ypixels*PIX_SIZE)+32;
|
||||
/* XXX -- above values work with XP; Phil had +10,+30 */
|
||||
|
||||
static_wh = CreateWindow(APP_CLASS, /* registered class name */
|
||||
window_name, /* window name */
|
||||
WS_OVERLAPPED, /* style */
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, /* X,Y */
|
||||
w, h,
|
||||
NULL, /* HWND hWndParent */
|
||||
NULL, /* HMENU hMenu */
|
||||
static_inst, /* application instance */
|
||||
NULL); /* lpParam */
|
||||
|
||||
ShowWindow(static_wh, SW_SHOW);
|
||||
UpdateWindow(static_wh);
|
||||
}
|
||||
|
||||
#ifdef THREADS
|
||||
static volatile int init_done;
|
||||
static DWORD msgthread_id;
|
||||
|
||||
static DWORD WINAPI
|
||||
msgthread(LPVOID arg)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
ws_init2();
|
||||
|
||||
/* XXX use a mutex? */
|
||||
init_done = 1;
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0) > 0) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
return msg.wParam;
|
||||
}
|
||||
|
||||
static void
|
||||
ws_thread_init(void)
|
||||
{
|
||||
HANDLE th = CreateThread(NULL, /* sec. attr. */
|
||||
0, /* stack size */
|
||||
msgthread,
|
||||
NULL, /* param */
|
||||
0, /* flags */
|
||||
&msgthread_id);
|
||||
CloseHandle(th);
|
||||
|
||||
/* XXX use a mutex; don't wait forever!! */
|
||||
while (!init_done)
|
||||
Sleep(200);
|
||||
}
|
||||
#endif /* THREADS */
|
||||
|
||||
/* called from display layer on first display op */
|
||||
int
|
||||
ws_init(char *name, int xp, int yp, int colors)
|
||||
{
|
||||
xpixels = xp;
|
||||
ypixels = yp;
|
||||
window_name = name;
|
||||
|
||||
#ifdef THREADS
|
||||
ws_thread_init();
|
||||
#else
|
||||
ws_init2();
|
||||
#endif
|
||||
return 1; /* XXX return errors!! */
|
||||
}
|
||||
|
||||
void *
|
||||
ws_color_rgb(int r, int g, int b)
|
||||
{
|
||||
/* XXX check for failure??? try GetNearestColor??? */
|
||||
return CreateSolidBrush(RGB(r/256, g/256, b/256));
|
||||
}
|
||||
|
||||
void *
|
||||
ws_color_black(void)
|
||||
{
|
||||
return black_brush;
|
||||
}
|
||||
|
||||
void *
|
||||
ws_color_white(void)
|
||||
{
|
||||
return white_brush;
|
||||
}
|
||||
|
||||
void
|
||||
ws_display_point(int x, int y, void *color)
|
||||
{
|
||||
HDC dc;
|
||||
RECT r;
|
||||
HBRUSH brush = color;
|
||||
|
||||
if (x > xpixels || y > ypixels)
|
||||
return;
|
||||
|
||||
y = ypixels - 1 - y; /* invert y, top left origin */
|
||||
|
||||
/* top left corner */
|
||||
r.left = x*PIX_SIZE;
|
||||
r.top = y*PIX_SIZE;
|
||||
|
||||
/* bottom right corner, non-inclusive */
|
||||
r.right = (x+1)*PIX_SIZE;
|
||||
r.bottom = (y+1)*PIX_SIZE;
|
||||
|
||||
if (brush == NULL)
|
||||
brush = black_brush;
|
||||
|
||||
dc = GetDC(static_wh);
|
||||
FillRect(dc, &r, brush);
|
||||
ReleaseDC(static_wh, dc);
|
||||
}
|
||||
|
||||
void
|
||||
ws_sync(void) {
|
||||
/* noop */
|
||||
}
|
||||
|
||||
void
|
||||
ws_beep(void) {
|
||||
#if 0
|
||||
/* play SystemDefault sound; does not work over terminal service */
|
||||
MessageBeep(MB_OK);
|
||||
#else
|
||||
/* works over terminal service? Plays default sound/beep on Win9x/ME */
|
||||
Beep(440, 500); /* Hz, ms. */
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned long
|
||||
os_elapsed(void)
|
||||
{
|
||||
static int new;
|
||||
unsigned long ret;
|
||||
static DWORD t[2];
|
||||
|
||||
/*
|
||||
* only returns milliseconds, but Sleep()
|
||||
* only takes milliseconds.
|
||||
*
|
||||
* wraps after 49.7 days of uptime.
|
||||
* DWORD is an unsigned long, so this should be OK
|
||||
*/
|
||||
t[new] = GetTickCount();
|
||||
if (t[!new] == 0)
|
||||
ret = ~0L; /* +INF */
|
||||
else
|
||||
ret = (t[new] - t[!new]) * 1000;
|
||||
new = !new; /* Ecclesiastes III */
|
||||
return ret;
|
||||
}
|
||||
|
|
131
display/ws.h
131
display/ws.h
|
@ -1,66 +1,65 @@
|
|||
/*
|
||||
* $Id: ws.h,v 1.17 2004/02/03 21:23:51 phil Exp $
|
||||
* Interfaces to window-system specific code for XY display simulation
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* unless you're writing a new driver, you shouldn't be looking here! */
|
||||
|
||||
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_black(void);
|
||||
extern void *ws_color_white(void);
|
||||
extern void ws_display_point(int, int, void *);
|
||||
extern void ws_sync(void);
|
||||
extern int ws_loop(void (*)(void *), void *);
|
||||
extern int ws_poll(int *, int);
|
||||
extern void ws_beep(void);
|
||||
|
||||
/* entries into display.c from below: */
|
||||
extern void display_keyup(int);
|
||||
extern void display_keydown(int);
|
||||
extern void display_repaint(void);
|
||||
|
||||
/*
|
||||
* Globals set by O/S display level to SCALED location in display
|
||||
* coordinate system in order to save an upcall on every mouse
|
||||
* movement.
|
||||
*
|
||||
* *NOT* for consumption by clients of display.c; although display
|
||||
* clients can now get the scaling factor, real displays only give you
|
||||
* a light pen "hit" when the beam passes under the light pen.
|
||||
*/
|
||||
|
||||
extern int ws_lp_x, ws_lp_y;
|
||||
|
||||
/*
|
||||
* O/S services in theory independent of window system,
|
||||
* but in (current) practice not!
|
||||
*/
|
||||
extern unsigned long os_elapsed(void);
|
||||
/*
|
||||
* $Id: ws.h,v 1.17 2004/02/03 21:23:51 phil Exp $
|
||||
* Interfaces to window-system specific code for XY display simulation
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* unless you're writing a new driver, you shouldn't be looking here! */
|
||||
|
||||
extern int ws_init(char *, int, int, int);
|
||||
extern void *ws_color_rgb(int, int, int);
|
||||
extern void *ws_color_black(void);
|
||||
extern void *ws_color_white(void);
|
||||
extern void ws_display_point(int, int, void *);
|
||||
extern void ws_sync(void);
|
||||
extern int ws_loop(void (*)(void *), void *);
|
||||
extern int ws_poll(int *, int);
|
||||
extern void ws_beep(void);
|
||||
|
||||
/* entries into display.c from below: */
|
||||
extern void display_keyup(int);
|
||||
extern void display_keydown(int);
|
||||
extern void display_repaint(void);
|
||||
|
||||
/*
|
||||
* Globals set by O/S display level to SCALED location in display
|
||||
* coordinate system in order to save an upcall on every mouse
|
||||
* movement.
|
||||
*
|
||||
* *NOT* for consumption by clients of display.c; although display
|
||||
* clients can now get the scaling factor, real displays only give you
|
||||
* a light pen "hit" when the beam passes under the light pen.
|
||||
*/
|
||||
|
||||
extern int ws_lp_x, ws_lp_y;
|
||||
|
||||
/*
|
||||
* O/S services in theory independent of window system,
|
||||
* but in (current) practice not!
|
||||
*/
|
||||
extern unsigned long os_elapsed(void);
|
||||
|
|
1001
display/x11.c
1001
display/x11.c
File diff suppressed because it is too large
Load diff
1036
display/xy.c
Normal file
1036
display/xy.c
Normal file
File diff suppressed because it is too large
Load diff
142
display/xy.h
Normal file
142
display/xy.h
Normal 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 */
|
41
makefile
41
makefile
|
@ -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_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
|
||||
#
|
||||
PDP1D = PDP1
|
||||
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_clk.c ${PDP1D}/pdp1_dcs.c
|
||||
PDP1_OPT = -I ${PDP1D}
|
||||
${PDP1D}/pdp1_clk.c ${PDP1D}/pdp1_dcs.c ${PDP1D}/pdp1_dpy.c ${DISPLAYL}
|
||||
PDP1_OPT = -I ${PDP1D} $(DISPLAY_OPT)
|
||||
|
||||
|
||||
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_ta.c ${PDP11D}/pdp11_rc.c ${PDP11D}/pdp11_kg.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
|
||||
PDP11_OPT = -DVM_PDP11 -I ${PDP11D} ${NETWORK_OPT}
|
||||
${PDP11D}/pdp11_dup.c ${PDP11D}/pdp11_rs.c ${PDP11D}/pdp11_vt.c \
|
||||
${PDP11D}/pdp11_io_lib.c $(DISPLAYL) $(DISPLAYVT)
|
||||
PDP11_OPT = -DVM_PDP11 -I ${PDP11D} ${NETWORK_OPT} $(DISPLAY_OPT)
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
TX0 = ${TX0D}/tx0_cpu.c ${TX0D}/tx0_dpy.c ${TX0D}/tx0_stddev.c \
|
||||
${TX0D}/tx0_sys.c ${TX0D}/tx0_sys_orig.c ${DISPLAYL}
|
||||
|
|
Loading…
Add table
Reference in a new issue