32
32
*/
33
33
34
34
#include "i1620_defs.h"
35
+ #include "sim_pdflpt.h"
35
36
36
37
#define LPT_BSIZE 197 /* buffer size */
37
38
@@ -70,7 +71,7 @@ t_stat lpt_space (int32 lines, int32 lflag);
70
71
*/
71
72
72
73
UNIT lpt_unit = {
73
- UDATA (& lpt_svc , UNIT_SEQ + UNIT_ATTABLE + UNIT_TEXT , 50 )
74
+ UDATA (& lpt_svc , UNIT_SEQ + UNIT_ATTABLE , 50 )
74
75
};
75
76
76
77
REG lpt_reg [] = {
@@ -92,8 +93,11 @@ DEVICE lpt_dev = {
92
93
"LPT" , & lpt_unit , lpt_reg , NULL ,
93
94
1 , 10 , 31 , 1 , 8 , 7 ,
94
95
NULL , NULL , & lpt_reset ,
95
- NULL , & lpt_attach , NULL
96
- };
96
+ NULL , & lpt_attach , & pdflpt_detach ,
97
+ NULL , 0 , 0 ,
98
+ NULL , NULL , NULL ,
99
+ & pdflpt_help , & pdflpt_attach_help ,
100
+ };
97
101
98
102
/* Data tables */
99
103
@@ -255,13 +259,13 @@ for (i = LPT_WIDTH; i <= LPT_BSIZE; i++) /* clear unprintable */
255
259
while ((lpt_bptr > 0 ) && (lpt_buf [lpt_bptr - 1 ] == ' ' ))
256
260
lpt_buf [-- lpt_bptr ] = 0 ; /* trim buffer */
257
261
if (lpt_bptr ) { /* any line? */
258
- fputs ( lpt_buf , lpt_unit . fileref ); /* print */
259
- lpt_unit .pos = ftell ( lpt_unit . fileref ); /* update pos */
262
+ pdflpt_puts ( & lpt_unit , lpt_buf ); /* print */
263
+ lpt_unit .pos = pdflpt_where ( & lpt_unit , NULL ); /* update pos */
260
264
lpt_buf_init (); /* reinit buf */
261
- if (ferror ( lpt_unit . fileref )) { /* error? */
265
+ if (pdflpt_error ( & lpt_unit )) { /* error? */
262
266
ind [IN_PRCHK ] = ind [IN_WRCHK ] = 1 ; /* wr, pri check */
263
- perror ( "LPT I/O error" );
264
- clearerr ( lpt_unit . fileref );
267
+ pdflpt_perror ( & lpt_unit , "LPT I/O error" );
268
+ pdflpt_clearerr ( & lpt_unit );
265
269
return SCPE_IOERR ;
266
270
}
267
271
}
@@ -301,18 +305,18 @@ int32 i;
301
305
302
306
cct_ptr = (cct_ptr + count ) % cct_lnt ; /* adv cct, mod lnt */
303
307
if (sflag && CHP (0 , cct [cct_ptr ])) /* skip, top of form? */
304
- fputs ( "\n\f" , lpt_unit . fileref ); /* nl, ff */
308
+ pdflpt_puts ( & lpt_unit , "\n\f" ); /* nl, ff */
305
309
else {
306
310
for (i = 0 ; i < count ; i ++ ) /* count lines */
307
- fputc ( '\n' , lpt_unit . fileref );
311
+ pdflpt_putc ( & lpt_unit , '\n' );
308
312
}
309
- lpt_unit .pos = ftell ( lpt_unit . fileref ); /* update position */
313
+ lpt_unit .pos = pdflpt_where ( & lpt_unit , NULL ); /* update position */
310
314
ind [IN_PRCH9 ] = CHP (9 , cct [cct_ptr ]) != 0 ; /* set indicators */
311
315
ind [IN_PRCH12 ] = CHP (12 , cct [cct_ptr ]) != 0 ;
312
- if (ferror ( lpt_unit . fileref )) { /* error? */
316
+ if (pdflpt_error ( & lpt_unit )) { /* error? */
313
317
ind [IN_PRCHK ] = ind [IN_WRCHK ] = 1 ; /* wr, pri check */
314
- perror ( "LPT I/O error" );
315
- clearerr ( lpt_unit . fileref );
318
+ pdflpt_perror ( & lpt_unit , "LPT I/O error" );
319
+ pdflpt_clearerr ( & lpt_unit );
316
320
return SCPE_IOERR ;
317
321
}
318
322
return SCPE_OK ;
@@ -342,11 +346,15 @@ return;
342
346
343
347
t_stat lpt_reset (DEVICE * dptr )
344
348
{
349
+ char tbuf [sizeof ("columns=999" )];
345
350
lpt_buf_init (); /* clear buffer */
346
351
cct_ptr = 0 ; /* clear cct ptr */
347
352
lpt_savctrl = 0x61 ; /* clear cct action */
348
353
ind [IN_PRCHK ] = ind [IN_PRBSY ] = 0 ; /* clear indicators */
349
354
ind [IN_PRCH9 ] = ind [IN_PRCH12 ] = 0 ;
355
+ pdflpt_reset (& lpt_unit );
356
+ sprintf (tbuf , "columns=%u" , LPT_WIDTH );
357
+ pdflpt_set_defaults (& lpt_unit , tbuf );
350
358
return SCPE_OK ;
351
359
}
352
360
@@ -355,5 +363,5 @@ return SCPE_OK;
355
363
t_stat lpt_attach (UNIT * uptr , char * cptr )
356
364
{
357
365
lpt_reset (& lpt_dev );
358
- return attach_unit (uptr , cptr );
366
+ return pdflpt_attach (uptr , cptr );
359
367
}
0 commit comments