Skip to content

Commit 19897f5

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

4 files changed

Lines changed: 174 additions & 1 deletion

File tree

PDP10/ka10_cart.c

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
/* ka10_cart.c: Stanford cart.
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+
RICHARD CORNWELL 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+
static t_stat cart_devio(uint32 dev, uint64 *data);
54+
static t_stat cart_svc(UNIT *uptr);
55+
static t_stat cart_reset (DEVICE *dptr);
56+
static const char *cart_description (DEVICE *dptr);
57+
58+
#define cart_bits cart_unit.u3
59+
60+
DIB cart_dib = { CART_DEVNUM, 1, &cart_devio, NULL };
61+
62+
UNIT cart_unit = {
63+
UDATA (&cart_svc, UNIT_IDLE, 0)
64+
};
65+
66+
REG cart_reg[] = {
67+
{ORDATA(BITS, cart_bits, 18)},
68+
{0}
69+
};
70+
71+
DEVICE cart_dev = {
72+
"CART", &cart_unit, cart_reg, NULL,
73+
0, 8, 0, 1, 8, 36,
74+
NULL, NULL, &cart_reset, NULL, NULL, NULL,
75+
&cart_dib, DEV_DISABLE | DEV_DIS | DEV_DEBUG, 0, NULL,
76+
NULL, NULL, NULL, NULL, NULL, &cart_description
77+
};
78+
79+
t_stat cart_on (uint64 bits)
80+
{
81+
if (bits & CART_UDP)
82+
sim_debug (DEBUG_CMD, &cart_dev, "UDP in use lamp on.");
83+
if (bits & CART_RED)
84+
sim_debug (DEBUG_CMD, &cart_dev, "Red lamp on.");
85+
if (bits & CART_YEL)
86+
sim_debug (DEBUG_CMD, &cart_dev, "Yellow lamp on.");
87+
if (bits & CART_BEL)
88+
sim_debug (DEBUG_CMD, &cart_dev, "Bell!");
89+
if (bits & CART_GRN)
90+
sim_debug (DEBUG_CMD, &cart_dev, "Green lamp on.");
91+
if (bits & CART_TUN)
92+
sim_debug (DEBUG_CMD, &cart_dev, "Frobbing TV tuner.");
93+
}
94+
95+
t_stat cart_off (uint64 bits)
96+
{
97+
if (bits & CART_UDP)
98+
sim_debug (DEBUG_CMD, &cart_dev, "UDP in use lamp off.");
99+
if (bits & CART_RED)
100+
sim_debug (DEBUG_CMD, &cart_dev, "Red lamp off.");
101+
if (bits & CART_YEL)
102+
sim_debug (DEBUG_CMD, &cart_dev, "Yellow lamp off.");
103+
if (bits & CART_GRN)
104+
sim_debug (DEBUG_CMD, &cart_dev, "Green lamp off.");
105+
if (bits & CART_TUN)
106+
sim_debug (DEBUG_CMD, &cart_dev, "Frobbing TV tuner.");
107+
}
108+
109+
t_stat cart_devio(uint32 dev, uint64 *data)
110+
{
111+
uint64 bits;
112+
113+
switch(dev & 07) {
114+
case CONO:
115+
sim_debug(DEBUG_CONO, &cart_dev, "%06llo", *data);
116+
bits = *data & CART_MASK;
117+
if (*data & CART_GRN) {
118+
/* This is a "one-shot" action. */
119+
if ((cart_bits & CART_GRN) == 0) {
120+
cart_on (CART_GRN);
121+
cart_off (CART_GRN << 1);
122+
}
123+
cart_bits &= ~0600000LL;
124+
cart_bits |= CART_GRN;
125+
sim_cancel (&cart_unit);
126+
sim_activate_after (&cart_unit, CART_ONESHOT);
127+
}
128+
if (*data & CART_OFF) {
129+
cart_bits &= ~bits;
130+
cart_off (bits);
131+
} else {
132+
cart_bits |= *data;
133+
cart_on (bits);
134+
}
135+
break;
136+
case CONI:
137+
*data = cart_bits & CART_MASK;
138+
break;
139+
/* This device doesn't respond to DATAI/O only. */
140+
}
141+
142+
return SCPE_OK;
143+
}
144+
145+
static t_stat cart_svc(UNIT *uptr)
146+
{
147+
if (cart_bits & CART_GRN) {
148+
cart_off (CART_GRN);
149+
cart_on (CART_GRN << 1);
150+
}
151+
cart_bits &= ~0600000LL;
152+
cart_bits |= CART_GRN << 1;
153+
}
154+
155+
156+
static t_stat cart_reset (DEVICE *dptr)
157+
{
158+
if (sim_switches & SWMASK('P'))
159+
cart_bits = 0;
160+
return SCPE_OK;
161+
}
162+
163+
const char *cart_description (DEVICE *dptr)
164+
{
165+
return "Stanford cart";
166+
}
167+
#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)