Exemple #1
0
uint32 mtdio (uint32 select_code, IOSIG signal, uint32 data)
{
const IOSIG base_signal = IOBASE (signal);              /* derive base signal */

switch (base_signal) {                                  /* dispatch base I/O signal */

    case ioCLF:                                         /* clear flag flip-flop */
        mtd_flag = mtd_flagbuf = CLEAR;
        break;

    case ioSTF:                                         /* set flag flip-flop */
    case ioENF:                                         /* enable flag */
        mtd_flag = mtd_flagbuf = SET;
        break;

    case ioSFC:                                         /* skip if flag is clear */
        setstdSKF (mtd);
        break;

    case ioSFS:                                         /* skip if flag is set */
        setstdSKF (mtd);
        break;

    case ioIOI:                                         /* I/O data input */
        data = mtc_unit.buf;
        break;

    case ioIOO:                                         /* I/O data output */
        mtc_unit.buf = data & 0377;                     /* store data */
        break;

    case ioPOPIO:                                       /* power-on preset to I/O */
        mt_clear ();                                    /* issue CLR to controller */
        mtd_flag = mtd_flagbuf = CLEAR;                 /* clear flag and flag buffer */
                                                        /* fall into CRS handler */
    case ioCRS:                                         /* control reset */
        break;

    case ioCLC:                                         /* clear control flip-flop */
        mtc_dtf = 0;                                    /* clr xfer flop */
        mtd_flag = mtd_flagbuf = CLEAR;                 /* clear flag and flag buffer */
        break;

    case ioSIR:                                         /* set interrupt request */
        setstdSRQ (select_code, mtd);                   /* set standard SRQ signal */
        break;

    default:                                            /* all other signals */
        break;                                          /*   are ignored */
    }

if (signal > ioCLF)                                     /* multiple signals? */
    mtdio (select_code, ioCLF, 0);                      /* issue CLF */
else if (signal > ioSIR)                                /* signal affected interrupt status? */
    mtdio (select_code, ioSIR, 0);                      /* set interrupt request */

return data;
}
Exemple #2
0
uint32 ttyio (DIB *dibptr, IOCYCLE signal_set, uint32 stat_data)
{
uint16 data;
IOSIGNAL signal;
IOCYCLE  working_set = IOADDSIR (signal_set);           /* add ioSIR if needed */

while (working_set) {
    signal = IONEXT (working_set);                      /* isolate next signal */

    switch (signal) {                                   /* dispatch I/O signal */

        case ioCLF:                                     /* clear flag flip-flop */
            tty.flag = tty.flagbuf = CLEAR;
            break;


        case ioSTF:                                     /* set flag flip-flop */
        case ioENF:                                     /* enable flag */
            tty.flag = tty.flagbuf = SET;
            break;


        case ioSFC:                                     /* skip if flag is clear */
            setstdSKF (tty);
            break;


        case ioSFS:                                     /* skip if flag is set */
            setstdSKF (tty);
            break;


        case ioIOI:                                     /* I/O data input */
            data = tty_buf;

            if (!(tty_mode & TM_KBD) && sim_is_active (&tty_unit[TTO]))
                data = data | TP_BUSY;

            stat_data = IORETURN (SCPE_OK, data);       /* merge in return status */
            break;


        case ioIOO:                                     /* I/O data output */
            data = IODATA (stat_data);                  /* clear supplied status */

            if (data & TM_MODE)
                tty_mode = data & (TM_KBD|TM_PRI|TM_PUN);

            tty_buf = data & 0377;
            break;


        case ioCRS:                                     /* control reset */
            tty.control = CLEAR;                        /* clear control */
            tty.flag = tty.flagbuf = SET;               /* set flag and flag buffer */
            tty_mode = TM_KBD;                          /* set tty, clear print/punch */
            tty_shin = 0377;                            /* input inactive */
            tty_lf = 0;                                 /* no lf pending */
            break;


        case ioCLC:                                     /* clear control flip-flop */
            tty.control = CLEAR;
            break;


        case ioSTC:                                     /* set control flip-flop */
            tty.control = SET;

            if (!(tty_mode & TM_KBD))                   /* output? */
                sim_activate (&tty_unit[TTO], tty_unit[TTO].wait);
            break;


        case ioSIR:                                     /* set interrupt request */
            setstdPRL (tty);                            /* set standard PRL signal */
            setstdIRQ (tty);                            /* set standard IRQ signal */
            setstdSRQ (tty);                            /* set standard SRQ signal */
            break;


        case ioIAK:                                     /* interrupt acknowledge */
            tty.flagbuf = CLEAR;
            break;


        default:                                        /* all other signals */
            break;                                      /*   are ignored */
        }

    working_set = working_set & ~signal;                /* remove current signal from set */
    }

return stat_data;
}
Exemple #3
0
uint32 ptpio (DIB *dibptr, IOCYCLE signal_set, uint32 stat_data)
{
IOSIGNAL signal;
IOCYCLE  working_set = IOADDSIR (signal_set);           /* add ioSIR if needed */

while (working_set) {
    signal = IONEXT (working_set);                      /* isolate next signal */

    switch (signal) {                                   /* dispatch I/O signal */

        case ioCLF:                                     /* clear flag flip-flop */
            ptp.flag = ptp.flagbuf = CLEAR;
            break;


        case ioSTF:                                     /* set flag flip-flop */
        case ioENF:                                     /* enable flag */
            ptp.flag = ptp.flagbuf = SET;
            break;


        case ioSFC:                                     /* skip if flag is clear */
            setstdSKF (ptp);
            break;


        case ioSFS:                                     /* skip if flag is set */
            setstdSKF (ptp);
            break;


        case ioIOI:                                         /* I/O data input */
            if ((ptp_unit.flags & UNIT_ATT) == 0)           /* not attached? */
                stat_data = IORETURN (SCPE_OK, PTP_LOW);    /* report as out of tape */
            else
                stat_data = IORETURN (SCPE_OK, 0);
            break;


        case ioIOO:                                     /* I/O data output */
            ptp_unit.buf = IODATA (stat_data);          /* clear supplied status */
            break;


        case ioPOPIO:                                   /* power-on preset to I/O */
            ptp.flag = ptp.flagbuf = SET;               /* set flag and flag buffer */
            ptp_unit.buf = 0;                           /* clear output buffer */
            break;


        case ioCRS:                                     /* control reset */
        case ioCLC:                                     /* clear control flip-flop */
            ptp.control = CLEAR;
            break;


        case ioSTC:                                     /* set control flip-flop */
            ptp.control = SET;
            sim_activate (&ptp_unit, ptp_unit.wait);
            break;


        case ioSIR:                                     /* set interrupt request */
            setstdPRL (ptp);                            /* set standard PRL signal */
            setstdIRQ (ptp);                            /* set standard IRQ signal */
            setstdSRQ (ptp);                            /* set standard SRQ signal */
            break;


        case ioIAK:                                     /* interrupt acknowledge */
            ptp.flagbuf = CLEAR;
            break;


        default:                                        /* all other signals */
            break;                                      /*   are ignored */
        }

    working_set = working_set & ~signal;                /* remove current signal from set */
    }

return stat_data;
}
Exemple #4
0
uint32 clkio (DIB *dibptr, IOCYCLE signal_set, uint32 stat_data)
{
IOSIGNAL signal;
IOCYCLE  working_set = IOADDSIR (signal_set);           /* add ioSIR if needed */

while (working_set) {
    signal = IONEXT (working_set);                      /* isolate next signal */

    switch (signal) {                                   /* dispatch I/O signal */

        case ioCLF:                                     /* clear flag flip-flop */
            clk.flag = clk.flagbuf = CLEAR;
            break;


        case ioSTF:                                     /* set flag flip-flop */
        case ioENF:                                     /* enable flag */
            clk.flag = clk.flagbuf = SET;
            break;


        case ioSFC:                                     /* skip if flag is clear */
            setstdSKF (clk);
            break;


        case ioSFS:                                     /* skip if flag is set */
            setstdSKF (clk);
            break;


        case ioIOI:                                     /* I/O data input */
            stat_data = IORETURN (SCPE_OK, clk_error);  /* merge in return status */
            break;


        case ioIOO:                                     /* I/O data output */
            clk_select = IODATA (stat_data) & 07;       /* save select */
            sim_cancel (&clk_unit);                     /* stop the clock */
            clk.control = CLEAR;                        /* clear control */
            working_set = working_set | ioSIR;          /* set interrupt request (IOO normally doesn't) */
            break;


        case ioPOPIO:                                   /* power-on preset to I/O */
            clk.flag = clk.flagbuf = SET;               /* set flag and flag buffer */
            break;


        case ioCRS:                                     /* control reset */
        case ioCLC:                                     /* clear control flip-flop */
            clk.control = CLEAR;
            sim_cancel (&clk_unit);                     /* deactivate unit */
            break;


        case ioSTC:                                             /* set control flip-flop */
            clk.control = SET;
            if (clk_unit.flags & UNIT_DIAG)                     /* diag mode? */
                clk_unit.flags = clk_unit.flags & ~UNIT_IDLE;   /* not calibrated */
            else
                clk_unit.flags = clk_unit.flags | UNIT_IDLE;    /* is calibrated */

            if (!sim_is_active (&clk_unit)) {                   /* clock running? */
                clk_tick = clk_delay (0);                       /* get tick count */

                if ((clk_unit.flags & UNIT_DIAG) == 0)          /* calibrated? */
                    if (clk_select == 2)                        /* 10 msec. interval? */
                        clk_tick = sync_poll (INITIAL);         /* sync poll */
                    else
                        sim_rtcn_init (clk_tick, TMR_CLK);      /* initialize timer */

                sim_activate (&clk_unit, clk_tick);             /* start clock */
                clk_ctr = clk_delay (1);                        /* set repeat ctr */
                }
            clk_error = 0;                                      /* clear error */
            break;


        case ioSIR:                                     /* set interrupt request */
            setstdPRL (clk);                            /* set standard PRL signal */
            setstdIRQ (clk);                            /* set standard IRQ signal */
            setstdSRQ (clk);                            /* set standard SRQ signal */
            break;


        case ioIAK:                                     /* interrupt acknowledge */
            clk.flagbuf = CLEAR;
            break;


        default:                                        /* all other signals */
            break;                                      /*   are ignored */
        }

    working_set = working_set & ~signal;                /* remove current signal from set */
    }

return stat_data;
}
Exemple #5
0
uint32 dqcio (DIB *dibptr, IOCYCLE signal_set, uint32 stat_data)
{
int32 fnc, drv;
IOSIGNAL signal;
IOCYCLE  working_set = IOADDSIR (signal_set);           /* add ioSIR if needed */

while (working_set) {
    signal = IONEXT (working_set);                      /* isolate next signal */

    switch (signal) {                                   /* dispatch I/O signal */

        case ioCLF:                                     /* clear flag flip-flop */
            dqc.flag = dqc.flagbuf = CLEAR;
            break;


        case ioSTF:                                     /* set flag flip-flop */
        case ioENF:                                     /* enable flag */
            dqc.flag = dqc.flagbuf = SET;
            break;


        case ioSFC:                                     /* skip if flag is clear */
            setstdSKF (dqc);
            break;


        case ioSFS:                                     /* skip if flag is set */
            setstdSKF (dqc);
            break;


        case ioIOI:                                     /* I/O data input */
            stat_data = IORETURN (SCPE_OK, 0);          /* no data */
            break;


        case ioIOO:                                     /* I/O data output */
            dqc_obuf = IODATA (stat_data);              /* clear supplied status */
            break;


        case ioPOPIO:                                   /* power-on preset to I/O */
            dqc.flag = dqc.flagbuf = SET;               /* set flag and flag buffer */
            dqc_obuf = 0;                               /* clear output buffer */
            break;


        case ioCRS:                                     /* control reset */
        case ioCLC:                                     /* clear control flip-flop */
            dqc.command = CLEAR;                        /* clear command */
            dqc.control = CLEAR;                        /* clear control */

            if (dqc_busy)
                sim_cancel (&dqc_unit[dqc_busy - 1]);

            sim_cancel (&dqd_unit);                     /* cancel dch */
            dqd_xfer = 0;                               /* clr dch xfer */
            dqc_busy = 0;                               /* clr busy */
            break;


        case ioSTC:                                     /* set control flip-flop */
            dqc.control = SET;                          /* set ctl */

            if (!dqc.command) {                         /* cmd clr? */
                dqc.command = SET;                      /* set cmd */
                drv = CW_GETDRV (dqc_obuf);             /* get fnc, drv */
                fnc = CW_GETFNC (dqc_obuf);             /* from cmd word */

                switch (fnc) {                          /* case on fnc */
                    case FNC_SEEK: case FNC_RCL:        /* seek, recal */
                    case FNC_CHK:                       /* check */
                        dqc_sta[drv] = 0;               /* clear status */
                    case FNC_STA: case FNC_LA:          /* rd sta, load addr */
                        dq_god (fnc, drv, dqc_dtime);   /* sched dch xfer */
                        break;
                    case FNC_RD: case FNC_WD:           /* read, write */
                    case FNC_RA: case FNC_WA:           /* rd addr, wr addr */
                    case FNC_AS:                        /* address skip */
                        dq_goc (fnc, drv, dqc_ctime);   /* sched drive */
                        break;
                    }                                   /* end case */
                }                                       /* end if !CMD */
            break;


        case ioSIR:                                     /* set interrupt request */
            setstdPRL (dqc);                            /* set standard PRL signal */
            setstdIRQ (dqc);                            /* set standard IRQ signal */
            setstdSRQ (dqc);                            /* set standard SRQ signal */
            break;


        case ioIAK:                                     /* interrupt acknowledge */
            dqc.flagbuf = CLEAR;
            break;


        default:                                        /* all other signals */
            break;                                      /*   are ignored */
        }

    working_set = working_set & ~signal;                /* remove current signal from set */
    }
return stat_data;
}
Exemple #6
0
uint32 dqdio (DIB *dibptr, IOCYCLE signal_set, uint32 stat_data)
{
IOSIGNAL signal;
IOCYCLE  working_set = IOADDSIR (signal_set);           /* add ioSIR if needed */

while (working_set) {
    signal = IONEXT (working_set);                      /* isolate next signal */

    switch (signal) {                                   /* dispatch I/O signal */

        case ioCLF:                                     /* clear flag flip-flop */
            dqd.flag = dqd.flagbuf = CLEAR;
            break;


        case ioSTF:                                     /* set flag flip-flop */
        case ioENF:                                     /* enable flag */
            dqd.flag = dqd.flagbuf = SET;
            break;


        case ioSFC:                                     /* skip if flag is clear */
            setstdSKF (dqd);
            break;


        case ioSFS:                                     /* skip if flag is set */
            setstdSKF (dqd);
            break;


        case ioIOI:                                     /* I/O data input */
            stat_data = IORETURN (SCPE_OK, dqd_ibuf);   /* merge in return status */
            break;


        case ioIOO:                                     /* I/O data output */
            dqd_obuf = IODATA (stat_data);              /* clear supplied status */

            if (!dqc_busy || dqd_xfer)
                dqd_wval = 1;                           /* if !overrun, valid */
            break;


        case ioPOPIO:                                   /* power-on preset to I/O */
            dqd.flag = dqd.flagbuf = SET;               /* set flag and flag buffer */
            dqd_obuf = 0;                               /* clear output buffer */
            break;


        case ioCRS:                                     /* control reset */
            dqd.command = CLEAR;                        /* clear command */
                                                        /* fall into CLC handler */

        case ioCLC:                                     /* clear control flip-flop */
            dqd.control = CLEAR;                        /* clear control */
            dqd_xfer = 0;                               /* clr xfer */
            break;


        case ioSTC:                                     /* set control flip-flop */
            dqd.command = SET;                          /* set ctl, cmd */
            dqd.control = SET;

            if (dqc_busy && !dqd_xfer)                  /* overrun? */
                dqc_sta[dqc_busy - 1] |= STA_DTE;
            break;


        case ioSIR:                                     /* set interrupt request */
            setstdPRL (dqd);                            /* set standard PRL signal */
            setstdIRQ (dqd);                            /* set standard IRQ signal */
            setstdSRQ (dqd);                            /* set standard SRQ signal */
            break;


        case ioIAK:                                     /* interrupt acknowledge */
            dqd.flagbuf = CLEAR;
            break;


        default:                                        /* all other signals */
            break;                                      /*   are ignored */
        }

    working_set = working_set & ~signal;                /* remove current signal from set */
    }

return stat_data;
}
Exemple #7
0
uint32 mtcio (uint32 select_code, IOSIG signal, uint32 data)
{
const IOSIG base_signal = IOBASE (signal);              /* derive base signal */
uint32 i;
int32 valid;

switch (base_signal) {                                  /* dispatch base I/O signal */

    case ioCLF:                                         /* clear flag flip-flop */
        mtc_flag = mtc_flagbuf = CLEAR;
        break;


    case ioSTF:                                         /* set flag flip-flop */
    case ioENF:                                         /* enable flag */
        mtc_flag = mtc_flagbuf = SET;
        break;


    case ioSFC:                                         /* skip if flag is clear */
        setstdSKF (mtc);
        break;


    case ioSFS:                                         /* skip if flag is set */
        setstdSKF (mtc);
        break;


    case ioIOI:                                         /* I/O data input */
        data = mtc_sta & ~(STA_LOCAL | STA_WLK | STA_BUSY);

        if (mtc_unit.flags & UNIT_ATT) {                /* construct status */
            if (sim_is_active (&mtc_unit))
                data = data | STA_BUSY;

            if (sim_tape_wrp (&mtc_unit))
                data = data | STA_WLK;
            }
        else
            data = data | STA_BUSY | STA_LOCAL;
        break;


    case ioIOO:                                         /* I/O data output */
        data = data & 0377;
        mtc_sta = mtc_sta & ~STA_REJ;                   /* clear reject */

        if (data == FNC_CLR) {                          /* clear? */
            mt_clear ();                                /* send CLR to controller */

            mtd_flag = mtd_flagbuf = CLEAR;             /* clear data flag and flag buffer */
            mtc_flag = mtc_flagbuf = SET;               /* set command flag and flag buffer */
            break;                                      /* command completes immediately */
            }

        for (i = valid = 0; i < sizeof (mtc_cmd); i++)  /* is fnc valid? */
            if (data == mtc_cmd[i])
                valid = 1;

        if (!valid || sim_is_active (&mtc_unit) ||      /* is cmd valid? */
           ((mtc_sta & STA_BOT) && (data == FNC_BSR)) ||
           (sim_tape_wrp (&mtc_unit) &&
             ((data == FNC_WC) || (data == FNC_GAP) || (data == FNC_WFM))))
            mtc_sta = mtc_sta | STA_REJ;

        else {
            sim_activate (&mtc_unit, mtc_ctime);        /* start tape */
            mtc_fnc = data;                             /* save function */
            mtc_sta = STA_BUSY;                         /* unit busy */
            mt_ptr = 0;                                 /* init buffer ptr */

            mtcio (select_code, ioCLF, 0);              /* clear flags */
            mtcio (mtd_dib.devno, ioCLF, 0);

            mtc_1st = 1;                                /* set 1st flop */
            mtc_dtf = 1;                                /* set xfer flop */
            }
        break;


    case ioPOPIO:                                       /* power-on preset to I/O */
        mtc_flag = mtc_flagbuf = CLEAR;                 /* clear flag and flag buffer */
                                                        /* fall into CRS handler */

    case ioCRS:                                         /* control reset */
                                                        /* fall into CLC handler */

    case ioCLC:                                         /* clear control flip-flop */
        mtc_control = CLEAR;
        break;


    case ioSTC:                                         /* set control flip-flop */
        mtc_control = SET;
        break;


    case ioSIR:                                         /* set interrupt request */
        setstdPRL (select_code, mtc);                   /* set standard PRL signal */
        setstdIRQ (select_code, mtc);                   /* set standard IRQ signal */
        setstdSRQ (select_code, mtc);                   /* set standard SRQ signal */
        break;

    case ioIAK:                                         /* interrupt acknowledge */
        mtc_flagbuf = CLEAR;
        break;


    default:                                            /* all other signals */
        break;                                          /*   are ignored */
    }


if (signal > ioCLF)                                     /* multiple signals? */
    mtcio (select_code, ioCLF, 0);                      /* issue CLF */
else if (signal > ioSIR)                                /* signal affected interrupt status? */
    mtcio (select_code, ioSIR, 0);                      /* set interrupt request */

return data;
}
Exemple #8
0
uint32 lptio (DIB *dibptr, IOCYCLE signal_set, uint32 stat_data)
{
uint16 data;
IOSIGNAL signal;
IOCYCLE  working_set = IOADDSIR (signal_set);           /* add ioSIR if needed */

while (working_set) {
    signal = IONEXT (working_set);                      /* isolate next signal */

    switch (signal) {                                   /* dispatch I/O signal */

        case ioCLF:                                     /* clear flag flip-flop */
            lpt.flag = lpt.flagbuf = CLEAR;
            break;


        case ioSTF:                                     /* set flag flip-flop */
        case ioENF:                                     /* enable flag */
            lpt.flag = lpt.flagbuf = SET;
            break;


        case ioSFC:                                     /* skip if flag is clear */
            setstdSKF (lpt);
            break;


        case ioSFS:                                     /* skip if flag is set */
            setstdSKF (lpt);
            break;


        case ioIOI:                                         /* I/O data input */
            data = 0;

            if (lpt_unit.flags & UNIT_POWEROFF)             /* power off? */
                data = LPT_PWROFF;

            else if (!(lpt_unit.flags & UNIT_OFFLINE)) {    /* online? */
                if (lpt_unit.flags & UNIT_ATT) {            /* paper loaded? */
                    data = LPT_RDY;
                    if (!sim_is_active (&lpt_unit))         /* printer busy? */
                        data = data | LPT_NBSY;
                    }

                else if (lpt_lcnt == LPT_PAGELNT - 1)       /* paper out, at BOF? */
                    data = LPT_PAPO;
                }

            stat_data = IORETURN (SCPE_OK, data);           /* merge in return status */
            break;


        case ioIOO:                                     /* I/O data output */
            lpt_unit.buf = IODATA (stat_data) & (LPT_CTL | 0177);
            break;


        case ioPOPIO:                                   /* power-on preset to I/O */
            lpt.flag = lpt.flagbuf = SET;               /* set flag and flag buffer */
            lpt_unit.buf = 0;                           /* clear output buffer */
            break;

        case ioCRS:                                     /* control reset */
        case ioCLC:                                     /* clear control flip-flop */
            lpt.control = CLEAR;
            break;


        case ioSTC:                                     /* set control flip-flop */
            lpt.control = SET;
            sim_activate (&lpt_unit,                    /* schedule op */
                (lpt_unit.buf & LPT_CTL)? lpt_ptime: lpt_ctime);
            break;


        case ioSIR:                                     /* set interrupt request */
            setstdPRL (lpt);                            /* set standard PRL signal */
            setstdIRQ (lpt);                            /* set standard IRQ signal */
            setstdSRQ (lpt);                            /* set standard SRQ signal */
            break;


        case ioIAK:                                     /* interrupt acknowledge */
            lpt.flagbuf = CLEAR;
            break;


        default:                                        /* all other signals */
            break;                                      /*   are ignored */
        }

    working_set = working_set & ~signal;                /* remove current signal from set */
    }

return stat_data;
}
Exemple #9
0
uint32 lptio (uint32 select_code, IOSIG signal, uint32 data)
{
const IOSIG base_signal = IOBASE (signal);              /* derive base signal */

switch (base_signal) {                                  /* dispatch base I/O signal */

    case ioCLF:                                         /* clear flag flip-flop */
        lpt_flag = lpt_flagbuf = CLEAR;
        break;


    case ioSTF:                                         /* set flag flip-flop */
    case ioENF:                                         /* enable flag */
        lpt_flag = lpt_flagbuf = SET;
        break;


    case ioSFC:                                         /* skip if flag is clear */
        setstdSKF (lpt);
        break;


    case ioSFS:                                         /* skip if flag is set */
        setstdSKF (lpt);
        break;


    case ioIOI:                                         /* I/O data input */
        if (lpt_unit.flags & UNIT_POWEROFF)             /* power off? */
            data = LPT_PWROFF;

        else if (!(lpt_unit.flags & UNIT_OFFLINE)) {    /* online? */
            if (lpt_unit.flags & UNIT_ATT) {            /* paper loaded? */
                data = LPT_RDY;
                if (!sim_is_active (&lpt_unit))         /* printer busy? */
                    data = data | LPT_NBSY;
                }

            else if (lpt_lcnt == LPT_PAGELNT - 1)       /* paper out, at BOF? */
                data = LPT_PAPO;
            }

        else
            data = 0;
        break;


    case ioIOO:                                         /* I/O data output */
        lpt_unit.buf = data & (LPT_CTL | 0177);
        break;


    case ioPOPIO:                                       /* power-on preset to I/O */
        lpt_flag = lpt_flagbuf = SET;                   /* set flag and flag buffer */
        lpt_unit.buf = 0;                               /* clear output buffer */
                                                        /* fall into CRS handler */

    case ioCRS:                                         /* control reset */
                                                        /* fall into CLC handler */

    case ioCLC:                                         /* clear control flip-flop */
        lpt_control = CLEAR;
        break;


    case ioSTC:                                         /* set control flip-flop */
        lpt_control = SET;
        sim_activate (&lpt_unit,                        /* schedule op */
            (lpt_unit.buf & LPT_CTL)? lpt_ptime: lpt_ctime);
        break;


    case ioSIR:                                         /* set interrupt request */
        setstdPRL (select_code, lpt);                   /* set standard PRL signal */
        setstdIRQ (select_code, lpt);                   /* set standard IRQ signal */
        setstdSRQ (select_code, lpt);                   /* set standard SRQ signal */
        break;


    case ioIAK:                                         /* interrupt acknowledge */
        lpt_flagbuf = CLEAR;
        break;


    default:                                            /* all other signals */
        break;                                          /*   are ignored */
    }


if (signal > ioCLF)                                     /* multiple signals? */
    lptio (select_code, ioCLF, 0);                      /* issue CLF */
else if (signal > ioSIR)                                /* signal affected interrupt status? */
    lptio (select_code, ioSIR, 0);                      /* set interrupt request */

return data;
}