mirror of
https://github.com/rcornwell/sims.git
synced 2026-04-24 19:34:05 +00:00
KA10: Added WAITS Petit Clock.
This commit is contained in:
committed by
Richard Cornwell
parent
b170ecd50c
commit
1c06d230ea
138
PDP10/ka10_pclk.c
Normal file
138
PDP10/ka10_pclk.c
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
/* ka10_pclk.c: Petit Calendar Clock.
|
||||||
|
|
||||||
|
Copyright (c) 2018, Lars Brinkhoff
|
||||||
|
Copyright (c) 2020, Bruce Baumgart ( by editing Brinkhoff ka10_pd.c )
|
||||||
|
|
||||||
|
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
|
||||||
|
RICHARD CORNWELL 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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include "kx10_defs.h"
|
||||||
|
|
||||||
|
#ifndef NUM_DEVS_PCLK
|
||||||
|
#define NUM_DEVS_PCLK 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (NUM_DEVS_PCLK > 0)
|
||||||
|
|
||||||
|
#define PCLK_DEVNUM 0730
|
||||||
|
#define PCLK_OFF (1 << DEV_V_UF)
|
||||||
|
#define PIA_CH u3
|
||||||
|
#define PIA_FLG 07
|
||||||
|
#define CLK_IRQ 010
|
||||||
|
|
||||||
|
t_stat pclk_devio(uint32 dev, uint64 *data);
|
||||||
|
const char *pclk_description (DEVICE *dptr);
|
||||||
|
t_stat pclk_srv(UNIT *uptr);
|
||||||
|
t_stat pclk_set_on(UNIT *uptr, int32 val, CONST char *cptr, void *desc);
|
||||||
|
t_stat pclk_set_off(UNIT *uptr, int32 val, CONST char *cptr, void *desc);
|
||||||
|
t_stat pclk_show_on(FILE *st, UNIT *uptr, int32 val, CONST void *desc);
|
||||||
|
|
||||||
|
UNIT pclk_unit[] = {
|
||||||
|
{UDATA(pclk_srv, UNIT_IDLE|UNIT_DISABLE, 0)}, /* 0 */
|
||||||
|
};
|
||||||
|
DIB pclk_dib = {PCLK_DEVNUM, 1, &pclk_devio, NULL};
|
||||||
|
MTAB pclk_mod[] = {
|
||||||
|
{ MTAB_VDV, 0, "ON", "ON", pclk_set_on, pclk_show_on },
|
||||||
|
{ MTAB_VDV, PCLK_OFF, NULL, "OFF", pclk_set_off },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
DEVICE pclk_dev = {
|
||||||
|
"PCLK", pclk_unit, NULL, pclk_mod, 1, 8, 0, 1, 8, 36, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
&pclk_dib, DEV_DISABLE | DEV_DIS | DEV_DEBUG, 0, NULL, NULL, NULL, NULL, NULL, NULL, &pclk_description
|
||||||
|
};
|
||||||
|
/*
|
||||||
|
This is the Petit real-time calendar-clock re-enactment, where
|
||||||
|
the DATE is always Friday 1974-07-26, and
|
||||||
|
the TIME is the local wall clock time.
|
||||||
|
|
||||||
|
Months are encoded 4,5,6, 7,8,9, A,B,C, D,E,F for January to December.
|
||||||
|
Day-of-month runs from 0 to 30, for the 1st to 31st.
|
||||||
|
July 1974 is hex '74A' and the 26th day is coded '25' decimal.
|
||||||
|
|
||||||
|
The original PCLK was installed on the PDP-6 I/O bus at the SAIL D.C.Power Lab in 1967.
|
||||||
|
*/
|
||||||
|
t_stat pclk_devio(uint32 dev, uint64 *data)
|
||||||
|
{
|
||||||
|
DEVICE *dptr = &pclk_dev;
|
||||||
|
time_t t=time(NULL);
|
||||||
|
struct tm *dt;
|
||||||
|
uint64 hour=12, minute=1, seconds=2, milliseconds=3;
|
||||||
|
uint64 coni_word = ((minute&0xF)<<26) | (seconds<<20) | milliseconds;
|
||||||
|
uint64 datai_word;
|
||||||
|
dt = localtime( &t );
|
||||||
|
hour = dt->tm_hour;
|
||||||
|
minute = dt->tm_min;
|
||||||
|
coni_word = (dt->tm_min << 26) | (dt->tm_sec << 20);
|
||||||
|
coni_word += 02020136700; // plus the Petit/Panofsky offset.
|
||||||
|
datai_word = ( 0x74A<<16 | 25<<11 | hour<<6 | minute ) + 05004;
|
||||||
|
switch(dev & 3) {
|
||||||
|
case DATAI:
|
||||||
|
*data = datai_word;
|
||||||
|
break;
|
||||||
|
case CONI:
|
||||||
|
*data = coni_word;
|
||||||
|
break;
|
||||||
|
case CONO:
|
||||||
|
pclk_unit[0].PIA_CH &= ~(PIA_FLG);
|
||||||
|
pclk_unit[0].PIA_CH |= (int32)(*data & PIA_FLG);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return SCPE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
t_stat
|
||||||
|
pclk_srv(UNIT * uptr)
|
||||||
|
{
|
||||||
|
if (uptr->PIA_CH & PIA_FLG) {
|
||||||
|
uptr->PIA_CH |= CLK_IRQ;
|
||||||
|
// set_interrupt(PCLK_DEVNUM, uptr->PIA_CH);
|
||||||
|
} else
|
||||||
|
sim_cancel(uptr);
|
||||||
|
return SCPE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *pclk_description (DEVICE *dptr)
|
||||||
|
{
|
||||||
|
return "Stanford A.I.Lab Phil Petit calendar clock crock";
|
||||||
|
}
|
||||||
|
|
||||||
|
t_stat pclk_set_on(UNIT *uptr, int32 val, CONST char *cptr, void *desc)
|
||||||
|
{
|
||||||
|
DEVICE *dptr = &pclk_dev;
|
||||||
|
dptr->flags &= ~PCLK_OFF;
|
||||||
|
return SCPE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
t_stat pclk_set_off(UNIT *uptr, int32 val, CONST char *cptr, void *desc)
|
||||||
|
{
|
||||||
|
DEVICE *dptr = &pclk_dev;
|
||||||
|
dptr->flags |= PCLK_OFF;
|
||||||
|
return SCPE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
t_stat pclk_show_on(FILE *st, UNIT *uptr, int32 val, CONST void *desc)
|
||||||
|
{
|
||||||
|
DEVICE *dptr = &pclk_dev;
|
||||||
|
fprintf (st, "%s", (dptr->flags & PCLK_OFF) ? "off" : "on");
|
||||||
|
return SCPE_OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -448,6 +448,7 @@ extern DEVICE dt_dev;
|
|||||||
extern DEVICE pmp_dev;
|
extern DEVICE pmp_dev;
|
||||||
extern DEVICE dk_dev;
|
extern DEVICE dk_dev;
|
||||||
extern DEVICE pd_dev;
|
extern DEVICE pd_dev;
|
||||||
|
extern DEVICE pclk_dev;
|
||||||
extern DEVICE dpy_dev;
|
extern DEVICE dpy_dev;
|
||||||
extern DEVICE iii_dev;
|
extern DEVICE iii_dev;
|
||||||
extern DEVICE imx_dev;
|
extern DEVICE imx_dev;
|
||||||
@@ -624,6 +625,7 @@ extern void ka10_lights_clear_aux (int);
|
|||||||
#define NUM_DEVS_DKB (WAITS * USE_DISPLAY)
|
#define NUM_DEVS_DKB (WAITS * USE_DISPLAY)
|
||||||
#define NUM_DEVS_III (WAITS * USE_DISPLAY)
|
#define NUM_DEVS_III (WAITS * USE_DISPLAY)
|
||||||
#define NUM_DEVS_PD ITS | KL_ITS
|
#define NUM_DEVS_PD ITS | KL_ITS
|
||||||
|
#define NUM_DEVS_PCLK WAITS
|
||||||
#define NUM_DEVS_IMX ITS
|
#define NUM_DEVS_IMX ITS
|
||||||
#define NUM_DEVS_STK ITS
|
#define NUM_DEVS_STK ITS
|
||||||
#define NUM_DEVS_TK10 ITS
|
#define NUM_DEVS_TK10 ITS
|
||||||
|
|||||||
@@ -156,6 +156,9 @@ DEVICE *sim_devices[] = {
|
|||||||
#if (NUM_DEVS_PD > 0)
|
#if (NUM_DEVS_PD > 0)
|
||||||
&pd_dev,
|
&pd_dev,
|
||||||
#endif
|
#endif
|
||||||
|
#if (NUM_DEVS_PCLK > 0)
|
||||||
|
&pclk_dev,
|
||||||
|
#endif
|
||||||
#if (NUM_DEVS_DPY > 0)
|
#if (NUM_DEVS_DPY > 0)
|
||||||
&dpy_dev,
|
&dpy_dev,
|
||||||
#if (NUM_DEVS_WCNSLS > 0)
|
#if (NUM_DEVS_WCNSLS > 0)
|
||||||
|
|||||||
@@ -225,6 +225,10 @@
|
|||||||
RelativePath="..\PDP10\ka10_mty.c"
|
RelativePath="..\PDP10\ka10_mty.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\PDP10\ka10_pclk.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\PDP10\ka10_pd.c"
|
RelativePath="..\PDP10\ka10_pd.c"
|
||||||
>
|
>
|
||||||
|
|||||||
BIN
doc/ka10_doc.doc
BIN
doc/ka10_doc.doc
Binary file not shown.
2
makefile
2
makefile
@@ -2011,7 +2011,7 @@ KA10 = ${KA10D}/kx10_cpu.c ${KA10D}/kx10_sys.c ${KA10D}/kx10_df.c \
|
|||||||
${KA10D}/pdp6_dtc.c ${KA10D}/pdp6_mtc.c ${KA10D}/pdp6_dsk.c \
|
${KA10D}/pdp6_dtc.c ${KA10D}/pdp6_mtc.c ${KA10D}/pdp6_dsk.c \
|
||||||
${KA10D}/pdp6_dcs.c ${KA10D}/ka10_dpk.c ${KA10D}/kx10_dpy.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_ai.c ${KA10D}/ka10_iii.c ${KA10D}/kx10_disk.c \
|
||||||
${DISPLAYL} ${DISPLAY340} ${DISPLAYIII}
|
${PDP10D}/ka10_pclk.c ${DISPLAYL} ${DISPLAY340} ${DISPLAYIII}
|
||||||
KA10_OPT = -DKA=1 -DUSE_INT64 -I ${KA10D} -DUSE_SIM_CARD ${NETWORK_OPT} ${DISPLAY_OPT} ${KA10_DISPLAY_OPT}
|
KA10_OPT = -DKA=1 -DUSE_INT64 -I ${KA10D} -DUSE_SIM_CARD ${NETWORK_OPT} ${DISPLAY_OPT} ${KA10_DISPLAY_OPT}
|
||||||
ifneq (${PANDA_LIGHTS},)
|
ifneq (${PANDA_LIGHTS},)
|
||||||
# ONLY for Panda display.
|
# ONLY for Panda display.
|
||||||
|
|||||||
Reference in New Issue
Block a user