Skip to content

Commit bb15304

Browse files
committed
KA10: CART device for Stanford cart.
Also four lights, a solenoid to ring a bell, and a TV tuner.
1 parent 81dff79 commit bb15304

File tree

4 files changed

+175
-1
lines changed

4 files changed

+175
-1
lines changed

PDP10/ka10_cart.c

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
/* ka10_cart.c: Stanford cart, with audiovisual system indicators.
2+
3+
Copyright (c) 2021, Lars Brinkhoff
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a
6+
copy of this software and associated documentation files (the "Software"),
7+
to deal in the Software without restriction, including without limitation
8+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
9+
and/or sell copies of the Software, and to permit persons to whom the
10+
Software is furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18+
LARS BRINKHOFF BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
22+
This is a device which interfaces with the Stanford cart. It also
23+
controls three lights and a solenoid to ring a bell. It's specific
24+
to the SAIL PDP-10. The hardware interface is documented in the
25+
UUO manual.
26+
*/
27+
28+
#include "kx10_defs.h"
29+
30+
#if NUM_DEVS_CART > 0
31+
32+
#define CART_DEVNUM 0354
33+
34+
/* CONO bits. */
35+
#define CART_UDP 0000001LL /* UDP in use. */
36+
#define CART_RED 0000004LL /* System crash. */
37+
#define CART_YEL 0000010LL /* System crash. */
38+
#define CART_TUN 0000720LL /* TV tuner. */
39+
#define CART_BEL 0001000LL /* System being debugged. */
40+
#define CART_DRV 0001000LL /* Cart drive direction. */
41+
#define CART_ON 0002000LL /* Cart drive on. */
42+
#define CART_STR 0004000LL /* Cart steer right. */
43+
#define CART_STL 0010000LL /* Cart steer left. */
44+
#define CART_PNR 0020000LL /* Cart pan right. */
45+
#define CART_PNL 0040000LL /* Cart pan left. */
46+
#define CART_MASK 0177777LL
47+
#define CART_GRN 0200000LL /* One-shot: system running. */
48+
#define CART_OFF 0400000LL
49+
50+
/* Delay for one-shot action, in microseconds. */
51+
#define CART_ONESHOT 1000000
52+
53+
/* Device state is 18 bits. */
54+
#define cart_bits cart_unit.u3
55+
56+
static t_stat cart_devio(uint32 dev, uint64 *data);
57+
static t_stat cart_svc(UNIT *uptr);
58+
static t_stat cart_reset (DEVICE *dptr);
59+
static const char *cart_description (DEVICE *dptr);
60+
61+
DIB cart_dib = { CART_DEVNUM, 1, &cart_devio, NULL };
62+
63+
UNIT cart_unit = {
64+
UDATA (&cart_svc, UNIT_IDLE, 0)
65+
};
66+
67+
REG cart_reg[] = {
68+
{ORDATA(BITS, cart_bits, 18)},
69+
{0}
70+
};
71+
72+
DEVICE cart_dev = {
73+
"CART", &cart_unit, cart_reg, NULL,
74+
1, 8, 0, 1, 8, 36,
75+
NULL, NULL, &cart_reset, NULL, NULL, NULL,
76+
&cart_dib, DEV_DISABLE | DEV_DIS | DEV_DEBUG, 0, NULL,
77+
NULL, NULL, NULL, NULL, NULL, &cart_description
78+
};
79+
80+
void cart_on (uint64 bits)
81+
{
82+
bits &= ~cart_bits;
83+
cart_bits |= bits;
84+
if (bits & CART_UDP)
85+
sim_debug (DEBUG_CMD, &cart_dev, "UDP in use lamp on.");
86+
if (bits & CART_RED)
87+
sim_debug (DEBUG_CMD, &cart_dev, "Red lamp on.");
88+
if (bits & CART_YEL)
89+
sim_debug (DEBUG_CMD, &cart_dev, "Yellow lamp on.");
90+
if (bits & CART_BEL)
91+
sim_debug (DEBUG_CMD, &cart_dev, "Bell!");
92+
if (bits & CART_GRN)
93+
sim_debug (DEBUG_CMD, &cart_dev, "Green lamp on.");
94+
if (bits & CART_TUN)
95+
sim_debug (DEBUG_CMD, &cart_dev, "Frobbing TV tuner.");
96+
}
97+
98+
void cart_off (uint64 bits)
99+
{
100+
bits &= cart_bits;
101+
cart_bits &= ~bits;
102+
if (bits & CART_UDP)
103+
sim_debug (DEBUG_CMD, &cart_dev, "UDP in use lamp off.");
104+
if (bits & CART_RED)
105+
sim_debug (DEBUG_CMD, &cart_dev, "Red lamp off.");
106+
if (bits & CART_YEL)
107+
sim_debug (DEBUG_CMD, &cart_dev, "Yellow lamp off.");
108+
if (bits & CART_GRN)
109+
sim_debug (DEBUG_CMD, &cart_dev, "Green lamp off.");
110+
if (bits & CART_TUN)
111+
sim_debug (DEBUG_CMD, &cart_dev, "Frobbing TV tuner.");
112+
}
113+
114+
void cart_oneshot (void)
115+
{
116+
/* This is a "one-shot" action. */
117+
sim_debug(DEBUG_DETAIL, &cart_dev, "Trigger one shot.");
118+
cart_on (CART_GRN);
119+
cart_off (CART_GRN << 1);
120+
sim_cancel (&cart_unit);
121+
sim_activate_after (&cart_unit, CART_ONESHOT);
122+
}
123+
124+
static t_stat cart_svc(UNIT *uptr)
125+
{
126+
sim_debug(DEBUG_DETAIL, &cart_dev, "One shot expired.");
127+
cart_off (CART_GRN);
128+
cart_on (CART_GRN << 1);
129+
return SCPE_OK;
130+
}
131+
132+
t_stat cart_devio(uint32 dev, uint64 *data)
133+
{
134+
uint64 bits;
135+
136+
switch(dev & 07) {
137+
case CONO|4:
138+
bits = *data;
139+
sim_debug(DEBUG_CONO, &cart_dev, "%06llo", bits);
140+
if (bits & CART_GRN)
141+
cart_oneshot ();
142+
bits &= CART_MASK;
143+
if (*data & CART_OFF)
144+
cart_off (bits);
145+
else
146+
cart_on (bits);
147+
break;
148+
case CONI|4:
149+
*data = cart_bits & CART_MASK;
150+
break;
151+
/* This device doesn't respond to DATAI/O. */
152+
}
153+
154+
return SCPE_OK;
155+
}
156+
157+
static t_stat cart_reset (DEVICE *dptr)
158+
{
159+
if (sim_switches & SWMASK('P'))
160+
cart_bits = 0;
161+
return SCPE_OK;
162+
}
163+
164+
const char *cart_description (DEVICE *dptr)
165+
{
166+
return "Stanford cart";
167+
}
168+
#endif

PDP10/kx10_defs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ extern DEVICE pd_dev;
496496
extern DEVICE pclk_dev;
497497
extern DEVICE dpy_dev;
498498
extern DEVICE iii_dev;
499+
extern DEVICE cart_dev;
499500
extern DEVICE imx_dev;
500501
extern DEVICE imp_dev;
501502
extern DEVICE ch10_dev;
@@ -719,6 +720,7 @@ extern void ka10_lights_clear_aux (int);
719720
#define NUM_DEVS_PMP WAITS
720721
#define NUM_DEVS_DKB (WAITS * USE_DISPLAY)
721722
#define NUM_DEVS_III (WAITS * USE_DISPLAY)
723+
#define NUM_DEVS_CART WAITS
722724
#define NUM_DEVS_PD ITS
723725
#define NUM_DEVS_PCLK WAITS
724726
#define NUM_DEVS_IMX ITS

PDP10/kx10_sys.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ DEVICE *sim_devices[] = {
174174
#if (NUM_DEVS_III > 0)
175175
&iii_dev,
176176
#endif
177+
#if (NUM_DEVS_CART > 0)
178+
&cart_dev,
179+
#endif
177180
#if NUM_DEVS_IMP > 0
178181
&imp_dev,
179182
#endif

makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2103,7 +2103,8 @@ KA10 = ${KA10D}/kx10_cpu.c ${KA10D}/kx10_sys.c ${KA10D}/kx10_df.c \
21032103
${KA10D}/pdp6_dtc.c ${KA10D}/pdp6_mtc.c ${KA10D}/pdp6_dsk.c \
21042104
${KA10D}/pdp6_dcs.c ${KA10D}/ka10_dpk.c ${KA10D}/kx10_dpy.c \
21052105
${PDP10D}/ka10_ai.c ${KA10D}/ka10_iii.c ${KA10D}/kx10_disk.c \
2106-
${PDP10D}/ka10_pclk.c ${DISPLAYL} ${DISPLAY340} ${DISPLAYIII}
2106+
${PDP10D}/ka10_pclk.c ${PDP10D}/ka10_cart.c \
2107+
${DISPLAYL} ${DISPLAY340} ${DISPLAYIII}
21072108
KA10_OPT = -DKA=1 -DUSE_INT64 -I ${KA10D} -DUSE_SIM_CARD ${NETWORK_OPT} ${DISPLAY_OPT} ${KA10_DISPLAY_OPT}
21082109
ifneq (${PANDA_LIGHTS},)
21092110
# ONLY for Panda display.

0 commit comments

Comments
 (0)