H316: Open LPT, PTP devices for append
This implements the principle of "least surprise", in that users won't normally expect to start overwriting an existing file on these devices. Real hardware didn't behave that way. A new (empty) file can always be created with the -N switch on the ATTACH.
This commit is contained in:
parent
323cd48244
commit
4099330616
3 changed files with 16 additions and 4 deletions
|
@ -97,6 +97,7 @@ int32 lpt_stopioe = 0; /* stop on error */
|
||||||
int32 lptio (int32 inst, int32 fnc, int32 dat, int32 dev);
|
int32 lptio (int32 inst, int32 fnc, int32 dat, int32 dev);
|
||||||
t_stat lpt_svc (UNIT *uptr);
|
t_stat lpt_svc (UNIT *uptr);
|
||||||
t_stat lpt_reset (DEVICE *dptr);
|
t_stat lpt_reset (DEVICE *dptr);
|
||||||
|
t_stat lpt_attach (UNIT *uptr, CONST char *cptr);
|
||||||
|
|
||||||
/* LPT data structures
|
/* LPT data structures
|
||||||
|
|
||||||
|
@ -135,7 +136,7 @@ DEVICE lpt_dev = {
|
||||||
"LPT", &lpt_unit, lpt_reg, NULL,
|
"LPT", &lpt_unit, lpt_reg, NULL,
|
||||||
1, 10, 31, 1, 8, 8,
|
1, 10, 31, 1, 8, 8,
|
||||||
NULL, NULL, &lpt_reset,
|
NULL, NULL, &lpt_reset,
|
||||||
NULL, NULL, NULL,
|
NULL, &lpt_attach, NULL,
|
||||||
&lpt_dib, DEV_DISABLE
|
&lpt_dib, DEV_DISABLE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -355,3 +356,11 @@ CLR_ENB (INT_LPT);
|
||||||
sim_cancel (&lpt_unit); /* deactivate unit */
|
sim_cancel (&lpt_unit); /* deactivate unit */
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Attach routine */
|
||||||
|
|
||||||
|
t_stat lpt_attach (UNIT *uptr, CONST char *cptr)
|
||||||
|
{
|
||||||
|
sim_switches |= SWMASK ('A'); /* Default to Append to existing file */
|
||||||
|
return attach_unit (uptr, cptr);
|
||||||
|
}
|
||||||
|
|
|
@ -421,13 +421,16 @@ return SCPE_OK;
|
||||||
t_stat pt_attach (UNIT *uptr, CONST char *cptr)
|
t_stat pt_attach (UNIT *uptr, CONST char *cptr)
|
||||||
{
|
{
|
||||||
t_stat r;
|
t_stat r;
|
||||||
|
int32 saved_switches = sim_switches;
|
||||||
|
|
||||||
if (!(uptr->flags & UNIT_ATTABLE)) /* not tti,tto */
|
if (!(uptr->flags & UNIT_ATTABLE)) /* not tti,tto */
|
||||||
return SCPE_NOFNC;
|
return SCPE_NOFNC;
|
||||||
if (strcmp ("PTR", sim_uname (uptr)) == 0) /* PTR is read only */
|
sim_switches &= ~SWMASK ('A');
|
||||||
sim_switches |= SWMASK ('R');
|
if (strcmp ("PTP", sim_uname (uptr)) == 0) /* PTP is append default */
|
||||||
if ((r = attach_unit (uptr, cptr)))
|
sim_switches |= SWMASK ('A');
|
||||||
|
if ((r = attach_unit (uptr, cptr)) != SCPE_OK)
|
||||||
return r;
|
return r;
|
||||||
|
sim_switches = saved_switches;
|
||||||
if (sim_switches & SWMASK ('A')) /* -a? ASCII */
|
if (sim_switches & SWMASK ('A')) /* -a? ASCII */
|
||||||
uptr->flags |= UNIT_ASC;
|
uptr->flags |= UNIT_ASC;
|
||||||
else if (sim_switches & SWMASK ('U')) /* -u? Unix ASCII */
|
else if (sim_switches & SWMASK ('U')) /* -u? Unix ASCII */
|
||||||
|
|
BIN
doc/h316_doc.doc
BIN
doc/h316_doc.doc
Binary file not shown.
Loading…
Add table
Reference in a new issue