PDP11, PDP1, TX-0: Merged most recent display code from Doug Gwyn.

This commit is contained in:
Mark Pizzolato 2016-02-08 16:43:36 -08:00
parent 804b7d8883
commit 94a0629134
12 changed files with 89 additions and 226 deletions

View file

@ -15,7 +15,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "ws.h" #include "ws.h"
#include "xy.h" #include "display.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>

View file

@ -1,10 +1,10 @@
/* /*
* $Id: display.c,v 1.57 2004/02/04 16:59:01 phil Exp $ * $Id: display.c,v 1.56 2004/02/03 21:44:34 phil Exp - revised by DAG $
* Simulator and host O/S independent XY display simulator * Simulator and host O/S independent XY display simulator
* Phil Budne <phil@ultimate.com> * Phil Budne <phil@ultimate.com>
* September 2003 * September 2003
* *
* with changes by Douglas A. Gwyn, 21 Jan. 2004 * with changes by Douglas A. Gwyn, 05 Feb. 2004
* *
* started from PDP-8/E simulator vc8e.c; * started from PDP-8/E simulator vc8e.c;
* This PDP8 Emulator was written by Douglas W. Jones at the * This PDP8 Emulator was written by Douglas W. Jones at the

View file

@ -42,7 +42,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "ws.h" #include "ws.h"
#include "xy.h" #include "display.h"
#ifndef PIX_SIZE #ifndef PIX_SIZE
#define PIX_SIZE 1 #define PIX_SIZE 1

View file

@ -1,5 +1,5 @@
/* /*
* $Id: test.c,v 1.24 2005/01/14 18:58:00 phil Exp $ * $Id: test.c,v 1.22 2004/01/25 17:20:50 phil Exp - revised by DAG $
* XY Display simulator test program (PDP-1 Munching Squares) * XY Display simulator test program (PDP-1 Munching Squares)
* Phil Budne <phil@ultimate.com> * Phil Budne <phil@ultimate.com>
* September 2003 * September 2003
@ -52,7 +52,7 @@
#define EXIT_FAILURE 1 #define EXIT_FAILURE 1
#endif #endif
#include "xy.h" #include "display.h"
static unsigned long test_switches = 0; static unsigned long test_switches = 0;

View file

@ -35,7 +35,7 @@
* from the authors. * from the authors.
*/ */
#include "xy.h" /* XY plot interface */ #include "display.h" /* XY plot interface */
/* /*
* The Type 340 was used on the PDP-{4,6,7,9,10} * The Type 340 was used on the PDP-{4,6,7,9,10}

View file

@ -1,5 +1,5 @@
/* /*
* $Id: vt11.c,v 1.28 2005/08/06 21:09:04 phil Exp $ * $Id: vt11.c,v 1.17 2004/01/24 20:44:46 phil Exp - revised by DAG $
* Simulator Independent VT11/VS60 Graphic Display Processor Simulation * Simulator Independent VT11/VS60 Graphic Display Processor Simulation
* Phil Budne <phil@ultimate.com> * Phil Budne <phil@ultimate.com>
* September 13, 2003 * September 13, 2003
@ -114,7 +114,7 @@
#include <math.h> /* atan2, cos, sin, sqrt */ #include <math.h> /* atan2, cos, sin, sqrt */
#endif #endif
#include "xy.h" /* XY plot interface */ #include "display.h" /* XY plot interface */
#include "vt11.h" #include "vt11.h"
#define BITMASK(n) (1<<(n)) /* PDP-11 bit numbering */ #define BITMASK(n) (1<<(n)) /* PDP-11 bit numbering */
@ -131,7 +131,7 @@
static void *vt11_dptr; static void *vt11_dptr;
static int vt11_dbit; static int vt11_dbit;
#ifdef DEBUG_VT11 #if defined(DEBUG_VT11) || defined(VM_PDP11)
#include <stdio.h> #include <stdio.h>
@ -140,10 +140,13 @@ static int vt11_dbit;
#define DBG_CALL 1 #define DBG_CALL 1
int vt11_debug; int vt11_debug;
#if defined(VM_PDP11)
extern void _sim_debug (int dbits, DEVICE* dptr, const char* fmt, ...); extern void _sim_debug (int dbits, DEVICE* dptr, const char* fmt, ...);
#define DEBUGF(...) do {if (vt11_debug & DBG_CALL) { _sim_debug (vt11_dbit, vt11_dptr, ## __VA_ARGS__); };} while (0) #define DEBUGF(...) _sim_debug (vt11_dbit, vt11_dptr, ## __VA_ARGS__)
#else /* DEBUG_VT11 */
#define DEBUGF(...) do {if (vt11_debug & DBG_CALL) { printf(## __VA_ARGS__); fflush(stdout); };} while (0)
#endif /* defined(DEBUG_VT11) || defined(VM_PDP11) */
#else #else
#define DEBUGF(...) #define DEBUGF(...)
@ -1760,7 +1763,7 @@ clip3(int32 x0, int32 y0, int32 z0, int32 x1, int32 y1, int32 z1)
if (x0 * (long)tPEd > (long)tPEn * rdx) if (x0 * (long)tPEd > (long)tPEn * rdx)
tPEn = x0, tPEd = rdx; tPEn = x0, tPEd = rdx;
} }
} else /* rdx > 0 */ } else { /* rdx > 0 */
if (x0 >= 0 && x0 <= rdx) { if (x0 >= 0 && x0 <= rdx) {
if (tPLd > 0) { if (tPLd > 0) {
if (x0 * (long)tPLd < (long)tPLn * rdx) if (x0 * (long)tPLd < (long)tPLn * rdx)
@ -1769,6 +1772,7 @@ clip3(int32 x0, int32 y0, int32 z0, int32 x1, int32 y1, int32 z1)
if (x0 * (long)tPLd > (long)tPLn * rdx) if (x0 * (long)tPLd > (long)tPLn * rdx)
tPLn = x0, tPLd = rdx; tPLn = x0, tPLd = rdx;
} }
}
/* /*
* Right: tR = NR . (PR - P0) / NR . (P1 - P0) * Right: tR = NR . (PR - P0) / NR . (P1 - P0)
@ -1812,7 +1816,7 @@ clip3(int32 x0, int32 y0, int32 z0, int32 x1, int32 y1, int32 z1)
if (tn * (long)tPLd < (long)tPLn * rdx) if (tn * (long)tPLd < (long)tPLn * rdx)
tPLn = tn, tPLd = rdx; tPLn = tn, tPLd = rdx;
} }
} else /* rdx > 0 */ } else { /* rdx > 0 */
if (tn >= 0 && tn <= rdx) { if (tn >= 0 && tn <= rdx) {
if (tPEd > 0) { if (tPEd > 0) {
if (tn * (long)tPEd > (long)tPEn * rdx) if (tn * (long)tPEd > (long)tPEn * rdx)
@ -1821,6 +1825,7 @@ clip3(int32 x0, int32 y0, int32 z0, int32 x1, int32 y1, int32 z1)
if (tn * (long)tPEd < (long)tPEn * rdx) if (tn * (long)tPEd < (long)tPEn * rdx)
tPEn = tn, tPEd = rdx; tPEn = tn, tPEd = rdx;
} }
}
/* /*
* Bottom: tB = NB . (PB - P0) / NB . (P1 - P0) * Bottom: tB = NB . (PB - P0) / NB . (P1 - P0)
@ -1867,10 +1872,11 @@ clip3(int32 x0, int32 y0, int32 z0, int32 x1, int32 y1, int32 z1)
if (tPLd > 0) { if (tPLd > 0) {
if (y0 * (long)tPLd < (long)tPLn * rdy) if (y0 * (long)tPLd < (long)tPLn * rdy)
tPLn = y0, tPLd = rdy; tPLn = y0, tPLd = rdy;
} else /* tPLd < 0 */ } else { /* tPLd < 0 */
if (y0 * (long)tPLd > (long)tPLn * rdy) if (y0 * (long)tPLd > (long)tPLn * rdy)
tPLn = y0, tPLd = rdy; tPLn = y0, tPLd = rdy;
} }
}
/* /*
* Top: tT = NT . (PT - P0) / NT . (P1 - P0) * Top: tT = NT . (PT - P0) / NT . (P1 - P0)
@ -1914,7 +1920,7 @@ clip3(int32 x0, int32 y0, int32 z0, int32 x1, int32 y1, int32 z1)
if (tn * (long)tPLd < (long)tPLn * rdy) if (tn * (long)tPLd < (long)tPLn * rdy)
tPLn = tn, tPLd = rdy; tPLn = tn, tPLd = rdy;
} }
} else /* rdy > 0 */ } else { /* rdy > 0 */
if (tn >= 0 && tn <= rdy) { if (tn >= 0 && tn <= rdy) {
if (tPEd > 0) { if (tPEd > 0) {
if (tn * (long)tPEd > (long)tPEn * rdy) if (tn * (long)tPEd > (long)tPEn * rdy)
@ -1922,8 +1928,9 @@ clip3(int32 x0, int32 y0, int32 z0, int32 x1, int32 y1, int32 z1)
} else /* tPEd < 0 */ } else /* tPEd < 0 */
if (tn * (long)tPEd < (long)tPEn * rdy) if (tn * (long)tPEd < (long)tPEn * rdy)
tPEn = tn, tPEd = rdy; tPEn = tn, tPEd = rdy;
} }
}
/* /*
* if ( tPL < tPE ) * if ( tPL < tPE )
* invisible * invisible
@ -1936,7 +1943,8 @@ clip3(int32 x0, int32 y0, int32 z0, int32 x1, int32 y1, int32 z1)
* invis * invis
*/ */
if (((tPLd > 0) && (tPEd < 0)) || ((tPLd < 0) && (tPEd > 0))) { if (((tPLd > 0) && (tPEd < 0)) ||
((tPLd < 0) && (tPEd > 0))) {
if (tPLn * (long)tPEd > (long)tPEn * tPLd) if (tPLn * (long)tPEd > (long)tPEn * tPLd)
return 0; /* invisible */ return 0; /* invisible */
} else } else
@ -2010,8 +2018,8 @@ vector3(int i, int32 dx, int32 dy, int32 dz) /* unscaled display-file units */
dz = z1 - z0; dz = z1 - z0;
if (stroking) { /* drawing a VS60 character */ if (stroking) { /* drawing a VS60 character */
DEBUGF(("offset, normalized stroke i%d (%ld,%ld) to (%ld,%ld)\r\n", DEBUGF("offset, normalized stroke i%d (%ld,%ld) to (%ld,%ld)\r\n",
i, (long)x0,(long)y0, (long)x1,(long)y1)); i, (long)x0,(long)y0, (long)x1,(long)y1);
if (dx == 0 && dy == 0) { /* just display a point */ if (dx == 0 && dy == 0) { /* just display a point */
if (i) { if (i) {
@ -2023,9 +2031,8 @@ vector3(int i, int32 dx, int32 dy, int32 dz) /* unscaled display-file units */
return; return;
} }
} else { } else {
DEBUGF(( DEBUGF("offset, normalized vector i%d (%ld,%ld,%ld) to (%ld,%ld,%ld)\r\n",
"offset, normalized vector i%d (%ld,%ld,%ld) to (%ld,%ld,%ld)\r\n", i, (long)x0, (long)y0, (long)z0, (long)x1, (long)y1, (long)z1);
i, (long)x0, (long)y0, (long)z0, (long)x1, (long)y1, (long)z1));
line_counter = 037; /* reset line-style counter */ line_counter = 037; /* reset line-style counter */
@ -2141,8 +2148,8 @@ vector3(int i, int32 dx, int32 dy, int32 dz) /* unscaled display-file units */
tangent = 010000L * dz / dy; tangent = 010000L * dz / dy;
lp_zpos = z0 + tangent * (lp_ypos - y0) / 010000L; lp_zpos = z0 + tangent * (lp_ypos - y0) / 010000L;
} }
DEBUGF(("adjusted LP coords (0%o,0%o,0%o)\r\n", DEBUGF("adjusted LP coords (0%o,0%o,0%o)\r\n",
lp_xpos, lp_ypos, lp_zpos)); lp_xpos, lp_ypos, lp_zpos);
/* xpos,ypos,zpos still pertain to the original endpoint /* xpos,ypos,zpos still pertain to the original endpoint
(assuming that Maintenance Switch 3 isn't set) */ (assuming that Maintenance Switch 3 isn't set) */
} }
@ -2264,10 +2271,9 @@ conic3(int i, int32 dcx, int32 dcy, int32 dcz, int32 dex, int32 dey, int32 dez)
dey -= dcy; dey -= dcy;
dez -= dcz; dez -= dcz;
DEBUGF(( DEBUGF("offset, normalized arc i%d s(%ld,%ld,%ld) c(%ld,%ld,%ld) e(%ld,%ld,%ld)\r\n",
"offset, normalized arc i%d s(%ld,%ld,%ld) c(%ld,%ld,%ld) e(%ld,%ld,%ld)\r\n",
i, (long)xs,(long)ys,(long)zs, (long)xc,(long)yc,(long)zc, i, (long)xs,(long)ys,(long)zs, (long)xc,(long)yc,(long)zc,
(long)xe,(long)ye,(long)ze)); (long)xe,(long)ye,(long)ze);
/* XXX not known whether Maintenance Switch 3 has any effect for arcs */ /* XXX not known whether Maintenance Switch 3 has any effect for arcs */
@ -2292,7 +2298,6 @@ conic3(int i, int32 dcx, int32 dcy, int32 dcz, int32 dex, int32 dey, int32 dez)
} else } else
edge_flag = 0; edge_flag = 0;
} }
/* XXX for now, resort to scissoring: /* XXX for now, resort to scissoring:
illuminates only pixels that lie in the visible display area */ illuminates only pixels that lie in the visible display area */
@ -2360,8 +2365,8 @@ conic3(int i, int32 dcx, int32 dcy, int32 dcz, int32 dex, int32 dey, int32 dez)
ypos += dcy + dey; ypos += dcy + dey;
zpos += dcz + dez; zpos += dcz + dez;
if (lp0_hit) { if (lp0_hit) {
DEBUGF(("LP hit on arc at (0%o,0%o,0%o)\r\n", DEBUGF("LP hit on arc at (0%o,0%o,0%o)\r\n",
lp_xpos, lp_ypos, lp_zpos)); lp_xpos, lp_ypos, lp_zpos);
if (lphit_irq) { if (lphit_irq) {
/* XXX save parameters for drawing remaining chords */ /* XXX save parameters for drawing remaining chords */
} }
@ -3057,9 +3062,9 @@ vt11_cycle(int us, int slowdown)
int32 dx = clip_x1 - clip_x0, int32 dx = clip_x1 - clip_x0,
dy = clip_y1 - clip_y0, dy = clip_y1 - clip_y0,
dz = clip_z1 - clip_z0; dz = clip_z1 - clip_z0;
DEBUGF(("clipped vector i%d (%ld,%ld,%ld) to (%ld,%ld,%ld)\r\n", clip_i, DEBUGF("clipped vector i%d (%ld,%ld,%ld) to (%ld,%ld,%ld)\r\n", clip_i,
(long)clip_x0, (long)clip_y0, (long)clip_z0, (long)clip_x0, (long)clip_y0, (long)clip_z0,
(long)clip_x1, (long)clip_y1, (long)clip_z1)); (long)clip_x1, (long)clip_y1, (long)clip_z1);
if (VS60 /* XXX assuming VT11 doesn't display */ if (VS60 /* XXX assuming VT11 doesn't display */
&& (dx != 0 || dy != 0 || dz != 0) /* hardware skips null vects */ && (dx != 0 || dy != 0 || dz != 0) /* hardware skips null vects */
&& clip_i && int0_scope) { /* show it */ && clip_i && int0_scope) { /* show it */
@ -3090,8 +3095,8 @@ vt11_cycle(int us, int slowdown)
tangent = 010000L * dz / dy; tangent = 010000L * dz / dy;
lp_zpos = clip_z0 + tangent * (lp_ypos - clip_y0) / 010000L; lp_zpos = clip_z0 + tangent * (lp_ypos - clip_y0) / 010000L;
} }
DEBUGF(("adjusted LP coords (0%o,0%o,0%o)\r\n", DEBUGF("adjusted LP coords (0%o,0%o,0%o)\r\n",
lp_xpos, lp_ypos, lp_zpos)); lp_xpos, lp_ypos, lp_zpos);
/* xpos,ypos,zpos still pertain to the original endpoint /* xpos,ypos,zpos still pertain to the original endpoint
(assuming that Maintenance Switch 3 isn't set) */ (assuming that Maintenance Switch 3 isn't set) */
} }
@ -3117,8 +3122,8 @@ vt11_cycle(int us, int slowdown)
DPC += 2; DPC += 2;
if (time_out) if (time_out)
goto bus_timeout; goto bus_timeout;
DEBUGF(("0%06o: 0%06o\r\n", DEBUGF("0%06o: 0%06o\r\n",
(unsigned)(DPC - 2 + reloc) & 0777777, (unsigned)inst)); (unsigned)(DPC - 2 + reloc) & 0777777, (unsigned)inst);
if (finish_jmpa) if (finish_jmpa)
goto jmpa; goto jmpa;
if (finish_jsra) if (finish_jsra)
@ -3230,17 +3235,17 @@ vt11_cycle(int us, int slowdown)
if (TESTBIT(inst,8)) { if (TESTBIT(inst,8)) {
#if 0 /* manual seems to say this, but it's wrong: */ #if 0 /* manual seems to say this, but it's wrong: */
DPC -= ez; DPC -= ez;
DEBUGF(("Display Jump Relative -0%o\r\n", DEBUGF("Display Jump Relative -0%o\r\n",
(unsigned)ez)); (unsigned)ez);
#else /* sign extend, twos complement add, 16-bit wrapping */ #else /* sign extend, twos complement add, 16-bit wrapping */
DPC = (DPC + (~0777 | ez)) & 0177777; DPC = (DPC + (~0777 | ez)) & 0177777;
DEBUGF(("Display Jump Relative -0%o\r\n", DEBUGF("Display Jump Relative -0%o\r\n",
~((~0777 | ez) - 1))); ~((~0777 | ez) - 1));
#endif #endif
} else { } else {
DPC += (vt11word)ez; DPC += (vt11word)ez;
DEBUGF(("Display Jump Relative +0%o\r\n", DEBUGF("Display Jump Relative +0%o\r\n",
(unsigned)ez)); (unsigned)ez);
} }
/* DPC was already incremented by 2 */ /* DPC was already incremented by 2 */
break; break;
@ -3254,8 +3259,8 @@ vt11_cycle(int us, int slowdown)
finish_jsra = 0; finish_jsra = 0;
push(); /* save return address and parameters */ push(); /* save return address and parameters */
DPC = inst & ~1; DPC = inst & ~1;
DEBUGF(("Display Jump to Subroutine Absolute 0%06o\r\n", DEBUGF("Display Jump to Subroutine Absolute 0%06o\r\n",
(unsigned)inst)); (unsigned)inst);
goto check; /* (break would set jsr = 0) */ goto check; /* (break would set jsr = 0) */
case 3: /* 110011: Display Jump to Subroutine Relative */ case 3: /* 110011: Display Jump to Subroutine Relative */
@ -3265,18 +3270,18 @@ vt11_cycle(int us, int slowdown)
/* have to be careful; DPC is unsigned */ /* have to be careful; DPC is unsigned */
if (TESTBIT(inst,8)) { if (TESTBIT(inst,8)) {
#if 0 /* manual seems to say this, but it's wrong: */ #if 0 /* manual seems to say this, but it's wrong: */
DPC -= ez; DPC -= (vt11word)ez;
DEBUGF(("Display Jump to Subroutine Relative -0%o\r\n", DEBUGF("Display Jump to Subroutine Relative -0%o\r\n",
(unsigned)ez)); (unsigned)ez);
#else /* sign extend, twos complement add, 16-bit wrapping */ #else /* sign extend, twos complement add, 16-bit wrapping */
DPC = (DPC + (~0777 | ez)) & 0177777; DPC = (DPC + (~0777 | ez)) & 0177777;
DEBUGF(("Display Jump to Subroutine Relative -0%o\r\n", DEBUGF("Display Jump to Subroutine Relative -0%o\r\n",
~((~0777 | ez) - 1))); ~((~0777 | ez) - 1));
#endif #endif
} else { } else {
DPC += (vt11word)ez; DPC += (vt11word)ez;
DEBUGF(("Display Jump to Subroutine Relative +0%o\r\n", DEBUGF("Display Jump to Subroutine Relative +0%o\r\n",
(unsigned)ez)); (unsigned)ez);
} }
/* DPC was already incremented by 2 */ /* DPC was already incremented by 2 */
break; /* jsr = 0 ?? */ break; /* jsr = 0 ?? */
@ -3478,8 +3483,8 @@ vt11_cycle(int us, int slowdown)
z = GETFIELD(inst,9,2); /* delta_z */ z = GETFIELD(inst,9,2); /* delta_z */
if (TESTBIT(inst,13)) if (TESTBIT(inst,13))
z = -z; z = -z;
DEBUGF(("short vector i%d (%d,%d,%d)\r\n", DEBUGF("short vector i%d (%d,%d,%d)\r\n",
i, (int)x, (int)y, (int)z)); i, (int)x, (int)y, (int)z);
vector3(i, x, y, z); vector3(i, x, y, z);
} else { } else {
DEBUGF("short vector i%d (%d,%d)\r\n", i, (int)x, (int)y); DEBUGF("short vector i%d (%d,%d)\r\n", i, (int)x, (int)y);
@ -3511,8 +3516,8 @@ vt11_cycle(int us, int slowdown)
z = GETFIELD(inst,9,2); /* delta_z */ z = GETFIELD(inst,9,2); /* delta_z */
if (TESTBIT(inst,13)) if (TESTBIT(inst,13))
z = -z; z = -z;
DEBUGF(("long vector i%d (%d,%d,%d)\r\n", DEBUGF("long vector i%d (%d,%d,%d)\r\n",
i, (int)x, (int)y, (int)z)); i, (int)x, (int)y, (int)z);
vector3(i, x, y, z); vector3(i, x, y, z);
} else { } else {
if (ex) if (ex)
@ -3566,8 +3571,8 @@ vt11_cycle(int us, int slowdown)
s_yoff = (unsigned char)(syo & 0xFF); s_yoff = (unsigned char)(syo & 0xFF);
s_zoff = (unsigned char)(szo & 0xFF); s_zoff = (unsigned char)(szo & 0xFF);
} else { } else {
DEBUGF(("point i%d (%d,%d,%d)\r\n", i, DEBUGF("point i%d (%d,%d,%d)\r\n", i,
(int)ex, (int)ey, (int)ez)); (int)ex, (int)ey, (int)ez);
point3(i, VSCALE(ex) + xoff, VSCALE(ey) + yoff, point3(i, VSCALE(ex) + xoff, VSCALE(ey) + yoff,
VSCALE(ez * 4) + zoff, VS60); VSCALE(ez * 4) + zoff, VS60);
} }
@ -3607,8 +3612,8 @@ vt11_cycle(int us, int slowdown)
blv: /* (VS60) BLVECT rather than GRAPHY */ blv: /* (VS60) BLVECT rather than GRAPHY */
x = GETFIELD(inst,13,11); /* direction */ x = GETFIELD(inst,13,11); /* direction */
y = GETFIELD(inst,9,0); /* length */ y = GETFIELD(inst,9,0); /* length */
DEBUGF(("basic long vector i%d d%d l%d\r\n", DEBUGF("basic long vector i%d d%d l%d\r\n",
i, (int)x, (int)y)); i, (int)x, (int)y);
basic_vector(i, (int)x, (int)y); basic_vector(i, (int)x, (int)y);
} else { } else {
ey = GETFIELD(inst,9,0); ey = GETFIELD(inst,9,0);
@ -3638,8 +3643,8 @@ vt11_cycle(int us, int slowdown)
ez = GETFIELD(inst,9,2); ez = GETFIELD(inst,9,2);
if (TESTBIT(inst,13)) if (TESTBIT(inst,13))
ez = -ez; ez = -ez;
DEBUGF(("relative point i%d (%d,%d,%d)\r\n", DEBUGF("relative point i%d (%d,%d,%d)\r\n",
i, (int)ex, (int)ey, (int)ez)); i, (int)ex, (int)ey, (int)ez);
point3(i, xpos + VSCALE(ex), ypos + VSCALE(ey), point3(i, xpos + VSCALE(ex), ypos + VSCALE(ey),
zpos + VSCALE(ez * 4), 1); zpos + VSCALE(ez * 4), 1);
} else { } else {
@ -3659,8 +3664,8 @@ vt11_cycle(int us, int slowdown)
y = GETFIELD(inst,3,0); /* length 0 */ y = GETFIELD(inst,3,0); /* length 0 */
ex = GETFIELD(inst,13,11); /* direction 1 */ ex = GETFIELD(inst,13,11); /* direction 1 */
ey = GETFIELD(inst,10,7); /* length 1 */ ey = GETFIELD(inst,10,7); /* length 1 */
DEBUGF(("basic short vector1 i%d d%d l%d\r\n", DEBUGF("basic short vector1 i%d d%d l%d\r\n",
i, (int)x, (int)y)); i, (int)x, (int)y);
basic_vector(i, (int)x, (int)y); basic_vector(i, (int)x, (int)y);
if (lphit_irq || edge_irq) /* MORE_DATA skips this */ if (lphit_irq || edge_irq) /* MORE_DATA skips this */
vt_lpen_intr(); /* post graphic interrupt to host */ vt_lpen_intr(); /* post graphic interrupt to host */
@ -3692,8 +3697,8 @@ vt11_cycle(int us, int slowdown)
z = GETFIELD(inst,11,2); z = GETFIELD(inst,11,2);
if (TESTBIT(inst,13)) if (TESTBIT(inst,13))
z = -z; z = -z;
DEBUGF(("absolute vector i%d (%d,%d,%d)\r\n", DEBUGF("absolute vector i%d (%d,%d,%d)\r\n",
i, (int)x, (int)y, (int)z)); i, (int)x, (int)y, (int)z);
ex = VSCALE(x) + xoff; ex = VSCALE(x) + xoff;
ey = VSCALE(y) + yoff; ey = VSCALE(y) + yoff;
ez = VSCALE(z * 4) + zoff; ez = VSCALE(z * 4) + zoff;
@ -3751,12 +3756,12 @@ vt11_cycle(int us, int slowdown)
ez = GETFIELD(inst,11,2); /* delta ez */ ez = GETFIELD(inst,11,2); /* delta ez */
if (TESTBIT(inst,13)) if (TESTBIT(inst,13))
ez = -ez; ez = -ez;
DEBUGF(("circle/arc i%d C(%d,%d,%d) E(%d,%d,%d)\r\n", DEBUGF("circle/arc i%d C(%d,%d,%d) E(%d,%d,%d)\r\n",
i, (int)x, (int)y, (int)z, (int)ex, (int)ey, (int)ez)); i, (int)x, (int)y, (int)z, (int)ex, (int)ey, (int)ez);
conic3(i, x, y, z, ex, ey, ez); /* approx. */ conic3(i, x, y, z, ex, ey, ez); /* approx. */
} else { } else {
DEBUGF(("circle/arc i%d C(%d,%d) E(%d,%d)\r\n", DEBUGF("circle/arc i%d C(%d,%d) E(%d,%d)\r\n",
i, (int)x, (int)y, (int)ex, (int)ey)); i, (int)x, (int)y, (int)ex, (int)ey);
conic2(i, x, y, ex, ey); conic2(i, x, y, ex, ey);
} }
break; break;

View file

@ -5,7 +5,7 @@
* September 16, 2003 * September 16, 2003
* Substantially revised by Douglas A. Gwyn, 14 Jan. 2004 * Substantially revised by Douglas A. Gwyn, 14 Jan. 2004
* *
* prerequisite: xy.h * prerequisite: display.h
*/ */
/* /*

View file

@ -1,5 +1,5 @@
/* /*
* $Id: vtmacs.h,v 1.5 2005/01/12 18:10:13 phil Exp $ * $Id: vtmacs.h,v 1.3 2004/01/24 20:54:54 phil Exp - revised by DAG $
* macros for coding a VT11/VS60 display file (instructions and data) * macros for coding a VT11/VS60 display file (instructions and data)
* for standalone use of vt11.c (not embedded in PDP-11 simulator) * for standalone use of vt11.c (not embedded in PDP-11 simulator)
* Douglas A. Gwyn <gwyn@arl.army.mil> * Douglas A. Gwyn <gwyn@arl.army.mil>

View file

@ -37,7 +37,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "ws.h" /* for ws_beep() */ #include "ws.h" /* for ws_beep() */
#include "xy.h" #include "display.h"
#include "vt11.h" #include "vt11.h"
#include "vtmacs.h" #include "vtmacs.h"

View file

@ -47,7 +47,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "ws.h" #include "ws.h"
#include "xy.h" #include "display.h"
#ifndef PIX_SIZE #ifndef PIX_SIZE
#define PIX_SIZE 1 #define PIX_SIZE 1

View file

@ -42,7 +42,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "ws.h" #include "ws.h"
#include "xy.h" #include "display.h"
#include <X11/X.h> #include <X11/X.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>

View file

@ -1,142 +0,0 @@
/*
* $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, void *dptr);
/* 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 */