1
0
mirror of https://github.com/simh/simh.git synced 2026-01-25 19:56:25 +00:00

DISPLAY: Update display code to support DEC Type 340, and 36 switches

Only interface code to Type 340 is for Richard Cornwell's KA10
(but could be used on PDP-1/4/7/9 as well)
This commit is contained in:
Phil Budne
2018-02-17 01:17:58 -05:00
parent c05190780b
commit b11fbf6cd4
12 changed files with 1260 additions and 260 deletions

View File

@@ -1,3 +1,8 @@
/*
* wrap, or clip?
* finish lc bitmaps
*/
/*
* $Id: type340.c,v 1.6 2005/01/14 18:58:00 phil Exp $
* Simulator Independent DEC Type 340 Graphic Display Processor Simulation
@@ -5,12 +10,33 @@
* September 20, 2003
* from vt11.c
*
* Information from DECUS 7-13
* First displayed PDP-6/10 SPCWAR Feb 2018!
*
* The Type 340 was used on the PDP-{4,6,7,9,10}
* and used 18-bit words, with bits numbered 0 thru 17
* (most significant to least)
*
* This file simulates ONLY the 340 proper
* and not CPU specific interfacing details
*
* see:
* http://www.bitsavers.org/pdf/dec/graphics/H-340_Type_340_Precision_Incremental_CRT_System_Nov64.pdf
*
* Initial information from DECUS 7-13:
* http://www.bitsavers.org/pdf/dec/graphics/7-13_340_Display_Programming_Manual.pdf
* pre-bitsavers location(!!):
* http://www.spies.com/~aek/pdf/dec/pdp7/7-13_340displayProgMan.pdf
*
* NOTE!!! The 340 is an async processor, with multiple control signals
* running in parallel. No attempt has been made to simulate this.
* And while it might be fun to try to implement it as a bit vector
* of signals, and run code triggered by those signals in the next
* service interval, BUT unless/until this is proven necessary, I'm
* resisting that impulse (pun not intended).
*/
/*
* Copyright (c) 2003-2004, Philip L. Budne
* Copyright (c) 2003-2018, 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"),
@@ -36,13 +62,21 @@
*/
#include "display.h" /* XY plot interface */
#include "type340.h" /* interface definitions */
#include "type340cmd.h" /* 340 command definitions */
/*
* The Type 340 was used on the PDP-{4,6,7,9,10}
* and used 18-bit words, with bits numbered 0 thru 17
* (most significant to least)
* sub-options, under "#if"
* (make runtime selectable????!)
* TYPE342 character generator
* TYPE343 slave display control
* TYPE347 subroutine facility
*/
#ifndef TYPE342
#define TYPE342 1 /* default to character generation */
#endif
#define BITMASK(N) (1<<(17-(N)))
/* mask for a field */
@@ -55,91 +89,126 @@
#define TESTBIT(W,B) (((W) & BITMASK(B)) != 0)
#ifdef DEBUG_TY340
#include <stdio.h>
#define DEBUGF(X) printf X
#else
#define DEBUGF(X)
#endif
typedef long ty340word;
static ty340word DAC; /* Display Address Counter */
static unsigned char shift; /* 1 bit */
static enum mode mode; /* 3 bits */
static int scale; /* 2 bits */
enum mode { PARAM=0, POINT, SLAVE, CHAR, VECTOR, VCONT, INCR, SUBR };
enum jump_type { DJP=2, DJS=3, DDS=1 };
static ty340word ASR; /* Address Save Register */
static unsigned char save_ff; /* "save" flip-flop */
#define TY340_UNITS 1
static unsigned char intensity; /* 3 bits */
static unsigned char lp_ena; /* 1 bit */
enum jump_type { DJP=2, DJS=3, DDS=1 }; /* type 347 */
/* kept signed for raster violation checking */
static short xpos, ypos; /* 10 bits, signed */
static unsigned char sequence; /* 2 bits */
/* put all the state in a struct "just in case" */
static struct type340 {
/* ty340word DAC; /* Display Address Counter */
ty340word status; /* see ST340_XXX in type340.h */
signed short xpos, ypos; /* 10 bits, signed (for OOB checks) */
char initialized; /* 0 before display_init */
/* only using (evil) bitfield syntax to limit enum size */
enum mode mode : 8; /* 3 bits */
unsigned char lp_ena; /* 1 bit */
unsigned char scale; /* multiplier: 1,2,4,8 */
unsigned char intensity; /* 3 bits */
#if TYPE342
unsigned char shift; /* 1 bit */
#endif
#if TYPE347
ty340word ASR; /* Address Save Register */
unsigned char SAVE_FF; /* "save" flip-flop */
#endif
} u340[TY340_UNITS];
/* XXX make defines public for 340_cycle return */
#define STOPPED 01
#define LPHIT 02
#define VEDGE 04
#define HEDGE 010
static unsigned char status = STOPPED;
/*
* callbacks into PDP-6/10 simulator
*/
extern ty340word ty340_fetch(ty340word);
extern void ty340_store(ty340word, ty340word);
extern void ty340_stop_int(void);
extern void ty340_lp_int(void);
#if TY340_UNITS == 1
#define UNIT(N) u340
#else
#define UNIT(N) (u340+(N))
#endif
#if 0
/* NOT USED WITH PDP-6 Type 344 Interface!! */
void
ty340_set_dac(ty340word addr)
{
DAC = addr;
mode = 0;
DEBUGF(("set DAC %06\r\n", DAC));
status = 0; /* XXX just clear stopped? */
/* XXX clear other stuff? save_ff? */
}
struct type340 *u = UNIT(0);
u->DAC = addr;
DEBUGF(("set DAC %06o\r\n", u->DAC));
void
/* XXX only when reset? */
u->mode = 0;
u->status = 0; /* XXX just clear stopped? */
ty340_rfd(); /* ready for data */
}
#endif
ty340word
ty340_reset(void)
{
/* XXX call display layer? destroy window? */
xpos = ypos = 0;
status = STOPPED;
struct type340 *u = UNIT(0);
#ifndef TY340_NODISPLAY
if (!u->initialized) {
display_init(DIS_TYPE340, 1, u); /* XXX check return? */
u->initialized = 1;
}
#endif
u->xpos = u->ypos = 0;
u->mode = 0;
u->status = 0; /* set ST340_DONE? */
u->scale = 1;
#if TYPE347
u->SAVE_FF = 0;
#endif
ty340_rfd(); /* ready for data */
return u->status;
}
static int
point(int x, int y, int seq)
{
struct type340 *u = UNIT(0);
int i;
/* XXX apply scale? */
#ifdef TYPE340_POINT
DEBUGF(("type340 point %d %d %d\r\n", x, y, seq));
#endif
i = DISPLAY_INT_MAX-7+intensity;
i = DISPLAY_INT_MAX-7+u->intensity;
if (i <= 0)
i = 1;
if (x < 0 || x > 1023) {
status |= VEDGE;
/* XXX clip? wrap?? */
u->status |= ST340_VEDGE;
return 0;
}
if (y < 0 || y > 1023) {
status |= HEDGE;
/* XXX clip? wrap?? */
u->status |= ST340_HEDGE;
return 0;
}
#ifndef TY340_NODISPLAY
if (display_point(x, y, i, 0)) {
if (lp_ena) {
/* XXX save location? */
status |= LPHIT;
sequence = seq;
}
/*
* in real life: type340 pauses
* until CPU reads coordinates
*/
u->status |= ST340_LPHIT;
if (u->lp_ena)
ty340_lp_int(x, y);
}
#endif
return 1;
}
void
lpoint(int x, int y)
{
#ifdef TYPE340_LPOINT
DEBUGF(("type340 lpoint %d %d\r\n", x, y));
#endif
point(x, y, 0);
}
/*
@@ -374,92 +443,125 @@ lineTwoStep(int x0, int y0, int x1, int y1)
}
} /* lineTwoStep */
static int
vector(int i, int sx, int dx, int sy, int dy)
/* here in VECTOR & VCONT modes */
int
vector(int i, int sy, int dy, int sx, int dx)
{
struct type340 *u = UNIT(0);
int x0, y0, x1, y1;
int flags;
x0 = xpos;
y0 = ypos;
DEBUGF(("v i%d y%c%d x%c%d\r\n", i,
(sy ? '-' : '+'), dy,
(sx ? '-' : '+'), dx));
x0 = u->xpos;
y0 = u->ypos;
if (sx) {
x1 = x0 - dx;
if (x1 < 0) /* XXX TEMP? */
x1 = x0 - dx * u->scale;
if (x1 < 0) {
x1 = 0;
flags = ST340_HEDGE;
}
}
else {
x1 = x0 + dx;
if (x1 > 1023) /* XXX TEMP? */
x1 = x0 + dx * u->scale;
if (x1 > 1023) {
x1 = 1023;
flags = ST340_HEDGE;
}
}
if (sy) {
y1 = y0 - dy;
if (y1 < 0) /* XXX TEMP? */
y1 = y0 - dy * u->scale;
if (y1 < 0) {
y1 = 0;
flags |= ST340_VEDGE;
}
}
else {
y1 = y0 + dy; /* XXX TEMP? */
if (y1 > 1023)
y1 = y0 + dy * u->scale;
if (y1 > 1023) {
y1 = 1023;
flags |= ST340_VEDGE;
}
}
DEBUGF(("vector i%d (%d,%d) to (%d,%d)\r\n", i, x0, y0, x1, y1));
if (i)
if (i) /* XXX need OLD value??? */
lineTwoStep(x0, y0, x1, y1);
xpos = x1;
ypos = y1;
return 0;
u->xpos = x1;
u->ypos = y1;
u->status |= flags; /* ?? */
return flags;
}
/* return true on raster violation */
/*
* incremental vector
* return true on raster violation
*
* i is intensify
* n is subvector number
* byte is 4 bits
*/
int
ipoint(int i, int n, unsigned char byte)
{
struct type340 *u = UNIT(0);
DEBUGF(("type340 ipoint i%d n%d %#o\r\n", i, n, byte));
if (byte & 010) { /* left/right */
if (byte & 04) {
if (xpos == 0) {
status |= VEDGE;
return 1;
if (byte & 04) { /* left */
u->xpos -= u->scale;
if (u->xpos < 0) {
u->xpos = 0; /* XXX wrap? */
u->status |= ST340_VEDGE; /* save flags & continue?? */
return 1; /* escape */
}
xpos--;
}
else {
if (xpos == 1023) {
status |= VEDGE;
else { /* right */
u->xpos += u->scale;
if (u->xpos > 1023) {
u->xpos = 1023; /* XXX wrap? */
u->status |= ST340_VEDGE;
return 1;
}
xpos++;
}
}
if (byte & 02) { /* up/down */
if (byte & 04) {
if (ypos == 0) {
status |= HEDGE;
if (byte & 01) { /* down */
u->ypos -= u->scale;
if (u->ypos < 0) {
u->ypos = 0; /* XXX wrap? */
u->status |= ST340_HEDGE;
return 1;
}
ypos--;
}
else {
if (ypos == 1023) {
status |= HEDGE;
u->ypos += u->scale;
if (u->ypos > 1023) {
u->ypos = 1023; /* XXX wrap? */
u->status |= ST340_HEDGE;
return 1;
}
ypos++;
}
}
if (i)
point(xpos, ypos, n);
point(u->xpos, u->ypos, n);
return 0;
return 0; /* no escape */
}
#if TYPE342
/*
* 342 character generator - first 64 characters (from manual)
* 342 character generator - first 64 characters
* 7-13_340_Display_Programming_Manual.pdf p.24
* each char contains a vertical stripe of the matrix.
* lowest bit is bottom
* first char is leftmost
*/
static const unsigned char chars[64][5] = {
{ 0070, 0124, 0154, 0124, 0070 }, /* 00 */
static const unsigned char chars[128][5] = {
{ 0070, 0124, 0154, 0124, 0070 }, /* 00 blob */
{ 0174, 0240, 0240, 0240, 0174 }, /* 01 A */
{ 0376, 0222, 0222, 0222, 0154 }, /* 02 B */
{ 0174, 0202, 0202, 0202, 0104 }, /* 03 C */
@@ -522,6 +624,76 @@ static const unsigned char chars[64][5] = {
{ 0020, 0050, 0104, 0202, 0000 }, /* 74 < */
{ 0050, 0050, 0050, 0050, 0050 }, /* 75 = */
{ 0000, 0202, 0104, 0050, 0020 }, /* 76 > */
{ 0100, 0200, 0236, 0220, 0140 }, /* 77 ? */
/*
* NOT YET COMPLETE!!!
* original letterforms not available, using
* https://fontstruct.com/fontstructions/show/357807/5x7_monospaced_pixel_font
* PLB: I wonder if VT52 was 5x7????
*/
{ 0070, 0124, 0154, 0124, 0070 }, /* 00 blob */
{ 0070, 0204, 0204, 0050, 0274 }, /* 01 a needs fixing! */
{ 0377, 0050, 0204, 0204, 0070 }, /* 02 b needs fixing! */
{ 0070, 0204, 0204, 0204, 0050 }, /* 03 c needs fixing! */
{ 0376, 0202, 0202, 0202, 0174 }, /* 04 D */
{ 0376, 0222, 0222, 0222, 0222 }, /* 05 E */
{ 0376, 0220, 0220, 0220, 0220 }, /* 06 F */
{ 0174, 0202, 0222, 0222, 0134 }, /* 07 G */
{ 0376, 0020, 0020, 0020, 0376 }, /* 10 H */
{ 0000, 0202, 0376, 0202, 0000 }, /* 11 I */
{ 0004, 0002, 0002, 0002, 0374 }, /* 12 J */
{ 0376, 0020, 0050, 0104, 0202 }, /* 13 K */
{ 0376, 0002, 0002, 0002, 0002 }, /* 14 K */
{ 0376, 0100, 0040, 0100, 0376 }, /* 15 M */
{ 0376, 0100, 0040, 0020, 0376 }, /* 16 N */
{ 0174, 0202, 0202, 0202, 0174 }, /* 17 O */
{ 0376, 0220, 0220, 0220, 0140 }, /* 20 P */
{ 0174, 0202, 0212, 0206, 0176 }, /* 21 Q */
{ 0376, 0220, 0230, 0224, 0142 }, /* 22 R */
{ 0144, 0222, 0222, 0222, 0114 }, /* 23 S */
{ 0200, 0200, 0376, 0200, 0200 }, /* 24 T */
{ 0374, 0002, 0002, 0002, 0374 }, /* 25 U */
{ 0370, 0004, 0002, 0004, 0370 }, /* 26 V */
{ 0376, 0004, 0010, 0004, 0376 }, /* 27 W */
{ 0202, 0104, 0070, 0104, 0202 }, /* 30 X */
{ 0200, 0100, 0076, 0100, 0200 }, /* 31 Y */
{ 0226, 0232, 0222, 0262, 0322 }, /* 32 Z */
{ 0000, 0000, 0000, 0000, 0000 }, /* 33 LF */
{ 0000, 0000, 0000, 0000, 0000 }, /* 34 CR */
{ 0000, 0000, 0000, 0000, 0000 }, /* 35 HORIZ */
{ 0000, 0000, 0000, 0000, 0000 }, /* 36 VERT */
{ 0000, 0000, 0000, 0000, 0000 }, /* 37 ESC */
{ 0000, 0000, 0000, 0000, 0000 }, /* 40 space */
{ 0000, 0000, 0372, 0000, 0000 }, /* 41 ! */
{ 0000, 0340, 0000, 0340, 0000 }, /* 42 " */
{ 0050, 0376, 0050, 0376, 0050 }, /* 43 # */
{ 0144, 0222, 0376, 0222, 0114 }, /* 44 $ */
{ 0306, 0310, 0220, 0246, 0306 }, /* 45 % */
{ 0154, 0222, 0156, 0004, 0012 }, /* 46 & */
{ 0000, 0000, 0300, 0340, 0000 }, /* 47 ' */
{ 0070, 0104, 0202, 0000, 0000 }, /* 50 ( */
{ 0000, 0000, 0202, 0104, 0070 }, /* 51 ) */
{ 0124, 0070, 0174, 0070, 0124 }, /* 52 * */
{ 0020, 0020, 0174, 0020, 0020 }, /* 53 + */
{ 0000, 0014, 0016, 0000, 0000 }, /* 54 , */
{ 0020, 0020, 0020, 0020, 0020 }, /* 55 - */
{ 0000, 0006, 0006, 0000, 0000 }, /* 56 . */
{ 0004, 0010, 0020, 0040, 0100 }, /* 57 / */
{ 0174, 0212, 0222, 0242, 0174 }, /* 60 0 */
{ 0000, 0102, 0376, 0002, 0000 }, /* 61 1 */
{ 0116, 0222, 0222, 0222, 0142 }, /* 62 2 */
{ 0104, 0202, 0222, 0222, 0154 }, /* 63 3 */
{ 0020, 0060, 0120, 0376, 0020 }, /* 64 4 */
{ 0344, 0222, 0222, 0222, 0214 }, /* 65 5 */
{ 0174, 0222, 0222, 0222, 0114 }, /* 66 6 */
{ 0306, 0210, 0220, 0240, 0300 }, /* 67 7 */
{ 0154, 0222, 0222, 0222, 0154 }, /* 70 8 */
{ 0144, 0222, 0222, 0222, 0174 }, /* 71 9 */
{ 0000, 0066, 0066, 0000, 0000 }, /* 72 : */
{ 0000, 0154, 0156, 0000, 0000 }, /* 73 ; */
{ 0020, 0050, 0104, 0202, 0000 }, /* 74 < */
{ 0050, 0050, 0050, 0050, 0050 }, /* 75 = */
{ 0000, 0202, 0104, 0050, 0020 }, /* 76 > */
{ 0100, 0200, 0236, 0220, 0140 } /* 77 ? */
};
@@ -529,178 +701,233 @@ static const unsigned char chars[64][5] = {
* type 342 Character/Symbol generator for type 340 display
* return true if ESCaped
*/
static int
character(int n, char c)
int
character(int n, unsigned char c)
{
struct type340 *u = UNIT(0);
int x, y;
unsigned char s = u->scale;
switch (c) {
case 033: /* LF */
if (ypos < 12) {
status |= HEDGE;
ypos = 0;
case CHRLF: /* LF */
u->ypos -= 12*s;
if (u->ypos < 0) {
u->status |= ST340_HEDGE;
u->ypos = 0;
}
else
ypos -= 12; /* XXX scale? */
return 0;
case 034: /* CR */
xpos = 0;
case CHRCR: /* CR */
u->xpos = 0;
return 0;
case 035: /* shift in */
shift = 1;
case CHRUC: /* "SHIFT IN (HORIZ)" */
u->shift = 0; /* upper case in spcwac.163 */
return 0;
case 036: /* shift out */
shift = 0;
case CHRLC: /* "SHIFT OUT (VERT)" */
u->shift = 0100; /* lower case in spcwar.163 */
return 0;
case 037: /* escape */
sequence = n;
case CHRESC: /* escape */
return 1;
}
/* XXX plot character from character set selected by "shift"
* (offset index by 64?)
*/
/* plot character from character set selected by "shift" */
for (x = 0; x < 5; x++) {
for (y = 0; y < 7; y++) {
if (chars[c][x] & (1<<y)) {
for (y = 0; y < 8; y++) {
if (chars[c|u->shift][x] & (1<<y)) {
/* XXX check for raster violation? */
point(xpos+x, ypos+y, n); /* XXX scale? */
point(u->xpos+x*s, u->ypos+y*s, n);
}
}
}
xpos += 7; /* XXX scale? */
if (xpos > 1023) {
xpos = 1023;
status |= VEDGE;
u->xpos += 7*s;
if (u->xpos > 1023) {
u->xpos = 1023;
u->status |= ST340_VEDGE;
}
return 0;
}
#endif
int
ty340_cycle(int us, int slowdown)
/*
* execute one type340 instruction
* returns status word
* (could return number of microseconds)
*/
ty340word
ty340_instruction(ty340word inst)
{
ty340word inst, addr;
int i, escape, stopped;
struct type340 *u = UNIT(0);
int i, escape;
#ifdef TYPE347
ty340word addr;
#endif
if (status & STOPPED)
return 0; /* XXX age display? */
/* cleared by RFD */
u->status &= ~(ST340_HEDGE|ST340_VEDGE);
inst = ty340_fetch(DAC);
DEBUGF(("%06o: %06o\r\n", DAC, inst));
DAC++;
DEBUGF(("type340 mode %#o status %#o\r\n", u->mode, u->status));
if (u->status & ST340_STOPPED) /* XXX LPINT as well??? */
return u->status;
escape = 0;
switch (mode) {
switch (u->mode) {
case PARAM:
mode = GETFIELD(inst, 2, 4);
if (inst & 0600600) { /* curious to see if MIT hacked theirs */
DEBUGF(("type340 reserved param bits set %#o\r\n", inst));
}
/* READ TO MODE: */
u->mode = GETFIELD(inst, 2, 4);
if (TESTBIT(inst, 5)) { /* load l.p. enable */
lp_ena = TESTBIT(inst,6);
DEBUGF(("lp_ena %d\r\n", lp_ena));
u->lp_ena = TESTBIT(inst,6);
DEBUGF(("type340 lp_ena %d\r\n", u->lp_ena));
}
/* PM PULSE: */
if (TESTBIT(inst, 14)) {
/* STORE INTENSITY: */
u->intensity = GETFIELD(inst, 15, 17);
DEBUGF(("type340 set intensity %d\r\n", u->intensity));
}
if (TESTBIT(inst, 11)) {
/* STORE SCALE: */
u->scale = 1<<GETFIELD(inst, 12, 13); /* save as multiplier */
DEBUGF(("type340 set scale %d\r\n", u->scale));
}
if (TESTBIT(inst, 7)) {
status |= STOPPED;
if (TESTBIT(inst, 8))
ty340_stop_int(); /* set stop_int_end? */
u->status |= ST340_STOPPED;
DEBUGF(("type340 stop\r\n"));
if (TESTBIT(inst, 8)) {
DEBUGF(("type340 stop int\r\n"));
u->status |= ST340_STOP_INT;
}
}
if (TESTBIT(inst, 11))
scale = GETFIELD(inst, 12, 13);
if (TESTBIT(inst, 14))
intensity = GETFIELD(inst, 15, 17);
break;
case POINT:
mode = GETFIELD(inst, 2, 4);
u->mode = GETFIELD(inst, 2, 4);
if (TESTBIT(inst, 5)) /* load l.p. enable */
lp_ena = TESTBIT(inst,6);
if (TESTBIT(inst, 5)) { /* load l.p. enable */
u->lp_ena = TESTBIT(inst,6);
DEBUGF(("type340 lp_ena %d\r\n", u->lp_ena));
}
if (TESTBIT(inst, 1))
ypos = GETFIELD(inst, 8, 17);
else
xpos = GETFIELD(inst, 8, 17);
if (TESTBIT(inst, 7))
point(xpos, ypos, 0);
if (TESTBIT(inst, 1)) {
u->ypos = GETFIELD(inst, 8, 17);
DEBUGF(("type340 set u->ypos %d\r\n", u->ypos));
}
else {
u->xpos = GETFIELD(inst, 8, 17);
DEBUGF(("type340 set xpos %d\r\n", u->xpos));
}
if (TESTBIT(inst, 7)) { /* intensify */
DEBUGF(("type340 point (%d,%d)\r\n", u->ypos, u->xpos));
point(u->xpos, u->ypos, 0);
}
break;
case SLAVE:
mode = GETFIELD(inst, 2, 4);
DEBUGF(("type340 slave %06o\r\n", inst));
u->mode = GETFIELD(inst, 2, 4);
#if TYPE343
/* control multiple windows???? */
#else
/* ..set the mode register and halt without requesting a new data word */
u->status |= ST340_STOPPED;
#endif
break;
case CHAR:
DEBUGF(("type340 char %06o\r\n", inst));
#if TYPE342
escape = (character(0, GETFIELD(inst, 0, 5)) ||
character(1, GETFIELD(inst, 6, 11)) ||
character(2, GETFIELD(inst, 12, 17)));
#else
/* what other missing options do: */
u->status |= ST340_STOPPED;
#endif
break;
case VECTOR:
DEBUGF(("type340 vector %06o\r\n", inst));
escape = TESTBIT(inst, 0);
if (vector(TESTBIT(inst, 1),
TESTBIT(inst, 2), GETFIELD(inst, 3, 9),
TESTBIT(inst, 10), GETFIELD(inst, 11, 17))) {
/* XXX interrupt? */
escape = 1;
}
break;
case VCONT:
escape = TESTBIT(inst, 0);
if (vector(TESTBIT(inst, 1),
TESTBIT(inst, 2), GETFIELD(inst, 3, 9),
TESTBIT(inst, 10), GETFIELD(inst, 11, 17))) {
/* XXX set escape? */
mode = PARAM; /* raster violation */
}
DEBUGF(("type340 vcont %06o\r\n", inst));
while (!vector(TESTBIT(inst, 1),
TESTBIT(inst, 2), GETFIELD(inst, 3, 9),
TESTBIT(inst, 10), GETFIELD(inst, 11, 17)))
;
escape = 1; /* XXX always???? */
/* NOTE: NO INTERRUPT!! Clear conditions???? */
break;
case INCR:
escape = TESTBIT(inst, 0); /* escape bit */
i = TESTBIT(inst, 1);
DEBUGF(("type340 incr %06o\r\n", inst));
i = TESTBIT(inst, 1); /* intensify bit */
if (ipoint(i, 0, GETFIELD(inst, 2, 5)) ||
ipoint(i, 1, GETFIELD(inst, 6, 9)) ||
ipoint(i, 2, GETFIELD(inst, 10, 13)) ||
ipoint(i, 3, GETFIELD(inst, 14, 17)))
/* XXX set escape? */
mode = PARAM; /* raster violation */
escape = 1;
else if (TESTBIT(inst, 0)) /* escape bit */
escape = 1;
break;
case SUBR:
DEBUGF(("type340 subr %06o\r\n", inst));
#if TYPE347
/* type 347 Display Subroutine Option? */
mode = GETFIELD(inst, 2, 4);
/* XXX take high bits of current DAC? */
u->mode = GETFIELD(inst, 2, 4);
addr = GETFIELD(inst, 5, 17);
switch (GETFIELD(inst, 0, 1)) {
case DJS: /* display jump and save */
ASR = DAC;
save_ff = 1; /* set "save" flip-flop */
u->ASR = u->DAC;
u->SAVE_FF = 1; /* set "save" flip-flop */
/* FALL */
case DJP: /* display jump */
DAC = addr;
u->DAC = addr;
break;
case DDS: /* display deposit save register */
ty340_deposit(addr, (DJP<<16) | ASR);
save_ff = 0; /* ?? */
ty340_store(addr, (DJP<<16) | u->ASR);
/* clear SAVE_FF? */
break;
default:
/* XXX ??? */
break;
}
#else /* no 347 */
/* "halts without generating request for data or interrupt" */
u->status |= ST340_STOPPED;
#endif
break;
}
if (escape) {
mode = PARAM;
if (save_ff) {
u->mode = PARAM;
#if TYPE347
if (u->SAVE_FF) {
/* return from subroutine */
DAC = ASR;
save_ff = 0;
u->DAC = u->ASR;
u->SAVE_FF = 0;
}
#endif
}
return status;
} /* ty340_cycle */
if (!(u->status & ST340_STOPPED)) /* XXX LPINT as well??? */
ty340_rfd(); /* ready for data */
return u->status;
} /* ty340_instruction */
ty340word
ty340_status(void)
{
struct type340 *u = UNIT(0);
return u->status;
}