KA10: Fixed bugs in WAITS support. New WAITS TOD clock.

This commit is contained in:
Richard Cornwell 2020-06-23 21:02:12 -04:00
parent 1035aa3e7a
commit ac4d9c0250
9 changed files with 258 additions and 44 deletions

View file

@ -92,7 +92,7 @@
#define POS_Y 00000377700
#define CBRT 00000000070 /* Current brightness */
#define CSIZE 00000000007 /* Current char size */
#define POS_X_V 16
#define POS_X_V 17
#define POS_Y_V 6
#define CBRT_V 3
#define CSIZE_V 0

138
PDP10/ka10_pclk.c Normal file
View 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

View file

@ -2163,6 +2163,7 @@ t_stat lp20_reset (DEVICE *dptr)
t_stat lp20_attach (UNIT *uptr, CONST char *cptr)
{
sim_switches |= SWMASK ('A'); /* Position to EOF */
return attach_unit (uptr, cptr);
}

View file

@ -246,6 +246,7 @@ cp_srv(UNIT *uptr) {
t_stat
cp_attach(UNIT * uptr, CONST char *file)
{
sim_switches |= SWMASK ('A'); /* Position to EOF */
return sim_card_attach(uptr, file);
}

View file

@ -412,8 +412,8 @@ REG cpu_reg[] = {
#endif
{ FLDATA (PIPEND, pi_pending, 0), REG_HRO},
{ FLDATA (PARITY, parity_irq, 0) },
{ ORDATAD (APRIRQ, apr_irq, 0, "APR Interrupt number") },
{ ORDATAD (CLKIRQ, clk_irq, 0, "CLK Interrupt number") },
{ ORDATAD (APRIRQ, apr_irq, 3, "APR Interrupt number") },
{ ORDATAD (CLKIRQ, clk_irq, 3, "CLK Interrupt number") },
{ FLDATA (CLKEN, clk_en, 0), REG_HRO},
{ FLDATA (XCT, xct_flag, 0), REG_HRO},
{ BRDATA (IRQV, dev_irq, 8, 16, 128 ), REG_HRO},
@ -4273,6 +4273,8 @@ in_loop:
}
}
} while (ind & !pi_rq);
/* If not a JRST clear the upper half of AR. */
if (IR != 0254) {
AR &= RMASK;
}
@ -5776,7 +5778,7 @@ dpnorm:
hst[hst_p].mb = AR;
}
MQ = 0;
AR = SWAP_AR;
AR = AR << 18; /* Move to upper half */
goto ufa;
}
#endif
@ -6223,7 +6225,7 @@ fnorm:
if (((SC & 0400) != 0) ^ ((SC & 0200) != 0))
fxu_hold_set = 1;
#endif
if (IR != 0130) { /* !UFA */
if (IR != 0130 && IR != 0247) { /* !UFA and WAITS FIX */
fnormx:
while (AR != 0 && ((AR & FPSBIT) != 0) == ((AR & FPNBIT) != 0) &&
((AR & FPNBIT) != 0) == ((AR & FP1BIT) != 0)) {
@ -6293,6 +6295,18 @@ fnormx:
check_apr_irq();
}
#endif
#if WAITS
/* WAITS FIX Instruction. This can't occur if WAITS not set */
if (IR == 0247) {
/* Extend sign if negative */
if (flag1)
AR |= EMASK;
set_reg(AC, AR);
break;
}
#endif
/* Set exponent */
SCAD = SC ^ ((AR & SMASK) ? 0377 : 0);
AR &= SMASK|MMASK;
AR |= ((uint64)(SCAD & 0377)) << 27;
@ -6304,6 +6318,7 @@ fnormx:
MQ |= SMASK;
}
#else
/* FADL FSBL FMPL */
if ((IR & 07) == 1) {
SC = (SC + (0777 ^ 26)) & 0777;
@ -6316,14 +6331,13 @@ fnormx:
}
}
#endif
/* Kill exponent if 0 */
if ((AR & MMASK) == 0)
AR = 0;
/* Handle UFA */
if (IR == 0130) {
set_reg(AC + 1, AR);
break;
}
break;

View file

@ -448,6 +448,7 @@ extern DEVICE dt_dev;
extern DEVICE pmp_dev;
extern DEVICE dk_dev;
extern DEVICE pd_dev;
extern DEVICE pclk_dev;
extern DEVICE dpy_dev;
extern DEVICE iii_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_III (WAITS * USE_DISPLAY)
#define NUM_DEVS_PD ITS | KL_ITS
#define NUM_DEVS_PCLK WAITS
#define NUM_DEVS_IMX ITS
#define NUM_DEVS_STK ITS
#define NUM_DEVS_TK10 ITS

View file

@ -43,9 +43,10 @@
#define MARGIN 6
#define UNIT_V_CT (UNIT_V_UF + 0)
#define UNIT_CT (3 << UNIT_V_CT)
#define UNIT_UC (1 << UNIT_V_CT)
#define UNIT_UTF8 (2 << UNIT_V_CT)
#define UNIT_CT (3 << UNIT_V_CT)
#define UNIT_WA (3 << UNIT_V_CT)
#define PI_DONE 000007
#define PI_ERROR 000070
@ -98,8 +99,9 @@ REG lpt_reg[] = {
MTAB lpt_mod[] = {
{UNIT_CT, 0, "Lower case", "LC", NULL},
{UNIT_CT, UNIT_UC, "Upper case", "UC", NULL},
{UNIT_CT, UNIT_UTF8, "UTF8 ouput", "UTF8", NULL},
{UNIT_CT, UNIT_UC, "Upper case", "UC", NULL, NULL, NULL, "Fold lower to upper case"},
{UNIT_CT, UNIT_UTF8, "UTF8 ouput", "UTF8", NULL, NULL, NULL, "Extended character set"},
{UNIT_CT, UNIT_WA, "WAITS ouput", "WAITS", NULL, NULL, NULL, "Waits character set"},
{MTAB_XTD|MTAB_VUN|MTAB_VALR, 0, "LINESPERPAGE", "LINESPERPAGE",
&lpt_setlpp, &lpt_getlpp, NULL, "Number of lines per page"},
{MTAB_XTD|MTAB_VUN|MTAB_VALR, 0, "DEV", "DEV",
@ -210,37 +212,73 @@ lpt_printline(UNIT *uptr, int nl) {
}
uint16 utf_code[32] = {
0x0000, /* Dot */
0x2193, /* Down arrow */
0x237a, /* APL Alpha */
0x03b2, /* Beta */
0x039b, /* Lambda */
0x2510, /* Box light down and left */
0x03b5, /* Epsilon */
0x03d6, /* Pi */
0x03bb, /* Lambda */
0x221d, /* proportional */
0x222b, /* Integral */
0x00b1, /* Plus minus */
0x2295, /* Circle plus */
0x221e, /* Infinity */
0x2202, /* Partial derivitive */
0x2282, /* Subset of */
0x2283, /* Superset of */
0x2229, /* Intersection */
0x222a, /* union */
0x2200, /* For all */
0x2203, /* Exists */
0x2295, /* Circle plus */
0x2194, /* Left right arrow */
0x2227, /* Logical and */
0x2192, /* Rightwards arror */
0x2014, /* Em dash */
0x2260, /* Not equal */
0x2264, /* Less than or equal */
0x2265, /* Greater than or equal */
0x2261, /* Identical too */
0x2228 /* Logical or */
0x00b7, /* 000 - Dot */
0x2193, /* 001 - Down arrow */
0x03b1, /* 002 - Alpha */
0x03b2, /* 003 - Beta */
0x039b, /* 004 - Lambda */
0x2510, /* 005 - Box light down and left */
0x03b5, /* 006 - Epsilon */
0x03d6, /* 007 - Pi */
0x03bb, /* 010 - Lambda */
0x03b3, /* 011 - small gamma */
0x221d, /* 012 - proportional */
0x222b, /* 013 - Integral */
0x00b1, /* 014 - Plus minus */
0x2295, /* 015 - Circle plus */
0x221e, /* 016 - Infinity */
0x2202, /* 017 - Partial derivitive */
0x2282, /* 020 - Subset of */
0x2283, /* 021 - Superset of */
0x2229, /* 022 - Intersection */
0x222a, /* 023 - union */
0x2200, /* 024 - For all */
0x2203, /* 025 - Exists */
0x2295, /* 026 - Circle plus */
0x2194, /* 027 - Left right arrow */
0x2227, /* 030 - Logical and */
0x2192, /* 031 - Rightwards arror */
0x2014, /* 032 - Em dash */
0x2260, /* 033 - Not equal */
0x2264, /* 034 - Less than or equal */
0x2265, /* 035 - Greater than or equal */
0x2261, /* 036 - Identical too */
0x2228 /* 037 - Logical or */
};
uint16 waits_code[32] = {
0x00b7, /* 000 - Dot */
0x2193, /* 001 - Down arrow */
0x03b1, /* 002 - Alpha */
0x03b2, /* 003 - Beta */
0x2227, /* 004 - Boolean AND */
0x00ac, /* 005 - Boolean NOT */
0x03b5, /* 006 - Epsilon */
0x03d6, /* 007 - Pi */
0x03bb, /* 010 - Lambda */
0x03b3, /* 011 - small gamma */
0x03b4, /* 012 - small delta */
0x222b, /* 013 - Integral */
0x00b1, /* 014 - Plus minus */
0x2295, /* 015 - Circle plus */
0x221e, /* 016 - Infinity */
0x2202, /* 017 - Partial derivitive */
0x2282, /* 020 - Subset of */
0x2283, /* 021 - Superset of */
0x2229, /* 022 - Intersection */
0x222a, /* 023 - union */
0x2200, /* 024 - For all */
0x2203, /* 025 - Exists */
0x2295, /* 026 - Circle plus */
0x2194, /* 027 - Left right arrow */
0x2190, /* 030 - underscore */
0x2192, /* 031 - Rightwards arror */
0x2191, /* 032 - Tilde */
0x2260, /* 033 - Not equal */
0x2264, /* 034 - Less than or equal */
0x2265, /* 035 - Greater than or equal */
0x2261, /* 036 - Identical too */
0x2228 /* 037 - Logical or */
};
/* Unit service */
@ -251,9 +289,9 @@ lpt_output(UNIT *uptr, char c) {
return;
if (uptr->COL == 132)
lpt_printline(uptr, 1);
if ((uptr->flags & UNIT_UC) && (c & 0140) == 0140)
if (((uptr->flags & UNIT_CT) == UNIT_UC) && (c & 0140) == 0140)
c &= 0137;
if ((uptr->flags & UNIT_UTF8) && c < 040) {
if (((uptr->flags & UNIT_CT) == UNIT_UTF8) && c < 040) {
uint16 u = utf_code[c & 0x1f];
if (u > 0x7ff) {
lpt_buffer[uptr->POS++] = 0xe0 + ((u >> 12) & 0xf);
@ -266,6 +304,23 @@ lpt_output(UNIT *uptr, char c) {
lpt_buffer[uptr->POS++] = u & 0x7f;
}
uptr->COL++;
} else if ((uptr->flags & UNIT_CT) == UNIT_WA) {
uint16 u = c & 0x7f;
if (c < 040)
u = waits_code[c & 0x1f];
else if (c == 0136) /* up arrow */
u = 0x2191;
if (u > 0x7ff) {
lpt_buffer[uptr->POS++] = 0xe0 + ((u >> 12) & 0xf);
lpt_buffer[uptr->POS++] = 0x80 + ((u >> 6) & 0x3f);
lpt_buffer[uptr->POS++] = 0x80 + (u & 0x3f);
} else if (u > 0x7f) {
lpt_buffer[uptr->POS++] = 0xc0 + ((u >> 6) & 0x3f);
lpt_buffer[uptr->POS++] = 0x80 + (u & 0x3f);
} else {
lpt_buffer[uptr->POS++] = u & 0x7f;
}
uptr->COL++;
} else if (c >= 040 && c < 0177) {
lpt_buffer[uptr->POS++] = c;
uptr->COL++;

View file

@ -209,7 +209,7 @@ t_stat ptp_attach (UNIT *uptr, CONST char *cptr)
{
t_stat reason;
sim_switches |= SWMASK ('A'); /* Default to Append to existing file */
sim_switches |= SWMASK ('A'); /* Position to EOF */
reason = attach_unit (uptr, cptr);
uptr->STATUS &= ~NO_TAPE_PP;
return reason;

View file

@ -156,6 +156,9 @@ DEVICE *sim_devices[] = {
#if (NUM_DEVS_PD > 0)
&pd_dev,
#endif
#if (NUM_DEVS_PCLK > 0)
&pclk_dev,
#endif
#if (NUM_DEVS_DPY > 0)
&dpy_dev,
#if (NUM_DEVS_WCNSLS > 0)