1. New Features in 2.10-2 The build procedures have changed. There is only one UNIX makefile. To compile without Ethernet support, simply type gmake {target|all} To compile with Ethernet support, type gmake USE_NETWORK=1 {target|all} The Mingw batch files require Mingw release 2 and invoke the Unix makefile. There are still separate batch files for compilation with or without Ethernet support. 1.1 SCP and Libraries - The EVAL command will evaluate a symbolic type-in and display it in numeric form. - The ! command (with no arguments) will launch the host operating system command shell. The ! command (with an argument) executes the argument as a host operating system command. (Code from Mark Pizzolato) - Telnet sessions now recognize BREAK. How a BREAK is transmitted dependent on the particular Telnet client. (Code from Mark Pizzolato) - The sockets library includes code for active connections as well as listening connections. - The RESTORE command will restore saved memory size, if the simulator supports dynamic memory resizing. 1.2 PDP-1 - The PDP-1 supports the Type 24 serial drum (based on recently discovered documents). 1.3 18b PDP's - The PDP-4 supports the Type 24 serial drum (based on recently discovered documents). 1.4 PDP-11 - The PDP-11 implements a stub DEUNA/DELUA (XU). The real XU module will be included in a later release. 1.5 PDP-10 - The PDP-10 implements a stub DEUNA/DELUA (XU). The real XU module will be included in a later release. 1.6 HP 2100 - The IOP microinstruction set is supported for the 21MX as well as the 2100. - The HP2100 supports the Access Interprocessor Link (IPL). 1.7 VAX - If the VAX console is attached to a Telnet session, BREAK is interpreted as console halt. - The SET/SHOW HISTORY commands enable and display a history of the most recently executed instructions. (Code from Mark Pizzolato) 1.8 Terminals Multiplexors - BREAK detection was added to the HP, DEC, and Interdata terminal multiplexors. 1.9 Interdata 16b and 32b - First release. UNIX is not yet working. 1.10 SDS 940 - First release. 2. Bugs Fixed in 2.10-2 - PDP-11 console must default to 7b for early UNIX compatibility. - PDP-11/VAX TMSCP emulator was using the wrong packet length for read/write end packets. - Telnet IAC+IAC processing was fixed, both for input and output (found by Mark Pizzolato). - PDP-11/VAX Ethernet setting flag bits wrong for chained descriptors (found by Mark Pizzolato). 3. New Features in 2.10 vs prior releases 3.1 SCP and Libraries - The VT emulation package has been replaced by the capability to remote the console to a Telnet session. Telnet clients typically have more complete and robust VT100 emulation. - Simulated devices may now have statically allocated buffers, in addition to dynamically allocated buffers or disk-based data stores. - The DO command now takes substitutable arguments (max 9). In command files, %n represents substitutable argument n. - The initial command line is now interpreted as the command name and substitutable arguments for a DO command. This is backward compatible to prior versions. - The initial command line parses switches. -Q is interpreted as quiet mode; informational messages are suppressed. - The HELP command now takes an optional argument. HELP <cmd> types help on the specified command. - Hooks have been added for implementing GUI-based consoles, as well as simulator-specific command extensions. A few internal data structures and definitions have changed. - Two new routines (tmxr_open_master, tmxr_close_master) have been added to sim_tmxr.c. The calling sequence for sim_accept_conn has been changed in sim_sock.c. - The calling sequence for the VM boot routine has been modified to add an additional parameter. - SAVE now saves, and GET now restores, controller and unit flags. - Library sim_ether.c has been added for Ethernet support. 3.2 VAX - Non-volatile RAM (NVR) can behave either like a memory or like a disk-based peripheral. If unattached, it behaves like memory and is saved and restored by SAVE and RESTORE, respectively. If attached, its contents are loaded from disk by ATTACH and written back to disk at DETACH and EXIT. - SHOW <device> VECTOR displays the device's interrupt vector. A few devices allow the vector to be changed with SET <device> VECTOR=nnn. - SHOW CPU IOSPACE displays the I/O space address map. - The TK50 (TMSCP tape) has been added. - The DEQNA/DELQA (Qbus Ethernet controllers) have been added. - Autoconfiguration support has been added. - The paper tape reader has been removed from vax_stddev.c and now references a common implementation file, dec_pt.h. - Examine and deposit switches now work on all devices, not just the CPU. - Device address conflicts are not detected until simulation starts. 3.3 PDP-11 - SHOW <device> VECTOR displays the device's interrupt vector. Most devices allow the vector to be changed with SET <device> VECTOR=nnn. - SHOW CPU IOSPACE displays the I/O space address map. - The TK50 (TMSCP tape), RK611/RK06/RK07 (cartridge disk), RX211 (double density floppy), and KW11P programmable clock have been added. - The DEQNA/DELQA (Qbus Ethernet controllers) have been added. - Autoconfiguration support has been added. - The paper tape reader has been removed from pdp11_stddev.c and now references a common implementation file, dec_pt.h. - Device bootstraps now use the actual CSR specified by the SET ADDRESS command, rather than just the default CSR. Note that PDP-11 operating systems may NOT support booting with non-standard addresses. - Specifying more than 256KB of memory, or changing the bus configuration, causes all peripherals that are not compatible with the current bus configuration to be disabled. - Device address conflicts are not detected until simulation starts. 3.4 PDP-10 - SHOW <device> VECTOR displays the device's interrupt vector. A few devices allow the vector to be changed with SET <device> VECTOR=nnn. - SHOW CPU IOSPACE displays the I/O space address map. - The RX211 (double density floppy) has been added; it is off by default. - The paper tape now references a common implementation file, dec_pt.h. - Device address conflicts are not detected until simulation starts. 3.5 PDP-1 - DECtape (then known as MicroTape) support has been added. - The line printer and DECtape can be disabled and enabled. 3.6 PDP-8 - The RX28 (double density floppy) has been added as an option to the existing RX8E controller. - SHOW <device> DEVNO displays the device's device number. Most devices allow the device number to be changed with SET <device> DEVNO=nnn. - Device number conflicts are not detected until simulation starts. 3.7 IBM 1620 - The IBM 1620 simulator has been released. 3.8 AltairZ80 - A hard drive has been added for increased storage. - Several bugs have been fixed. 3.9 HP 2100 - The 12845A has been added and made the default line printer (LPT). The 12653A has been renamed LPS and is off by default. It also supports the diagnostic functions needed to run the DCPC and DMS diagnostics. - The 12557A/13210A disk defaults to the 13210A (7900/7901). - The 12559A magtape is off by default. - New CPU options (EAU/NOEAU) enable/disable the extended arithmetic instructions for the 2116. These instructions are standard on the 2100 and 21MX. - New CPU options (MPR/NOMPR) enable/disable memory protect for the 2100 and 21MX. - New CPU options (DMS/NODMS) enable/disable the dynamic mapping instructions for the 21MX. - The 12539 timebase generator autocalibrates. 3.10 Simulated Magtapes - Simulated magtapes recognize end of file and the marker 0xFFFFFFFF as end of medium. Only the TMSCP tape simulator can generate an end of medium marker. - The error handling in simulated magtapes was overhauled to be consistent through all simulators. 3.11 Simulated DECtapes - Added support for RT11 image file format (256 x 16b) to DECtapes. 4. Bugs Fixed in 2.10 vs prior releases - TS11/TSV05 was not simulating the XS0_MOT bit, causing failures under VMS. In addition, two of the CTL options were coded interchanged. - IBM 1401 tape was not setting a word mark under group mark for load mode reads. This caused the diagnostics to crash. - SCP bugs in ssh_break and set_logon were fixed (found by Dave Hittner). - Numerous bugs in the HP 2100 extended arithmetic, floating point, 21MX, DMS, and IOP instructions were fixed. Bugs were also fixed in the memory protect and DMS functions. The moving head disks (DP, DQ) were revised to simulate the hardware more accurately. Missing functions in DQ (address skip, read address) were added. - PDP-10 tape wouldn't boot, and then wouldn't read (reported by Michael Thompson and Harris Newman, respectively) - PDP-1 typewriter is half duplex, with only one shift state for both input and output (found by Derek Peschel) 5. General Notes WARNING: V2.10 has reorganized and renamed some of the definition files for the PDP-10, PDP-11, and VAX. Be sure to delete all previous source files before you unpack the Zip archive, or unpack it into a new directory structure. WARNING: V2.10 has a new, more comprehensive save file format. Restoring save files from previous releases will cause 'invalid register' errors and loss of CPU option flags, device enable/ disable flags, unit online/offline flags, and unit writelock flags. WARNING: If you are using Visual Studio .NET through the IDE, be sure to turn off the /Wp64 flag in the project settings, or dozens of spurious errors will be generated. WARNING: Compiling Ethernet support under Windows requires extra steps; see the Ethernet readme file. Ethernet support is currently available only for Windows, Linux, NetBSD, and OpenBSD.
614 lines
15 KiB
C
614 lines
15 KiB
C
/*
|
|
* (C) Copyright 2002, Brian Knittel.
|
|
* You may freely use this program, but: it offered strictly on an AS-IS, AT YOUR OWN
|
|
* RISK basis, there is no warranty of fitness for any purpose, and the rest of the
|
|
* usual yada-yada. Please keep this notice and the copyright in any distributions
|
|
* or modifications.
|
|
*
|
|
* This is not a supported product, but I welcome bug reports and fixes.
|
|
* Mail to sim@ibm1130.org
|
|
*/
|
|
|
|
// DISKVIEW - lists contents of an 1130 system disk image file. Not finished yet.
|
|
// needs LET/SLET listing routine.
|
|
//
|
|
// usage:
|
|
// diskview -v diskfile
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdarg.h>
|
|
#include "util_io.h"
|
|
|
|
#define BETWEEN(v,a,b) (((v) >= (a)) && ((v) <= (b)))
|
|
#define MIN(a,b) (((a) <= (b)) ? (a) : (b))
|
|
#define MAX(a,b) (((a) >= (b)) ? (a) : (b))
|
|
|
|
#ifndef TRUE
|
|
# define TRUE 1
|
|
# define FALSE 0
|
|
# define BOOL int
|
|
#endif
|
|
|
|
#define NOT_DEF 0x0658 // defective cylinder table entry means no defect
|
|
|
|
#define DSK_NUMWD 321 /* words/sector */
|
|
#define DSK_NUMCY 203 /* cylinders/drive */
|
|
#define DSK_SECCYL 8 /* sectors per cylinder */
|
|
#define SECLEN 320 /* data words per sector */
|
|
#define SLETLEN ((3*SECLEN)/4) /* length of slet in records */
|
|
|
|
typedef unsigned short WORD;
|
|
|
|
FILE *fp;
|
|
WORD buf[DSK_NUMWD];
|
|
WORD dcom[DSK_NUMWD];
|
|
|
|
#pragma pack(2)
|
|
struct tag_slet {
|
|
WORD phid;
|
|
WORD addr;
|
|
WORD nwords;
|
|
WORD sector;
|
|
} slet[SLETLEN];
|
|
|
|
#pragma pack()
|
|
|
|
WORD dcyl[3];
|
|
BOOL verbose = FALSE;
|
|
|
|
void checksectors (void);
|
|
void dump_id (void);
|
|
void dump_dcom (void);
|
|
void dump_resmon (void);
|
|
void dump_slet (void);
|
|
void dump_hdng (void);
|
|
void dump_scra (void);
|
|
void dump_let (void);
|
|
void dump_flet (void);
|
|
void dump_cib (void);
|
|
void getsector (int sec, WORD *sbuf);
|
|
void getdcyl (void);
|
|
char *lowcase (char *str);
|
|
|
|
void bail(char *fmt, ...);
|
|
char *trim (char *s);
|
|
|
|
int main (int argc, char **argv)
|
|
{
|
|
char *fname = NULL, *arg;
|
|
static char usestr[] = "Usage: diskview [-v] filename";
|
|
int i;
|
|
|
|
util_io_init();
|
|
|
|
for (i = 1; i < argc;) {
|
|
arg = argv[i++];
|
|
if (*arg == '-') {
|
|
arg++;
|
|
lowcase(arg);
|
|
while (*arg) {
|
|
switch (*arg++) {
|
|
case 'v':
|
|
verbose = TRUE;
|
|
break;
|
|
|
|
default:
|
|
bail(usestr);
|
|
}
|
|
}
|
|
}
|
|
else if (fname == NULL)
|
|
fname = arg;
|
|
else
|
|
bail(usestr);
|
|
}
|
|
|
|
if (fname == NULL)
|
|
bail(usestr);
|
|
|
|
if ((fp = fopen(fname, "rb")) == NULL) {
|
|
perror(fname);
|
|
return 2;
|
|
}
|
|
|
|
printf("%s:\n", fname);
|
|
|
|
checksectors();
|
|
getdcyl();
|
|
|
|
dump_id(); // ID & coldstart
|
|
dump_dcom(); // DCOM
|
|
dump_resmon(); // resident image
|
|
dump_slet(); // SLET
|
|
dump_hdng(); // heading sector
|
|
dump_scra();
|
|
dump_flet();
|
|
dump_cib();
|
|
dump_let();
|
|
|
|
fclose(fp);
|
|
return 0;
|
|
}
|
|
|
|
// checksectors - verify that all sectors are properly numbered
|
|
|
|
void checksectors ()
|
|
{
|
|
WORD sec = 0;
|
|
|
|
fseek(fp, 0, SEEK_SET);
|
|
|
|
for (sec = 0; sec < DSK_NUMCY*DSK_SECCYL; sec++) {
|
|
if (fxread(buf, sizeof(WORD), DSK_NUMWD, fp) != DSK_NUMWD)
|
|
bail("File read error or not a disk image file");
|
|
|
|
if (buf[0] != sec)
|
|
bail("Sector /%x is misnumbered, run checkdisk [-f]", sec);
|
|
}
|
|
}
|
|
|
|
// get defective cylinder list
|
|
|
|
void getdcyl (void)
|
|
{
|
|
fseek(fp, sizeof(WORD), SEEK_SET); // skip sector count
|
|
if (fxread(dcyl, sizeof(WORD), 3, fp) != 3)
|
|
bail("Unable to read defective cylinder table");
|
|
}
|
|
|
|
// getsector - read specified absolute sector
|
|
|
|
void getsector (int sec, WORD *sbuf)
|
|
{
|
|
int i, cyl, ssec;
|
|
|
|
sec &= 0x7FF; // mask of drive bits, if any
|
|
|
|
cyl = sec / DSK_SECCYL; // get cylinder
|
|
ssec = sec & ~(DSK_SECCYL-1); // mask to get starting sector of cylinder
|
|
for (i = 0; i < 3; i++) { // map through defective cylinder table
|
|
if (dcyl[i] == ssec) {
|
|
sec &= (DSK_SECCYL-1); // mask to get base sector
|
|
cyl = DSK_NUMCY-3+i; // replacements are last three on disk
|
|
sec += cyl*DSK_SECCYL; // add new cylinder offset
|
|
break;
|
|
}
|
|
}
|
|
// read the sector
|
|
if (fseek(fp, (sec*DSK_NUMWD+1)*sizeof(WORD), SEEK_SET) != 0)
|
|
bail("File seek failed");
|
|
|
|
if (fxread(sbuf, sizeof(WORD), DSK_NUMWD, fp) != DSK_NUMWD)
|
|
bail("File read error or not a disk image file");
|
|
}
|
|
|
|
void dump (int nwords)
|
|
{
|
|
int i, nline = 0;
|
|
|
|
for (i = 0; i < nwords; i++) {
|
|
if (nline == 16) {
|
|
putchar('\n');
|
|
nline = 0;
|
|
}
|
|
|
|
printf("%04x", buf[i]);
|
|
nline++;
|
|
}
|
|
putchar('\n');
|
|
}
|
|
|
|
void showmajor (char *label)
|
|
{
|
|
int i;
|
|
|
|
printf("\n--- %s ", label);
|
|
|
|
for (i = strlen(label); i < 40; i++)
|
|
putchar('-');
|
|
|
|
putchar('\n');
|
|
putchar('\n');
|
|
}
|
|
|
|
void name (char *label)
|
|
{
|
|
printf("%-32.32s ", label);
|
|
}
|
|
|
|
void pbf (char *label, WORD *buf, int nwords)
|
|
{
|
|
int i, nout;
|
|
|
|
name(label);
|
|
|
|
for (i = nout = 0; i < nwords; i++, nout++) {
|
|
if (nout == 8) {
|
|
putchar('\n');
|
|
name("");
|
|
nout = 0;
|
|
}
|
|
printf(" %04x", buf[i]);
|
|
}
|
|
|
|
putchar('\n');
|
|
}
|
|
|
|
void prt (char *label, char *fmt, ...)
|
|
{
|
|
va_list args;
|
|
|
|
name(label);
|
|
|
|
putchar(' ');
|
|
va_start(args, fmt);
|
|
vprintf(fmt, args);
|
|
va_end(args);
|
|
|
|
putchar('\n');
|
|
}
|
|
|
|
void dump_id (void)
|
|
{
|
|
showmajor("Sector 0 - ID & coldstart");
|
|
getsector(0, buf);
|
|
|
|
pbf("DCYL def cyl table", buf+ 0, 3);
|
|
pbf("CIDN cart id", buf+ 3, 1);
|
|
pbf(" copy code", buf+ 4, 1);
|
|
pbf("DTYP disk type", buf+ 7, 1);
|
|
pbf(" diskz copy", buf+ 30, 8);
|
|
pbf(" cold start pgm",buf+270, 8);
|
|
}
|
|
|
|
// EQUIVALENCES FOR DCOM PARAMETERS
|
|
#define NAME 4 // NAME OF PROGRAM/CORE LOAD
|
|
#define DBCT 6 // BLOCK CT OF PROGRAM/CORE LOAD
|
|
#define FCNT 7 // FILES SWITCH
|
|
#define SYSC 8 // SYSTEM/NON-SYSTEM CARTRIDGE INDR
|
|
#define JBSW 9 // JOBT SWITCH
|
|
#define CBSW 10 // CLB-RETURN SWITCH
|
|
#define LCNT 11 // NO. OF LOCALS
|
|
#define MPSW 12 // CORE MAP SWITCH
|
|
#define MDF1 13 // NO. DUP CTRL RECORDS (MODIF)
|
|
#define MDF2 14 // ADDR OF MODIF BUFFER
|
|
#define NCNT 15 // NO. OF NOCALS
|
|
#define ENTY 16 // RLTV ENTRY ADDR OF PROGRAM
|
|
#define RP67 17 // 1442-5 SWITCH
|
|
#define TODR 18 // OBJECT WORK STORAGE DRIVE CODE
|
|
#define FHOL 20 // ADDR LARGEST HOLE IN FIXED AREA
|
|
#define FSZE 21 // BLK CNT LARGEST HOLE IN FXA
|
|
#define UHOL 22 // ADDR LAST HOLE IN USER AREA 2-10
|
|
#define USZE 23 // BLK CNT LAST HOLE IN UA 2-10
|
|
#define DCSW 24 // DUP CALL SWITCH
|
|
#define PIOD 25 // PRINCIPAL I/O DEVICE INDICATOR
|
|
#define PPTR 26 // PRINCIPAL PRINT DEVICE INDICATOR
|
|
#define CIAD 27 // RLTV ADDR IN @STRT OF CIL ADDR
|
|
#define ACIN 28 // AVAILABLE CARTRIDGE INDICATOR
|
|
#define GRPH 29 // 2250 INDICATOR 2G2
|
|
#define GCNT 30 // NO. G2250 RECORDS 2G2
|
|
#define LOSW 31 // LOCAL-CALLS-LOCAL SWITCH 2-2
|
|
#define X3SW 32 // SPECIAL ILS SWITCH 2-2
|
|
#define ECNT 33 // NO. OF *EQUAT RCDS 2-4
|
|
#define ANDU 35 // 1+BLK ADDR END OF UA (ADJUSTED)
|
|
#define BNDU 40 // 1+BLK ADDR END OF UA (BASE)
|
|
#define FPAD 45 // FILE PROTECT ADDR
|
|
#define PCID 50 // CARTRIDGE ID, PHYSICAL DRIVE
|
|
#define CIDN 55 // CARTRIDGE ID, LOGICAL DRIVE
|
|
#define CIBA 60 // SCTR ADDR OF CIB
|
|
#define SCRA 65 // SCTR ADDR OF SCRA
|
|
#define FMAT 70 // FORMAT OF PROG IN WORKING STG
|
|
#define FLET 75 // SCTR ADDR 1ST SCTR OF FLET
|
|
#define ULET 80 // SCTR ADDR 1ST SCTR OF LET
|
|
#define WSCT 85 // BLK CNT OF PROG IN WORKING STG
|
|
#define CSHN 90 // NO. SCTRS IN CUSHION AREA
|
|
|
|
struct tag_dcominfo {
|
|
char *nm;
|
|
int offset;
|
|
char *descr;
|
|
} dcominfo[] = {
|
|
"NAME", 4, "NAME OF PROGRAM/CORE LOAD",
|
|
"DBCT", 6, "BLOCK CT OF PROGRAM/CORE LOAD",
|
|
"FCNT", 7, "FILES SWITCH",
|
|
"SYSC", 8, "SYSTEM/NON-SYSTEM CARTRIDGE INDR",
|
|
"JBSW", 9, "JOBT SWITCH",
|
|
"CBSW", 10, "CLB-RETURN SWITCH",
|
|
"LCNT", 11, "NO. OF LOCALS",
|
|
"MPSW", 12, "CORE MAP SWITCH",
|
|
"MDF1", 13, "NO. DUP CTRL RECORDS (MODIF)",
|
|
"MDF2", 14, "ADDR OF MODIF BUFFER",
|
|
"NCNT", 15, "NO. OF NOCALS",
|
|
"ENTY", 16, "RLTV ENTRY ADDR OF PROGRAM",
|
|
"RP67", 17, "1442-5 SWITCH",
|
|
"TODR", 18, "OBJECT WORK STORAGE DRIVE CODE",
|
|
"FHOL", 20, "ADDR LARGEST HOLE IN FIXED AREA",
|
|
"FSZE", 21, "BLK CNT LARGEST HOLE IN FXA",
|
|
"UHOL", 22, "ADDR LAST HOLE IN USER AREA",
|
|
"USZE", 23, "BLK CNT LAST HOLE IN UA",
|
|
"DCSW", 24, "DUP CALL SWITCH",
|
|
"PIOD", 25, "PRINCIPAL I/O DEVICE INDICATOR",
|
|
"PPTR", 26, "PRINCIPAL PRINT DEVICE INDICATOR",
|
|
"CIAD", 27, "RLTV ADDR IN @STRT OF CIL ADDR",
|
|
"ACIN", 28, "AVAILABLE CARTRIDGE INDICATOR",
|
|
"GRPH", 29, "2250 INDICATOR",
|
|
"GCNT", 30, "NO. G2250 RECORDS",
|
|
"LOSW", 31, "LOCAL-CALLS-LOCAL SWITCH",
|
|
"X3SW", 32, "SPECIAL ILS SWITCH",
|
|
"ECNT", 33, "NO. OF *EQUAT RCDS",
|
|
"ANDU", 35, "1+BLK ADDR END OF UA (ADJUSTED)",
|
|
"BNDU", 40, "1+BLK ADDR END OF UA (BASE)",
|
|
"FPAD", 45, "FILE PROTECT ADDR",
|
|
"PCID", 50, "CARTRIDGE ID, PHYSICAL DRIVE",
|
|
"CIDN", 55, "CARTRIDGE ID, LOGICAL DRIVE",
|
|
"CIBA", 60, "SCTR ADDR OF CIB",
|
|
"SCRA", 65, "SCTR ADDR OF SCRA",
|
|
"FMAT", 70, "FORMAT OF PROG IN WORKING STG",
|
|
"FLET", 75, "SCTR ADDR 1ST SCTR OF FLET",
|
|
"ULET", 80, "SCTR ADDR 1ST SCTR OF LET",
|
|
"WSCT", 85, "BLK CNT OF PROG IN WORKING STG",
|
|
"CSHN", 90, "NO. SCTRS IN CUSHION AREA",
|
|
NULL
|
|
};
|
|
|
|
void dump_dcom (void)
|
|
{
|
|
struct tag_dcominfo *d;
|
|
char txt[50];
|
|
|
|
showmajor("Sector 1 - DCOM");
|
|
getsector(1, dcom);
|
|
|
|
for (d = dcominfo; d->nm != NULL; d++) {
|
|
sprintf(txt, "%-4.4s %s", d->nm, d->descr);
|
|
pbf(txt, dcom+d->offset, 1);
|
|
}
|
|
}
|
|
|
|
void dump_resmon (void)
|
|
{
|
|
showmajor("Sector 2 - Resident Image");
|
|
getsector(2, buf);
|
|
dump(verbose ? SECLEN : 32);
|
|
}
|
|
|
|
struct {
|
|
int pfrom, pto;
|
|
int printed;
|
|
char *name;
|
|
} sletinfo[] = {
|
|
0x01, 0x12, FALSE, "DUP",
|
|
0x1F, 0x39, FALSE, "Fortran",
|
|
0x51, 0x5C, FALSE, "Cobol",
|
|
0x6E, 0x74, FALSE, "Supervisor",
|
|
0x78, 0x84, FALSE, "Core Load Builder",
|
|
0x8C, 0x8C, FALSE, "Sys 1403 prt",
|
|
0x8D, 0x8D, FALSE, "Sys 1132 prt",
|
|
0x8E, 0x8E, FALSE, "Sys console prt",
|
|
0x8F, 0x8F, FALSE, "Sys 2501 rdr",
|
|
0x90, 0x90, FALSE, "Sys 1442 rdr/pun",
|
|
0x91, 0x91, FALSE, "Sys 1134 paper tape",
|
|
0x92, 0x92, FALSE, "Sys kbd",
|
|
0x93, 0x93, FALSE, "Sys 2501/1442 conv",
|
|
0x94, 0x94, FALSE, "Sys 1134 conv",
|
|
0x95, 0x95, FALSE, "Sys kbd conv",
|
|
0x96, 0x96, FALSE, "Sys diskz",
|
|
0x97, 0x97, FALSE, "Sys disk1",
|
|
0x98, 0x98, FALSE, "Sys diskn",
|
|
0x99, 0x99, FALSE, "(primary print)",
|
|
0x9A, 0x9A, FALSE, "(primary input)",
|
|
0x9B, 0x9B, FALSE, "(primary input excl kbd)",
|
|
0x9C, 0x9C, FALSE, "(primary sys conv)",
|
|
0x9D, 0x9D, FALSE, "(primary conv excl kbd)",
|
|
0xA0, 0xA1, FALSE, "Core Image Loader",
|
|
0xB0, 0xCC, FALSE, "RPG",
|
|
0xCD, 0xCE, FALSE, "Dup Part 2",
|
|
0xCF, 0xF6, FALSE, "Macro Assembler",
|
|
0
|
|
};
|
|
|
|
void dump_slet (void)
|
|
{
|
|
int i, j, iphase, nsecs, sec, max_sec = 0;
|
|
char sstr[16], *smark;
|
|
|
|
showmajor("Sectors 3-5 - SLET");
|
|
for (i = 0; i < 3; i++) {
|
|
getsector(3+i, buf);
|
|
memmove(((WORD *) slet)+SECLEN*i, buf, SECLEN*sizeof(WORD));
|
|
}
|
|
|
|
printf("# PHID Addr Len Sector Secs\n");
|
|
printf("------------------------------------------\n");
|
|
for (i = 0; i < SLETLEN; i++) {
|
|
if (slet[i].phid == 0)
|
|
break;
|
|
|
|
sec = slet[i].sector;
|
|
iphase = (int) (signed short) slet[i].phid;
|
|
nsecs = (slet[i].nwords + SECLEN-1)/SECLEN;
|
|
|
|
if (sec & 0xF800) {
|
|
smark = "*";
|
|
sec &= 0x7FF;
|
|
}
|
|
else
|
|
smark = " ";
|
|
|
|
for (j = 0; sletinfo[j].pfrom != 0; j++)
|
|
if (sletinfo[j].pfrom <= iphase && sletinfo[j].pto >= iphase)
|
|
break;
|
|
|
|
sprintf(sstr, "(%d.%d)", sec / DSK_SECCYL, slet[i].sector % DSK_SECCYL);
|
|
|
|
printf("%3d %04x %4d %04x %04x %04x %s %-7s %3x",
|
|
i, slet[i].phid, iphase, slet[i].addr, slet[i].nwords, slet[i].sector, smark, sstr, nsecs);
|
|
|
|
if (iphase < 0)
|
|
iphase = -iphase;
|
|
|
|
if (sletinfo[j].pfrom == 0)
|
|
printf(" ???");
|
|
else if (! sletinfo[j].printed) {
|
|
printf(" %s", sletinfo[j].name);
|
|
sletinfo[j].printed = TRUE;
|
|
}
|
|
|
|
for (j = 0; j < i; j++) {
|
|
if (sec == (slet[j].sector & 0x7FF)) {
|
|
printf(" (same as %04x)", slet[j].phid);
|
|
break;
|
|
}
|
|
}
|
|
|
|
max_sec = MAX(max_sec, sec+nsecs-1); // find last sector used
|
|
|
|
putchar('\n');
|
|
|
|
if (i >= 15 && ! verbose) {
|
|
printf("...\n");
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
int ascii_to_ebcdic_table[128] =
|
|
{
|
|
0x00,0x01,0x02,0x03,0x37,0x2d,0x2e,0x2f, 0x16,0x05,0x25,0x0b,0x0c,0x0d,0x0e,0x0f,
|
|
0x10,0x11,0x12,0x13,0x3c,0x3d,0x32,0x26, 0x18,0x19,0x3f,0x27,0x1c,0x1d,0x1e,0x1f,
|
|
0x40,0x5a,0x7f,0x7b,0x5b,0x6c,0x50,0x7d, 0x4d,0x5d,0x5c,0x4e,0x6b,0x60,0x4b,0x61,
|
|
0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7, 0xf8,0xf9,0x7a,0x5e,0x4c,0x7e,0x6e,0x6f,
|
|
|
|
0x7c,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7, 0xc8,0xc9,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,
|
|
0xd7,0xd8,0xd9,0xe2,0xe3,0xe4,0xe5,0xe6, 0xe7,0xe8,0xe9,0xba,0xe0,0xbb,0xb0,0x6d,
|
|
0x79,0x81,0x82,0x83,0x84,0x85,0x86,0x87, 0x88,0x89,0x91,0x92,0x93,0x94,0x95,0x96,
|
|
0x97,0x98,0x99,0xa2,0xa3,0xa4,0xa5,0xa6, 0xa7,0xa8,0xa9,0xc0,0x4f,0xd0,0xa1,0x07,
|
|
};
|
|
|
|
int ebcdic_to_ascii (int ch)
|
|
{
|
|
int j;
|
|
|
|
for (j = 32; j < 128; j++)
|
|
if (ascii_to_ebcdic_table[j] == ch)
|
|
return j;
|
|
|
|
return '?';
|
|
}
|
|
|
|
#define HDR_LEN 120
|
|
|
|
void dump_hdng(void)
|
|
{
|
|
int i;
|
|
char str[HDR_LEN+1], *p = str;
|
|
|
|
showmajor("Sector 7 - Heading");
|
|
getsector(7, buf);
|
|
|
|
for (i = 0; i < (HDR_LEN/2); i++) {
|
|
*p++ = ebcdic_to_ascii((buf[i] >> 8) & 0xFF);
|
|
*p++ = ebcdic_to_ascii( buf[i] & 0xFF);
|
|
}
|
|
|
|
*p = '\0';
|
|
trim(str);
|
|
printf("%s\n", str);
|
|
}
|
|
|
|
BOOL mget (int offset, char *name)
|
|
{
|
|
char title[80];
|
|
|
|
if (dcom[offset] == 0)
|
|
return FALSE;
|
|
|
|
getsector(dcom[offset], buf);
|
|
sprintf(title, "Sector %x - %s", dcom[offset], name);
|
|
showmajor(title);
|
|
return TRUE;
|
|
}
|
|
|
|
void dump_scra (void)
|
|
{
|
|
if (! mget(SCRA, "SCRA"))
|
|
return;
|
|
|
|
dump(verbose ? SECLEN : 32);
|
|
}
|
|
|
|
void dump_let (void)
|
|
{
|
|
if (! mget(ULET, "LET"))
|
|
return;
|
|
}
|
|
|
|
void dump_flet (void)
|
|
{
|
|
if (! mget(FLET, "FLET"))
|
|
return;
|
|
}
|
|
|
|
void dump_cib (void)
|
|
{
|
|
if (! mget(CIBA, "CIB"))
|
|
return;
|
|
|
|
dump(verbose ? SECLEN : 32);
|
|
}
|
|
|
|
#define LFHD 5 // WORD COUNT OF LET/FLET HEADER PMN09970
|
|
#define LFEN 3 // NO OF WDS PER LET/FLET ENTRY PMN09980
|
|
#define SCTN 0 // RLTY ADDR OF LET/FLET SCTR NO. PMN09990
|
|
#define UAFX 1 // RLTV ADDR OF SCTR ADDR OF UA/FXA PMN10000
|
|
#define WDSA 3 // RLTV ADDR OF WDS AVAIL IN SCTR PMN10010
|
|
#define NEXT 4 // RLTV ADDR OF ADDR NEXT SCTR PMN10020
|
|
#define LFNM 0 // RLTV ADDR OF LET/FLET ENTRY NAME PMN10030
|
|
#define BLCT 2 // RLTV ADDR OF LET/FLET ENTRY DBCT PMN10040
|
|
|
|
void bail (char *fmt, ...)
|
|
{
|
|
va_list args;
|
|
|
|
va_start(args, fmt);
|
|
fprintf(stderr, fmt, args);
|
|
va_end(args);
|
|
putchar('\n');
|
|
|
|
exit(1);
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------------
|
|
// trim - remove trailing whitespace from string s
|
|
// ---------------------------------------------------------------------------------
|
|
|
|
char *trim (char *s)
|
|
{
|
|
char *os = s, *nb;
|
|
|
|
for (nb = s-1; *s; s++)
|
|
if (*s > ' ')
|
|
nb = s;
|
|
|
|
nb[1] = '\0';
|
|
return os;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* lowcase - force a string to lowercase (ASCII)
|
|
* ------------------------------------------------------------------------ */
|
|
|
|
char *lowcase (char *str)
|
|
{
|
|
char *s;
|
|
|
|
for (s = str; *s; s++) {
|
|
if (*s >= 'A' && *s <= 'Z')
|
|
*s += 32;
|
|
}
|
|
|
|
return str;
|
|
}
|
|
|