예제 #1
0
t_stat clk_svc (UNIT *uptr)
{
if (clk_dev.flags & DEV_DIS)                            /* disabled? */
    return SCPE_OK;
tmxr_poll = sim_rtcn_calb (CLK_TPS, TMR_CLK);           /* calibrate clock */
sim_activate (&clk_unit, tmxr_poll);                    /* reactivate unit */
clk_cntr = clk_cntr + CLK_CNTS;                         /* incr counter */
if ((clk_cntr % CLK_C32MS) == 0)                        /* 32ms interval? */
    dev_req_int (clk32ms_sbs);                          /* req intr */
if (clk_cntr >= CLK_C1MIN) {                            /* 1min interval? */
    dev_req_int (clk1min_sbs);                          /* req intr */
    clk_cntr = 0;                                       /* reset counter */
    }
return SCPE_OK;
}
예제 #2
0
t_stat tto_svc (UNIT *uptr)
{
int32 c;
t_stat r;

if (tty_buf == FIODEC_UC)                               /* upper case? */
    tty_uc = UC;
else if (tty_buf == FIODEC_LC)                          /* lower case? */
    tty_uc = 0;
else {
    c = fiodec_to_ascii[tty_buf | tty_uc];              /* translate */
    if (c && ((r = sim_putchar_s (c)) != SCPE_OK)) {    /* output; error? */
        sim_activate (uptr, uptr->wait);                /* retry */
        return ((r == SCPE_STALL)? SCPE_OK: r);
        }
    }
if (cpls & CPLS_TTO) {                                  /* completion pulse? */
    ios = 1;                                            /* restart */
    cpls = cpls & ~CPLS_TTO;
    }
iosta = iosta | IOS_TTO;                                /* set flag */
dev_req_int (tto_sbs);                                  /* req interrupt */
uptr->pos = uptr->pos + 1;
if (c == '\r') {                                        /* cr? add lf */
    sim_putchar ('\n');
    uptr->pos = uptr->pos + 1;
    }
return SCPE_OK;
}
예제 #3
0
파일: pdp1_stddev.c 프로젝트: ST3ALth/simh
t_stat tto_svc (UNIT *uptr)
{
t_stat r;
int32 c;
static const char *red_str = "[red]\r\n";
static const char *black_str = "[black]\r\n";

if (tty_buf == FIODEC_UC)                               /* upper case? */
    tty_uc = UC;
else if (tty_buf == FIODEC_LC)                          /* lower case? */
    tty_uc = 0;
else if (((uptr->flags & UNIT_ET) != 0) &&              /* ET ribbon chg? */
    ((tty_buf == FIODEC_BLACK) || (tty_buf == FIODEC_RED)) &&
    (tty_buf != tty_ribbon)) {
    tto_puts ((tty_buf == FIODEC_RED)? red_str: black_str);
    tty_ribbon = tty_buf;
    }
else if (tty_buf == FIODEC_CR)
    tto_puts ("\r\n");
else {
    c = fiodec_to_ascii[tty_buf | tty_uc];              /* translate */
    if ((c != 0) && ((r = sim_putchar_s (c)) != SCPE_OK)) { /* output; error? */
        sim_activate (uptr, uptr->wait);                /* retry */
        return ((r == SCPE_STALL)? SCPE_OK: r);
        }
    }
if (cpls & CPLS_TTO) {                                  /* completion pulse? */
    ios = 1;                                            /* restart */
    cpls = cpls & ~CPLS_TTO;
    }
iosta = iosta | IOS_TTO;                                /* set flag */
dev_req_int (tto_sbs);                                  /* req interrupt */
uptr->pos = uptr->pos + 1;
return SCPE_OK;
}
예제 #4
0
t_stat ptr_svc (UNIT *uptr)
{
int32 temp;

if ((uptr->flags & UNIT_ATT) == 0) {                    /* attached? */
    if (ptr_wait)                                       /* if wait, clr ioh */
        ptr_wait = ioh = 0;
    if ((cpls & CPLS_PTR) || ptr_stopioe)
        return SCPE_UNATT;
    return SCPE_OK;
    }
if ((uptr->flags & UNIT_ASCII) && (ptr_state == 0))     /* ASCII mode, alpha read? */
    temp = ptr_get_ascii (uptr);                        /* get processed char */
else if ((temp = getc (uptr->fileref)) != EOF)          /* no, get raw char */
    uptr->pos = uptr->pos + 1;                          /* if not eof, count */
if (temp == EOF) {                                      /* end of file? */
    if (ptr_wait)                                       /* if wait, clr ioh */
        ptr_wait = ioh = 0;
    if (feof (uptr->fileref)) {
        if ((cpls & CPLS_PTR) || ptr_stopioe)
            printf ("PTR end of file\n");
        else return SCPE_OK;
        }
    else perror ("PTR I/O error");
    clearerr (uptr->fileref);
    return SCPE_IOERR;
    }
if (ptr_state == 0)                                     /* alpha */
    uptr->buf = temp & 0377;
else if (temp & 0200) {                                 /* binary */
    ptr_state = ptr_state - 6;
    uptr->buf = uptr->buf | ((temp & 077) << ptr_state);
    }
if (ptr_state == 0) {                                   /* done? */
    if (cpls & CPLS_PTR) {                              /* completion pulse? */
        iosta = iosta & ~IOS_PTR;                       /* clear flag */
        IO = uptr->buf;                                 /* fill IO */
        ios = 1;                                        /* restart */
        cpls = cpls & ~CPLS_PTR;
        }
    else {                                              /* no, interrupt */
        iosta = iosta | IOS_PTR;                        /* set flag */
        dev_req_int (ptr_sbs);                          /* req interrupt */
        }
    }
else sim_activate (uptr, uptr->wait);                   /* get next char */
return SCPE_OK;
}
예제 #5
0
t_stat ptp_svc (UNIT *uptr)
{
if (cpls & CPLS_PTP) {                                  /* completion pulse? */
    ios = 1;                                            /* restart */
    cpls = cpls & ~CPLS_PTP;
    }
iosta = iosta | IOS_PTP;                                /* set flag */
dev_req_int (ptp_sbs);                                  /* req interrupt */
if ((uptr->flags & UNIT_ATT) == 0)                      /* not attached? */
    return IORETURN (ptp_stopioe, SCPE_UNATT);
if (putc (uptr->buf, uptr->fileref) == EOF) {           /* I/O error? */
    perror ("PTP I/O error");
    clearerr (uptr->fileref);
    return SCPE_IOERR;
    }
uptr->pos = uptr->pos + 1;
return SCPE_OK;
}
예제 #6
0
파일: pdp1_stddev.c 프로젝트: ST3ALth/simh
t_stat ptp_svc (UNIT *uptr)
{
int32 c;

if (cpls & CPLS_PTP) {                                  /* completion pulse? */
    ios = 1;                                            /* restart */
    cpls = cpls & ~CPLS_PTP;
    }
iosta = iosta | IOS_PTP;                                /* set flag */
dev_req_int (ptp_sbs);                                  /* req interrupt */
if ((uptr->flags & UNIT_ATT) == 0)                      /* not attached? */
    return IORETURN (ptp_stopioe, SCPE_UNATT);
if ((uptr->flags & UNIT_ASCII) != 0) {                  /* ASCII mode? */
    int32 c1 = uptr->buf & 077;
    if (uptr->buf == 0)                                 /* ignore nulls */
        return SCPE_OK;
    if (c1 == FIODEC_UC) {                              /* UC? absorb */
        ptp_uc = UC;
        return SCPE_OK;
        }
    else if (c1 == FIODEC_LC) {                         /* LC? absorb */
        ptp_uc = 0;
        return SCPE_OK;
        }
    else c = fiodec_to_ascii[c1 | ptp_uc];
    if (c == 0)
        return SCPE_OK;
    if (c == '\n') {                                    /* new line? */
        putc ('\r', uptr->fileref);                     /* cr first */
        uptr->pos = uptr->pos + 1;
        }
    }
else c = uptr->buf;        
if (putc (c, uptr->fileref) == EOF) {                   /* I/O error? */
    sim_perror ("PTP I/O error");
    clearerr (uptr->fileref);
    return SCPE_IOERR;
    }
uptr->pos = uptr->pos + 1;
return SCPE_OK;
}
예제 #7
0
t_stat tti_svc (UNIT *uptr)
{
int32 in, temp;

sim_activate (uptr, uptr->wait);                        /* continue poll */
if (tti_hold & CW) {                                    /* char waiting? */
    tty_buf = tti_hold & TT_WIDTH;                      /* return char */
    tti_hold = 0;                                       /* not waiting */
    }
else {
    if ((temp = sim_poll_kbd ()) < SCPE_KFLAG)
        return temp;
    if (temp & SCPE_BREAK)                              /* ignore break */
        return SCPE_OK;
    temp = temp & 0177;
    if (temp == 0177)                                   /* rubout? bs */
        temp = '\b';
    sim_putchar (temp);                                 /* echo */
    if (temp == '\r')                                   /* cr? add nl */
        sim_putchar ('\n');
    in = ascii_to_fiodec[temp];                         /* translate char */
    if (in == 0)                                        /* no xlation? */
        return SCPE_OK;
    if ((in & BOTH) || ((in & UC) == (tty_uc & UC)))
        tty_buf = in & TT_WIDTH;
    else {                                              /* must shift */
        tty_uc = in & UC;                               /* new case */
        tty_buf = tty_uc? FIODEC_UC: FIODEC_LC;
        tti_hold = in | CW;                             /* set 2nd waiting */
        }
    }
iosta = iosta | IOS_TTI;                                /* set flag */
dev_req_int (tti_sbs);                                  /* req interrupt */
PF = PF | PF_SS_1;                                      /* set prog flag 1 */
uptr->pos = uptr->pos + 1;
return SCPE_OK;
}