From 629f138fea0f72697974a74acf2d55a190f9016f Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Mon, 15 Jun 2020 12:44:41 +0200 Subject: [PATCH] IMLAC: Add MIT bell device. A hardware device particular to MIT with some kind of bell sound. --- Visual Studio Projects/imlac.vcproj | 4 ++ imlac/imlac_bel.c | 66 +++++++++++++++++++++++++++++ imlac/imlac_defs.h | 1 + imlac/imlac_sys.c | 2 +- makefile | 2 +- 5 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 imlac/imlac_bel.c diff --git a/Visual Studio Projects/imlac.vcproj b/Visual Studio Projects/imlac.vcproj index ce93995f..16107eff 100644 --- a/Visual Studio Projects/imlac.vcproj +++ b/Visual Studio Projects/imlac.vcproj @@ -199,6 +199,10 @@ RelativePath="..\display\imlac.c" > + + diff --git a/imlac/imlac_bel.c b/imlac/imlac_bel.c new file mode 100644 index 00000000..370be45c --- /dev/null +++ b/imlac/imlac_bel.c @@ -0,0 +1,66 @@ +/* imlac_bel.c: MIT bell device. + + Copyright (c) 2020, 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. + + Except as contained in this notice, the name of Lars Brinkhoff shall not be + used in advertising or otherwise to promote the sale, use or other dealings + in this Software without prior written authorization from Lars Brinkhoff. +*/ + +#include "imlac_defs.h" +#include "sim_video.h" + +/* Debug */ +#define DBG 0001 + +/* Function declaration. */ +static uint16 bel_iot (uint16, uint16); + +static IMDEV bel_imdev = { + 1, + { { 0071, bel_iot, { "BEL" } } } +}; + +static DEBTAB bel_deb[] = { + { "DBG", DBG }, + { NULL, 0 } +}; + +DEVICE bel_dev = { + "BEL", NULL, NULL, NULL, + 0, 8, 16, 1, 8, 16, + NULL, NULL, NULL, + NULL, NULL, NULL, + &bel_imdev, DEV_DISABLE | DEV_DEBUG | DEV_DIS, 0, bel_deb, + NULL, NULL, NULL, NULL, NULL, NULL +}; + +static uint16 +bel_iot (uint16 insn, uint16 AC) +{ + sim_debug (DBG, &bel_dev, "IOT\n"); + if ((insn & 0771) == 0711) { /* BEL */ + sim_debug (DBG, &bel_dev, "Dong!\n"); +#ifdef HAVE_LIBSDL + vid_beep (); +#endif + } + return AC; +} diff --git a/imlac/imlac_defs.h b/imlac/imlac_defs.h index 635b6727..db3ccc2c 100644 --- a/imlac/imlac_defs.h +++ b/imlac/imlac_defs.h @@ -73,5 +73,6 @@ extern uint16 memmask; extern SUBDEV *dev_tab[0100]; extern DEVICE cpu_dev, irq_dev, rom_dev, dp_dev, crt_dev, kbd_dev; extern DEVICE tty_dev, ptr_dev, ptp_dev, sync_dev; +extern DEVICE bel_dev; #endif /* IMLAC_DEFS_H_ */ diff --git a/imlac/imlac_sys.c b/imlac/imlac_sys.c index 3563da93..2003569e 100644 --- a/imlac/imlac_sys.c +++ b/imlac/imlac_sys.c @@ -49,7 +49,7 @@ DEVICE *sim_devices[] = { /* &pen_dev, / * 13 */ &ptp_dev, /* 27 */ /* &mse_dev, / * 70, 73 */ - /* &bel_dev, / * 71 */ + &bel_dev, /* 71 */ NULL }; diff --git a/makefile b/makefile index ec859e4b..7416eee4 100644 --- a/makefile +++ b/makefile @@ -1496,7 +1496,7 @@ PDP10_OPT = -DVM_PDP10 -DUSE_INT64 -I ${PDP10D} -I ${PDP11D} ${NETWORK_OPT} IMLACD = ${SIMHD}/imlac IMLAC = ${IMLACD}/imlac_sys.c ${IMLACD}/imlac_cpu.c \ ${IMLACD}/imlac_dp.c ${IMLACD}/imlac_crt.c ${IMLACD}/imlac_kbd.c \ - ${IMLACD}/imlac_tty.c ${IMLACD}/imlac_pt.c \ + ${IMLACD}/imlac_tty.c ${IMLACD}/imlac_pt.c ${IMLACD}/imlac_bel.c \ ${DISPLAYL} ${DISPLAYIMLAC} IMLAC_OPT = -I ${IMLACD} ${DISPLAY_OPT}