mirror of
https://github.com/rcornwell/sims.git
synced 2026-04-14 23:58:21 +00:00
SCP: Updated to current.
This commit is contained in:
25
sim_disk.c
25
sim_disk.c
@@ -1489,6 +1489,22 @@ buf[1] = rad50[val % 050];
|
||||
buf[0] = rad50[val / 050];
|
||||
}
|
||||
|
||||
static t_stat rstsValidateClusterSize(uint16 size, uint16 minSize)
|
||||
{
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Check that the cluster size is a power of 2 and greater than or equal
|
||||
* to some location dependent value.
|
||||
*/
|
||||
if (size >= minSize)
|
||||
for (i = 0; i < 16; i++)
|
||||
if (size == (1 << i))
|
||||
return SCPE_OK;
|
||||
|
||||
return SCPE_IOERR;
|
||||
}
|
||||
|
||||
static t_stat rstsReadBlock(rstsContext *context, uint16 cluster, uint16 block, void *buf)
|
||||
{
|
||||
t_lba blk = (cluster << context->dcshift) + block;
|
||||
@@ -1529,7 +1545,8 @@ if (rstsReadBlock(context, 1, 0, &root) == SCPE_OK) {
|
||||
* First validate fields which are common to both the MFD label and
|
||||
* Pack label - we'll use Pack label offsets here.
|
||||
*/
|
||||
if ((root.rt_pack.pk_mbm1 == 0177777) && (root.rt_pack.pk_ppcs >= dcs)) {
|
||||
if ((root.rt_pack.pk_mbm1 == 0177777) &&
|
||||
(rstsValidateClusterSize(root.rt_pack.pk_ppcs, dcs) == SCPE_OK)) {
|
||||
char ch, *tmp = &context->packid[1];
|
||||
uint16 mfd, gfd;
|
||||
|
||||
@@ -1644,6 +1661,10 @@ if (uar != 0) {
|
||||
uint16 blocks = acnt.ac_usiz;
|
||||
uint16 offset = 0;
|
||||
|
||||
if ((rstsValidateClusterSize(acnt.ac_uclus, context->pcs) != SCPE_OK) ||
|
||||
(blocks > 16))
|
||||
return SCPE_IOERR;
|
||||
|
||||
memset(bitmap, 0xFF, sizeof(bitmap));
|
||||
|
||||
if (blocks != 0) {
|
||||
@@ -1682,7 +1703,7 @@ if (uar != 0) {
|
||||
}
|
||||
}
|
||||
scanDone:
|
||||
*result = (blocks + 1) * context->pcs;
|
||||
*result = (t_offset)(blocks + 1) * context->pcs;
|
||||
return SCPE_OK;
|
||||
}
|
||||
}
|
||||
|
||||
12
sim_ether.c
12
sim_ether.c
@@ -1077,7 +1077,7 @@ static const char* lib_name =
|
||||
|
||||
static char no_pcap[PCAP_ERRBUF_SIZE] =
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
"wpcap.dll failed to load, install Npcap or WinPcap 4.x to use pcap networking";
|
||||
"wpcap.dll failed to load, install Npcap or WinPcap 4.1.3 to use pcap networking";
|
||||
#elif defined(__APPLE__)
|
||||
"/usr/lib/libpcap.A.dylib failed to load, install libpcap to use pcap networking";
|
||||
#else
|
||||
@@ -2474,7 +2474,15 @@ return SCPE_OK;
|
||||
const char *eth_version (void)
|
||||
{
|
||||
#if defined(HAVE_PCAP_NETWORK)
|
||||
return pcap_lib_version();
|
||||
static char version[256];
|
||||
|
||||
if (!version[0]) {
|
||||
if (memcmp(pcap_lib_version(), "Npcap", 5))
|
||||
strlcpy(version, pcap_lib_version(), sizeof(version));
|
||||
else
|
||||
snprintf(version, sizeof(version), "Unsupported - %s", pcap_lib_version());
|
||||
}
|
||||
return version;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
@@ -809,7 +809,10 @@ while ((c = strstr (fullpath, "/../"))) { /* process up directory climbing
|
||||
else
|
||||
break;
|
||||
}
|
||||
name = 1 + strrchr (fullpath, '/');
|
||||
if (!strrchr (fullpath, '/'))
|
||||
name = fullpath + strlen (fullpath);
|
||||
else
|
||||
name = 1 + strrchr (fullpath, '/');
|
||||
ext = strrchr (name, '.');
|
||||
if (ext == NULL)
|
||||
ext = name + strlen (name);
|
||||
|
||||
@@ -164,7 +164,7 @@ static t_stat diskParse(DISK_INFO *myDisk, uint32 isVerbose)
|
||||
sim_fread(&imd, 1, 5, myDisk->file);
|
||||
if (feof(myDisk->file))
|
||||
break;
|
||||
sectorSize = 128 << imd.sectsize;
|
||||
sectorSize = 128 << (imd.sectsize & 0x1f);
|
||||
sectorHeadwithFlags = imd.head; /*AGN save the head and flags */
|
||||
imd.head &= 1 ; /*AGN mask out flag bits to head 0 or 1 */
|
||||
|
||||
|
||||
30
sim_tmxr.c
30
sim_tmxr.c
@@ -303,11 +303,6 @@
|
||||
|
||||
sim> set MUX disconnect=2
|
||||
|
||||
A line which is connected to a serial port can be manually closed by
|
||||
adding the -C switch to a disconnect command.
|
||||
|
||||
sim> set -C MUX disconnect=2
|
||||
|
||||
Full Modem Control serial port support.
|
||||
|
||||
This library supports devices which wish to emulate full modem
|
||||
@@ -4405,6 +4400,9 @@ if (single_line) { /* Single Line Multiplexer */
|
||||
}
|
||||
fprintf (st, "A Telnet listening port can be configured with:\n\n");
|
||||
fprintf (st, " sim> ATTACH %s {interface:}port\n\n", dptr->name);
|
||||
fprintf (st, "The -U switch can be specified on the attach command that specifies\n");
|
||||
fprintf (st, "a listening port. This will allow a listening port to be reused if\n");
|
||||
fprintf (st, "some prior connections haven't completely shutdown.\n\n");
|
||||
fprintf (st, "Line buffering can be enabled for the %s device with:\n\n", dptr->name);
|
||||
fprintf (st, " sim> ATTACH %s Buffer{=bufsize}\n\n", dptr->name);
|
||||
fprintf (st, "Line buffering can be disabled for the %s device with:\n\n", dptr->name);
|
||||
@@ -4431,6 +4429,9 @@ else {
|
||||
fprintf (st, " sim> ATTACH %s Line=n,NoModem\n\n", dptr->name);
|
||||
fprintf (st, "A Telnet listening port can be configured with:\n\n");
|
||||
fprintf (st, " sim> ATTACH %s {interface:}port\n\n", dptr->name);
|
||||
fprintf (st, "The -U switch can be specified on the attach command that specifies\n");
|
||||
fprintf (st, "a listening port. This will allow a listening port to be reused if\n");
|
||||
fprintf (st, "some prior connections haven't completely shutdown.\n\n");
|
||||
if (mux)
|
||||
fprintf (st, "Line buffering for all %d lines on the %s device can be configured with:\n\n", mux->lines, dptr->name);
|
||||
else
|
||||
@@ -4611,9 +4612,12 @@ if (dptr->modifiers) {
|
||||
fprintf (st, "This will cause a telnet connection to be closed, but a serial port will\n");
|
||||
fprintf (st, "normally have DTR dropped for 500ms and raised again (thus hanging up a\n");
|
||||
fprintf (st, "modem on that serial port).\n\n");
|
||||
fprintf (st, "A line which is connected to a serial port can be manually closed by\n");
|
||||
fprintf (st, "adding the -C switch to a %s command.\n\n", mptr->mstring);
|
||||
fprintf (st, " sim> SET -C %s %s=n\n\n", dptr->name, mptr->mstring);
|
||||
fprintf (st, "Any lines connected to serial port can be manually closed by unplugging\n");
|
||||
fprintf (st, "the serial cable from the host computer. Dynamically adding or removing\n");
|
||||
fprintf (st, "a serial port from a mux while the simulated operating system is running\n");
|
||||
fprintf (st, "is guaranteed to have an inconsistent state between the running OS and\n");
|
||||
fprintf (st, "the simulated port state. Restart the simulator without the serial port\n");
|
||||
fprintf (st, "attached.\n\n");
|
||||
}
|
||||
}
|
||||
return SCPE_OK;
|
||||
@@ -4848,8 +4852,7 @@ if (lp->txstall)
|
||||
If the line was connected to a tcp session, the socket associated with the
|
||||
line will be closed. If the line was connected to a serial port, the port
|
||||
will NOT be closed, but DTR will be dropped. After a 500ms delay DTR will
|
||||
be raised again. If the sim_switches -C flag is set, then a serial port
|
||||
connection will be closed.
|
||||
be raised again.
|
||||
|
||||
Implementation notes:
|
||||
|
||||
@@ -4875,8 +4878,11 @@ if (lp == NULL) /* bad line numb
|
||||
if ((lp->sock) || (lp->serport)) { /* connection active? */
|
||||
if (!lp->notelnet)
|
||||
tmxr_linemsg (lp, "\r\nOperator disconnected line\r\n\n");/* report closure */
|
||||
if (lp->serport && (sim_switches & SWMASK ('C')))
|
||||
return tmxr_detach_ln (lp);
|
||||
if (lp->serport && (sim_switches & SWMASK ('C'))) {
|
||||
sim_messagef (SCPE_OK, "If you really feel the need to disconnect this serial port, unplug the cable\n");
|
||||
sim_messagef (SCPE_OK, "from the serial port on your system. Alternatively, you should restart the\n");
|
||||
sim_messagef (SCPE_OK, "simulator without attaching the serial port in your configuration.\n");
|
||||
}
|
||||
return tmxr_reset_ln_ex (lp, FALSE); /* drop the line */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user