int32 lpt (int32 pulse, int32 code, int32 AC) { if (code == ioDOA) lpt_unit.buf = AC & 0177 ; switch (pulse) { /* decode IR<8:9> */ case iopS: /* start */ DEV_SET_BUSY( INT_LPT ) ; DEV_CLR_DONE( INT_LPT ) ; DEV_UPDATE_INTR ; if ( lpt_unit.wait ) if ( (lpt_unit.buf == 015) || (lpt_unit.buf == 014) || (lpt_unit.buf == 012) ) { sim_activate (&lpt_unit, lpt_unit.wait); break ; } return (lpt_svc (&lpt_unit) << IOT_V_REASON); break; case iopC: /* clear */ DEV_CLR_BUSY( INT_LPT ) ; DEV_CLR_DONE( INT_LPT ) ; DEV_UPDATE_INTR ; sim_cancel (&lpt_unit); /* deactivate unit */ break; } /* end switch */ return 0; }
int32 clk (int32 pulse, int32 code, int32 AC) { if (code == ioDOA) { /* DOA */ clk_sel = AC & 3; /* save select */ sim_rtc_init (clk_time[clk_sel]); /* init calibr */ } switch (pulse) { /* decode IR<8:9> */ case iopS: /* start */ DEV_SET_BUSY( INT_CLK ) ; DEV_CLR_DONE( INT_CLK ) ; DEV_UPDATE_INTR ; if (!sim_is_active (&clk_unit)) /* not running? */ sim_activate (&clk_unit, /* activate */ sim_rtc_init (clk_time[clk_sel])); /* init calibr */ break; case iopC: /* clear */ DEV_CLR_BUSY( INT_CLK ) ; DEV_CLR_DONE( INT_CLK ) ; DEV_UPDATE_INTR ; sim_cancel (&clk_unit); /* deactivate unit */ break; } /* end switch */ return 0; }
int32 tti (int32 pulse, int32 code, int32 AC) { int32 iodata; if (code == ioDIA) iodata = tti_unit.buf & 0377; else iodata = 0; switch (pulse) { /* decode IR<8:9> */ case iopS: /* start */ DEV_SET_BUSY( INT_TTI ) ; DEV_CLR_DONE( INT_TTI ) ; DEV_UPDATE_INTR ; break; case iopC: /* clear */ DEV_CLR_BUSY( INT_TTI ) ; DEV_CLR_DONE( INT_TTI ) ; DEV_UPDATE_INTR ; break; } /* end switch */ return iodata; }
t_stat lpt_reset (DEVICE *dptr) { lpt_unit.buf = 0; /* (not DG compatible) */ DEV_CLR_BUSY( INT_LPT ) ; DEV_CLR_DONE( INT_LPT ) ; DEV_UPDATE_INTR ; sim_cancel (&lpt_unit); /* deactivate unit */ return SCPE_OK; }
t_stat tto_reset (DEVICE *dptr) { tto_unit.buf = 0; /* <not DG compatible!> */ DEV_CLR_BUSY( INT_TTO ) ; DEV_CLR_DONE( INT_TTO ) ; DEV_UPDATE_INTR ; sim_cancel (&tto_unit); /* deactivate unit */ return SCPE_OK; }
t_stat tti_reset (DEVICE *dptr) { tti_unit.buf = 0; /* <not DG compatible> */ DEV_CLR_BUSY( INT_TTI ) ; DEV_CLR_DONE( INT_TTI ) ; DEV_UPDATE_INTR ; sim_activate (&tti_unit, tti_unit.wait); /* activate unit */ return SCPE_OK; }
t_stat clk_reset (DEVICE *dptr) { clk_sel = 0; DEV_CLR_BUSY( INT_CLK ) ; DEV_CLR_DONE( INT_CLK ) ; DEV_UPDATE_INTR ; sim_cancel (&clk_unit); /* deactivate unit */ tmxr_poll = clk_time[0]; /* poll is default */ return SCPE_OK; }
t_stat lpt_svc (UNIT *uptr) { DEV_CLR_BUSY( INT_LPT ) ; DEV_SET_DONE( INT_LPT ) ; DEV_UPDATE_INTR ; if ((lpt_unit.flags & UNIT_ATT) == 0) /* attached? */ return IORETURN (lpt_stopioe, SCPE_UNATT); fputc (uptr->buf, uptr->fileref); uptr->pos = ftell (uptr->fileref); if (ferror (uptr->fileref)) { sim_perror ("LPT I/O error"); clearerr (uptr->fileref); return SCPE_IOERR; } return SCPE_OK; }
t_stat lpt_svc (UNIT *uptr) { DEV_CLR_BUSY( INT_LPT ) ; DEV_SET_DONE( INT_LPT ) ; DEV_UPDATE_INTR ; if ((lpt_unit.flags & UNIT_ATT) == 0) /* attached? */ return IORETURN (lpt_stopioe, SCPE_UNATT); pdflpt_putc (uptr, uptr->buf); uptr->pos = pdflpt_where (uptr, NULL); if (pdflpt_error (uptr)) { pdflpt_perror (uptr, "LPT I/O error"); pdflpt_clearerr (uptr); return SCPE_IOERR; } return SCPE_OK; }
t_stat tto_svc (UNIT *uptr) { int32 c; t_stat r; c = tto_unit.buf & 0177; if ((tto_unit.flags & UNIT_DASHER) && (c == 031)) c = '\b'; if ((r = sim_putchar_s (c)) != SCPE_OK) { /* output; error? */ sim_activate (uptr, uptr->wait); /* try again */ return ((r == SCPE_STALL)? SCPE_OK : r); /* !stall? report */ } DEV_CLR_BUSY( INT_TTO ) ; DEV_SET_DONE( INT_TTO ) ; DEV_UPDATE_INTR ; ++(tto_unit.pos); return SCPE_OK; }
t_stat clk_svc (UNIT *uptr) { int32 t; if ( DEV_IS_BUSY(INT_CLK) ) { DEV_CLR_BUSY( INT_CLK ) ; DEV_SET_DONE( INT_CLK ) ; DEV_UPDATE_INTR ; } t = sim_rtc_calb (clk_tps[clk_sel]); /* calibrate delay */ sim_activate (&clk_unit, t); /* reactivate unit */ if (clk_adj[clk_sel] > 0) /* clk >= 60Hz? */ tmxr_poll = t * clk_adj[clk_sel]; /* poll is longer */ else tmxr_poll = t / (-clk_adj[clk_sel]); /* poll is shorter */ return SCPE_OK; }
t_stat tti_svc (UNIT *uptr) { int32 temp; sim_activate (&tti_unit, tti_unit.wait); /* continue poll */ if ((temp = sim_poll_kbd ()) < SCPE_KFLAG) return temp; /* no char or error? */ tti_unit.buf = temp & 0177; if (tti_unit.flags & UNIT_DASHER) { if (tti_unit.buf == '\r') tti_unit.buf = '\n'; /* Dasher: cr -> nl */ else if (tti_unit.buf == '\n') tti_unit.buf = '\r' ; /* Dasher: nl -> cr */ } DEV_CLR_BUSY( INT_TTI ) ; DEV_SET_DONE( INT_TTI ) ; DEV_UPDATE_INTR ; ++(uptr->pos) ; return SCPE_OK; }
t_stat qty_common_reset( DIB * dibp, UNIT * unitp, DEVICE * dptr ) { if ((dptr->flags & DEV_DIS) == 0) { if (dptr == &qty_dev) alm_dev.flags |= DEV_DIS; else qty_dev.flags |= DEV_DIS; } qty_clear( TRUE ) ; DEV_CLR_BUSY( INT_QTY ) ; /* clear busy */ DEV_CLR_DONE( INT_QTY ) ; /* clear done, int */ DEV_UPDATE_INTR ; if ( QTY_MASTER_ACTIVE(&qty_desc) ) { sim_activate( unitp, tmxr_poll ) ; } else { sim_cancel( unitp ) ; } return ( SCPE_OK ) ; } /* end of 'qty_common_reset' */
int32 tto (int32 pulse, int32 code, int32 AC) { if (code == ioDOA) tto_unit.buf = AC & 0377; switch (pulse) { /* decode IR<8:9> */ case iopS: /* start */ DEV_SET_BUSY( INT_TTO ) ; DEV_CLR_DONE( INT_TTO ) ; DEV_UPDATE_INTR ; sim_activate (&tto_unit, tto_unit.wait); /* activate unit */ break; case iopC: /* clear */ DEV_CLR_BUSY( INT_TTO ) ; DEV_CLR_DONE( INT_TTO ) ; DEV_UPDATE_INTR ; sim_cancel (&tto_unit); /* deactivate unit */ break; } /* end switch */ return 0; }
int qty_update_status( DIB * dibp, TMXR * tmxr_desc ) { int line ; int status ; int txbusy ; /*----------------------------------------------*/ /* return global device status for current qty */ /* state. */ /* */ /* Receiver interrupts have higher priority */ /* than transmitter interrupts according to DG */ /* but this routine could be modified to use */ /* different priority criteria. */ /* */ /* Round-robin polling could also be used in */ /* some future release rather than starting */ /* with line 0 each time. */ /* */ /* Return <QTY_S_RI + line # + character> of */ /* first waiting character, else return */ /* <QTY_S_TI + line #> of first finished line */ /* output, else return 0. */ /* */ /* This routine does -not- clear input line */ /* BZ/DN flags; caller should do this. */ /* */ /* Global device done and busy flags are */ /* updated. */ /*----------------------------------------------*/ for ( txbusy = status = line = 0 ; line < qty_max ; ++line ) { txbusy |= (QTY_LINE_BIT_SET(line,QTY_L_TXBZ)) ; if ( QTY_LINE_BIT_SET(line,QTY_L_RXDN) ) { if ( ! status ) { status = QTY_LINE_BITS( line, QTY_S_DMASK ) | QTY_S_RI ; status = status | (line << 8) ; } break ; } else if ( QTY_LINE_BIT_SET(line,QTY_L_TXDN) ) { if ( ! (status & QTY_S_RI) ) if ( ! (status & QTY_S_RI) ) { status = QTY_S_TI ; status = status | (line << 8) ; } } } /* <we could check each line for TX busy to set DEV_SET_BUSY)?> */ DEV_CLR_BUSY( INT_QTY ) ; DEV_CLR_DONE( INT_QTY ) ; if ( txbusy ) { DEV_SET_BUSY( INT_QTY ) ; } if ( status & (QTY_S_RI | QTY_S_TI) ) { DEV_SET_DONE( INT_QTY ) ; } DEV_UPDATE_INTR ; /* update final intr status */ return ( status ) ; } /* end of 'qty_update_status' */