Exemple #1
0
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;
}
Exemple #2
0
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;
}
Exemple #3
0
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;
}
Exemple #4
0
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;
}
Exemple #5
0
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;
}
Exemple #6
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'  */