diff --git a/PDP10/kx10_lp.c b/PDP10/kx10_lp.c index ceb0ecf..a5a4c03 100644 --- a/PDP10/kx10_lp.c +++ b/PDP10/kx10_lp.c @@ -62,6 +62,8 @@ t_stat lpt_svc (UNIT *uptr); t_stat lpt_reset (DEVICE *dptr); t_stat lpt_attach (UNIT *uptr, CONST char *cptr); t_stat lpt_detach (UNIT *uptr); +t_stat lpt_setlpp(UNIT *, int32, CONST char *, void *); +t_stat lpt_getlpp(FILE *, UNIT *, int32, CONST void *); t_stat lpt_help (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr); const char *lpt_description (DEVICE *dptr); @@ -79,7 +81,7 @@ uint8 lpt_chbuf[5]; /* Read in Character buffers */ DIB lpt_dib = { LP_DEVNUM, 1, &lpt_devio, NULL }; UNIT lpt_unit = { - UDATA (&lpt_svc, UNIT_SEQ+UNIT_ATTABLE+UNIT_TEXT, 0), 100 + UDATA (&lpt_svc, UNIT_SEQ+UNIT_ATTABLE+UNIT_TEXT, 66), 100 }; REG lpt_reg[] = { @@ -94,6 +96,8 @@ 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}, + {MTAB_XTD|MTAB_VUN|MTAB_VALR, 0, "LINESPERPAGE", "LINESPERPAGE", + &lpt_setlpp, &lpt_getlpp, NULL, "Number of lines per page"}, { 0 } }; @@ -178,7 +182,13 @@ lpt_printline(UNIT *uptr, int nl) { lpt_buffer[uptr->POS++] = '\n'; uptr->LINE++; } + if (uptr->LINE > (int32)uptr->capac) { + lpt_buffer[uptr->POS++] = '\f'; + uptr->LINE = 0; + } + sim_fwrite(&lpt_buffer, 1, uptr->POS, uptr->fileref); + uptr->pos += uptr->POS; uptr->COL = 0; uptr->POS = 0; if (ferror (uptr->fileref)) { /* error? */ @@ -305,40 +315,47 @@ t_stat lpt_svc (UNIT *uptr) case 014: /* Form feed, skip to top of page */ lpt_printline(uptr, 0); sim_fwrite("\014", 1, 1, uptr->fileref); + uptr->pos++; uptr->LINE = 0; break; case 013: /* Vertical tab, Skip mod 20 */ lpt_printline(uptr, 1); while((uptr->LINE % 20) != 0) { sim_fwrite("\r\n", 1, 2, uptr->fileref); + uptr->pos+=2; uptr->LINE++; } break; - case 020: /* Skip even lines */ + case 020: /* Skip half page */ + lpt_printline(uptr, 1); + while((uptr->LINE % 30) != 0) { + sim_fwrite("\r\n", 1, 2, uptr->fileref); + uptr->pos+=2; + uptr->LINE++; + } + break; + case 021: /* Skip even lines */ lpt_printline(uptr, 1); while((uptr->LINE % 2) != 0) { sim_fwrite("\r\n", 1, 2, uptr->fileref); + uptr->pos+=2; uptr->LINE++; } break; - case 021: /* Skip third lines */ + case 022: /* Skip triple lines */ lpt_printline(uptr, 1); while((uptr->LINE % 3) != 0) { sim_fwrite("\r\n", 1, 2, uptr->fileref); + uptr->pos+=2; uptr->LINE++; } break; - case 022: /* Skip one line */ - lpt_printline(uptr, 1); + case 023: /* Skip one line */ + if (uptr->COL != 0) + lpt_printline(uptr, 1); sim_fwrite("\r\n", 1, 2, uptr->fileref); - uptr->LINE+=2; - break; - case 023: /* Skip every 10 lines */ - lpt_printline(uptr, 1); - while((uptr->LINE % 10) != 0) { - sim_fwrite("\r\n", 1, 2, uptr->fileref); - uptr->LINE++; - } + uptr->pos+=2; + uptr->LINE++; break; default: /* Ignore */ break; @@ -388,12 +405,46 @@ t_stat lpt_detach (UNIT *uptr) return detach_unit (uptr); } +/* + * Line printer routines + */ + +t_stat +lpt_setlpp(UNIT *uptr, int32 val, CONST char *cptr, void *desc) +{ + t_value i; + t_stat r; + if (cptr == NULL) + return SCPE_ARG; + if (uptr == NULL) + return SCPE_IERR; + i = get_uint (cptr, 10, 100, &r); + if (r != SCPE_OK) + return SCPE_ARG; + uptr->capac = (t_addr)i; + uptr->LINE = 0; + return SCPE_OK; +} + +t_stat +lpt_getlpp(FILE *st, UNIT *uptr, int32 v, CONST void *desc) +{ + if (uptr == NULL) + return SCPE_IERR; + fprintf(st, "linesperpage=%d", uptr->capac); + return SCPE_OK; +} + + t_stat lpt_help (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr) { fprintf (st, "Line Printer (LPT)\n\n"); fprintf (st, "The line printer (LPT) writes data to a disk file. The POS register specifies\n"); fprintf (st, "the number of the next data item to be written. Thus, by changing POS, the\n"); fprintf (st, "user can backspace or advance the printer.\n"); +fprintf (st, "The Line printer can be configured to any number of lines per page with the:\n"); +fprintf (st, " sim> SET %s LINESPERPAGE=n\n\n", dptr->name); +fprintf (st, "The default is 66 lines per page.\n\n"); fprint_set_help (st, dptr); fprint_show_help (st, dptr); fprint_reg_help (st, dptr);