Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KA10: Stanford Cart device #245

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions I7000/i7080_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ const char *cpu_description (DEVICE *dptr);

uint32 read_addr(uint8 *reg, uint8 *zone);
void write_addr(uint32 addr, uint8 reg, uint8 zone);
uint32 load_addr(int *loc);
void store_addr(uint32 addr, int *loc);
uint32 load_addr(uint32 *loc);
void store_addr(uint32 addr, uint32 *loc);
void store_cpu(uint32 addr, int full);
void load_cpu(uint32 addr, int full);
uint16 get_acstart(uint8 reg);
Expand Down Expand Up @@ -2405,7 +2405,7 @@ void write_addr(uint32 addr, uint8 reg, uint8 zone) {
}

/* Store converted address in storage */
void store_addr(uint32 addr, int *loc) {
void store_addr(uint32 addr, uint32 *loc) {
uint8 value[4];
int i;

Expand Down Expand Up @@ -2454,7 +2454,7 @@ void store_addr(uint32 addr, int *loc) {


/* Read address from storage */
uint32 load_addr(int *loc) {
uint32 load_addr(uint32 *loc) {
uint8 t;
uint8 f;
uint8 zone;
Expand Down Expand Up @@ -2507,7 +2507,7 @@ uint32 load_addr(int *loc) {
}

/* Store converted hex address in storage */
void store_hex(uint32 addr, int *loc) {
void store_hex(uint32 addr, uint32 *loc) {
/* Convert address into BCD first */
AC[*loc] = bin_bcd[addr & 0xf];
*loc = next_addr[*loc];
Expand All @@ -2520,7 +2520,7 @@ void store_hex(uint32 addr, int *loc) {
}

/* Read hex address from storage */
uint32 load_hex(int *loc) {
uint32 load_hex(uint32 *loc) {
uint8 t;
uint8 f;
uint32 addr;
Expand Down
4 changes: 2 additions & 2 deletions I7000/i7080_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ int chan_cmd(uint16 dev, uint16 cmd, uint32 addr);
int chan_mapdev(uint16 dev);
/* Process the CHR 3 13 command and abort all channel activity */
void chan_chr_13();
uint32 load_addr(int *loc);
void store_addr(uint32 addr, int *loc);
uint32 load_addr(uint32 *loc);
void store_addr(uint32 addr, uint32 *loc);

/* Opcode definitions. */
#define OP_TR CHR_1
Expand Down
168 changes: 168 additions & 0 deletions PDP10/ka10_cart.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
/* ka10_cart.c: Stanford cart, with audiovisual system indicators.

Copyright (c) 2021, Lars Brinkhoff

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
LARS BRINKHOFF 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.

This is a device which interfaces with the Stanford cart. It also
controls three lights and a solenoid to ring a bell. It's specific
to the SAIL PDP-10. The hardware interface is documented in the
UUO manual.
*/

#include "kx10_defs.h"

#if NUM_DEVS_CART > 0

#define CART_DEVNUM 0354

/* CONO bits. */
#define CART_UDP 0000001LL /* UDP in use. */
#define CART_RED 0000004LL /* System crash. */
#define CART_YEL 0000010LL /* System crash. */
#define CART_TUN 0000720LL /* TV tuner. */
#define CART_BEL 0001000LL /* System being debugged. */
#define CART_DRV 0001000LL /* Cart drive direction. */
#define CART_ON 0002000LL /* Cart drive on. */
#define CART_STR 0004000LL /* Cart steer right. */
#define CART_STL 0010000LL /* Cart steer left. */
#define CART_PNR 0020000LL /* Cart pan right. */
#define CART_PNL 0040000LL /* Cart pan left. */
#define CART_MASK 0177777LL
#define CART_GRN 0200000LL /* One-shot: system running. */
#define CART_OFF 0400000LL

/* Delay for one-shot action, in microseconds. */
#define CART_ONESHOT 1000000

/* Device state is 18 bits. */
#define cart_bits cart_unit.u3

static t_stat cart_devio(uint32 dev, uint64 *data);
static t_stat cart_svc(UNIT *uptr);
static t_stat cart_reset (DEVICE *dptr);
static const char *cart_description (DEVICE *dptr);

DIB cart_dib = { CART_DEVNUM, 1, &cart_devio, NULL };

UNIT cart_unit = {
UDATA (&cart_svc, UNIT_IDLE, 0)
};

REG cart_reg[] = {
{ORDATA(BITS, cart_bits, 18)},
{0}
};

DEVICE cart_dev = {
"CART", &cart_unit, cart_reg, NULL,
1, 8, 0, 1, 8, 36,
NULL, NULL, &cart_reset, NULL, NULL, NULL,
&cart_dib, DEV_DISABLE | DEV_DIS | DEV_DEBUG, 0, NULL,
NULL, NULL, NULL, NULL, NULL, &cart_description
};

void cart_on (uint64 bits)
{
bits &= ~cart_bits;
cart_bits |= bits;
if (bits & CART_UDP)
sim_debug (DEBUG_CMD, &cart_dev, "UDP in use lamp on.");
if (bits & CART_RED)
sim_debug (DEBUG_CMD, &cart_dev, "Red lamp on.");
if (bits & CART_YEL)
sim_debug (DEBUG_CMD, &cart_dev, "Yellow lamp on.");
if (bits & CART_BEL)
sim_debug (DEBUG_CMD, &cart_dev, "Bell!");
if (bits & CART_GRN)
sim_debug (DEBUG_CMD, &cart_dev, "Green lamp on.");
if (bits & CART_TUN)
sim_debug (DEBUG_CMD, &cart_dev, "Frobbing TV tuner.");
}

void cart_off (uint64 bits)
{
bits &= cart_bits;
cart_bits &= ~bits;
if (bits & CART_UDP)
sim_debug (DEBUG_CMD, &cart_dev, "UDP in use lamp off.");
if (bits & CART_RED)
sim_debug (DEBUG_CMD, &cart_dev, "Red lamp off.");
if (bits & CART_YEL)
sim_debug (DEBUG_CMD, &cart_dev, "Yellow lamp off.");
if (bits & CART_GRN)
sim_debug (DEBUG_CMD, &cart_dev, "Green lamp off.");
if (bits & CART_TUN)
sim_debug (DEBUG_CMD, &cart_dev, "Frobbing TV tuner.");
}

void cart_oneshot (void)
{
/* This is a "one-shot" action. */
sim_debug(DEBUG_DETAIL, &cart_dev, "Trigger one shot.");
cart_on (CART_GRN);
cart_off (CART_GRN << 1);
sim_cancel (&cart_unit);
sim_activate_after (&cart_unit, CART_ONESHOT);
}

static t_stat cart_svc(UNIT *uptr)
{
sim_debug(DEBUG_DETAIL, &cart_dev, "One shot expired.");
cart_off (CART_GRN);
cart_on (CART_GRN << 1);
return SCPE_OK;
}

t_stat cart_devio(uint32 dev, uint64 *data)
{
uint64 bits;

switch(dev & 07) {
case CONO|4:
bits = *data;
sim_debug(DEBUG_CONO, &cart_dev, "%06llo", bits);
if (bits & CART_GRN)
cart_oneshot ();
bits &= CART_MASK;
if (*data & CART_OFF)
cart_off (bits);
else
cart_on (bits);
break;
case CONI|4:
*data = cart_bits & CART_MASK;
break;
/* This device doesn't respond to DATAI/O. */
}

return SCPE_OK;
}

static t_stat cart_reset (DEVICE *dptr)
{
if (sim_switches & SWMASK('P'))
cart_bits = 0;
return SCPE_OK;
}

const char *cart_description (DEVICE *dptr)
{
return "Stanford cart";
}
#endif
2 changes: 2 additions & 0 deletions PDP10/kx10_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ extern DEVICE dpy_dev;
extern DEVICE iii_dev;
extern DEVICE dd_dev;
extern DEVICE vds_dev;
extern DEVICE cart_dev;
extern DEVICE imx_dev;
extern DEVICE imp_dev;
extern DEVICE ch10_dev;
Expand Down Expand Up @@ -794,6 +795,7 @@ extern void ka10_lights_clear_aux (int);
#define NUM_DEVS_III (WAITS * USE_DISPLAY)
#define NUM_DEVS_TV (WAITS * USE_DISPLAY)
#define NUM_DEVS_DD (WAITS * USE_DISPLAY)
#define NUM_DEVS_CART WAITS
#define NUM_DEVS_PD ITS
#define NUM_DEVS_PCLK WAITS
#define NUM_DEVS_IMX ITS
Expand Down
3 changes: 3 additions & 0 deletions PDP10/kx10_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ DEVICE *sim_devices[] = {
&dd_dev,
&vds_dev,
#endif
#if (NUM_DEVS_CART > 0)
&cart_dev,
#endif
#if NUM_DEVS_IMP > 0
&imp_dev,
#endif
Expand Down
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ KA10 = ${KA10D}/kx10_cpu.c ${KA10D}/kx10_sys.c ${KA10D}/kx10_df.c \
${KA10D}/pdp6_dcs.c ${KA10D}/ka10_dpk.c ${KA10D}/kx10_dpy.c \
${PDP10D}/ka10_ai.c ${KA10D}/ka10_iii.c ${KA10D}/kx10_disk.c \
${PDP10D}/ka10_pclk.c ${PDP10D}/ka10_tv.c ${KA10D}/kx10_ddc.c \
${PDP10D}/ka10_dd.c \
${PDP10D}/ka10_dd.c ${PDP10D}/ka10_cart.c \
${DISPLAYL} ${DISPLAY340}
KA10_OPT = -DKA=1 -DUSE_INT64 -I ${KA10D} -DUSE_SIM_CARD ${NETWORK_OPT} ${DISPLAY_OPT} ${KA10_DISPLAY_OPT}
ifneq (${PANDA_LIGHTS},)
Expand Down