From efec386179cd630f9a0b356f6ddfabb5c4a77d95 Mon Sep 17 00:00:00 2001 From: "James C. Bevier" Date: Mon, 28 Feb 2022 15:39:34 -0700 Subject: [PATCH] SEL32: Remove taptools and util directories. SEL32: Remove testcode files from tests directory. SEL32: Update ICL file to Concept/32 format. SEL32: Update README.md file. SEL32: Add .gitignore in install directory for dsk/tapes files. --- SEL32/.gitignore | 3 + SEL32/README.md | 20 +- SEL32/installs/.gitignore | 6 + SEL32/installs/loaddma1x67.ini | 2 +- SEL32/installs/loaddma21b.ini | 2 +- SEL32/installs/loadscsi21b.ini | 2 +- SEL32/installs/loadscsi3x.ini | 2 +- SEL32/installs/sel32load1x.ini | 2 +- SEL32/installs/user36esdtp2.ini | 2 +- SEL32/taptools/README.md | 278 ---- SEL32/taptools/cutostap.c | 238 ---- SEL32/taptools/ddump.c | 232 ---- SEL32/taptools/deblk.c | 604 -------- SEL32/taptools/diagcopy.c | 322 ----- SEL32/taptools/disk2tap.c | 268 ---- SEL32/taptools/diskload.c | 356 ----- SEL32/taptools/eomtap.c | 241 ---- SEL32/taptools/filelist.c | 335 ----- SEL32/taptools/fmgrcopy.c | 308 ----- SEL32/taptools/instcopy.c | 477 ------- SEL32/taptools/loadMPXfile.txt | 119 -- SEL32/taptools/makefile | 227 --- SEL32/taptools/mkdiagtape.c | 301 ---- SEL32/taptools/mkfmtape.c | 427 ------ SEL32/taptools/mkvmtape.c | 1035 -------------- SEL32/taptools/mpxblk.c | 186 --- SEL32/taptools/renum.c | 60 - SEL32/taptools/sdtfmgrcopy.c | 384 ------ SEL32/taptools/small.c | 161 --- SEL32/taptools/tap2disk.c | 246 ---- SEL32/taptools/tapdump.c | 274 ---- SEL32/taptools/tape2disk.c | 253 ---- SEL32/taptools/tapscan.c | 153 -- SEL32/taptools/volmcopy.c | 307 ----- SEL32/tests/.gitignore | 6 + SEL32/tests/cpu.icl | 139 +- SEL32/tests/testcode.mem | Bin 60 -> 0 bytes SEL32/tests/testcode0.l | 1009 -------------- SEL32/tests/testcode0.mem | Bin 1776 -> 0 bytes SEL32/tests/testcpu.l | 25 - SEL32/tests/testcpu.s | 24 - SEL32/util/makecode.c | 2298 ------------------------------- SEL32/util/makefile | 73 - 43 files changed, 141 insertions(+), 11266 deletions(-) create mode 100644 SEL32/.gitignore create mode 100644 SEL32/installs/.gitignore delete mode 100644 SEL32/taptools/README.md delete mode 100644 SEL32/taptools/cutostap.c delete mode 100644 SEL32/taptools/ddump.c delete mode 100644 SEL32/taptools/deblk.c delete mode 100644 SEL32/taptools/diagcopy.c delete mode 100644 SEL32/taptools/disk2tap.c delete mode 100644 SEL32/taptools/diskload.c delete mode 100644 SEL32/taptools/eomtap.c delete mode 100644 SEL32/taptools/filelist.c delete mode 100644 SEL32/taptools/fmgrcopy.c delete mode 100644 SEL32/taptools/instcopy.c delete mode 100644 SEL32/taptools/loadMPXfile.txt delete mode 100644 SEL32/taptools/makefile delete mode 100644 SEL32/taptools/mkdiagtape.c delete mode 100644 SEL32/taptools/mkfmtape.c delete mode 100644 SEL32/taptools/mkvmtape.c delete mode 100644 SEL32/taptools/mpxblk.c delete mode 100644 SEL32/taptools/renum.c delete mode 100644 SEL32/taptools/sdtfmgrcopy.c delete mode 100644 SEL32/taptools/small.c delete mode 100644 SEL32/taptools/tap2disk.c delete mode 100644 SEL32/taptools/tapdump.c delete mode 100644 SEL32/taptools/tape2disk.c delete mode 100644 SEL32/taptools/tapscan.c delete mode 100644 SEL32/taptools/volmcopy.c create mode 100644 SEL32/tests/.gitignore delete mode 100644 SEL32/tests/testcode.mem delete mode 100644 SEL32/tests/testcode0.l delete mode 100644 SEL32/tests/testcode0.mem delete mode 100644 SEL32/tests/testcpu.l delete mode 100644 SEL32/tests/testcpu.s delete mode 100644 SEL32/util/makecode.c delete mode 100644 SEL32/util/makefile diff --git a/SEL32/.gitignore b/SEL32/.gitignore new file mode 100644 index 0000000..8053ee5 --- /dev/null +++ b/SEL32/.gitignore @@ -0,0 +1,3 @@ +#ignore taptools and util directories. +/taptools +/util diff --git a/SEL32/README.md b/SEL32/README.md index 84b19da..b6c9fe1 100644 --- a/SEL32/README.md +++ b/SEL32/README.md @@ -41,17 +41,16 @@ available configurations. # SEL32 test configuration files in the tests directory: -In the tests directory contains the machine diagnostic command file and +The tests directory contains the SEL32 machine diagnostic command file and bootable tape. They are used by the simh makefile to test the SEL32 simulator after it built. All of the instruction set and operating modes are validated by the diagnostic. There is a pass/failure indication from the diagnostic. The command file sel32_test.ini is used by the makefile. The command file diag.ini can be run at any time by the user to rerun the -diagnostics. There is also some test code used during initial development -of the SEL32 simulator. Also an example of the initial configuration file -(ICL) used by the diagnostic is provided. The machine configuration is -loaded by the diag or the UTX or MPX operating system at boot time. See -the MPX manuals at bitsavers.org/pdf/sel/sel32_mpx for using MPX 1X or 3X. +diagnostics. There is an example of the initial configuration file (ICL) +used by the diagnostic. The machine configuration is loaded by the diag +or the UTX or MPX operating system at boot time. See the MPX manuals at +bitsavers.org/pdf/sel/sel32_mpx for using MPX 1X or 3X. #sel32_test.ini - diag.tap; type "../sel32_test.ini" or run from makefile. Auto run by sel32 makefile to validate build or can be run at any time @@ -96,13 +95,6 @@ diag.tap - bootable level one diagnostic tape w/auto testing. Testing is extremely difficult without any source for the diagnostics. Updates to follow as tests are corrected. -# SEL32 tap tools available in the taptools directory: - -Available tap tools in taptools directory: -./taptools - set of tools to work with .tap formatted tapes. Also tools - to convert between MPX and UNIX file formats. See README - file in the taptools directory and source for descriptions. - Other MPX versions support: I have recently received some old MPX 3.X save tapes. Using these I have been able to hand build a MPX3.6 SDT tape that @@ -117,5 +109,5 @@ Other MPX versions support: thankfull. Please keep looking. James C. Bevier -02/27/2022 +02/28/2022 diff --git a/SEL32/installs/.gitignore b/SEL32/installs/.gitignore new file mode 100644 index 0000000..7ba7fdd --- /dev/null +++ b/SEL32/installs/.gitignore @@ -0,0 +1,6 @@ +#tape files are dynamically downloaded from github.com/AZBevier/SEL32-installs as they are needed. +/tape +#disk files are created by the simh installation command files. These are SEL32 bootable disks. +/dsk +#ignore lp output from MPX-1X install. +lprout diff --git a/SEL32/installs/loaddma1x67.ini b/SEL32/installs/loaddma1x67.ini index d73a7a3..978dd52 100644 --- a/SEL32/installs/loaddma1x67.ini +++ b/SEL32/installs/loaddma1x67.ini @@ -26,7 +26,7 @@ mkdir tapes ; Set tape image filename set env FILE=mpx1xsdt.tap ; Set github.com URL for downloading files -set env GITURL=https://github.com/AZBevier/SEL32-installs/raw/master/tapes/ +set env GITURL=https://github.com/AZBevier/SEL32-installs/raw/main/tapes/ if exist "tapes/%FILE%" goto exists if not exist "tapes/%FILE%" echof "file %FILE% missing, trying %FILE%.tgz" cd tapes diff --git a/SEL32/installs/loaddma21b.ini b/SEL32/installs/loaddma21b.ini index d1e6274..ece03a1 100644 --- a/SEL32/installs/loaddma21b.ini +++ b/SEL32/installs/loaddma21b.ini @@ -28,7 +28,7 @@ mkdir tapes ; Set tape image filename set env FILE1=utx21b1.tap ; Set github.com URL for downloading files -set env GITURL=https://github.com/AZBevier/SEL32-installs/raw/master/tapes/ +set env GITURL=https://github.com/AZBevier/SEL32-installs/raw/main/tapes/ if exist "tapes/%FILE1%" goto exists1 if not exist "tapes/%FILE1%" echof "file %FILE1% missing, trying %FILE1%.tgz" cd tapes diff --git a/SEL32/installs/loadscsi21b.ini b/SEL32/installs/loadscsi21b.ini index f799111..5f6fd7e 100644 --- a/SEL32/installs/loadscsi21b.ini +++ b/SEL32/installs/loadscsi21b.ini @@ -34,7 +34,7 @@ mkdir tapes set env FILE1=utx21b1.tap if exist "tapes/%FILE1%" goto exists1 ; Set github.com URL for downloading files -set env GITURL=https://github.com/AZBevier/SEL32-installs/raw/master/tapes/ +set env GITURL=https://github.com/AZBevier/SEL32-installs/raw/main/tapes/ if not exist "tapes/%FILE1%" echof "file %FILE1% missing, trying %FILE1%.tgz" cd tapes if exist "%FILE1%.tgz" goto nocurl1 diff --git a/SEL32/installs/loadscsi3x.ini b/SEL32/installs/loadscsi3x.ini index 104cff3..00c344c 100644 --- a/SEL32/installs/loadscsi3x.ini +++ b/SEL32/installs/loadscsi3x.ini @@ -30,7 +30,7 @@ mkdir tapes ; Set tape image filename set env FILE=mpxsdt69.tap ; Set github.com URL for downloading files -set env GITURL=https://github.com/AZBevier/SEL32-installs/raw/master/tapes/ +set env GITURL=https://github.com/AZBevier/SEL32-installs/raw/main/tapes/ if exist "tapes/%FILE%" goto exists if not exist "tapes/%FILE%" echof "file %FILE% missing, trying %FILE%.tgz" cd tapes diff --git a/SEL32/installs/sel32load1x.ini b/SEL32/installs/sel32load1x.ini index b20ab1e..9e096f3 100644 --- a/SEL32/installs/sel32load1x.ini +++ b/SEL32/installs/sel32load1x.ini @@ -26,7 +26,7 @@ mkdir tapes ; Set tape image filename set env FILE=mpx1xsdt.tap ; Set github.com URL for downloading files -set env GITURL=https://github.com/AZBevier/SEL32-installs/raw/master/tapes/ +set env GITURL=https://github.com/AZBevier/SEL32-installs/raw/main/tapes/ if exist "tapes/%FILE%" goto exists if not exist "tapes/%FILE%" echof "file %FILE% missing, trying %FILE%.tgz" cd tapes diff --git a/SEL32/installs/user36esdtp2.ini b/SEL32/installs/user36esdtp2.ini index 9f0d075..73000cf 100644 --- a/SEL32/installs/user36esdtp2.ini +++ b/SEL32/installs/user36esdtp2.ini @@ -38,7 +38,7 @@ mkdir tapes ; Set tape image filename set env FILE=user36esdtp2.tap ; Set github.com URL for downloading files -set env GITURL=https://github.com/AZBevier/SEL32-installs/raw/master/tapes/ +set env GITURL=https://github.com/AZBevier/SEL32-installs/raw/main/tapes/ if exist "tapes/%FILE%" goto exists if not exist "tapes/%FILE%" echof "file %FILE% missing, trying %FILE%.tgz" cd tapes diff --git a/SEL32/taptools/README.md b/SEL32/taptools/README.md deleted file mode 100644 index e7e5fa3..0000000 --- a/SEL32/taptools/README.md +++ /dev/null @@ -1,278 +0,0 @@ -This directory contains several utilites to work with .tap metadata -files used by the simh simulators. Some of these would be usable -for any simulator, not just the SEL32 simulator. General use MPX -utilities are also attached that help with file format conversion -between MPX and UNIX files. - -Users should create the directories /system and /system/bin to hold -the utilities. The directories should be world readable/writable. -chmod 777 /system /system/bin -The following two lines should be added to your ~/.bashrc so you -will be able to execute the utilities from anywhere: -PATH=$PATH:/system/bin -export PATH -You can test to see if correct by typing 'echo $PATH' and you -should get a response with /system/bin in the directory list. - -Compile and install the utilities by typing 'make install' to -install utilities into the /system/bin directory. - - -cutostap - This program scans a metadata .tap file and copies files - until an EOF is found. This program is used to remove - the sdt image from a .tap file to be used in another - .tap sdt image. The mkfmcopy can be used to create a - user sdt tape with files following the sdt image. - - command: cutostap stdout - input - stdin file to be written with sdt image - -diskload - This program reads an MPX load module and stores it into - a simulated diskfile. The MPX 1.X SMD entry for the file - is entered into the SMD for the file. Will not work for - MPX 3.X file systems. - - command: diskload -la program diskfile - option -a - add filename to diskfile - option -l - list files in diskfile SMD, ignore filename - input - filename - file to copy to system disk - - diskfile - simulated system disk - output - modified system disk - -eomtap - This program reads a tape assigned as input device. It - copies files until two EOFs are read and then makes sure - two EOFs are written followed by an EOM. This program - makes sure a .tap tape is readable without errors. - - command: eomtap mt00 filename - input - mag tape device or file being read - output - disk file containing tape file contents - -filelist - This program scans a metadata .tap file and prints the - file count and sizes. Used to determine the file - format contained in the metadata .tap file. - - command: filelist stdout - input - stdin stdout - input - file.tap file to dump - output - stdout filelist and sizes - output - directory/files extracted to current directory - -mkfmtape - This program creates an MPX 1.X filemgr save tape. The - tape can then be used to restore files to the MPX 1.x - system. The output will be in SIMH simulated .tap format. - - command: mkfmtape opts output.tap file1 file2 ... - input - list of filename to save to tape. - output - output.tap a tap formatted file. - options - -p = file type 0xca for programs - - -t = ASCII text file type 0xee - - -l = library/directory file type 0xff - - -o = other type 0x00 - - -a = append entries to current file - - -u = username (directory) - -mkvmtape - This program reads MPX files and stores them into a - simulated volmgr save tape. The tape may then become - a MPX 3.X sdt boot tape to install MPX 3.X from or a - volmgr file restore tape for a running MPX system. - The output will be in SIMH simulated .tap format. - - command: mkfmtape [-ptloa] [-bboot] [-iimage] [-jj.vfmt] - [-uusername] tapname file1 file2 ... - intput - [options] volmtape filename, filename, etc. - output - volmtape file, file list to stdout - - options - -p = file type 0xca for programs - - -t = ASCII text file type 0xee - - -l = library/directory file type 0xff - - -o = other type 0x00 - - -a = append entries to current file - - -u = username (username) - - -d = dirname (directory) - - -v = volname (volume) - - -b = bootfile name - - -i = system image file - - -j = j.vfmt filename - -mkdiagtape.c - This program extracts the diag command file (file 2) - from a diagnostic tape in .tap format and replaces it - with a new command file. The rest of the tape is copied - unchanged. The original command file from the diag tape - must be extracted from the diag tape using the diagcopy - utility. This file can then be deblocked using the deblk - utility. The file can then be editied using VI or your - favorite editor. Lines must be blank filled to 80 chars - exactly after editing. The mpxblk utility must then be - used to restore the file to blocked MPX format before - installing it on the new diag tape. - - 1. mkdir temp; Create temp directory. - 2. cp diag.tap temp; Copy in current diag tape. - 3. cd temp; Move to temp directory. - 4. diagcopy diag.tap; Extract diag tape contents. - 5. deblk cmdfile >cmd.txt; Creat unblocked text file. - 6. vi cmd.txt; Edit text file with new commands and save. - 7. mpxblk cmd.blk; Restore blocked file format. - 8. mkdiagtape -c cmd.txt diag.tap newdiag.tap. - 9. copy newdiag.tap to execution directory and run sel32. - - command: mkdiagtape -c cmdfile olddiag newdiag - intput - simulated in_diagtape - output - simulated newtape - option - -c cmdfile - -diagcopy - This program reads a SEL .tap diagnostic boot tape and splits - the contents into multiple files. The first tape record - is 204 bytes of boot code and is put into the file bootcode. - The following records in the file contains the diagnostic - overlay program (DOL) and are in 7680 byte blocks. The last - record can be <= 7680 bytes. The data is put into the file - dolfile. The 2nd file on the tape contains the diagnostic - auto execute file. It is a MPX blocked file where the first - word of each 768 char block contains 0x0003f3b8. It can be - read using the deblk utility in the taptools directory. - The following diagnostic files on the tape are written to - files named diagfileNN where NN is relative file number on - the tape. These records are all multiple of 768 bytes each - and contain binary programs. - - command: diagcopy diag.tap - input - diag.tap file to dump - output - stdout filelist and sizes - output - if tape contains a valid diag image, it will be - output to files bootfile, cmdfile, dolfile and - to diagfileNN, where NN is 3 or larger. - -tapdump - This program reads a metadata .tap file and prints a side - by side hexdump of the file contents. The records are - displayed as 256 byte chuncks. After each record of 256 - bytes are displayed, hitting C/R will continue dumping, - hitting 'q' will terminate the display, and hitting 's' - will skip to the next file on the simulated tape. - - command: tapdump stdout - input - stdin output - input - .tap formatted file being read - output - disk file containing .tap file contents - -tape2disk - This program reads a tape assigned as input device. It - generates a .tap metadata file. Stdout will contain a - listing of the files and sizes written to disk. The define - #define FILEMGR must be compiled in for tapes ending with - two EOFs. Unix and MPX 1.X filemgr tapes use that format. - MPX 3.X volmgr save tapes contain three EOFs so comment out - the define for that case. - - command: tape2disk /dev/mt00 [file.tap] - input - mag tape device being read - output - list of files and sizes read from input tape - output - metadata .tap file optionally specified - -disk2tap - This program reads a file assigned as input device. It - generates a .tap formatted metadata file. Stdout will - display the file name and size written to disk. - - command: disk2tap file [dest.tap] - input - input filename being read - output - filename and size read from input - output - metadata .tap file specified - -tapscan - This program scans a metadata .tap file and prints the - file count and sizes. Used to determine the file - format contained in the metadata .tap file. - - command: tapscan file.tap >stdout - input - file.tap file to scan - output - stdout filelist and sizes - -volmcopy - This program reads a MPX 3.X volmgr save tape. The tape - must contain a volmgr save image with 6144 byte records - containing a list of saved files. Followed by directory - entries of 1536 bytes and finally file data of 1 to 8 768 - byte records. Files larger than 6144 bytes will be output - as modulo 6144 bytes. There is an EOF after each file - definition. The program will create a directory in the - current directory for each different directory. Within - each directory each file contained on the tape is extracted - and written as binary data to the named file. The .tap - file MUST be a volmgr save tape and not a MPX 1.X SDT/save - tape. - - command: fmgrcopy file.tap >stdout - input - file.tap file to dump - output - stdout filelist and sizes - output - directory/files extracted to current directory - -General utilities for MPX - -ddump - Create a side by side ASCII dump of a file. Same operation - as the DDUMP utility in MPX. 256 bytes are displayed at - a time. Hitting C/R will continue to next 256 bytes. A - hex address can be input to display data at a given offset - in the file. Optionally, the file data can be modified. - - command: ddump -r filename - option - -r means open file read only - input - filename file to read - output - side by size ASCII dump of file - -deblk - read and convert a MPX blocked file to unblocked UNIX file - format. Compressed and uncompressed files records can be - read. Output is an ASCII string with '\n' termination. - - command: deblk [filename] - input - filename or if non specified, stdin - output - ASCII sting to stdout - -mpxblk - Create an MPX blocked file from a '\n' terminated ASCII - character string file. Trailing blanks are not deleted - from the source file. Max line size is 254 bytes. - - command: mpxblk fileout - input - read a '\n' terminated ASCII file from stdin - output - write MPX blocked file to stdout - -renum - Create a numbered file from a '\n' terminated ASCII file. - The input file is assumed to be a standard UNIX file. The - input lines are truncated or expaned to lines of 72 chars. - A line number in the form of XXXX.000 is appended to - create 80 char '\n' terminated lines. - - command: renum fileout - input - read ASCII file from stdin - output - write numbered ASCII file to stdout - -small - Remove line numbers and trailing blanks from an ASCII '\n' - terminated file. Lines are terminated at 72 chars and then - stripped of trailing blanks. Output is '\n' terminated - ASCII files. - - command: small fileout - input - read ASCII file from stdin - output - write stripped ASCII file to stdout - -James C. Bevier -02/15/2021 diff --git a/SEL32/taptools/cutostap.c b/SEL32/taptools/cutostap.c deleted file mode 100644 index 5d5304c..0000000 --- a/SEL32/taptools/cutostap.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * cutostap.c - * - * This program scans a metatape file and copies files until EOF is found. - * This program has the net effect of removing the sdt image from a file. - * The program will make sure 2 eof's and 1 eom are written to the tape. - * input - specified filename - * output - specified filename - */ - -#include -#include -#ifdef _WIN32 -#include -//#include -//#include -#endif -//#include -//#include - -int filen = 1; -int EOFcnt = 0; -int count=0, lcount=0; -int size=0, tsize=0; -int oldsize, newsize; -FILE *outfp; -//int inp; -FILE *infp; -int ln; - -/* get a line of input. */ -int getloi(char *s, int lim) -{ -/* int c, i; */ - int n1, n2, hc, tc, n; - - /* read the byte count in 32 bit word as header */ -// n1 = read(inp, (char *)(&hc), (size_t)4); - n1 = fread((char *)(&hc), sizeof(char), (size_t)4, infp); - if (n1 <= 0) { - hc = -1; /* at EOM on disk file */ - return hc; /* return EOM */ - } - - /* check for EOF & EOM on tape data */ - if (hc & 0xffff0000) { /* check for garbage, assume EOM */ - hc = -1; /* at EOM on disk file */ - return hc; /* return EOM */ - } - - /* check for EOF & EOM on tape data */ - if (hc == 0) { - /* we are at tape EOF */ - if (++EOFcnt < 2) { /* if 1st EOF, print file info */ - if (ln > 0) { - if (count - lcount > 1) - fprintf(stderr, "file %d: records %d to %d: size %d\n", - filen, lcount, count - 1, ln); - else - fprintf(stderr, "file %d: record %d: size %d\n", - filen, lcount, ln); - } - fprintf(stderr, "file %d: EOF after %d records: %d bytes\n\n", - filen, count, size); - filen++; /* set next file number */ - } else { - fprintf(stderr, "second EOF after %d files: %d bytes\n", - filen-1, tsize+size); - } - count = 0; /* file record count back to zero */ - lcount = 0; /* last record count back to zero */ - tsize += size; /* add to total tape size */ - size = 0; /* file size back to zero */ - ln = -1; /* set ln to -1 showing we are at EOF */ - return 0; /* return EOF on tape data */ - } - - /* check for EOM */ - if (hc == -1) { - return -1; /* at EOM on disk file */ - } - - /* read the data */ -// n = read(inp, s, (size_t)hc); - n = fread(s, sizeof(char), (size_t)hc, infp); - if (n <= 0) - return -1; /* at EOM on disk file */ - - /* if odd byte record, read extra byte and throw it away */ - if (n & 0x1) { -// n2 = read(inp, (char *)(&tc), (size_t)1); - n2 = fread((char *)(&tc), sizeof(char), (size_t)1, infp); - if (n2 <= 0) - return -1; /* at EOM on disk file */ - } - - /* read the byte count in 32 bit word as trailer */ -// n2 = read(inp, (char *)(&tc), (size_t)4); - n2 = fread((char *)(&tc), sizeof(char), (size_t)4, infp); - if (n2 <= 0) - return -1; /* at EOM on disk file */ - - count++; /* bump record count */ - size += n; /* update bytes read */ - EOFcnt = 0; /* not an EOF */ - if (n != ln) { - if (ln > 0) { - if (count - lcount > 1) - fprintf(stderr, "file %d: records %d to %d: size %d\n", - filen, lcount, count - 1, ln); - else - fprintf(stderr, "file %d: record %d: size %d\n", - filen, lcount, ln); - } - ln = n; - lcount = count; - } - /* return bytes in buffer */ - return n; -} - -void putrec(int cnt, char *buf) -{ - int n1, n2, nw; - int hc = (cnt + 1) & ~1; /* make byte count even */ - -//printf("writing %d chars\n", cnt); - /* write actual byte count to 32 bit word as header */ - n1 = fwrite((char *)(&hc), (size_t)1, (size_t)4, outfp); - /* write the data mod 2 */ - nw = fwrite((char *)buf, (size_t)1, (size_t)hc, outfp); - /* write the byte count in 32 bit word as footer */ - n2 = fwrite((char *)(&hc), (size_t)1, (size_t)4, outfp); - if (n1 != 4 || nw != hc || n2 != 4) - { - fprintf(stderr, "write (%d) failure\n", nw); - fprintf(stderr, "Operation aborted\n"); - fclose(outfp); -// close(inp); - fclose(infp); - free(buf); - exit(1); - } -} - -int main (int argc, char *argv[]) -{ - char *buf; - size_t buf_size = 256 * 1024; - size_t ll, gotboth = 0; - int zero = 0; - - if (argc != 3) { - fprintf(stderr, "usage: %s infile outfile\n", argv[0]); - exit(1); - } - - /* open input file */ -// if ((inp = open(argv[1], O_RDONLY, 0666)) < 0) { - if ((infp = fopen(argv[1], "r")) == NULL) { - fprintf(stderr,"%s: fopen: unable to open input file %s\n", - argv[0], argv[1]); - return (1); - } - -// close(inp); /* close input */ - fclose(infp); /* close input */ - outfp = fopen(argv[1], "r"); /* reopen */ - fseek(outfp, 0, SEEK_END); /* seek to end */ - oldsize = ftell(outfp); /* get filesize in bytes */ - fclose(outfp); /* now close it */ - - /* open input file */ -// if ((inp = open(argv[1], O_RDONLY, 0666)) < 0) { - if ((infp = fopen(argv[1], "r")) == NULL) { - fprintf(stderr,"%s: fopen: unable to open input file %s\n", - argv[0], argv[1]); - exit(1); - } - - /* open output file */ - outfp = fopen(argv[2], "w"); - if (outfp == NULL) { - fprintf(stderr,"%s: fopen: unable to open output file %s\n", - argv[0], argv[2]); - exit(1); - } - - /* init counts */ -// ln = -2; /* look for 2 eof */ - ln = -1; /* look for 2 eof */ - count = 0; - size = 0; - tsize = 0; - lcount = 0; - - /* get a 256k buffer */ - if ((buf = malloc(buf_size)) == NULL) { - fprintf(stderr, "Can't allocate memory for %s\n", argv[0]); - exit(1); - } - - /* get buffers until eof */ -/*domore:*/ - while ((ll=getloi(buf, buf_size)) > 0) { -//printf("got %d char\n", ll); - /* we have data to write */ - putrec(ll, buf); /* write the buffer */ - gotboth = 0; - } -//printf("we have EOF or EOM, DONE\n"); - /* We have EOM, see if EOF's needed */ - switch (gotboth) { - case 0: /* we have written no EOFs, so write two */ - fwrite((char *)(&zero), (size_t)1, (size_t)4, outfp); - /* drop through */ - case 1: /* we have written 1 EOF, so write one more */ - fwrite((char *)(&zero), (size_t)1, (size_t)4, outfp); - /* drop through */ - default: - case 2: /* we have written 2 EOFs, now do EOM */ - zero = -1; - fwrite((char *)(&zero), (size_t)1, (size_t)4, outfp); - } - fprintf(stderr, "EOM after 2 EOFs %d files: %d bytes\n", - filen-1, tsize); - - newsize = ftell(outfp); /* get filesize in bytes */ - fprintf(stderr, "Size of file changed from %d to %d\n", - oldsize, newsize); - - /* we done */ - fclose(outfp); -// close(inp); - fclose(infp); - free(buf); - exit(0); -} diff --git a/SEL32/taptools/ddump.c b/SEL32/taptools/ddump.c deleted file mode 100644 index dfd123d..0000000 --- a/SEL32/taptools/ddump.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - ddump - file dump utility for listing files in side-by-side hex - and ascii, plus having the option to modify the file giving - a hexadecimal byte offset into the file and the hex data - which will be written to the supplied address. - - Usage is: - ddump file - - where: - file1 is the file to dump and/or modify. - - written by Rick Beery - modified many times by Jim Bevier - - The program fd.c written by M. Kraieski has been incorporated - into this program. -*/ - -#include -#include -#include - -void dodump(); -int modify(); -void modify_file(); - -int main(argc,args) -int argc; -char *args[]; -{ - FILE *fp, *fopen(); -/* int i; */ -/* char *tempstring; */ - - if ((argc < 2) || (argc > 3)) { - printf("usage: %s [-r] file\n", args[0]); - printf(" -r uses read-only mode\n"); - exit(1); - } /* end of if */ - - if (argc == 3) -#ifdef mpx - /* open read and unblocked */ - if (strcmp("-r",args[1]) == 0) - fp = fopen(args[2],"ru"); -#else - if (strcmp("-r",args[1]) == 0) - fp = fopen(args[2],"r"); -#endif - else { - printf("Invalid option %s ignored\n", args[1]); -#ifdef mpx - /* open read/write unblocked */ - fp = fopen(args[2],"r+u"); -#else - fp = fopen(args[2],"r+"); -#endif - } -#ifdef mpx - /* open read/write unblocked */ - else - fp = fopen(args[1],"r+u"); -#else - else - fp = fopen(args[1],"r+"); -#endif - - if (fp == NULL) { - fprintf(stderr,"%s: fopen: unable to open file %s\n", args[0], args[1]); - exit(1); - } /* end of if */ - dodump(fp,0); - fclose(fp); -} /* end of main */ - -#define PRINTABLE(x) ((x < 32) || (x > 126)) ? '.' : x - -void dodump(fp, fileadr) -FILE *fp; -int fileadr; -{ - char buff[257]; - int file_byte_count=0, curchar, buffptr, bufflen; - - buffptr = 0; - bufflen = 16; - - fseek(fp,fileadr,0); - while ((curchar = getc(fp)) != EOF) { - file_byte_count++; - if (!buffptr) - printf(" %06x : ",fileadr); - printf("%02x",curchar); - buff[buffptr++] = PRINTABLE(curchar); - if (!(buffptr % 4)) - printf(" "); - if (buffptr >= bufflen) { - buff[buffptr] = 0; - printf(" |%s|\n",buff); - buffptr = 0; - fileadr += bufflen; - if (!(file_byte_count % 256)) { - modify_file(fp); - } /* end of if */ - } /* end of if */ - } /* end of while */ - - if (buffptr) { - buff[buffptr] = 0; - while (buffptr++ < bufflen) { - printf(" "); - if (!(buffptr % 4)) - printf(" "); - } /* end of while */ - printf(" |%s|\n",buff); - } /* end of if */ - modify_file(fp); - return; -} /* end of dodump */ - -int modify(fp1) -FILE *fp1; -{ - char hexstring[33]; - int num_chars, digit, i, byte=0, /*stat,*/ file_offset=0, indx=0; - int power(); - void gethex_string(); - int asciihex_digit_to_decimal(); - - gethex_string(hexstring); - num_chars = strlen(hexstring); - for (i=num_chars-1; i>=0; i--) { - digit = asciihex_digit_to_decimal(hexstring[indx++]); - file_offset += digit*power(16,i); - } /* end of for */ - if ((fseek(fp1,file_offset,0)) != -1) { - /* read characters from the terminal */ - printf("\nenter new hex data > "); - gethex_string(hexstring); - num_chars = strlen(hexstring); - - /* convert character to numeric field and - new set of data at offset in file specified */ - for (i=0; i='0' && c<='9') || (c>='a' && c<='f')) - hex[indx++] = c; - else { - while ((c=getchar()) != '\n') - ; - indx = 0; - printf("Invalid hex number; please re-enter > "); - } - } - hex[indx] = '\0'; -} /* end of gethex_string */ - -int asciihex_digit_to_decimal(c) -char c; -{ - int digit; - - if (c >= 'a' && c <= 'f') - digit = c - 'a' + 10; - else - if (c >= '0' && c <= '9') - digit = c -'0'; - else - digit = -1; /* error */ - return(digit); -} /* end of asciihex_digit_to_decimal */ - -int power(x,n) -int x, n; -{ - int p; - - for (p=1; n>0; --n) - p = p*x; - return (p); -} /* end of routine power */ - -void modify_file(fp) -FILE *fp; -{ - int ans, modify(),modified_addr; - - printf("\n hex address, - continue, q = quit > "); - ans = getchar(); - if ((ans>='0' && ans<='9') || (ans>='a' && ans<='f')) { - ungetc(ans, stdin); - modified_addr = modify(fp); - printf("\n"); - dodump(fp, (modified_addr/256)*256); - } /* end of "if" part of if - then */ - else { - if (ans == 'q') { - fclose(fp); - exit(1); - } - else { - if (ans != '\n') - while ((ans=getchar()) != '\n') - ; - } - } /* end of if -then */ -} /* end of modify_file */ diff --git a/SEL32/taptools/deblk.c b/SEL32/taptools/deblk.c deleted file mode 100644 index 4ade82f..0000000 --- a/SEL32/taptools/deblk.c +++ /dev/null @@ -1,604 +0,0 @@ -/* - * deblk.c - * - * This program reads MPX blocked and/or MPX compressed files and - * deblocks blocked files and uncompresses compressed files and - * deletes trailing blanks from a source file. The program will - * also process standard ASCII newline ('\n') terminated files. - * input - [filename] or stdin - * output - stdout - */ - -/* - * MPX blocked file format - * bytes 0-1 - not used and are zero - * bytes 2-3 - next record position in buffer - * byte 4 - start/end of block flag - * - 0x20 - EOB end of block - * - 0x40 - BOB start of block - * byte 5 - last record byte count - * byte 6 - this blocks flags - * - 0x00 - valid data - * - 0x20 - EOB end of block - * - 0x80 - EOF end of file - * - 0xa0 - EOB/EOF end of file - * byte 7 - bytes in this record - * data byte - cnt data bytes - * byte cnt+4- 0x20 EOB status - * byte cnt+5- last record count - */ - -/* - * Compressed record - * byte 0 - 0xbf -> start of record - * 0x9f -> start of next record - * byte 1 - record count - * byte 2 - high order byte of 16 bit checksum - * byte 3 - low order byte of 16 bit checksum - * - */ - -/* -* -* An O.S. compressed record consists of 120 bytes: -* -* 6 Control bytes and 114 bytes of compressed source -* -* (The last record can be less than 120 bytes, on that -* record the compressed source will be from 4-114 bytes). -* -* 6 Control bytes -* -* 1 Byte- Data type code bf or 9f (9f means this is last record) -* 1 Byte- Size of compressed record (- 6 for control bytes) -* (Usually 114 (72(x)) is the size except last record) -* 2 Byte- Checksum -* 2 Byte- Record sequence number (starting from zero) -* -* 4-114 Bytes of one or more groups of compressed source as follows: -* -* A compressed group consists of: -* A blank count byte, a data count byte, data. -* -* Compressed groups are repeated and terminated by an ff char. -* Compressed groups are usually terminated at 114 chars by -* the ff char unless this is the last record in the file. -* -* A line of text usually is compressed as follows: -* A blank count byte, a data count byte, compressed data -* (one or more of these compressed groups for up to 72 chars of source) -* followed by a blank count byte,a data count byte (of 8), -* data (8 char sequence number), terminated by a ff char. -* -* A workfile logical compressed line is similiar to the O.S. -* logical compressed line except that an 8 char sequence number -* always exists in the workfile format and it is always first -* rather than at the end of the record (if sequence numbers did -* not exist in columns 73-80 in the O.S. original compressed -* records than the editor generates them). Preceding the workfile -* compressed record is a 2 byte previous record in the page pointer. -* Also note that workfiles are not blocked by the O.S., but have -* their own structure of headers, data space, and free space. -* -* If the sequence number does not exist or the period is not in -* the proper place (nnnn.nnn) or the sequence number contains -* anything other than numbers, then the editor will generate -* its own sequence number. -* -* The first blank count can range from 0-80 blank chars -* subsequent blank counts can range from 3-79 max. That is -* since it takes 2 bytes to do blank compression (a blank count -* and a data count), only 3 or more blank chars after the first -* non-blank char in a line are compressed. -* Records to be compressed are assumed to be 80 chars or less -* (including an 8 char sequence number). -* -* The checksum is simply the addition of all the 120 chars in the -* compressed record except for the 6 control bytes. -* -* The smallest compressed line consists of 14 chars: -* A blank count byte (of 71), a data count byte (of 8), -* data (an 8 char sequence number, a blank count byte (of zero), -* a data count byte (of 1), data (one char), and an ff terminator -* compressed record format can be processed only by the following: -* -* Assembler, P4, Source Update, Editor and some functions of Media -* and of course some utility programs like flip. -* -* Note that a text line can be spread across several compressed -* records. -*/ - -#include -#include -#include - -#define BLKSIZE 768 /* MPX block file sector size */ -extern int rbl(); -extern int getloi(); /* right from my mind */ -extern int putloi(); /* write line */ - -/* read file and output to stdout */ -int main(argc, argv) -int argc; -char *argv[]; -{ - FILE *fp, *fopen(); - unsigned char s[BUFSIZ]; - - if(argc == 1) { /* no args; copy std in */ - while (1) { - if (rbl(stdin, s, BUFSIZ) <= 0) /* read til EOF */ - exit(0); - putloi(s); - } - } else { - while (--argc > 0) - if ((fp = fopen(*++argv, "r")) == NULL) { - fprintf(stderr, "list: can't open %s\n", *argv); - exit(1); - } else { - while (1) { - if (rbl(fp, s, BUFSIZ) <= 0) /* read til EOF */ - exit(0); - putloi(s); - } - fclose(fp); - } - } - exit(0); -} - -/* - * This function computes and checks the checksum of a compressed file - */ -int checksum(buf) -unsigned char *buf; -{ - int i = 0; - short int ccs = 0; /*zero checksum */ - /* get checksum */ - unsigned int rcs = (((buf[2] << 8) & 0xff00) | (buf[3] & 0xff)); - int cnt = buf[1] & 0xff; /* record count */ -//fprintf(stderr, "checksum cnt %x data %x %x %x %x %x %x %x %x\n", -// cnt, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); - - while (cnt > 0) { - unsigned short v = buf[i+6] & 0xff; - ccs += v; /* add the byte */ -//fprintf(stderr, "checksum cnt %x val %x sum %x\n", i, v, ccs); - i++; /* bump address */ - cnt--; /* reduce count */ - } -//fprintf(stderr, "checksum size %x read %x calc %x\n", buf[1], rcs, ccs); - if (ccs == rcs) - return 0; /* return OK */ - return 1; /* return error */ -} - -int bin = 0; -unsigned char si[BLKSIZE]; -unsigned char bi[BLKSIZE]; -int ubdp = 0; /* unblocked data pointer */ -int ubdc = 0; /* unblocked data count */ -int bdp = 0; /* blocked data pointer */ -int bdc = 0; /* blocked data count */ -short filetype = 0; - -#define unknown 0x00 -#define blocked 0x01 -#define compress 0x02 -#define ascii 0x04 - -/* - * This function reads MPX blocked files - */ -int readbb(fp, ip, cnt) -FILE *fp; -char *ip; -int cnt; -{ - int c; - int i = 0; - - if (bin == 0) { -//fprintf(stderr, "read sector a\n"); - if (fread(si, 1, BLKSIZE, fp) <= 0) - return (0); /* this means eof */ - bin = 6; - } - /* check for EOF */ - if (si[bin] & 0x80) { - bin = 0; - return(0); /* we have EOF */ - } - /* check for EOB in last record */ - if (si[bin - 2] & 0x20) { -//fprintf(stderr, "read sector b\n"); - if (fread(si, 1, BLKSIZE, fp) <= 0) - return (0); /* this means eof */ - bin = 6; - } -//fprintf(stderr, "copy block from sector @ bin %x\n", bin); - /* copy the block into users buffer */ - if ((c = si[bin+1]) > 0) { - for (i = 0; i < c; i++) { - ip[i] = si[bin + 2 + i]; - if (i >= cnt) - break; - } - bin += (c + 4); - ip[i] = '\0'; - return (i); - } - bin = 0; - return (i); -} - -/* function to read a byte from an unblocked file */ -int getb(fp) -FILE *fp; -{ - int c; - static int goteof = 0; - - /* file is unblocked, get next record */ - if (goteof) { - goteof = 0; -//fprintf(stderr, "getb - returning EOF ubdc=%x\n", ubdc); - return (-1); /* this means eof */ - } - if (ubdp < ubdc) /* is count exhausted */ - c = si[ubdp++] & 0xff; /* copy char */ - if (ubdp >= ubdc) { /* is count exhausted */ - /* need to read next block, if not first time */ - /* we need a new buffer */ - /* read in 768 byte block of the file */ - if ((ubdc = fread(si, 1, BLKSIZE, fp)) <= 0) - goteof = 1; /* this means eof */ -//fprintf(stderr, "getb - read unblocked file goteof %x ubdc=%x\n", goteof, ubdc); - ubdp = 0; - } - return (c); -} - -/* get a line of input */ -int getloi(fp, s, lim) /* right from my mind */ -FILE *fp; -unsigned char s[]; -int lim; -{ - int c, i, cc, bc = 0, rc = 0; - - /* see how we are to process data */ - if (filetype & blocked) { - /* file is blocked, get next record */ - if (bdp == 0) { - /* we need a new buffer */ -/*newbuf:*/ - if ((bdc = readbb(fp, bi, lim)) <= 0) - return (0); /* this means eof */ -//fprintf(stderr, "getloi read blocked file %x\n", bdc); - bdp = 0; - } - /* check for compressed data */ - if (filetype & compress) { - if ((bi[bdp] & 0x9f) != 0x9f) { - fprintf(stderr, "blocked compressed file read error %x\n", bi[bdp]); - return (0); /* this means error */ - } - /* checksum the record */ - if (checksum(&bi[bdp])) { - fprintf(stderr, "blocked compressed file checksum error\n"); - return (0); /* this means error */ - } -//fprintf(stderr, "getloi blocked compressed file checksum OK @ %x cnt %x\n", bdp, bdc); - /* copy in the next record */ - /* get chars until EOF or limit reached */ - cc = bi[bdp+1]+6; /* get count */ - for (i = 0; (--lim > 0) && (i < cc); i++) { - s[rc++] = bi[bdp++]; /* copy char */ - } - if ((bdp >= bdc) || (i == cc)) { - bdp = 0; /* read new buffer next time */ -//fprintf(stderr, "getloi blocked compressed read return %x bdc %x bdp %x\n", rc, bdc, bdp); - } - return (rc); /* return data count */ - } - /* file is uncompressed, so copy MPX records */ -//fprintf(stderr, "getloi blocked data rc=%x bdc=%x\n", rc, bdc); - for (i=0; i -#include -//#include -//#include -//#include -//#include -//#include - -int lfilen, filen = 1; -int diag = 0; -int EOFcnt = 0; -int count=0, lcount=0; -int size=0, tsize=0; -int size_512K = 512 * 1024; -int ln; -//int inp, outp; -FILE *infp, *outfp; -int smd = 0; -#define PRINTABLE(x) ((x < 32) || (x > 126)) ? '.' : x - -/* get a line of input. */ -int getloi(char *s, int lim) -{ -/* int c, i; */ - int n1, n2, hc, tc, n; - -// errno = 0; - /* read the byte count in 32 bit word as header */ -// n1 = read(inp, (char *)(&hc), (size_t)4); - n1 = fread((char *)(&hc), (size_t)1, (size_t)4, infp); - if (n1 <= 0) - hc = -1; /* at EOM on disk file */ - - /* check for EOF & EOM on tape data */ - if (hc & 0xffff0000) /* check for garbage, assume EOM */ - hc = -1; /* at EOM on disk file */ - - /* check for EOF & EOM on tape data */ - if (hc == 0) { - /* we are at tape EOF */ - if (++EOFcnt < 2) { /* if 1st EOF, print file info */ -// printf("EOF found after file %d\n", filen); - lfilen = filen; - filen++; /* set next file number */ - smd = 1; /* look for smd again */ - } - count = 0; /* file record count back to zero */ - lcount = 0; /* last record count back to zero */ - tsize += size; /* add to total tape size */ - size = 0; /* file size back to zero */ - ln = -1; /* set ln to -1 showing we are at EOF */ - - /* we have EOF */ - return 0; /* return EOF on tape data */ - } - if (hc == -1) { - printf("EOM found after file %d\n", filen); - return -1; /* at EOM on disk file */ - } - - /* read the data */ -// n = read(inp, s, (size_t)hc); - n = fread(s, (size_t)1, (size_t)hc, infp); - - /* if odd byte record, read extra byte and throw it away */ - if (n & 0x1) { -// n2 = read(inp, (char *)(&tc), (size_t)1); - n2 = fread((char *)(&tc), (size_t)1, (size_t)1, infp); - if (n2 <= 0) - return -1; /* at EOM on disk file */ - } - - /* read the byte count in 32 bit word as trailer */ -// n2 = read(inp, (char *)(&tc), (size_t)4); - n2 = fread((char *)(&tc), (size_t)1, (size_t)4, infp); - count++; /* bump record count */ - size += n; /* update bytes read */ - EOFcnt = 0; /* not an EOF */ - if (n != ln) { - ln = n; - lcount = count; - } - /* return bytes in buffer */ - return n; -} - -int main (int argc, char *argv[]) -{ - char *buf; - size_t size_512K = 512 * 1024; - size_t buf_size = 512 * 1024; -// char *cp, *np; - int ll; -// char path[64], command[128]; - int boot = 0; - int dol = 0; - int sdt = 0; - - if (argc != 2) { - printf("usage: %s infile\n", argv[0]); - exit(1); - } /* end of if */ - -// if ((inp = open(argv[1], O_RDONLY, 0666)) < 0) { - if ((infp = fopen(argv[1], "r")) == NULL) { - printf("%s: fopen: unable to open input file %s\n", argv[0], argv[1]); - return (1); - } -// outp = -1; - outfp = NULL; - - /* get a 512k buffer */ - if ((buf = malloc(buf_size)) == NULL) { - //fprintf(stderr, "Can't allocate memory for tscan\n"); - printf("Can't allocate memory for tscan\n"); - return (4); - } - /* init counts */ - ln = -2; /* look for 2 eof */ - count = 0; - size = 0; - tsize = 0; - lcount = 0; - filen = 1; - lfilen = 0; - printf("\nfile %d:\n", filen); - - /* get lines until eof */ - while ((ll=getloi(buf, buf_size)) != EOF) { - printf("got ll = %d filen %d\n", ll, filen); - if (ll == 204) { - diag = 1; /* process diag boot record */ - printf("process diag ll = %d\n", ll); - } - if ((dol == 1) || ((ll == 7680) && (diag))) { - dol = 1; /* process DOL record */ - printf("process dol ll = %d\n", ll); - } - - if (ll == 0) { - /* eof found, process new file */ - printf("\nfile complete %d:\n", filen); - break; - //continue; /* go look for another SDT bootfile or SMD entry */ - } else - if (ll == 1920) { - printf("File is a MPX SDT tape and can not be processed!\n"); - break; - } else - if (ll == 4608) { - printf("File is a MPX filemgr save tape and can not be processed!\n"); - break; - } else - if ((diag == 0) && (ll != 204)) { - printf("File type is unknown and can not be processed!\n"); - break; - } else { - int cc = 0; -// unsigned int curchar; - char filename[16]; -// int i, j, m; - - /* A diag tape has a 204 byte boot loader in the first record. */ - /* It is followed by multiple 7680 byte records of the diagnostic */ - /* overlay loader (DOL) */ - - if (diag == 1) { - int no, ct = 0;; - /* get more diag data */ - /* open output file, create it if necessary */ -// if (outp == -1) { - if (outfp == NULL) { - sprintf(filename, "bootfile\0"); -// if ((outp = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { - if ((outfp = fopen(filename, "w")) == NULL) { - printf("Can't open bootfile\n"); -// close(inp); - fclose(infp); - free(buf); - return (3); - } - } - printf("got2 ll = %d writing to bootfile -> %s\n", ll, filename); -// no = write(outp, buf, ll); - no = fwrite(buf, (size_t)1, (size_t)ll, outfp); - if (no != ll) - printf("write (%d) != read (%d) on file bootfile\n", no, ll); -// close(outp); - fclose(outfp); -// outp = -1; - outfp = NULL; - - /* now put the rest of the code in another file */ - sprintf(filename, "dolfile"); -// if ((outp = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { - if ((outfp = fopen(filename, "w")) == NULL) { - printf("Can't open dolfile\n"); -// close(inp); - fclose(infp); - free(buf); - return (3); - } - /* get lines until eof */ - while ((ll=getloi(buf, buf_size)) > 0) { - ct++; -// no = write(outp, buf, ll); - no = fwrite(buf, (size_t)1, (size_t)ll, outfp); - if (no != ll) - printf("write (%d) != read (%d) on file dolfile\n", no, ll); - } - diag = 2; -// close(outp); - fclose(outfp); -// outp = -1; - outfp = NULL; - printf("wrote %d records to dolfile %s\n", ct, filename); - continue; /* go look for diag command file */ - } else - if (diag == 2) { - /* read the command file in and write to cmdfile */ - int no, ct = 0;; - /* get more data */ - /* open output file, create it if necessary */ -// if (outp == -1) { - if (outfp == NULL) { - sprintf(filename, "cmdfile\0"); -// if ((outp = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { - if ((outfp = fopen(filename, "w")) == NULL) { - printf("Can't open cmdfile\n"); -// close(inp); - fclose(infp); - free(buf); - return (3); - } - } - printf("got2 ll = %d writing to cmdfile -> %s\n", ll, filename); -// no = write(outp, buf, ll); - no = fwrite(buf, (size_t)1, (size_t)ll, outfp); - if (no != ll) - printf("write (%d) != read (%d) on file cmdfile\n", no, ll); - - /* now put the rest of the code in the file */ - /* get lines until eof */ - while ((ll=getloi(buf, buf_size)) > 0) { - ct++; -// no = write(outp, buf, ll); - no = fwrite(buf, (size_t)1, (size_t)ll, outfp); - if (no != ll) - printf("write (%d) != read (%d) on file cmdfile\n", no, ll); - } - diag = 3; -// close(outp); - fclose(outfp); -// outp = -1; - outfp = NULL; - printf("wrote %d records to cmdfile %s\n", ct, filename); - continue; /* go look for diag command file */ - } else - if (diag == 3) { - /* read the diag file in and write to diagfile */ - int no, ct = 0;; - /* get more data */ - /* open output file, create it if necessary */ -// if (outp == -1) { - if (outfp == NULL) { - sprintf(filename, "diagfile%02d\0", filen); -// if ((outp = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { - if ((outfp = fopen(filename, "w")) == NULL) { - printf("Can't open %s\n", filename); -// close(inp); - fclose(infp); - free(buf); - return (3); - } - } - printf("got2 ll = %d writing to %s\n", ll, filename); -// no = write(outp, buf, ll); - no = fwrite(buf, (size_t)1, (size_t)ll, outfp); - if (no != ll) - printf("write (%d) != read (%d) on file %s\n", no, ll, filename); - - /* now put the rest of the code in the file */ - /* get lines until eof */ - while ((ll=getloi(buf, buf_size)) > 0) { - ct++; -// no = write(outp, buf, ll); - no = fwrite(buf, (size_t)1, (size_t)ll, outfp); - if (no != ll) - printf("write (%d) != read (%d) on file %s\n", no, ll, filename); - } -// close(outp); - fclose(outfp); -// outp = -1; - outfp = NULL; - printf("wrote %d records to cmdfile %s\n", ct, filename); - continue; /* go look for diag command file */ - } /* read cmd file records */ - } /* process read of tape */ - } /* end of getloi read */ -/*dostop:*/ -// close(inp); - fclose(infp); - free(buf); -// if (outp >= 0) - if (outfp != NULL) -// close(outp); - fclose(outfp); - exit(0); -} diff --git a/SEL32/taptools/disk2tap.c b/SEL32/taptools/disk2tap.c deleted file mode 100644 index 5a8fc3e..0000000 --- a/SEL32/taptools/disk2tap.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * MPX uses 2 EOF in a row to separate sections of MPX3.x master SDT tapes. - * It uses 3 EOF in a row to indicate the EOT on MPX 3.X tapes. So we - * cannot assume EOT is at the 1st or 2nd EOF in a row. Keep looking - * for a third one. Comment out the #define FMGRTAPE below to read an - * MPX 3.x master SDT. For user SDT tapes or MPX 1.X master SDT tapes - * leave the #define FMGRTAPE uncommented so it will be defined. The - * program will stop on two EOFs. For non MPX tapes, the 2nd EOF means - * EOT. Some tapes have only one EOT and will terminate on EOT detected. - * Leave off the output file name to just scan the tape and output record - * sizes and counts. - */ - -#include -//#include -//#include -//#include -//#include -//#include -#include -//#include -//#include -//#include - -//#define FMGRTAPE /* defined for filemgr tapes, undefined for volmgr tape */ -#if defined(_MSC_VER) && (_MSC_VER < 1600) -typedef __int8 int8; -typedef __int16 int16; -typedef __int32 int32; -typedef unsigned __int8 uint8; -typedef unsigned __int16 uint16; -typedef unsigned __int32 uint32; -typedef signed __int64 t_int64; -typedef unsigned __int64 t_uint64; -typedef t_int64 off_t; -#else -/* All modern/standard compiler environments */ -/* any other environment needa a special case above */ -#include -typedef int8_t int8; -typedef int16_t int16; -typedef int32_t int32; -typedef uint8_t uint8; -typedef uint16_t uint16; -typedef uint32_t uint32; -#endif /* end standard integers */ - -char *buff; /* buffer for read/write */ -int filen = 1; /* file number being processed */ -long count=0, lcount=0; /* number of blocks for file */ -extern void RUBOUT(); /* handle user DELETE key signal */ -off_t size=0, tsize=0; /* number of bytes in file, total */ -int ln; -char *inf, *outf; -int copy; -int32 size_1K = 1024; -#if 0 -int32_t size_128K = 128 * 1024; -int32_t size_256K = 256 * 1024; -#endif - -int main(argc, argv) -int argc; -char **argv; -{ -// int n, nw, inp, outp; - int n, nw; - FILE *inp, *outp; -// struct mtop op; -// int32_t buf_size = size_256K; - int32 buf_size = size_1K; - int EOFcnt = 0; /* count the number of EOFs in a row. */ - - if (argc <= 1 || argc > 3) { - (void)fprintf(stderr, "Usage: disk2tap src [dest]\n"); - return (1); - } - inf = argv[1]; - if (argc == 3) { - outf = argv[2]; - copy = 1; - } -// if ((inp = open(inf, O_RDONLY, 0666)) < 0) { - if ((inp = fopen(inf, "r")) == NULL) { - (void)fprintf(stderr, "Can't open %s\n", inf); - return (1); - } - if (copy) { - /* open output file, create it if necessary */ -// if ((outp = open(outf, O_WRONLY|O_CREAT, 0666)) < 0) { - if ((outp = fopen(outf, "w")) == NULL) { - (void)fprintf(stderr, "Can't open %s\n", outf); - return (3); - } - } - /* get a 1k buffer */ - if ((buff = malloc(buf_size)) == NULL) { - (void)fprintf(stderr, "Can't allocate memory for disk2tap\n"); - return (4); - } -// if (signal(SIGINT, SIG_IGN) != SIG_IGN) -// (void)signal(SIGINT, RUBOUT); - - ln = -2; - for (;;) { - count++; -// errno = 0; - /* read first record to get size for buffer, doubling each time unsuccessful */ -// while ((n = read(inp, buff, buf_size)) < 0) { - while ((n = fread(buff, (size_t)1, (size_t)buf_size, inp)) <= 0) { -#if 0 - if (errno == ENOMEM) { -#if 0 - if (buf_size < size_256K) - buf_size = size_256K; - else - buf_size *= 2; -#endif - free(buff); - if ((buff = malloc(buf_size)) == NULL) { - (void)fprintf(stderr, "Can't allocate memory for tapecopy\n"); - return (4); - } - op.mt_op = MTFSF; /* Rewind to start of file */ - op.mt_count = (daddr_t) 0; - if (ioctl(inp, MTIOCTOP, (char *)&op) < 0) { - perror("Read buffer size error"); - return (6); - } - errno = 0; - continue; - } -#endif - perror("Unknown read error"); -// errno = 0; - return (6); /* abort on error, comment out to ignore taoe errors */ - } - if (n > 0) { - /* we read some data, see if scanning or writing */ - EOFcnt = 0; /* not at EOF anymore */ - if (copy) { - int32 n1, n2; - /* we have data to write */ - int32 hc = (n + 1) & ~1; /* make byte count even */ - int32 wc = n; /* get actual byte count */ - /* write actual byte count to 32 bit word as header */ -// n1 = write(outp, (char *)(&wc), (int32_t)4); - n1 = fwrite((char *)(&wc), (size_t)1, (size_t)4, outp); - /* write the data mod 2 */ -// nw = write(outp, buff, (int32_t)hc); - nw = fwrite(buff, (size_t)1, (size_t)hc, outp); - /* write the byte count in 32 bit word as footer */ -// n2 = write(outp, (char *)(&wc), (int32_t)4); - n2 = fwrite((char *)(&wc), (size_t)1, (size_t)4, outp); - if (n1 != 4 || nw != hc || n2 != 4) { - fprintf(stderr, "write (%d) !=" " read (%d)\n", nw, n); - fprintf(stderr, "COPY " "Aborted\n"); - return (5); - } - } - size += n; /* update bytes read */ - if (n != ln) { /* must be last record of file if different */ - if (ln > 0) { - /* we read something */ - if ((count - lcount) > 1) - (void)printf("file %d: records %ld to %ld: size %d\n", - filen, lcount, count - 1, ln); - else - (void)printf("file %d: record %ld: size %d\n", - filen, lcount, ln); - } - ln = n; /* save last record size */ - lcount = count; /* also record count */ - } - } else { - /* we did not read data, it must be an EOF */ - /* if ln is -1, last operation was EOF, now we have a second */ -#ifdef FMGRTAPE - /* filemgr has 2 EOF's at end of tape */ - if (++EOFcnt > 1) { - /* two EOFs mean we are at EOT */ - (void)printf("fmgr eot\n"); - break; - } -#else - /* volmgr has 3 EOF's at end of tape */ - if (++EOFcnt > 2) { - /* three EOFs mean we are at EOT on MPX */ - (void)printf("volm eot\n"); - break; - } -#endif - if (ln > 0) { - if (count - lcount > 1) - (void)printf("file %d: records %ld to %ld: size %d\n", - filen, lcount, count - 1, ln); - else - (void)printf("file %d: record %ld: size %d\n", - filen, lcount, ln); - } -#ifdef FMGRTAPE - (void)printf("file %d: eof after %ld records: %ld bytes\n", - filen, count - 1, size); -#else - if (EOFcnt == 2) /* if 2nd EOF, print file info */ - (void)printf("second eof after %d files: %ld bytes\n", - filen, size); -#endif - if (copy) { - /* write a sudo EOF to disk file as a zero 4 byte record */ - int n1, hc = 0; - /* write the EOF */ - /* write a zero as the byte count in 32 bit word as EOF */ -// n1 = write(outp, (char *)(&hc), (int32_t)4); - n1 = fwrite((char *)(&hc), (size_t)1, (size_t)4, outp); - if (n1 != 4) { - perror("Write EOF"); - return (6); - } - } -#ifdef FMGRTAPE - filen++; /* advance number of files */ -#else - if (EOFcnt < 2) /* not really a file if 2nd EOF */ - filen++; /* advance number of files */ -#endif - count = 0; /* file record count back to zero */ - lcount = 0; /* last record count back to zero */ - tsize += size; /* add to total tape size */ - size = 0; /* file size back to zero */ - ln = n; /* set ln to -1 showing we are at EOF */ - } - } - if (copy) { - /* write a sudo EOM to disk file as a -1 4 byte record */ - int32 n1, hc = 0xffffffff; - /* write the EOM to disk */ - /* write a -1 as the byte count in 32 bit word as EOM */ -// n1 = write(outp, (char *)(&hc), (int32_t)4); - n1 = fwrite((char *)(&hc), (size_t)1, (size_t)4, outp); - if (n1 != 4) { - perror("Write EOM"); - return (6); - } -// (void)close(outp); - fclose(outp); - } - /* print out total tape size in bytes */ - (void)printf("total length: %ld bytes\n", tsize); - return (0); -} - -#if 0 -/* entered when user hit the DELETE key */ -void RUBOUT() -{ - if (count > lcount) - --count; - if (count) - if (count > lcount) - (void)printf("file %d: records %ld to %ld: size" " %d\n", filen, lcount, count, ln); - else - (void)printf("file %d: record %ld: size %d\n", filen, lcount, ln); - (void)printf("interrupted at file %d: record %ld\n", filen, count); - (void)printf("total length: %ld bytes\n", tsize + size); - exit(1); -} -#endif diff --git a/SEL32/taptools/diskload.c b/SEL32/taptools/diskload.c deleted file mode 100644 index 9c06033..0000000 --- a/SEL32/taptools/diskload.c +++ /dev/null @@ -1,356 +0,0 @@ -/* - * diskload.c - * - * This program reads an MPX load module and stores it into the - * sumulated diskfile. The SMD entry is changed to reflect the - * new file entry. - * input - filename - * - simulated diskfile - * output - modified diskfile with SMD entry modified - * 08/11/2018 - */ - -#include -#include -#include - -#define BLKSIZE 768 /* MPX file sector size */ -unsigned char os[BLKSIZE * 100]; /* O/S code */ - -/* read program file and output to simulated mpx1.x diskfile using filemgr format */ -/* dload file diskfile */ -int main(argc, argv) -int argc; -char *argv[]; -{ - FILE *fp, *dp, *fopen(); - unsigned char si[BUFSIZ]; - char *p; - int i, j; -#define DOLIST 1 -#define DOADD 2 - unsigned int option = DOLIST; /* what to do */ - unsigned char *fnp; /* file name pointer */ - unsigned int size; /* size in 768 byte sectors */ - unsigned int word,tmp; /* just a temp word variable */ - unsigned char name[9]; /* LM name */ - unsigned int lmname[2], passwd[2]; - unsigned int smds; /* size of smd */ - unsigned int smdd[2]; /* SMD space definition */ - unsigned char *smd; - unsigned int hash1; /* SMD hash value for name */ - unsigned int udtp; /* UDT pointer */ - unsigned int *mptr; /* word ptr for SMD entries */ - unsigned int boff; - unsigned int rem; - unsigned int blk; - unsigned int lmblk; /* sector addess of load module on disk */ - unsigned int smdudt; /* smd udt index */ - unsigned int spau; /* sectors per allocation unit */ - unsigned int fileau; /* file size in allocation units */ -// unsigned int auptr; /* pointer to allocation unit on disk */ - unsigned int lsblk; /* lowest block address of SMD entries */ - - if (argc <= 1) { /* see if correct # args */ -// fprintf(stderr, "Error: incorrect number of parameters\n"); - fprintf(stderr, "Usage: %s -la program diskfile\n", *argv); - exit(1); - } - if (--argc > 0) { - p = *++argv; -// printf("argv %s\n", p); - if (*p++ == '-') { - while (*p != '\0') { - switch (*p++) { - case 'l': - case 'L': - option |= DOLIST; - break; - case 'A': - case 'a': - option |= DOADD; - break; - default: -// fprintf(stderr, "Error: incorrect option %c specified\n", *--p); - fprintf(stderr, "Usage: %s -la program diskfile\n", *--argv); - exit(1); - break; - } - } - if (*--p == '-') { - fprintf(stderr, "Error: no option specified\n"); - fprintf(stderr, "Usage: %s -la program diskfile\n", *--argv); - exit(1); - } - } else { - argc++; - argv--; - } - if (--argc > 0) { - p = *++argv; -// printf("argv2 %s\n", p); - if ((fp = fopen(*argv, "r")) == NULL) { - fprintf(stderr, "error: can't open load module %s\n", *argv); - exit(1); - } - fnp = *argv; /* get file name pointer */ - fseek(fp, 0, SEEK_END); /* seek to end */ - word = ftell(fp); /* get filesize in bytes */ - fseek(fp, 0, SEEK_SET); /* rewind file */ - } - } - if (--argc <= 0) { - fprintf(stderr, "Error: incorrect number of parameters\n"); - fprintf(stderr, "Usage: %s -la program diskfile\n", *argv); - exit(1); - } - /* open diskfile */ - if ((dp = fopen(*++argv, "r+")) == NULL) { - fprintf(stderr, "error: can't open disk file %s\n", *argv); - exit(1); - } - - /* determine size of file */ - size = word/BLKSIZE; /* get sector count */ - if ((word % BLKSIZE) != 0) - size++; /* add in 1 for partial sector */ - /* size now has load module size in sectors */ - /* we need the file name and password for entry */ - for (i=0; i<8; i++) - name[i] = 0x20; /* pre blank name */ - name[8] = '\0'; /* NULL terminate */ - for (i=0; (i<8) && (fnp[i] != 0); i++) - name[i] = toupper(fnp[i]); /* upper case name */ -// fprintf(stderr, "file %s is size %d sectors\n", name, size); - lmname[0] = (name[0] << 24) | (name[1] << 16) | (name[2] << 8) | (name[3]); - lmname[1] = (name[4] << 24) | (name[5] << 16) | (name[6] << 8) | (name[7]); - passwd[0] = passwd[1] = 0; /* no password */ - /* the disk data has the O/S starting at 0x780 in the file */ - /* add 0x780 to any O/S location you want to load */ - /* C.SMDS (#smd entries) is at 0xb00 + 0x780 = 0x1280 */ - /* read the O/S diskfile into buffer, 7680 bytes */ -// fprintf(stderr, "reading 100*BLKSIZE bytes from disk\n", 100*BLKSIZE); - if (fread(os, 1, BLKSIZE*100, dp) <= 0) - return (0); /* this means bad read */ - smds = (os[0x780+0xb00] << 24) | (os[0x780+0xb01] << 16) | (os[0x780+0xb02] << 8) | (os[0x780+0xb03]); - - /* get udt index for SMD location */ - smdudt = (os[0x780+0xc2c] << 8) | (os[0x780+0xc2d]); - /* udt size id 0x40, C.UDTA is at 0xb40 */ - word = (os[0x780+0xb40] << 24) | (os[0x780+0xb41] << 16) | (os[0x780+0xb42] << 8) | (os[0x780+0xb43]); - udtp = (smdudt * 0x40 + word); /* get udt address */ - /* spau is in byte 0x0f of udt */ - spau = os[0x780+udtp+0x0f] & 0xff; /* get word with spau */ - - /* get file size in au's */ - fileau = size / spau; /* get number of au's required for file */ - if ((size % spau) != 0) - fileau++; /* round up to next au of overflow */ - fprintf(stderr, "file %s is size %d sectors (%d au) requiring %d sectors on disk\n", - name, size, fileau, fileau*spau); -// fprintf(stderr, "UDTP 0x%x SPAU 0x%x\n", udtp, spau); /* display udtp & spau */ - fprintf(stderr, "C.SMDS(0xB00) - SMD size is 0x%x %d entries C.SMDUDT is %x\n", smds, smds, smdudt); - - /* get SMD space definition */ - smdd[0] = (os[0x780+0x840] << 24) | (os[0x780+0x841] << 16) | (os[0x780+0x842] << 8) | (os[0x780+0x843]); - smdd[1] = (os[0x780+0x844] << 24) | (os[0x780+0x845] << 16) | (os[0x780+0x846] << 8) | (os[0x780+0x847]); - fprintf(stderr, "C.SMDD(0x840) - SMD space definition wd0 0x%x wd1 0x%x wd0 %d wd1 %d entries %d\n", - smdd[0], smdd[1], smdd[0] ,smdd[1], smdd[1] * 24); - fprintf(stderr, "SMD space def: blk 0x%x seek 0x%x size 0x%x (%d)\n", - smdd[0], smdd[0]*BLKSIZE, smdd[1], smdd[1]); - - /* rewind the disk */ - fseek(dp, 0, 0); /* seek home */ - /* seek to the smd */ - fseek(dp, smdd[0]*BLKSIZE, 0); /* seek smd */ - if ((smd = (unsigned char *)malloc(smdd[1] * BLKSIZE)) < 0) - return (0); /* this means bad read */ - /* read the SMD into memory */ - if (fread(smd, 1, smdd[1]*BLKSIZE, dp) <= 0) - return (0); /* this means bad read */ - /* use lowest space definition from SMD entries */ - lsblk = smdd[0]; /* set lowest to start of SMD */ - /* loop through the SMD looking for a match to the load module name */ - for (i=0; i<((int)smds*32); i+=32) { - unsigned int sblk, len, udt, pw; - int yep = 0; - for (j=0; j<8; j++) { - if (smd[i+j] != 0) { - fprintf(stderr, "%c", smd[i+j]); - yep = 1; - } - } - if (yep) { - int bit; - unsigned int lmn[2]; /* load module name */ - - sblk = (smd[i+8] << 24) | (smd[i+9] << 16) | (smd[i+10] << 8) | (smd[i+11]); - if ((sblk & 0xffffff) < lsblk) - lsblk = sblk & 0xffffff;/* save the new lowest address */ - len = (smd[i+12] << 24) | (smd[i+13] << 16) | (smd[i+14] << 8) | (smd[i+15]); - pw = (smd[i+24] << 8) | (smd[i+25]); - udt = (smd[i+26] << 8) | (smd[i+27]); - - /* hash the name to see if pointer is to current SMD entry */ - mptr = (unsigned int *)smd; /* get word pointer for SMD data */ - j = i/32; /* offset in SMD file (entry #) */ - lmn[0] = mptr[j*8]; /* get filename first 4 chars to R5 and shift right circular by 1 */ - word = ((lmn[0] & 0xff) << 24) | ((lmn[0] & 0xff00) << 8) | - ((lmn[0] & 0xff0000) >> 8) | ((lmn[0] & 0xff000000) >> 24); - bit = word & 1; /* save bit 31 */ - word = word >> 1; /* shift right 1 */ - if (bit) - word |= 0x80000000; /* copy old bit 31 to bit 0 */ - lmn[1] = mptr[j*8+1]; /* get 2nd 4 chars of filename */ - rem = ((lmn[1] & 0xff) << 24) | ((lmn[1] & 0xff00) << 8) | - ((lmn[1] & 0xff0000) >> 8) | ((lmn[1] & 0xff000000) >> 24); - word = word ^ rem; /* EOR with 2nd half of load module name */ - rem = word % smds; /* get remainder as relative entry number */ - fprintf(stderr, " entry %d (calc %d) off 0x%x typ 0x%x blk 0x%x len 0x%x, pw 0x%x udt 0x%x\n", - j, rem, (sblk & 0xffffff)*BLKSIZE, sblk>>24, sblk, len, pw, udt); -// fprintf(stderr, "offset index %d calc %d\n", i/32, rem); /* display entry # */ - } - } - - /* see if user want list only */ - if ((option & DOLIST) && !(option & DOADD)) - goto doexit; // getout - -#if 0 - /* get file size in au's */ - fileau = size / spau; /* get number of au's required for file */ - if ((size % spau) != 0) - fileau++; /* round up to next au of overflow */ -#endif - - /* lsblk has the lowest space definition from SMD entries */ - lmblk = lsblk - fileau * spau; /* get sector address of where to store lm */ - fprintf(stderr, "lmblk 0x%x lsblk 0x%x fileau 0x%x spau 0x%x\n", lmblk, lsblk, fileau, spau); - - /* hash filename into SMD entry number */ - fprintf(stderr, "1 hashing lmname[0] %x lmname[1] %x\n", lmname[0], lmname[1]); - word = lmname[0]; /* get filename first 4 chars to R5 and shift right circular by 1 */ - i = word & 1; /* save bit 31 */ - word = word >> 1; /* shift right 1 */ - if (i) - word |= 0x80000000; /* copy old bit 31 to bit 0 */ - word = word ^ lmname[1]; /* EOR with 2nd half of load module name */ - hash1 = word / smds; /* calc SMD hash number and save */ - rem = word % smds; /* get remainder as relative entry number */ - - /* get relative 192W block in SMD */ - blk = rem/24; /* divide entry # by # entries/block */ - boff = (rem%24) * 32; /* get byte offset in block of entry */ - tmp = (blk * 24 + (boff/32)); /* make word offset in smd array */ - fprintf(stderr, "hash1 %x rem %x blk 0x%x %d boff %x index %d\n", hash1, rem, blk, blk, boff, tmp); - /* populate the 32 byte SMD entry */ - /* smd has entire SMD in memory */ - tmp = (blk * BLKSIZE + boff) >> 2; /* make word offset in smd array */ - mptr = (unsigned int *)smd; /* get word pointer for smd data */ - /* word 1 and 2 has filename */ - blk = lmname[0]; /* 1st 4 char of lmname */ - word = ((blk & 0xff) << 24) | ((blk & 0xff00) << 8) | ((blk & 0xff0000) >> 8) | ((blk & 0xff000000) >> 24); - mptr[tmp] = word; /* set 1st 4 char of name */ - - blk = lmname[1]; /* set 2nd 4 char of name */ - word = ((blk & 0xff) << 24) | ((blk & 0xff00) << 8) | ((blk & 0xff0000) >> 8) | ((blk & 0xff000000) >> 24); - mptr[tmp+1] = word; /* set 2nd 4 char of name */ - -// blk = 0xca000000 | lmblk; /* type ca and blk address */ - blk = 0xee000000 | lmblk; /* type ca and blk address */ - word = ((blk & 0xff) << 24) | ((blk & 0xff00) << 8) | ((blk & 0xff0000) >> 8) | ((blk & 0xff000000) >> 24); - mptr[tmp+2] = word; /* set type and blk addr */ - /* size now has load module size in sectors */ - blk = 0x80000000 | size; /* file flags and size */ - word = ((blk & 0xff) << 24) | ((blk & 0xff00) << 8) | ((blk & 0xff0000) >> 8) | ((blk & 0xff000000) >> 24); - mptr[tmp+3] = word; /* set flags and size */ - mptr[tmp+4] = 0; /* no username */ - mptr[tmp+5] = 0; /* no username */ - blk = 0x00000000 | smdudt; /* no password and smd udt */ - word = ((blk & 0xff) << 24) | ((blk & 0xff00) << 8) | ((blk & 0xff0000) >> 8) | ((blk & 0xff000000) >> 24); - mptr[tmp+6] = word; /* set password and udt index */ - mptr[tmp+7] = 0; /* not used */ - - /* loop through the SMD looking for a match to the load module name */ - for (i=0; i<((int)smds*32); i+=32) { - unsigned int sblk, len, udt, pw; - int yep = 0; - for (j=0; j<8; j++) { - if (smd[i+j] != 0) { - fprintf(stderr, "%c", smd[i+j]); - yep = 1; - } - } - if (yep) { - int bit; - unsigned int lmn[2]; /* load module name */ - sblk = (smd[i+8] << 24) | (smd[i+9] << 16) | (smd[i+10] << 8) | (smd[i+11]); - len = (smd[i+12] << 24) | (smd[i+13] << 16) | (smd[i+14] << 8) | (smd[i+15]); - pw = (smd[i+24] << 8) | (smd[i+25]); - udt = (smd[i+26] << 8) | (smd[i+27]); -#if 0 - fprintf(stderr, " entry %d blk # 0x%x off 0x%x len 0x%x, pw 0x%x udt 0x%x\n", - i/32, sblk, (sblk & 0xffffff) * BLKSIZE, len, pw, udt); - /* udt size id 0x40, C.UDTA is at 0xb40 */ - word = (os[0x780+0xb40] << 24) | (os[0x780+0xb41] << 16) | (os[0x780+0xb42] << 8) | (os[0x780+0xb43]); - udtp = (udt * 0x40 + word); /* get udt address */ - fprintf(stderr, "UDTP 0x%x\n", udtp); /* display word */ - /* spau is in byte 0x0f */ - spau = os[0x780+udtp+0x0f] & 0xff; /* get word with spau */ - fprintf(stderr, "SPAU 0x%x\n", spau); /* display spau */ -#endif - - /* hash the name to see if pointer is to current SMD entry */ - mptr = (unsigned int *)smd; /* get word pointer for SMD data */ - j = i/32; /* offset in SMD file (entry #) */ - lmn[0] = mptr[j*8]; /* get filename first 4 chars to R5 and shift right circular by 1 */ - word = ((lmn[0] & 0xff) << 24) | ((lmn[0] & 0xff00) << 8) | - ((lmn[0] & 0xff0000) >> 8) | ((lmn[0] & 0xff000000) >> 24); - bit = word & 1; /* save bit 31 */ - word = word >> 1; /* shift right 1 */ - if (bit) - word |= 0x80000000; /* copy old bit 31 to bit 0 */ - lmn[1] = mptr[j*8+1]; /* get 2nd 4 chars of filename */ - rem = ((lmn[1] & 0xff) << 24) | ((lmn[1] & 0xff00) << 8) | - ((lmn[1] & 0xff0000) >> 8) | ((lmn[1] & 0xff000000) >> 24); - word = word ^ rem; /* EOR with 2nd half of load module name */ - rem = word % smds; /* get remainder as relative entry number */ - fprintf(stderr, " entry %d (calc %d) off 0x%x typ 0x%x blk 0x%x len 0x%x, pw 0x%x udt 0x%x\n", - j, rem, (sblk & 0xffffff)*BLKSIZE, sblk>>24, sblk, len, pw, udt); -// fprintf(stderr, "offset index %d calc %d\n", i/32, rem); /* display entry # */ - } - } - - fprintf(stderr, "file space def: blk 0x%x seek 0x%x size 0x%x %d\n", lmblk, lmblk*BLKSIZE, size, size); - if (option & DOADD) { /* see if user wants file written to disk */ - /* write the load module to disk */ - /* rewind the disk */ - fseek(dp, 0, 0); /* seek home */ - /* seek to where the load module is to be stored */ - fseek(dp, lmblk*BLKSIZE, 0); /* seek sector for saving load module */ - /* rewind the load module */ - fseek(fp, 0, 0); /* seek home */ - /* copy all of the sectors */ - for (i=0; i<(int)size; i++) { - /* read a block of the load module */ - if (fread(si, 1, BLKSIZE, fp) <= 0) - return (0); /* this means eof */ - /* write it to the disk file */ - if (fwrite(si, 1, BLKSIZE, dp) <= 0) - return (0); /* this means eof */ - } - - /* write the updated smd to disk */ - /* rewind the disk */ - fseek(dp, 0, 0); /* seek home */ - /* seek to the smd */ - fseek(dp, smdd[0]*BLKSIZE, 0); /* seek smd */ - /* write the SMD from memory to disk */ - if (fwrite(smd, 1, smdd[1]*BLKSIZE, dp) <= 0) - return (0); /* this means bad write */ - } -doexit: - fclose(fp); - fclose(dp); - exit(0); -} diff --git a/SEL32/taptools/eomtap.c b/SEL32/taptools/eomtap.c deleted file mode 100644 index 33d13d7..0000000 --- a/SEL32/taptools/eomtap.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * eomtap.c - * - * This program scans a metatape file and copies files until EOM is found. - * The program will make sure 2 eof's and 1 eom are written to the tape. - * input - specified filename - * output - specified filename - */ - -#include -#include -//#include -//#include -//#include -//#include - -int filen = 1; -int EOFcnt = 0; -int count=0, lcount=0; -int size=0, tsize=0; -int oldsize, newsize; -FILE *outfp; -//int inp; -FILE *infp; -int ln; - -/* get a line of input. */ -int getloi(char *s, int lim) -{ -// int c, i; - int n1, n2, hc, tc, n; - - /* read the byte count in 32 bit word as header */ -// n1 = read(inp, (char *)(&hc), (size_t)4); - n1 = fread((char *)(&hc), (size_t)1, (size_t)4, infp); - if (n1 <= 0) { - hc = -1; /* at EOM on disk file */ - return hc; /* return EOM */ - } - - /* check for EOF & EOM on tape data */ - if (hc & 0xffff0000) { /* check for garbage, assume EOF */ - hc = -1; /* at EOM on disk file */ -#if 0 - return hc; /* return EOM */ -#endif - } - - /* check for EOF & EOM on tape data */ - if (hc == 0) { - /* we are at tape EOF */ - if (++EOFcnt < 2) { /* if 1st EOF, print file info */ - if (ln > 0) { - if (count - lcount > 1) - fprintf(stderr, "file %d: records %d to %d: size %d\n", filen, lcount, count - 1, ln); - else - fprintf(stderr, "file %d: record %d: size %d\n", filen, lcount, ln); - } - fprintf(stderr, "file %d: EOF after %d records: %d bytes\n\n", filen, count, size); - filen++; /* set next file number */ - } else { - fprintf(stderr, "second EOF after %d files: %d bytes\n", filen-1, tsize+size); - } - count = 0; /* file record count back to zero */ - lcount = 0; /* last record count back to zero */ - tsize += size; /* add to total tape size */ - size = 0; /* file size back to zero */ - ln = -1; /* set ln to -1 showing we are at EOF */ - return 0; /* return EOF on tape data */ - } - - /* check for EOM */ - if (hc == -1) { - return -1; /* at EOM on disk file */ - } - - /* read the data */ -// n = read(inp, s, (size_t)hc); - n = fread(s, (size_t)1, (size_t)hc, infp); - if (n <= 0) - return -1; /* at EOM on disk file */ - - /* if odd byte record, read extra byte and throw it away */ - if (n & 0x1) { -// n2 = read(inp, (char *)(&tc), (size_t)1); - n2 = fread((char *)(&tc), (size_t)1, (size_t)1, infp); - if (n2 <= 0) - return -1; /* at EOM on disk file */ - } - - /* read the byte count in 32 bit word as trailer */ -// n2 = read(inp, (char *)(&tc), (size_t)4); - n2 = fread((char *)(&tc), (size_t)1, (size_t)4, infp); -#if 0 - if (n2 <= 0) - return -1; /* at EOM on disk file */ -#endif - count++; /* bump record count */ - size += n; /* update bytes read */ - EOFcnt = 0; /* not an EOF */ - if (n != ln) { - if (ln > 0) { - if (count - lcount > 1) - fprintf(stderr, "file %d: records %d to %d: size %d\n", filen, lcount, count - 1, ln); - else - fprintf(stderr, "file %d: record %d: size %d\n", filen, lcount, ln); - } - ln = n; - lcount = count; - } - /* return bytes in buffer */ - return n; -} - -void putrec(int cnt, char *buf) -{ - int n1, n2, nw; - int hc = (cnt + 1) & ~1; /* make byte count even */ - int ac = cnt; /* get actual byte count */ - -//printf("writing %d chars\n", cnt); - /* write actual byte count to 32 bit word as header */ - n1 = fwrite((char *)(&hc), (size_t)1, (size_t)4, outfp); - /* write the data mod 2 */ - nw = fwrite((char *)buf, (size_t)1, (size_t)hc, outfp); - /* write the byte count in 32 bit word as footer */ - n2 = fwrite((char *)(&hc), (size_t)1, (size_t)4, outfp); - if (n1 != 4 || nw != hc || n2 != 4) - { - fprintf(stderr, "write (%d) failure\n", nw); - fprintf(stderr, "Operation aborted\n"); - fclose(outfp); -// close(inp); - fclose(infp); - free(buf); - exit(1); - } -} - -int main (int argc, char *argv[]) -{ - char *buf; - size_t buf_size = 256 * 1024; - size_t ll, gotboth = 0; - int zero = 0; - - if (argc != 3) { - fprintf(stderr, "usage: %s infile outfile\n", argv[0]); - exit(1); - } - - /* open input file */ -// if ((inp = open(argv[1], O_RDONLY, 0666)) < 0) { - if ((infp = fopen(argv[1], "r")) == NULL) { - fprintf(stderr,"%s: fopen: unable to open input file %s\n", argv[0], argv[1]); - return (1); - } - -// close(inp); /* close input */ - fclose(infp); /* close input */ - outfp = fopen(argv[1],"r"); /* reopen */ - fseek(outfp, 0, SEEK_END); /* seek to end */ - oldsize = ftell(outfp); /* get filesize in bytes */ - fclose(outfp); /* now close it */ - - /* open input file */ -// if ((inp = open(argv[1], O_RDONLY, 0666)) < 0) { - if ((infp = fopen(argv[1], "r")) == NULL) { - fprintf(stderr,"%s: fopen: unable to open input file %s\n", argv[0], argv[1]); - return (1); - } - - /* open output file */ - outfp = fopen(argv[2], "w"); - if (outfp == NULL) { - fprintf(stderr,"%s: fopen: unable to open output file %s\n", argv[0], argv[2]); - exit(1); - } - - /* init counts */ - ln = -2; /* look for 2 eof */ - count = 0; - size = 0; - tsize = 0; - lcount = 0; - - /* get a 256k buffer */ - if ((buf = malloc(buf_size)) == NULL) { - fprintf(stderr, "Can't allocate memory for %s\n", argv[0]); - return (4); - } - - /* get buffers until eof */ -domore: -//??while ((ll=getloi(buf, buf_size)) > 0) { - while ((ll=getloi(buf, buf_size)) != EOF) { -//printf("got %d char\n", ll); - /* we have data to write */ - putrec(ll, buf); /* write the buffer */ - gotboth = 0; - } -printf("we have EOF %d\n", gotboth+1); - /* we have an EOF or an EOM */ - if (ll == 0) { - /* we have EOF, write a zero */ - fwrite((char *)(&zero), (size_t)1, (size_t)4, outfp); - gotboth++; /* one more EOF */ - if (gotboth == 2) { - /* we have written both EOF's, now write EOM */ - ll = -1; - } else { - goto domore; /* get more data */ - } - } - -printf("we have EOM, DONE\n"); - /* We have EOM, see if EOF's needed */ - switch (gotboth) { - case 0: /* we have written no EOFs, so write two */ - fwrite((char *)(&zero), (size_t)1, (size_t)4, outfp); - /* drop through */ - case 1: /* we have written 1 EOF, so write one more */ - fwrite((char *)(&zero), (size_t)1, (size_t)4, outfp); - /* drop through */ - default: - case 2: /* we have written 2 EOFs, now do EOM */ - zero = -1; - fwrite((char *)(&zero), (size_t)1, (size_t)4, outfp); - } - fprintf(stderr, "EOM after 2 EOFs %d files: %d bytes\n", filen-1, tsize); - - newsize = ftell(outfp); /* get filesize in bytes */ - fprintf(stderr, "Size of file changed from %d to %d\n", oldsize, newsize); - - /* we done */ - fclose(outfp); -// close(inp); - fclose(infp); - free(buf); - exit(0); -} diff --git a/SEL32/taptools/filelist.c b/SEL32/taptools/filelist.c deleted file mode 100644 index a7c37f1..0000000 --- a/SEL32/taptools/filelist.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - * filelist.c - * - * This program scans a metatape file and prints file count and sizes. - * input - stdin or specified filename - * output - stdout - */ -//#define NOTDUMP -#define DUMPFILES - -#include -#include -//#include -//#include -#include -//#include -//#include - -int filen = 1; -int EOFcnt = 0; -int count=0, lcount=0; -int size=0, tsize=0; -int size_512K = 512 * 1024; -int ln; -//int inp; -FILE *infp; -#define PRINTABLE(x) ((x < 32) || (x > 126)) ? '.' : x - -/* get a line of input. */ -int getloi(char *s, int lim) -{ -// int c, i; - int n1, n2, hc, tc, n; - -// errno = 0; - /* read the byte count in 32 bit word as header */ -// n1 = read(inp, (char *)(&hc), (size_t)4); - n1 = fread((char *)(&hc), (size_t)1, (size_t)4, infp); - if (n1 <= 0) - hc = -1; /* at EOM on disk file */ - - /* check for EOF & EOM on tape data */ - if (hc & 0xffff0000) /* check for garbage, assume EOM */ - hc = -1; /* at EOM on disk file */ - - /* check for EOF & EOM on tape data */ - if (hc == 0) { - /* we are at tape EOF */ - if (++EOFcnt < 2) { /* if 1st EOF, print file info */ -#ifdef NOTDUMP - if (ln > 0) { - if (count - lcount > 1) - fprintf(stderr, "file %d: records %d to %d: size %d\n", filen, lcount, count - 1, ln); - else - fprintf(stderr, "file %d: record %d: size %d\n", filen, lcount, ln); - } - fprintf(stderr, "file %d: eof after %d records: %d bytes\n", filen, count, size); -#endif - filen++; /* set next file number */ - } else { -#ifdef NOTDUMP - fprintf(stderr, "second eof after %d files: %d bytes\n", filen, size); -#endif - } - count = 0; /* file record count back to zero */ - lcount = 0; /* last record count back to zero */ - tsize += size; /* add to total tape size */ - size = 0; /* file size back to zero */ - ln = -1; /* set ln to -1 showing we are at EOF */ - - /* we have EOF */ - return 0; /* return EOF on tape data */ - } - if (hc == -1) { -#ifdef NOTDUMP - /* we have EOM */ - fprintf(stderr, "mpx eot\n"); - /* print out total tape size in bytes */ - fprintf(stderr, "total length: %ld bytes\n", tsize); -#endif - return -1; /* at EOM on disk file */ - } - /* read the data */ -// n = read(inp, s, (size_t)hc); - n = fread(s, (size_t)1, (size_t)hc, infp); - - /* if odd byte record, read extra byte and throw it away */ - if (n & 0x1) { -// n2 = read(inp, (char *)(&tc), (size_t)1); - n2 = fread((char *)(&tc), (size_t)1, (size_t)1, infp); - if (n2 <= 0) - return -1; /* at EOM on disk file */ - } - - /* read the byte count in 32 bit word as trailer */ -// n2 = read(inp, (char *)(&tc), (size_t)4); - n2 = fread((char *)(&tc), (size_t)1, (size_t)4, infp); - count++; /* bump record count */ - size += n; /* update bytes read */ - EOFcnt = 0; /* not an EOF */ - if (n != ln) { -#ifdef NOTDUMP - if (ln > 0) { - if (count - lcount > 1) - fprintf(stderr, "file %d: records %d to %d: size %d\n", filen, lcount, count - 1, ln); - else - fprintf(stderr, "file %d: record %d: size %d\n", filen, lcount, ln); - } -#endif - ln = n; - lcount = count; - } - /* return bytes in buffer */ - return n; -} - -int main (int argc, char *argv[]) -{ -// char in[BUFSIZ], out[BUFSIZ]; - char *buf; - size_t size_512K = 512 * 1024; - size_t buf_size = 512 * 1024; -// char *cp, *np; - int ll, gotboth = 0; - int lfilen = filen; - unsigned int fileaddr, file_byte_count=0, /*curchar,*/ buffptr, bufflen; - int skipfile = 0; - - if (argc != 2) { - fprintf(stderr, "usage: %s infile\n", argv[0]); - exit(1); - } /* end of if */ - -// if ((inp = open(argv[1], O_RDONLY, 0666)) < 0) { - if ((infp = fopen(argv[1], "r")) == NULL) { - fprintf(stderr,"%s: fopen: unable to open input file %s\n", argv[0], argv[1]); - return (1); - } - - /* get a 512k buffer */ - if ((buf = malloc(buf_size)) == NULL) { - fprintf(stderr, "Can't allocate memory for %s\n", argv[0]); - return (4); - } - /* init counts */ - ln = -2; /* look for 2 eof */ - count = 0; - size = 0; - tsize = 0; - lcount = 0; - filen = 1; - lfilen = filen; - buffptr = 0; - bufflen = 16; - fileaddr = 0; - file_byte_count = 0; - printf("\nfile %d:\n", filen); - - /* get lines until eof */ - while ((ll=getloi(buf, buf_size)) != EOF) { - if (ll == 0) { - /* eof found, process new file */ - skipfile = 0; - file_byte_count = 0; - fileaddr = 0; - printf("\nfile %d:\n", filen); - } else { - int cc = 0; -// char buff[257]; -// int ans; - int w1, w2, i, j; - char path[64], command[128]; - buffptr = 0; - { - /* dump first 2 words */ - w1 = (buf[0] & 0xff) << 24 | buf[1] << 16 | buf[2] << 8 | (buf[3] & 0xff); - w2 = (buf[4] & 0xff) << 24 | buf[5] << 16 | buf[6] << 8 | (buf[7] & 0xff); -#ifdef NODATA - if (filen > 480) - printf("w1 = %x, w2 = %x count = %d\n", w1, w2, count); -#endif - if (count == 1 && w1 == 1) { - char file[20], dir[20], vol[20]; - int off = 8; - int l = 0; - /* we have directory entries */ - for (j=0; j (6144-48-off)) { - ll=getloi(buf, buf_size); - off = 0; - l = 0; - k = 0; -#ifdef NODATA - printf("reread: got ll= %d\n", ll); -#endif - for (i=0; i<16; i++) { - file[i] = tolower(buf[k+off+i]); - if (file[i] == ' ') - file[i] = '\0'; - } - file[16] = '\0'; - printf("file %s\n", file); - } - for (i=0; i<16; i++) { - file[i] = tolower(buf[k+off+i]); - if (file[i] == ' ') - file[i] = '\0'; - } - file[16] = '\0'; - for (i=0; i<16; i++) { - dir[i] = tolower(buf[k+off+16+i]); - if (dir[i] == ' ') - dir[i] = '\0'; - } - dir[16] = '\0'; - for (i=0; i<16; i++) { - vol[i] = tolower(buf[k+off+32+i]); - if (vol[i] == ' ') - vol[i] = '\0'; - } - vol[16] = '\0'; - sprintf(path, "./%s/%s", vol, dir); - /* create the directory/file */ -#ifdef DUMPFILES - sprintf(command, "mkdir -p %s", path); - system(command); -#endif - sprintf(path, "./%s/%s/%s", vol, dir, file); - printf("path %s\n", path); -#ifdef DUMPFILES - sprintf(command, "touch %s", path); - system(command); -#endif - } - } else - if (count == 1 && w1 == 2 && w2 == 0) { - char file[20], dir[20], vol[20]; - /* process file definition */ - /* we have a file definition entry */ - for (i=0; i<16; i++) { - file[i] = tolower(buf[8+i]); - if (file[i] == ' ') - file[i] = '\0'; - } - file[16] = '\0'; - for (i=0; i<16; i++) { - dir[i] = tolower(buf[24+i]); - if (dir[i] == ' ') - dir[i] = '\0'; - } - dir[16] = '\0'; - for (i=0; i<16; i++) { - vol[i] = tolower(buf[40+i]); - if (vol[i] == ' ') - vol[i] = '\0'; - } - vol[16] = '\0'; - sprintf(path, "./%s/%s/%s", vol, dir, file); - printf("path2 = %s\n", path); - } - } - /* see if skipping to next file */ - if (skipfile == 1) { - continue; - } - -#ifdef NODUMP - /* process the returned buffer */ - while (cc < ll) { - curchar = (unsigned int)buf[cc++] & 0xff; - file_byte_count++; - if (!buffptr) - printf(" %06x : ",fileaddr); - printf("%02x", curchar & 0xff); - buff[buffptr++] = PRINTABLE(curchar); - if (!(buffptr % 4)) - printf(" "); - if (buffptr >= bufflen) { - buff[buffptr] = 0; - printf(" |%s|\n",buff); - buffptr = 0; - fileaddr += bufflen; - if (!(file_byte_count % 256)) { - printf("\n - continue, q = quit, s = skip > "); - ans = getchar(); - if (ans == 'q') { -// close(inp); - fclose(infp); - free(buf); - exit(1); - } - if (ans == 's') - skipfile = 1; - if (ans != '\n') - while ((ans=getchar()) != '\n' ) - ; - } /* end of if */ - if (skipfile == 1) - break; - } /* end of if */ - } /* end of while */ -#endif - -#ifdef NODUMP - if (buffptr && !skipfile) { - buff[buffptr] = 0; - while (buffptr++ < bufflen) { - printf(" "); - if (!(buffptr % 4)) - printf(" "); - } /* end of while */ - printf(" |%s|\n",buff); - - /* see what user wants to do */ - printf("\n - continue, q = quit > "); - ans = getchar(); - if (ans == 'q') { -// close(inp); - fclose(infp); - free(buf); - exit(1); - } - if (ans != '\n') - while ((ans=getchar()) != '\n' ) - ; - } /* end of if */ -#endif - } - } -// close(inp); - fclose(infp); - free(buf); - exit(0); -} diff --git a/SEL32/taptools/fmgrcopy.c b/SEL32/taptools/fmgrcopy.c deleted file mode 100644 index f0538d0..0000000 --- a/SEL32/taptools/fmgrcopy.c +++ /dev/null @@ -1,308 +0,0 @@ -/* - * fmgrcopy.c - * - * This program scans a metatape file and prints file count and sizes. - * In addition, it creats a directory for each username specified in - * the filemanager tape and then creates a file containing the file - * contents. The file must be a filemgr save tape and not an SDT - * tape. - * input - stdin or specified filename - * output - stdout - */ - -#include -#include -//#include -//#include -//#include -#include -//#include - -int lfilen, filen = 1; -int EOFcnt = 0; -int count=0, lcount=0; -int size=0, tsize=0; -int size_512K = 512 * 1024; -int ln; -//int inp, outp; -FILE *infp, *outfp; -#define PRINTABLE(x) ((x < 32) || (x > 126)) ? '.' : x - -/* get a line of input. */ -int getloi(char *s, int lim) -{ -// int c, i; - int n1, n2, hc, tc, n; - -// errno = 0; - /* read the byte count in 32 bit word as header */ -// n1 = read(inp, (char *)(&hc), (size_t)4); - n1 = fread((char *)(&hc), (size_t)1, (size_t)4, infp); - if (n1 <= 0) - hc = -1; /* at EOM on disk file */ - - /* check for EOF & EOM on tape data */ - if (hc & 0xffff0000) /* check for garbage, assume EOM */ - hc = -1; /* at EOM on disk file */ - - /* check for EOF & EOM on tape data */ - if (hc == 0) { - /* we are at tape EOF */ - if (++EOFcnt < 2) { /* if 1st EOF, print file info */ - lfilen = filen; - filen++; /* set next file number */ - } - count = 0; /* file record count back to zero */ - lcount = 0; /* last record count back to zero */ - tsize += size; /* add to total tape size */ - size = 0; /* file size back to zero */ - ln = -1; /* set ln to -1 showing we are at EOF */ - - /* we have EOF */ - return 0; /* return EOF on tape data */ - } - if (hc == -1) - return -1; /* at EOM on disk file */ - - /* read the data */ -// n = read(inp, s, (size_t)hc); - n = fread(s, (size_t)1, (size_t)hc, infp); - - /* if odd byte record, read extra byte and throw it away */ - if (n & 0x1) { -// n2 = read(inp, (char *)(&tc), (size_t)1); - n2 = fread((char *)(&tc), (size_t)1, (size_t)1, infp); - if (n2 <= 0) - return -1; /* at EOM on disk file */ - } - - /* read the byte count in 32 bit word as trailer */ -// n2 = read(inp, (char *)(&tc), (size_t)4); - n2 = fread((char *)(&tc), (size_t)1, (size_t)4, infp); - count++; /* bump record count */ - size += n; /* update bytes read */ - EOFcnt = 0; /* not an EOF */ - if (n != ln) { - ln = n; - lcount = count; - } - /* return bytes in buffer */ - return n; -} - -int main (int argc, char *argv[]) -{ - char *buf; - size_t size_512K = 512 * 1024; - size_t buf_size = 512 * 1024; -// char *cp, *np; - int ll; - char path[64], command[128]; - - if (argc != 2) { - //fprintf(stderr, "usage: %s infile\n", argv[0]); - printf("usage: %s infile\n", argv[0]); - exit(1); - } /* end of if */ - -// if ((inp = open(argv[1], O_RDONLY, 0666)) < 0) { - if ((infp = fopen(argv[1], "r")) == NULL) { - //fprintf(stderr,"%s: fopen: unable to open input file %s\n", argv[0], argv[1]); - printf("%s: fopen: unable to open input file %s\n", argv[0], argv[1]); - return (1); - } -// outp = -1; - outfp = NULL; - - /* get a 512k buffer */ - if ((buf = malloc(buf_size)) == NULL) { - //fprintf(stderr, "Can't allocate memory for tscan\n"); - printf("Can't allocate memory for tscan\n"); - return (4); - } - /* init counts */ - ln = -2; /* look for 2 eof */ - count = 0; - size = 0; - tsize = 0; - lcount = 0; - filen = 1; - lfilen = 0; - printf("\nfile %d:\n", filen); - - /* get lines until eof */ - while ((ll=getloi(buf, buf_size)) != EOF) { - if (ll == 0) { - /* eof found, process new file */ - printf("\nfile %d:\n", filen); - } else { - int cc = 0; -// unsigned int curchar; - - /* filemgr smd entries are 8 words, and are in 1152 words (4608 bytes) - * (6 sector) blocks. Saved data files are modulo 1152 words also */ - /* 8 wds per SMD entry, 24 entries per sector, 144 entries per 6 sector - * block. */ - int i, j, m; -// if (filen == 1) - { - /* read smd entry */ - char file[20], dir[20]; - int l = 0; - int smddone = 0; - int totent = 0; - char *buf2 = buf; - printf("\nfile %d:\n", filen); - /* see how man entries here */ - while(!smddone) { - /* process entries in this record */ - for (j=0; j<144; j++) { - int k = l++ * 32; - int w1 = (buf[k+13] & 0xff) << 16 | (buf[k+14] & 0xff) << 8 | (buf[k+15] & 0xff); - /* stop processing on first zero smd entry */ - if (w1 <= 0) { - smddone = 1; - break; - } - totent++; - /* get file/dir name */ - for (i=0; i<8; i++) { - file[i] = tolower(buf[k+0+i]); - if (file[i] == ' ') - file[i] = '\0'; - } - file[8] = '\0'; - for (i=0; i<8; i++) { - dir[i] = tolower(buf[k+0+16+i]); - if (dir[i] == ' ') - dir[i] = '\0'; - } - dir[8] = '\0'; - if (dir[0] == '\0') - sprintf(dir, "%s", "system"); - sprintf(path, "./%s/%s", dir, file); - // see if active file - if ((buf[k+12] & 0x80) == 0) - // not active goon - printf("inactive file: w1 = %d path = %s\n", w1, path); - else - printf("active file: w1 = %d path = %s\n", w1, path); - } - if (smddone) - break; - buf2 += 4608; /* next buffer */ - ll=getloi(buf2, 4608); - } - printf("%d smd entries found\n", totent); - /* we have directory entries */ - for (j=0; j= 0) - if (outfp != NULL) -// close(outp); - fclose(outfp); -// outp = -1; - outfp = NULL; - -#ifndef DO_LATER - /* open output file, create it if necessary */ -// if ((outp = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { - if ((outfp = fopen(path, "w")) == NULL) { - //fprintf(stderr, "Can't open %s\n", path); - printf("Can't open %s\n", path); -// close(inp); - fclose(infp); - free(buf); - return (3); - } -#endif - /* get the file data */ - for (m=0; m<((w1+5)/6); m++) { - char data[5000]; /* data buffer */ - ll=getloi(data, 4608); - - /* process file data for file */ - if (ll == 4608) { -#ifndef DO_LATER - /* blks/w1 have number of blocks to write */ - int bcnt, no; /* block count */ - if (blks >= 6) { - blks -= 6; /* enough for 6 block, write them */ - bcnt = 6*768; /* write all 6 blocks */ - } else { - bcnt = blks*768;/* just write what we need */ - blks = 0; - } - /* only write number of sectors on save tape, not all 4608 */ - /* if zero, just reading excess blocks */ - if (bcnt != 0) { -// no = write(outp, data, bcnt); - no = fwrite(data, (size_t)1, (size_t)bcnt, outfp); - if (no != bcnt) - // fprintf(stderr, "write (%d) != read (%d) on file %s\n", no, bcnt, path); - printf("write (%d) != read (%d) on file %s\n", no, bcnt, path); - } -#else - printf("read (%d) on file %s\n", ll, path); -#endif - } else { - printf("Bad file size read! %d instead of 4608\n", ll); -/// if (ll == -1) break; - if (ll == -1) - goto dostop; - } - } /* end writing file */ - } /* end of smd scan */ - } /* read smd entries 4608 byte records */ - } /* process read of smd or sdt */ - } /* end of getloi read */ -dostop: -// close(inp); - fclose(infp); - free(buf); -// if (outp >= 0) - if (outfp != NULL) -// close(outp); - fclose(outfp); - exit(0); -} diff --git a/SEL32/taptools/instcopy.c b/SEL32/taptools/instcopy.c deleted file mode 100644 index 9e77f47..0000000 --- a/SEL32/taptools/instcopy.c +++ /dev/null @@ -1,477 +0,0 @@ -/* - * instcopy.c - * - * This program scans an ISC install metatape file and prints file count and - * sizes. It is only for special ISC install save images. The first set of - * files on the tape are in volmgr format and the second set of files on the - * tape are in filemgr format. The files in filemgr format are prefixed with - * ./fm/ before being saved. Volmgr save images have the following format: - * One or more 6144 byte records containing a list of files saved 16 char file - * name followed my 16 char directory name followed by 16 char volume name. - * A 1536 byte file definition entry will be followed by 1 to 8 768 byte - * file data records followed by an EOF for each file. If the file size is - * greater than 6144 bytes, 1 or more 6144 byte records are output followed - * by last record modulo 768 bytes. Filemgr SMD entries are 8 words, and are - * in 1152 words (4608 bytes) (6 sector) blocks. Saved data files are modulo - * 1152 words also; 8 wds per SMD entry, 24 entries per sector, 144 entries - * per 6 sector block. Three EOFs in a row define the EOT. - * input - stdin or specified filename - * output - stdout - */ - -#include -#include -//#include -//#include -//#include -#include -//#include -#include - -int filen = 1; -int EOFcnt = 0; -int count=0, lcount=0; -int size=0, tsize=0; -int size_512K = 512 * 1024; -int ln; -//int inp, outp; -FILE *infp, *outfp; -#define PRINTABLE(x) ((x < 32) || (x > 126)) ? '.' : x - -/* get a line of input. */ -int getloi(char *s, int lim) -{ -// int c, i; - int n1, n2, hc, tc, n; - -// errno = 0; - /* read the byte count in 32 bit word as header */ -// n1 = read(inp, (char *)(&hc), (size_t)4); - n1 = fread((char *)(&hc), (size_t)1, (size_t)4, infp); - if (n1 <= 0) - hc = -1; /* at EOM on disk file */ - - /* check for EOF & EOM on tape data */ - if (hc & 0xffff0000) /* check for garbage, assume EOM */ - hc = -1; /* at EOM on disk file */ - - /* check for EOF & EOM on tape data */ - if (hc == 0) { - /* we are at tape EOF */ - if (++EOFcnt < 2) { /* if 1st EOF, print file info */ - filen++; /* set next file number */ - } - count = 0; /* file record count back to zero */ - lcount = 0; /* last record count back to zero */ - tsize += size; /* add to total tape size */ - size = 0; /* file size back to zero */ - ln = -1; /* set ln to -1 showing we are at EOF */ - - /* we have EOF */ - return 0; /* return EOF on tape data */ - } - if (hc == -1) - return -1; /* at EOM on disk file */ - - /* read the data */ -// n = read(inp, s, (size_t)hc); - n = fread(s, (size_t)1, (size_t)hc, infp); - - /* if odd byte record, read extra byte and throw it away */ - if (n & 0x1) { -// n2 = read(inp, (char *)(&tc), (size_t)1); - n2 = fread((char *)(&tc), (size_t)1, (size_t)1, infp); - if (n2 <= 0) - return -1; /* at EOM on disk file */ - } - - /* read the byte count in 32 bit word as trailer */ -// n2 = read(inp, (char *)(&tc), (size_t)4); - n2 = fread((char *)(&tc), (size_t)1, (size_t)4, infp); - count++; /* bump record count */ - size += n; /* update bytes read */ - EOFcnt = 0; /* not an EOF */ - if (n != ln) { - ln = n; - lcount = count; - } - /* return bytes in buffer */ - return n; -} - -int main (int argc, char *argv[]) -{ - unsigned char *buf; - size_t size_512K = 512 * 1024; - size_t buf_size = 512 * 1024; -// char *cp, *np; - int ll; - int lfilen = filen; - unsigned int mpxtime[2]; - char path[64], command[128], dtime[64]; - time_t utime=0; - struct tm *dt; - - if (argc != 2) { - fprintf(stderr, "usage: %s infile\n", argv[0]); - exit(1); - } /* end of if */ - -// if ((inp = open(argv[1], O_RDONLY, 0666)) < 0) { - if ((infp = fopen(argv[1], "r")) == NULL) { - fprintf(stderr,"%s: fopen: unable to open input file %s\n", argv[0], argv[1]); - return (1); - } -// outp = -1; - outfp = NULL; - - /* get a 512k buffer */ - if ((buf = malloc(buf_size)) == NULL) { - fprintf(stderr, "Can't allocate memory for tscan\n"); - return (4); - } - /* init counts */ - ln = -2; /* look for 2 eof */ - count = 0; - size = 0; - tsize = 0; - lcount = 0; - filen = 1; - lfilen = filen; - printf("\nfile %d:\n", filen); - - /* get lines until eof */ - while ((ll=getloi(buf, buf_size)) != EOF) { -// printf("got ll = %d filen %d count %d size %d\n", ll, filen, count, size); - if (ll == 0) { - /* eof found, process new file */ - printf("\nfile %d:\n", filen); - } else - if ((ll == 4608) && (count == 1)) { - int smd = 1; - /* see if ISC install tape with filemgr records */ - /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - /* filemgr smd entries are 8 words, and are in 1152 words (4608 bytes) - * (6 sector) blocks. Saved data files are modulo 1152 words also */ - /* 8 wds per SMD entry, 24 entries per sector, 144 entries per 6 sector - * block. */ -// printf("gotx ll = %d filen %d count %d size %d\n", ll, filen, count, size); - if (smd == 1) { - /* check for SMD entry instead of SDT entry */ - /* read smd entry */ - char file[20], dir[20]; - int j, m, i, l = 0; - int smddone = 0; - int totent = 0; - char *buf2 = buf; -// printf("\nfile %d: %d\n", filen, ll); - /* see how many entries here */ - while(!smddone) { - /* process entries in this record */ - for (j=0; j<144; j++) { - int k = l++ * 32; - int w1 = (buf[k+13] & 0xff) << 16 | (buf[k+14] & 0xff) << 8 | (buf[k+15] & 0xff); - /* stop processing on first zero smd entry */ - if (w1 <= 0) { - smddone = 1; - break; - } - totent++; - /* get file/dir name */ - for (i=0; i<8; i++) { - file[i] = tolower(buf[k+0+i]); - if (file[i] == ' ') - file[i] = '\0'; - } - file[8] = '\0'; - for (i=0; i<8; i++) { - dir[i] = tolower(buf[k+0+16+i]); - if (dir[i] == ' ') - dir[i] = '\0'; - } - dir[8] = '\0'; - if (dir[0] == '\0') - sprintf(dir, "%s", "system"); - sprintf(path, "./%s/%s", dir, file); -#if 0 - // see if active file - if ((buf[k+12] & 0x80) == 0) - // not active goon - printf("inactive file: w1 = %d path = %s\n", w1, path); - else - printf("active file: w1 = %d path = %s\n", w1, path); -#else - printf("blks: %d file: path = %s\n", w1, path); -#endif - } - if (smddone) - break; - buf2 += 4608; /* next buffer */ - ll=getloi(buf2, 4608); - } -// printf("%d smd entries found\n", totent); - /* we have directory entries */ - for (j=0; j= 0) - if (outfp != NULL) -// close(outp); - fclose(outfp); -// outp = -1; - outfp = NULL; - - /* open output file, create it if necessary */ -// if ((outp = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { - if ((outfp = fopen(path, "w")) == NULL) { - //fprintf(stderr, "Can't open %s\n", path); - printf("Can't open %s\n", path); -// close(inp); - fclose(infp); - free(buf); - return (3); - } - - /* get the file data */ - for (m=0; m<((w1+5)/6); m++) { - char data[5000]; /* data buffer */ - ll=getloi(data, 4608); - - /* process file data for file */ - if (ll == 4608) { - /* blks/w1 have number of blocks to write */ - int bcnt, no; /* block count */ - if (blks >= 6) { - blks -= 6; /* enough for 6 block, write them */ - bcnt = 6*768; /* write all 6 blocks */ - } else { - bcnt = blks*768;/* just write what we need */ - blks = 0; - } - /* only write number of sectors on save tape, not all 4608 */ - /* if zero, just reading excess blocks */ - if (bcnt != 0) { -// no = write(outp, data, bcnt); - no = fwrite(data, (size_t)1, (size_t)bcnt, outfp); - if (no != bcnt) - //fprintf(stderr, "write (%d) != read (%d) on file %s\n", no, bcnt, path); - printf("write (%d) != read (%d) on file %s\n", no, bcnt, path); - } - } else { - printf("Bad file size read! %d instead of 4608\n", ll); -/// if (ll == -1) break; - if (ll == -1) - goto dostop; - } - } /* end writing file */ - } /* end of smd scan */ - } /* read smd entries 4608 byte records */ -// } /* process read of smd or sdt */ - /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - } else { - int cc = 0; -// unsigned int curchar; - - /* dump first 2 words */ - int w1, w2, i, j; - w1 = (buf[0] & 0xff) << 24 | buf[1] << 16 | buf[2] << 8 | (buf[3] & 0xff); - w2 = (buf[4] & 0xff) << 24 | buf[5] << 16 | buf[6] << 8 | (buf[7] & 0xff); -// printf("w1 = %x, w2 = %d count = %d\n", w1, w2, count); - if (count == 1 && w1 == 1) { - char file[20], dir[20], vol[20]; - int off = 8; - int l = 0; -printf("Directory with %d entries\n", w2); - /* we have directory entries */ - for (j=0; j (6144-48-off)) { - ll=getloi(buf, buf_size); - off = 0; - l = 0; - k = 0; -// printf("reread: got ll= %d\n", ll); - } - for (i=0; i<16; i++) { - file[i] = tolower(buf[k+off+i]); - if (file[i] == ' ') - file[i] = '\0'; - } - file[16] = '\0'; - for (i=0; i<16; i++) { - dir[i] = tolower(buf[k+off+16+i]); - if (dir[i] == ' ') - dir[i] = '\0'; - } - dir[16] = '\0'; - for (i=0; i<16; i++) { - vol[i] = tolower(buf[k+off+32+i]); - if (vol[i] == ' ') - vol[i] = '\0'; - } - vol[16] = '\0'; - sprintf(path, "./%s/%s", vol, dir); -#if 0 - /* create the directory/file */ - sprintf(command, "mkdir -p %s", path); - system(command); -#endif - sprintf(path, "./%s/%s/%s", vol, dir, file); -#if 0 - sprintf(command, "touch %s", path); - system(command); -#endif -// printf("path0 = %s\n", path); - } - } else - if (count == 1 && w1 == 2 && w2 == 0) { - char file[20], dir[20], vol[20]; -// if (outp >= 0) - if (outfp != NULL) { -// close(outp); - fclose(outfp); - sprintf(command, "touch -a -m -t %s %s", dtime, path); -// sprintf(command, "touch -t %s %s", dtime, path); -// printf("1cmd [%s] path[%s]\n", command, path); -// fflush(stdout); - system(command); - } -// outp = -1; - outfp = NULL; - /* process file definition */ - /* we have a file definition entry */ - for (i=0; i<16; i++) { - file[i] = tolower(buf[8+i]); - if (file[i] == ' ') - file[i] = '\0'; - } - file[16] = '\0'; - for (i=0; i<16; i++) { - dir[i] = tolower(buf[24+i]); - if (dir[i] == ' ') - dir[i] = '\0'; - } - dir[16] = '\0'; - for (i=0; i<16; i++) { - vol[i] = tolower(buf[40+i]); - if (vol[i] == ' ') - vol[i] = '\0'; - } - vol[16] = '\0'; - - i = 0x300 + 0x38; /* last modified date */ -// i = 0x300 + 0x20; /* creation date */ - /* get last modification time for file */ - /* day number since 1/1/1960 */ -// printf("D %02x%02x%02x%02x M %02x%02x%02x%02x\n", -// buf[i+0],buf[i+1],buf[i+2],buf[i+3],buf[i+4],buf[i+5],buf[i+6],buf[i+7]); - mpxtime[0] = buf[i+0] << 24 | buf[i+1] << 16 | buf[i+2] << 8 | (buf[i+3] & 0xff); - /* .1ms count in day 0-864,000,000 */ - mpxtime[1] = (buf[i+4] << 24) | (buf[i+5] << 16) | (buf[i+6] << 8) | (buf[i+7] & 0xff); - /* get UNIX time, secs sense 1970, not 1960 */ - utime =(time_t)((mpxtime[0]-3653)*86400)+(time_t)(mpxtime[1]/10000); - dt = gmtime(&utime); - j = dt->tm_year+1900; - if (j > 2037) - j -= 100; - sprintf(dtime, "%04d%02d%02d%02d%02d", j, dt->tm_mon+1, - dt->tm_mday, dt->tm_hour, dt->tm_min); -// printf("mpx day %x ms %x utime %ld dtime %s\n", mpxtime[0], mpxtime[1], utime, dtime); -// fflush(stdout); - - sprintf(path, "./%s/%s", vol, dir); - /* create the directory/file */ -// printf("dir path = %s\n", path); - sprintf(command, "mkdir -p %s", path); - system(command); - sprintf(path, "./%s/%s/%s", vol, dir, file); - printf("path = %s\n", path); - - /* open output file, create it if necessary */ -// if ((outp = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { - if ((outfp = fopen(path, "w")) == NULL) { - (void)fprintf(stderr, "Can't open %s\n", path); -// close(inp); - fclose(infp); - free(buf); - return (3); - } - /* process file data for file */ - if (ll > 1536) { -// int no = write(outp, buf+1536, ll-1536); - int no = fwrite(buf+1536, (size_t)1, (size_t)(ll-1536), outfp); - if (no != ll) - fprintf(stderr, "write (%d) != read (%d) on file %s\n", no, ll, path); - } - } else - if (count > 1) { - /* process file data for file */ -// int no = write(outp, buf, ll); - int no = fwrite(buf, (size_t)1, (size_t)ll, outfp); - if (no != ll) - fprintf(stderr, "write (%d) != read (%d) on file %s\n", no, ll, path); - } - } /* end if */ - } /* end while */ -dostop: -// close(inp); - fclose(infp); - free(buf); -// if (outp >= 0) - if (outfp != NULL) { -// close(outp); - fclose(outfp); - sprintf(command, "touch -a -m -t %s %s", dtime, path); -// sprintf(command, "touch -t %s %s", dtime, path); -// printf("2cmd [%s]\n", command); -// fflush(stdout); - system(command); - } - exit(0); -} diff --git a/SEL32/taptools/loadMPXfile.txt b/SEL32/taptools/loadMPXfile.txt deleted file mode 100644 index 8705186..0000000 --- a/SEL32/taptools/loadMPXfile.txt +++ /dev/null @@ -1,119 +0,0 @@ -Following are the instructions for loading an ASCII file to an -MPX-1.X system. It is assumed that the reader has compiled the -utilities in the taptools directory using the provided makefile. -Filenames on MPX-1.X must be 8 chars or less. - -1. Create an ASCII file on Windows or Linux using your favorite editor. - The EDIT program on MPX works with numbered or unnumbered text files. - Each record in the text file uses columns 1-72 for text and columns - 73-80 for a line number (xxx.xxx). This is 80 column card format. - -2. To convert a newline terminated file to an MPX file use the utility - "renum" included in the taptools directory. Lines in the file will - be expanded to 72 characters or truncated to 72 characters. The - carriage return characters (\r) will be removed and lines will be - terminated with a newline (\n). Line numbers of the form (xxx.xxx) - will then be appended to the text line to create the card format. - /somewhere/renum cardfile - -3. The next step is to convert the card image text file to an MPX - blocked file format. This involves removing the carriage return - character and then encoding the line into the blocked format. - The block file format is the standard file format for MPX. - /somewhere/mpxblk blkfile - -4. Once we have the files converted, the next step involves creating - a FILEMGR formatted save tape. The output file will be in SIMH - .tap simulated tape format. The tape can then be read by the - FILEMGR on MPX to load the files into the desired directory. - The file system on MPX is a flat file where all files are in - the same file system. A username is used to separate files for - each user. A blank filename implies the system directory. - /somewhere/mkfmtape -t -u username usertape.tap file1 file2 ... - Valid options are: - -p : use file type 0xca for executable programs - -t : use file type 0xee for text files - -l : use file type 0xff for library files - -a : append current files to output tape - -u username : the username (directory) for the files - - Make sure the usertape.tap file is assigned to the tape drive - in the .ini file or use the following commands at the sim> - prompt for SEL32. - hit ^E to get the sim> prompt. - sim>detach mta0 remove current assignment - sim>attach mta0 usertape.tap assign your restore tape - sim>go - -5. Boot MPX-1.X. Input @@A to get OPCOM prompt ??. Use cap lock for - uppercase input. Type "EXIT" to OPCOM prompt to get a TSM> prompt. - If you type WHO, TSM will display your current logon information. - -TSM>WHO -ADDRESS OWNERNAME USERNAME -======= ========= ======== -*TY7EFC CONSOLE - - The username will be blank for system directory. Use the command - TSM>USERNAME JOHNDOE to set username to the one specified in the - -u option above or just TSM>USERNAME to make it blank. There is a - command file on MPX that is handy to restore files from tape that - does the device assignments to the FILEMGR program. The file is - FMGR and can be run to input files from the assigned tape. MPX-1.X - has been SYSGEN'd to have 4 tape drives defined at 1000, 1001, 1002, - & 1003. SIMH names are mta0, mta1, mta2, & mta3. So attach the - restore file to mta0 as show above. Now execute the FILEMGR program. - TSM>FMGR 1000 -TSM>FMGR 1000 - * * * F I L E M A N A G E R * * * - FUNCTION USER NAME FILE NAME DEVICE START LENGTH SPEED - (FIRST BLK) (# BLKS) - - FILEMGR output will be assigned to the terminal and tape input from - device MT1000. The FILEMGR will output a heading and then the FILEMGR - prompt FIL>. At this point you can use the command FIL>SAVELOG to - list the files on the tape or you can use the command FIL>RESTORE to - restore the files to the disk. You can then type EXIT or X to the - FIL> prompt to exit the FILEMGR. -FIL>RESTORE - RESTORE JOHNDOE FILE1 DM0800 234656 1052 SLOW -FIL>REWIND IN - REWIND (IN) -FIL>X -TSM> - If you would like to see your files listed in the system, use - FMGR again without any parameters. Then use LOGU to log your - username files or LOG to log all files. -TSM>FMGR - heading here -FIL>LOGU - LOG JOHNDOE FILE1 DM0800 234656 1052 SLOW - LOG JOHNDOE XX*WRKFL DM0800 233536 1120 SLOW -FIL>LOG - LOG 1X.PRE DM0800 302916 24 SLOW - LOG 7X.PRE DM0800 302892 24 SLOW - LOG ALOC.L DM0800 241312 800 SLOW - LOG ASM DM0800 302884 8 SLOW - LOG ASSEMBLE DM0800 296784 84 SLOW - LOG ASSM DM0800 302872 12 SLOW - LOG ASSMJ DM0800 302864 8 SLOW - LOG ASSML DM0800 302860 4 SLOW - LOG BOOT27 DM0800 303424 24 SLOW - all files list here - -6. You can use the program EDIT to view or modify the file. At the - TSM> prompt type EDIT XX, where XX is a two character editor - workfile name. It will show up in the directory listing as XX*WRKFL. - At the EDT> prompt type USE FILE1. You will get another prompt when - the editor is done reading the file. Hit return to list the file. - -TSM>EDIT XX - BEGIN TEXT EDITOR -XX*WRKFL CLEAR -EDT> USE FILE1 - File listing will be here. - -See the MPX-1.X reference manuals for the other FILEMGR and EDIT commands. - -Jim Bevier -03/10/2020 diff --git a/SEL32/taptools/makefile b/SEL32/taptools/makefile deleted file mode 100644 index 27693bc..0000000 --- a/SEL32/taptools/makefile +++ /dev/null @@ -1,227 +0,0 @@ -# Makefile for taptools -SHELL = /bin/sh - -# Adapt the flags in the following paragraph to your system -# for Linux -ROOT = . -OPTC = -O #-m32 - -#B = $(ROOT) -#B = $(ROOT)/bin -B = /system/bin -#I = $(ROOT)/include -I = -#L = $(ROOT)/lib -#D = $L/mylib.a -D = - -##CFLAGS= $(OPTC) -I$I -CFLAGS= $(OPTC) -I$I -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE - -# For Linux -#LFLAGS= -L$L -LFLAGS= - -PROGS = \ - $(ROOT)/diskload \ - $(ROOT)/filelist \ - $(ROOT)/fmgrcopy \ - $(ROOT)/mkfmtape \ - $(ROOT)/mkvmtape \ - $(ROOT)/sdtfmgrcopy \ - $(ROOT)/mkdiagtape \ - $(ROOT)/tapdump \ - $(ROOT)/tape2disk \ - $(ROOT)/disk2tap \ - $(ROOT)/tapscan \ - $(ROOT)/eomtap \ - $(ROOT)/volmcopy \ - $(ROOT)/instcopy \ - $(ROOT)/diagcopy \ - $(ROOT)/ddump \ - $(ROOT)/deblk \ - $(ROOT)/mpxblk \ - $(ROOT)/renum \ - $(ROOT)/tap2disk \ - $(ROOT)/cutostap \ - $(ROOT)/small -## $(ROOT)/fileread - -all: $(PROGS) - -#install :$(PROGS) -# @cp $(@F) $B -# @echo $(@F) installed in $B -# @echo -## @chmod 755 $(@F) - -##$(PROGS): $D $$(@F).c -## @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ -##$(PROGS): $D $$(@F).c -## @chmod 755 $@ -## @cp $(@F) $B -## @echo $(@F) installed in $B -## @echo - -$B/diskload: $D diskload.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/filelist: $D filelist.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/fmgrcopy: $D fmgrcopy.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/mkfmtape: $D mkfmtape.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/mkvmtape: $D mkvmtape.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/sdtfmgrcopy: $D sdtfmgrcopy.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/mkdiagtape: $D mkdiagtape.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/tapdump: $D tapdump.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/tape2disk: $D tape2disk.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -##$B/fileread: $D fileread.c -## @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ -## @chmod 755 $@ -## @cp $(@F) $B -## @echo $(@F) installed in $B - -$B/disk2tap: $D disk2tap.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/tapsca: $D tapscan.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/eomtap: $D eomtap.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/volmcopy: $D volmcopy.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/instcopy: $D instcopy.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/diagcopy: $D diagcopy.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/ddump: $D ddump.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/deblk: $D deblk.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/mpxblk: $D mpxblk.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/renum: $D renum.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/cutostap: $D cutostap.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/tap2disk: $D tap2disk.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -$B/small: $D small.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -# Some makes don't understand the $$ notation above. In this case -# you have to type out the compile paragraph for each PROG. Sigh. -# Here's a start, good luck. -# -#$B/abshw: abshw.c -# $(CC) $(CFLAGS) $? $(LFLAGS) -o $@ -# @chmod 751 $@ -# @echo $(@F) installed in $B - -remake : clobber - @make ROOT=$(ROOT) OPTC=$(OPTC) - -clean : - @-rm -f a.out junk* JUNK* core - @-rm -f *.o - -clobber : clean - @-rm -f $(PROGS) - -install : $(PROGS) - @cp $(PROGS) $B - @echo $(PROGS) installed in $B - @echo -# @chmod 755 $(@F) diff --git a/SEL32/taptools/mkdiagtape.c b/SEL32/taptools/mkdiagtape.c deleted file mode 100644 index ec0b10d..0000000 --- a/SEL32/taptools/mkdiagtape.c +++ /dev/null @@ -1,301 +0,0 @@ -/* - * mkdiagtape.c - * - * This program extracts the diag command file (file 2) from a - * diagnostic tape in .tap format and replaces it with a new - * command file. The rest of the tape is copied unchanged. - * intput - simulated indiagtape outdiagtape - * output - simulated newtape - * option - -c = cmdfile - * 08/22/2020 - * 02/14/2022 - */ - -#include -#include -#include -#include -#ifdef _WIN32 -#include -#endif -//#include - -#if defined(_MSC_VER) && (_MSC_VER < 1600) -typedef __int8 int8; -typedef __int16 int16; -typedef __int32 int32; -typedef unsigned __int8 uint8; -typedef unsigned __int16 uint16; -typedef unsigned __int32 uint32; -typedef signed __int64 t_int64; -typedef unsigned __int64 t_uint64; -typedef t_int64 off_t; -#else -/* All modern/standard compiler environments */ -/* any other environment needa a special case above */ -#include -typedef int8_t int8; -typedef int16_t int16; -typedef int32_t int32; -typedef uint8_t uint8; -typedef uint16_t uint16; -typedef uint32_t uint32; -#endif /* end standard integers */ - -#define BLKSIZE 768 /* MPX file sector size */ -unsigned char data[7680]; /* room for 10*768=(7680) 768 byte sectors per 7680 byte block */ - -/* write 1 file to tape in 768 byte records */ -/* mblks is the maximum blockes to write from a file, 0=all */ -/* chunks is the number of sectors to wrote at a time 1-8 */ -int writefile(FILE *tp, char *fnp, uint32 mblks, int32 chunks) { - int32 word, blks=mblks; /* just a temp word variable */ - int32 size, bsize, csize; /* size in 768 byte sectors */ - FILE *fp; - int32_t n1, n2, hc, nw, cs; - - memset((char *)data, 0, sizeof(data)); /* zero data storage */ - /* write file to tape */ - if ((fp = fopen(fnp, "r")) == NULL) { - fprintf(stderr, "error: can't open user file %s\n", fnp); - exit(1); - } - fseek(fp, 0, SEEK_END); /* seek to end */ - word = ftell(fp); /* get filesize in bytes */ -//printf("MPX file %s is %x (%d) bytes\n", fnp, word, word); - fseek(fp, 0, SEEK_SET); /* rewind file */ - size = (word/768); /* filesize in sectors */ - if (word%768 != 0) /* see if byte left over */ - size += 1; /* partial sector, add 1 */ - if (mblks == 0) { - mblks = (word/768); /* blocks */ - if ((word%768) != 0) /* round up blks if remainder */ - mblks++; /* total block to write */ - } - blks = mblks/chunks; /* chunks */ - if (mblks%768 != 0) /* see if blks left over */ - blks += 1; /* partial blks, add 1 */ - - bsize = mblks; /* save # blks */ - -//printf("MPX file %s is %x (%d) bytes blks %d chk %d\n", -// fnp, word, word, bsize, (bsize+1)/chunks); - csize = 0; - /* read in the image file */ - while (bsize > 0) { - if (bsize > chunks) /* see if there is a chunk left to read */ - csize = chunks; /* yes, do max chunk size */ - else - csize = bsize; /* no, use what is left */ - cs = fread((char *)data, 1, csize*768, fp); - /* we have data to write */ - hc = (csize*768 + 1) & ~1; /* make byte count even */ - /* write actual byte count to 32 bit word as header */ - n1 = fwrite((char *)(&hc), 1, (size_t)sizeof(hc), tp); - /* write the data mod 2 */ - nw = fwrite((unsigned char *)data, 1, (size_t)hc, tp); - /* write the byte count in 32 bit word as footer */ - n2 = fwrite((char *)(&hc), 1, (size_t)sizeof(hc), tp); - if (n1 != sizeof(hc) || nw != hc || n2 != sizeof(hc)) - { - fprintf(stderr, "write to %s failure\n", fnp); - fprintf(stderr, "Operation aborted\n"); - exit(1); - } - bsize -= csize; /* do next chunk */ - memset((char *)data, 0, csize); /* zero data storage */ - } -//printf("write file %s (size %d bytes) (%d sect) (%d blocks) (%d chunks)\n", -// fnp, word, size, mblks, blks); -//HUH fclose(fp); -//HUH exit(0); -//printf("return from write file\n"); - return (1); -} - -/* read program file and output to a simulated diagnostic tape */ -/* mkdiagtape -c cmdfile diagtape diagtapeout */ -int main(argc, argv) -int argc; -char *argv[]; -{ - FILE *dp, *fp, *fopen(); - char **targv; - char *p, *cmdp; - int i; - unsigned int word; /* just a temp word variable */ - int goteof; /* end flags */ - int writing; /* writing output */ - - memset((char *)data, 0, 4608); /* zero data storage */ - - targv = argv; /* save filename */ - if (argc <= 1) { /* see if correct # args */ - fprintf(stderr, "Usage: %s [-ptloa] [-uusername] fmgrtape file1 file2 ...\n", *argv); - exit(1); - } - while(--argc > 0) { - printf("argc %d argv %s\n", argc, *argv); - p = *++argv; - if (*p++ == '-') { - if (*p == '\0') { - fprintf(stderr, "Error: no option specified\n"); - fprintf(stderr, "Usage: %s -c cmdfile infile outfile\n", *targv); - exit(1); - } - printf("doing options %s\n", p); - while (*p != '\0') { - switch (*p++) { - case 'c': - case 'C': - if (*p == '\0') { - p = *++argv; /* next parameter */ - --argc; /* one less arg */ - }; - cmdp = p; /* save ptr to file name */ - while (*p != '\0') - p++; - break; - default: - fprintf(stderr, "Error: no cmd file specified\n"); - fprintf(stderr, "Usage: %s -c cmdfile infile outfile\n", *targv); - exit(1); - break; - } /* end switch */ - continue; - } /* end while */ - } - else { - if ((dp = fopen(*argv, "r")) == NULL) { - fprintf(stderr, "error: can't open input diag tape file %s\n", *argv); - exit(1); - } - printf("opening %s file for tape\n", *argv); - *++argv; - break; /* go handle files now */ - } - continue; - } - /* end while --argc */ - if ((argc-1) <= 0) { - fprintf(stderr, "Error: incorrect number of parameters\n"); - fprintf(stderr, "Usage: %s -c cmdfile infile outfile\n", *targv); - exit(1); - } - /* got input tapefile and options, handle output file now */ -//printf("AT 3 argc %d argv %s\n", argc, *argv); - if (--argc > 0) { - p = *argv++; - printf("argc %d argv3 %s\n", argc, p); - if ((fp = fopen(p, "w")) == NULL) { - fprintf(stderr, "error: can't open tape output file %s\n", p); - fprintf(stderr, "Usage: %s -c cmdfile infile outfile\n", *targv); - exit(1); - } - printf("opened output file %s\n", p); - } - - /* now copy input tape until 1st EOF */ - goteof = 0; /* no eof yet */ - writing = 1; /* we are copying in to out */ - while (goteof == 0) { - int n1, n2, hc, tc, n, nw; - /* read the byte count in 32 bit word as header */ - n1 = fread((char *)(&hc), 1, (size_t)4, dp); - - /* check for EOM on tape */ - if ((n1 <= 0) || (hc & 0xffff0000)) { /* check for garbage, assume EOM */ - fprintf(stderr, "Premature EOM on input file bad tape\n"); - exit(1); - } - /* see if at EOF */ - if (hc == 0) { - /* we are at tape EOF */ - if (writing == 0) - break; /* done with copy */ - writing = 0; /* stop writing */ - /* copy the EOF to the output tape */ - n1 = fwrite((char *)(&hc), 1, (size_t)4, fp); - if (n1 != 4) { - fprintf(stderr, "Error write EOF to output file\n"); - exit(1); - } - continue; /* continue processing */ - } - - /* read the data to copy to output */ - n = fread(data, 1, (size_t)hc, dp); - if (n <= 0) { - fprintf(stderr, "Read error on input file bad tape\n"); - exit(1); - } - - /* if odd byte record, read extra byte and throw it away */ - if (n & 0x1) { - n2 = fread((char *)(&tc), 1, (size_t)1, dp); - if (n2 <= 0) { - fprintf(stderr, "Read error on input file bad tape\n"); - exit(1); - } - } - /* if writing, write out the record */ - if (writing) { - int wc = n; /* get actual byte count */ - /* write actual byte count to 32 bit word as header */ - n1 = fwrite((char *)(&wc), 1, (size_t)4, fp); - /* write the data mod 2 */ - nw = fwrite(data, 1, (size_t)hc, fp); - if (n1 != 4 || nw != hc) { - fprintf(stderr, "write error to tape\n"); - exit(1); - } - } - - /* read the byte count in 32 bit word as trailer */ - n2 = fread((char *)(&tc), 1, (size_t)4, dp); - if (n2 <= 0) { - fprintf(stderr, "Read error on input file bad tape\n"); - exit(1); - } - if (writing) { - /* write the byte count in 32 bit word as footer */ - n2 = fwrite((char *)(&tc), 1, (size_t)4, fp); - if (n2 != 4) { - fprintf(stderr, "write error to tape\n"); - exit(1); - } - } - } - - /* now handle new command file */ - /* we have copied the first file and bypassed the second */ - /* copy in the new com file and write out 768 byte records */ - writefile(fp, cmdp, 0, 1); /* write command file out in 768 byte blks */ - - word = 0; - /* copy the EOF to the output tape */ - i = fwrite((char *)(&word), 1, (size_t)4, fp); - if (i != 4) { - fprintf(stderr, "Error writing EOF to output file\n"); - exit(1); - } - - while (1) { - /* read the data to copy to output */ - i = fread(data, 1, (size_t)7680, dp); -//printf("got i = %x after fread call\n", i); - if (i <= 0) { - fprintf(stderr, "EOM input file, done\n"); - break; - } - /* write the data to output */ - i = fwrite(data, 1, (size_t)i, fp); - if (i <= 0) { - fprintf(stderr, "Error writing data to output file\n"); - break; - } - } - fclose(dp); - fclose(fp); - exit(0); -} diff --git a/SEL32/taptools/mkfmtape.c b/SEL32/taptools/mkfmtape.c deleted file mode 100644 index f1500c9..0000000 --- a/SEL32/taptools/mkfmtape.c +++ /dev/null @@ -1,427 +0,0 @@ -/* - * mkfmtape.c - * - * This program reads MPX files and stores it into a simulated - * filemgr save tape. The tape may then be restored to a MPX - * running system using the filemgr. - * new file entry. - * intput - simulated fmgrtape filename, filename, etc. - * output - simulated fmgrtape, file list to stdout - * options - -p = file type 0xca for programs - * - -t = ascii text file 0xee - * - -l = library/directory file 0xff - * - -o = other 0x00 - * - -a = append entries to current file - * - -u = username (directory) - * 11/26/2018 - */ - -#include -#include -#include -#include - -#if defined(_MSC_VER) && (_MSC_VER < 1600) -typedef __int8 int8; -typedef __int16 int16; -typedef __int32 int32; -typedef unsigned __int8 uint8; -typedef unsigned __int16 uint16; -typedef unsigned __int32 uint32; -typedef signed __int64 t_int64; -typedef unsigned __int64 t_uint64; -typedef t_int64 off_t; -#else -/* All modern/standard compiler environments */ -/* any other environment needa a special case above */ -#include -typedef int8_t int8; -typedef int16_t int16; -typedef int32_t int32; -typedef uint8_t uint8; -typedef uint16_t uint16; -typedef uint32_t uint32; -#endif /* end standard integers */ - -#define BLKSIZE 768 /* MPX file sector size */ -uint32 dir[1152]; /* room for 144 8w smd entries */ -unsigned char data[4608]; /* room for 6*768=(4608) 768 byte sectors per 4608 byte block */ -unsigned char bigdata[19200]; /* room for 6*768=(4608) 768 byte sectors per 4608 byte block */ - -/* read program file and output to a simulated mpx1.x filemgr savetape */ -/* mkfmtape -ltoa fmgrtape, filename, filename, ... */ -int main(argc, argv) -int argc; -char *argv[]; -{ - FILE *fp, *dp, *fopen(); - int targc; - char **targv; - unsigned char username[8]; - char *p; - int i; -#define DOPROG 1 -#define DOADD 2 -#define DOOTHER 4 -#define DOTEXT 8 -#define DOLIB 16 -#define DOUSER 32 - unsigned int option = DOTEXT; /* what to do */ - unsigned char *fnp; /* file name pointer */ - unsigned int size; /* size in 768 byte sectors */ - unsigned int word; /* just a temp word variable */ - unsigned char name[9]; /* LM name */ - unsigned int typ; /* file type requested by user */ - char *userp = username; /* pointer to username */ -// int ofd; /* output file number */ - int filen; /* file number */ - uint32 *dirp; /* directory entry pointer */ - int totent; /* total smd entries */ - - memset((char *)dir, 0, 4608); /* zero smd storage */ - memset((char *)data, 0, 4608); /* zero data storage */ - for (i=0; i<8; i++) - username[i] = 0; /* use zero for system username */ - typ = 0xee000000; /* set type */ - if (argc <= 1) { /* see if correct # args */ - fprintf(stderr, "Usage: %s [-ptloa] [-uusername] fmgrtape file1 file2 ...\n", *argv); - exit(1); - } - while(--argc > 0) { -// printf("argc %d argv %s\n", argc, *argv); - p = *++argv; - if (*p++ == '-') { - if (*p == '\0') { - fprintf(stderr, "Error: no option specified\n"); - fprintf(stderr, "Usage: %s [-ptloa] [-uusername] fmgrtape file1 file2 ...\n", *argv); - exit(1); - } -// printf("doing options %s\n", p); - while (*p != '\0') { - switch (*p++) { - case 'p': - case 'P': - option |= DOPROG; /* save program modules */ - typ = 0xca; /* set type */ - break; - case 'A': - case 'a': - option |= DOADD; /* append to save tape */ - break; - case 'O': - case 'o': - option |= DOOTHER; /* other type files */ - typ = 0x00; /* set type */ - break; - case 'T': - case 't': - option |= DOTEXT; /* save text files */ - typ = 0xee; /* set type */ - break; - case 'L': - case 'l': - option |= DOLIB; /* save library files */ - typ = 0xff; /* set type */ - break; - case 'U': - case 'u': - option |= DOUSER; /* save username for files */ - if (*p == '\0') { - p = *++argv; /* next parameter */ - --argc; /* one less arg */ - }; - userp = p; - while (*p != '\0') - p++; - break; - default: - fprintf(stderr, "Error: no option specified\n"); - fprintf(stderr, "Usage: %s [-ptloa] [-uusername] fmgrtape file1 file2 ...\n", *argv); - exit(1); - break; - } /* end switch */ - continue; - } /* end while */ - } - else { -// printf("option set to %x\n", option); - if (option & DOADD) { - long bytes; - /* open read/write */ - if ((dp = fopen(*argv, "r+")) == NULL) { - /* file not there, create one by opening w+ */ - if ((dp = fopen(*argv, "w")) == NULL) { - fprintf(stderr, "error: can't create/open simulated tape disk file %s\n", *argv); - exit(1); - } -// printf("1 opened output in w mode, write at start\n"); - } -// else -// printf("2 opened output in r+ mode write at end\n"); - - fseek(dp, 0, SEEK_END); /* seek to end */ - bytes = ftell(dp); /* get filesize in bytes */ - printf("file length %ld bytes\n", bytes); - printf("start writing at %ld bytes offset\n", bytes-8); - fseek(dp, 0, SEEK_SET); /* rewind file to beginning */ - if (bytes > 8) { /* see if file written to already */ - /* we need to find the EOT */ - int n1, n2, hc, tc, n; - int EOFcnt = 0; -readmore: - n1 = fread((char *)(&hc), 1, (size_t)4, dp); /* read 4 byte record size */ - if (n1 <=0) /* check for read error */ - goto doabort; /* bad tape format */ - - if (hc & 0xffff0000) /* check for garbage */ - hc = 0; /* assume EOF on disk */ - - if (hc == 0) { /* check for EOF on file */ - /* EOF found */ - if (++EOFcnt == 2) { - /* we have second EOF, we need to backup 4 bytes */ -backup4: - bytes = ftell(dp); /* get file position in bytes */ - fseek(dp, bytes-4, SEEK_SET); /* backspace over 2nd EOF */ - goto getout; /* start our processing */ - } - /* we have first EOF, keep reading */ - goto readmore; /* read more records */ - } else - if (hc == -1) { /* check for EOM */ - if (EOFcnt == 1) - /* see if one EOF followed by EOM (-1) */ - goto backup4; /* start write over the EOM */ - /* we have an EOM without any EOF, so bad tape */ - goto doabort; /* bad tape format */ - } - - /* we have data, so no EOF */ - EOFcnt = 0; /* reset EOF count */ - - /* read the data */ - tc = hc; /* save record size */ - n = fread(bigdata, 1, (size_t)hc, dp); /* read in record size */ - if (n <= 0) { /* check for read error */ - goto doabort; /* bad tape format */ - } - - /* if odd byte record, read extra byte and throw it away */ - if (n & 0x1) { - n2 = fread((char *)(&hc), (size_t)1, (size_t)1, dp); - if (n2 <= 0) - return -1; /* at EOM on disk file */ - } - - n2 = fread((char *)(&hc), 1, (size_t)4, dp); /* read 4 byte record size */ - if (n2 <= 0) { /* check for read error */ -doabort: - /* error, abort the operation */ - fprintf(stderr, "error: formatting error on simulated tape disk file %s\n", *argv); - exit(1); - } - /* verify counts & sizes */ - if ((tc != hc) || (hc != n)) - goto doabort; /* bad tape format */ - goto readmore; /* read more records */ - } - } - else { - if ((dp = fopen(*argv, "w")) == NULL) { - fprintf(stderr, "error: can't create/open simulated tape disk file %s\n", *argv); - exit(1); - } -// printf("3 opened output in w mode, write at start\n"); - } -getout: -// printf("opening %s file for tape\n", *argv); - *++argv; - break; /* go handle files now */ - } - continue; - } - /* end while --argc */ - if ((argc-1) <= 0) { - fprintf(stderr, "Error: incorrect number of parameters\n"); - fprintf(stderr, "Usage: %s [-ptloa] [-uusername] fmgrtape, file1 file2 ...\n", *argv); - exit(1); - } - /* got tapefile and options, handle files now */ - targc = argc; /* save argc to reread list */ - targv = argv; /* save argv to reread list */ -// printf("AT 3 argc %d argv %s\n", argc, *argv); - filen = 0; /* no files yet */ - totent = 0; /* no files yet */ - /* populate the 32 byte SMD entry */ - dirp = (uint32 *)dir; /* get word pointer for smd data */ - while (--argc > 0) { - uint32 smd[8]; /* smd entry data */ - int blks; - - for (i=0; i<8; i++) /* zero smd entry */ - smd[i] = 0; - p = *argv++; - i = strlen(p); /* filename size */ - if (i == 0 || i > 8) { - fprintf(stderr, "error: Filename too long (%d>8) %s, Aborting\n", i, p); - exit(1); - } -// printf("argc %d argv3 %s\n", argc, p); - if ((fp = fopen(p, "r")) == NULL) { - fprintf(stderr, "error: can't open user file %s\n", p); - exit(1); - } - fnp = p; /* get file name pointer */ - fseek(fp, 0, SEEK_END); /* seek to end */ - word = ftell(fp); /* get filesize in bytes */ - fseek(fp, 0, SEEK_SET); /* rewind file */ - size = (word/768); /* filesize in sectors */ - if (word%768 != 0) /* see if byte left over */ - size += 1; /* partial sector, add 1 */ - blks = (word/4608); /* blocks */ - if ((word%4608) != 0) - blks++; - printf("write SMD %s user %s size %d bytes %d sect %d blocks\n", - fnp, userp, word, size, blks); - fclose(fp); - /* create smd entry for this file */ - memset(name, ' ', 8); /* blank filename */ - for (i=0; i<8; i++) { - if (p[i] == '\0') /* check for null termination char */ - break; - name[i] = toupper(p[i]); /* uppercase filename */ - } - /* populate the 32 byte SMD entry */ - /* word 1 and 2 has filename */ - smd[0] = name[3] << 24 | name[2] << 16 | name[1] << 8 | name[0]; - smd[1] = name[7] << 24 | name[6] << 16 | name[5] << 8 | name[4]; - /* type and smd loc in wd 2 */ - smd[2] = typ; /* save the type of file */ - /* size now has load module size in sectors */ - size = 0x80000000 | (blks * 6); /* file flags and size */ - smd[3] = (size & 0xff) << 24 | (size & 0xff00) << 8 | - (size & 0xff0000) >> 8 | (size & 0xff000000) >> 24; - memset(name, ' ', 8); /* blank username */ - for (i=0; i<8; i++) { - if (userp[i] == '\0') /* check for null termination char */ - break; - name[i] = toupper(userp[i]); /* uppercase username */ - } - /* set username */ - smd[4] = name[3] << 24 | name[2] << 16 | name[1] << 8 | name[0]; - smd[5] = name[7] << 24 | name[6] << 16 | name[5] << 8 | name[4]; - if (((smd[4] == 0x20202020) && (smd[5] == 0x20202020)) || - ((smd[4] == 0) && (smd[5] == 0))) { - smd[4] = smd[5] = 0; /* use null for system */ - } - smd[6] = 0x00080000; /* no password or udt index */ - smd[7] = 0x00000080; /* fmgr has 0x80000000 in it so I will too */ - for (i=0; i<8; i++) - *dirp++ = smd[i]; /* save smd entry */ - filen++; /* bump the file count */ - totent++; /* bump total count */ - if (filen == 144) { /* see if entry is full */ - /* we need to write out the directory entries */ - int32 n1, nw; - /* we have data to write */ - int32 hc = (4608 + 1) & ~1; /* make byte count even */ - int32 n2 = 4608; /* get actual byte count */ - /* write actual byte count to 32 bit word as header */ - n1 = fwrite((char *)(&n2), 1, (size_t)4, dp); - /* write the data mod 2 */ - nw = fwrite((unsigned char *)dir, 1, (size_t)hc, dp); - /* write the byte count in 32 bit word as footer */ - n2 = fwrite((char *)(&hc), 1, (size_t)4, dp); - if (n1 != 4 || nw != hc || n2 != 4) - { - fprintf(stderr, "write (%d) failure\n", nw); - fprintf(stderr, "Operation aborted\n"); - exit(1); - } - memset((char *)dir, 0, 4608); /* zero smd storage */ - filen = 0; /* restart count */ - dirp = (uint32 *)dir; /* get word pointer for smd data */ - } - } - /* write out the directory entries for the files to save */ - if (filen != 0) { - /* we need to write out the directory entries */ - int32 n1, nw; - /* we have data to write */ - int32 hc = (4608 + 1) & ~1; /* make byte count even */ - int32 n2 = 4608; /* get actual byte count */ - /* write actual byte count to 32 bit word as header */ - n1 = fwrite((char *)(&n2), 1, (size_t)4, dp); - /* write the data mod 2 */ - nw = fwrite((unsigned char *)dir, 1, (size_t)hc, dp); - /* write the byte count in 32 bit word as footer */ - n2 = fwrite((char *)(&hc), 1, (size_t)4, dp); - if (n1 != 4 || nw != hc || n2 != 4) - { - fprintf(stderr, "write (%d) failure\n", nw); - fprintf(stderr, "Operation aborted\n"); - exit(1); - } - memset(dir, 0, 4608); /* zero smd storage */ - filen = 0; /* restart count */ - } - /* totcnt has total number of files to output */ - memset((char *)data, 0, 4608); /* zero data storage */ - argc = targc; /* restore argc for reread */ - argv = targv; /* restore argv for reread */ - /* read each file and output to save tape file in 6 sector blocks */ - while (--argc > 0) { - int blks; - - p = *argv++; -// printf("argc %d argv3 %s\n", argc, p); - if ((fp = fopen(p, "r")) == NULL) { - fprintf(stderr, "error: can't open user file %s\n", p); - exit(1); - } - fnp = p; /* get file name pointer */ - fseek(fp, 0, SEEK_END); /* seek to end */ - word = ftell(fp); /* get filesize in bytes */ - fseek(fp, 0, SEEK_SET); /* rewind file */ - size = (word/768); /* filesize in sectors */ - if (word%768 != 0) /* see if byte left over */ - size += 1; /* partial sector, add 1 */ - blks = (word/4608); /* blocks */ - if ((word%4608) != 0) - blks++; -// rewind(fp); /* back to beginning */ - while (fread((char *)data, 1, 4608, fp) > 0) { - int32 n1, nw; - /* we have data to write */ - int32 hc = (4608 + 1) & ~1; /* make byte count even */ - int32 n2 = 4608; /* get actual byte count */ - /* write actual byte count to 32 bit word as header */ - n1 = fwrite((char *)(&n2), 1, (size_t)4, dp); - /* write the data mod 2 */ - nw = fwrite((unsigned char *)data, 1, (size_t)hc, dp); - /* write the byte count in 32 bit word as footer */ - n2 = fwrite((char *)(&hc), 1, (size_t)4, dp); - if (n1 != 4 || nw != hc || n2 != 4) - { - fprintf(stderr, "write (%d) failure\n", nw); - fprintf(stderr, "Operation aborted\n"); - exit(1); - } - memset((char *)data, 0, 4608); /* zero data storage */ - } - printf("write file %s user %s (size %d bytes) (%d sect) (%d blocks)\n", - fnp, userp, word, size, blks); - fclose(fp); - } - /* write EOF (zero) to file */ - filen = 0; /* zero count */ - fwrite((char *)(&filen), 1, (size_t)4, dp); - /* do second EOF */ - fwrite((char *)(&filen), 1, (size_t)4, dp); - filen = -1; /* make in -1 for EOM */ - /* do EOM */ - fwrite((char *)(&filen), 1, (size_t)4, dp); -// printf("setting at %ld bytes in file after EOM\n", ftell(dp)); - fclose(dp); - exit(0); -} diff --git a/SEL32/taptools/mkvmtape.c b/SEL32/taptools/mkvmtape.c deleted file mode 100644 index cee7b15..0000000 --- a/SEL32/taptools/mkvmtape.c +++ /dev/null @@ -1,1035 +0,0 @@ -/* - * mkvmtape.c - * - * This program reads MPX files and stores them into a simulated - * volmgr save tape. The tape may then become an sdt boot tape - * to install MPX from or a volmgr file restore tape on a running - * MPX system. - * - * intput - [options] volmtape filename, filename, etc. - * output - volmtape file, file list to stdout - * - * options - -p = file type 0xca for programs - * - -t = ascii text file 0xee - * - -l = library/directory file 0xff - * - -o = other 0x00 - * - -a = append entries to current file - * - -u = username (username) - * - -d = dirname (directory) - * - -v = volname (volume) - * - -b = bootfile name - * - -i = system image file - * - -j = j.vfmt filename - * - -m = master sdt tape image - * 04/11/2020 update for mpx3.x - */ - -#include -#include -#include -#include - -#define MASK24 0x00ffffff - -/* memory access macros */ -/* The RMW and WMW macros are used to read/write memory words */ -/* RMW(addr) or WMW(addr, data) where addr is a byte alligned word address */ -#define RMB(a) ((M[(a)>>2]>>(8*(3-(a&3))))&0xff) /* read memory addressed byte */ -#define RMH(a) ((a)&2?(M[(a)>>2]&RMASK):(M[(a)>>2]>>16)&RMASK) /* read memory addressed halfword */ -#define RMW(a) (M[((a)&MASK24)>>2]) /* read memory addressed word */ -#define WMW(a,d) (M[((a)&MASK24)>>2]=d) /* write memory addressed word */ -/* write halfword to memory address */ -#define WMH(a,d) ((a)&2?(M[(a)>>2]=(M[(a)>>2]&LMASK)|((d)&RMASK)):(M[(a)>>2]=(M[(a)>>2]&RMASK)|((d)<<16))) -/* write byte to memory */ -#define WMB(a,d) (M[(a)>>2]=(((M[(a)>>2])&(~(0xff<<(8*(3-(a&3))))))|((d&0xff)<<(8*(3-(a&3)))))) - -#if defined(_MSC_VER) && (_MSC_VER < 1600) -typedef __int8 int8; -typedef __int16 int16; -typedef __int32 int32; -typedef unsigned __int8 uint8; -typedef unsigned __int16 uint16; -typedef unsigned __int32 uint32; -typedef signed __int64 t_int64; -typedef unsigned __int64 t_uint64; -typedef t_int64 off_t; -#else -/* All modern/standard compiler environments */ -/* any other environment needa a special case above */ -#include -typedef int8_t int8; -typedef int16_t int16; -typedef int32_t int32; -typedef uint8_t uint8; -typedef uint16_t uint16; -typedef uint32_t uint32; -#endif /* end standard integers */ - -#define BLKSIZE 768 /* MPX file sector size */ -uint32 dir[32]; /* directory name */ -uint32 vol[32]; /* volume name */ -unsigned char data[6144]; /* room for 8*768=(6144) 768 byte sectors per 4608 byte block */ -unsigned char bigdata[19200]; /* room for 6*768=(4608) 768 byte sectors per 4608 byte block */ -uint32 M[768]; /* fake memory */ -unsigned char bootcode[2048]; /* room for bootcode */ -uint32 resdes[384]; /* room for the 1536 char (two blks) resource descriptor */ -uint32 dirlist[1536]; /* 6144 byte directory listing */ -int16 savecnt = 0; /* entries in save list */ -char sysname[16] = "SYSTEM "; -char mstrall[] = "mstrall"; -char mstrext[] = "mstrext"; -char mstrout[] = "mstrout"; - -/* write 1 file to tape in 768 byte records */ -/* mblks is the maximum blockes to write from a file, 0=all */ -/* mblks is rounded to next sector */ -/* chunks is the number of sectors to wrote at a time 1-8 */ -/* rem is byte excess in last sector based on program size */ -/* sysinit reads exact bytes from file. If rounded we get RM82 error */ -int writefile(FILE *tp, char *fnp, uint32 mblks, int32 chunks, int32 rem) { - uint32 word, blks=mblks; /* just a temp word variable */ - uint32 size, bsize, csize; /* size in 768 byte sectors */ - FILE *fp; - int32 n1, n2, hc, nw, cs; - - /* setting rem to 0 will always write full sectors */ - /* doing partial sectors did not fix anything */ - rem = 0; /* do not use remainders */ - memset((char *)data, 0, sizeof(data)); /* zero data storage */ - /* write file to tape */ - if ((fp = fopen(fnp, "r")) == NULL) { - fprintf(stderr, "error: can't open user file %s\n", fnp); - exit(1); - } - fseek(fp, 0, SEEK_END); /* seek to end */ - word = ftell(fp); /* get filesize in bytes */ -//printf("MPX file %s is %x (%d) bytes rem %x (%d) mblks %x (%d)\n", fnp, word, word, rem, rem, mblks, mblks); - fseek(fp, 0, SEEK_SET); /* rewind file */ - size = (word/768); /* filesize in sectors */ - if (word%768 != 0) /* see if bytes left over */ - size += 1; /* partial sector, add 1 */ - /* size has #768 blocks in file */ - if (mblks == 0) { -// mblks = (word/768); /* blocks */ -// if ((word%768) != 0) /* round up blks if remainder */ -// mblks++; /* total block to write */ - mblks = size; /* use file size */ - rem = 0; /* no rem if no mblks */ - } - if (rem != 0) { - mblks--; /* last block will be rem bytes */ - } -//printf("MPX0 file %s is %x (%d) bytes mblks %d chunk %d rem %d\n", -// fnp, word, word, mblks, chunks, rem); -// blks = mblks/chunks; /* chunks */ -// if (mblks%768 != 0) /* see if blks left over */ -// blks += 1; /* partial blks, add 1 */ -/// bsize = mblks/chunks; /* chunks */ -/// if (mblks%chunks != 0) /* see if blks left over */ -/// bsize += 1; /* partial blks, add 1 */ - -/// blks = bsize; /* save # blks */ - bsize = mblks; /* save # blks */ - -//printf("MPX1 file %s is %x (%d) bytes mblks %d bsize %d rem %d\n", -// fnp, word, word, mblks, bsize, rem); - csize = 0; - /* read in the image file */ - while (bsize > 0) { - if ((int32)bsize > chunks) /* see if there is a chunk left to read */ - csize = chunks; /* yes, do max chunk size */ - else - csize = bsize; /* no, use what is left */ - cs = fread((char *)data, 1, csize*768, fp); - /* we have data to write */ - hc = (csize*768 + 1) & ~1; /* make byte count even */ - /* write actual byte count to 32 bit word as header */ - n1 = fwrite((char *)(&hc), 1, (size_t)sizeof(hc), tp); - /* write the data mod 2 */ - nw = fwrite((unsigned char *)data, 1, (size_t)hc, tp); - /* write the byte count in 32 bit word as footer */ - n2 = fwrite((char *)(&hc), 1, (size_t)sizeof(hc), tp); - if (n1 != sizeof(hc) || nw != hc || n2 != sizeof(hc)) - { - fprintf(stderr, "write to %s failure\n", fnp); - fprintf(stderr, "Operation aborted\n"); - exit(1); - } - bsize -= csize; /* do next chunk */ - memset((char *)data, 0, csize*768); /* zero data storage */ - if ((bsize <= 0) && (rem != 0)) { - fprintf(stderr, "writing last block to %s rem = %x (%d)\n", fnp, rem, rem); - cs = fread((char *)data, rem, 1, fp); /* read last "real" bytes */ - /* we have data to write */ - hc = (rem + 1) & ~1; /* make byte count even */ - /* write actual byte count to 32 bit word as header */ - n1 = fwrite((char *)(&hc), 1, (size_t)sizeof(hc), tp); - /* write the data mod 2 */ - nw = fwrite((unsigned char *)data, 1, (size_t)hc, tp); - /* write the byte count in 32 bit word as footer */ - n2 = fwrite((char *)(&hc), 1, (size_t)sizeof(hc), tp); - fprintf(stderr, "done with last block to %s rem %x n1 %x nw %x n2 %x\n", fnp, rem, n1, nw, n2); - if (n1 != sizeof(hc) || nw != hc || n2 != sizeof(hc)) - { - fprintf(stderr, "write to %s failure\n", fnp); - fprintf(stderr, "Operation aborted\n"); - exit(1); - } - } - } -//printf("write file %s (size %d bytes) (%d sect) (%d blocks) (%d chunks) (%d rem)\n", -// fnp, word, size, mblks, blks, rem); - fclose(fp); - return(0); -} - -uint32 readboot(char *name, char *buf, uint32 start, uint32 end) { - int32 word = end-start+4; /* just a temp word variable */ - FILE *fp; - int32 n1, n2; - - memset((char *)bootcode, 0, sizeof(bootcode)); /* zero data storage */ - if ((fp = fopen(name, "r")) == NULL) { - fprintf(stderr, "error: can't open user file %s\n", name); - exit(1); - } - fseek(fp, start, 0); /* seek to boot code */ - n1 = fread(bootcode, 1, word, fp); /* read bootcode */ - if (n1 <=0) /* check for read error */ - exit(1); /* bad tape format */ -//printf("MPX bootfile %s is %x (%d) bytes\n", name, word, word); - fclose(fp); - fopen("volmboot", "w"); - fwrite(bootcode, 1, word, fp); - fclose(fp); - for (n2=0; n2> 8) | ((val >> 24) & 0xff)); -} - -/* get number of 768 byte blocks in file */ -/* returned number of sectors is rounded up */ -/* rem is bytes in last sect */ -uint32 getblks(char *imgp, uint32 *rem) -{ - unsigned int word; /* just a temp word variable */ - FILE *fp; - int32 n1, n2, w2, blks; - - memset((char *)M, 0, 768); /* zero data storage */ - if ((fp = fopen(imgp, "r")) == NULL) { - fprintf(stderr, "error: can't open image file %s\n", imgp); - exit(1); /* we are done here */ - } - fseek(fp, 0, SEEK_END); /* seek to end */ - word = ftell(fp); /* get filesize in bytes */ -//printf("image file %s is %x (%d) bytes\n", imgp, word, word); - fseek(fp, 0, SEEK_SET); /* rewind file */ - w2 = fread((char *)M, sizeof(uint32), 192, fp); /* read the image file */ - n1 = flip(M[0x68/4]); /* get PR.BYTDR bytes in dsect rel matrix */ - n2 = flip(M[0x64/4]); /* get PR.SFADR sec addr of rel matrix */ - if (n2 == 0) { /* if zero use PR.SFAD rel addr of dsect */ - n1 = flip(M[0x5C/4]); /* get PR.BYTED bytes in dsect */ - n2 = flip(M[0x58/4]); /* get PR.SFAD sec addr of dsect */ - n2 += 1; /* add 1 blk for sys debug blk */ - } - blks = n1/768; /* get #block rounded mod 768 */ - *rem = n1%768; /* get excess bytes */ - if ((n1%768) != 0) /* round up blks if remainder */ - blks++; - blks += n2; /* get total blks to read */ -//printf("image file %s n1 %x (%d) n2 %x (%d) blks %x (%d) rem %x (%d)\n", -// imgp, n1, n1, n2, n2, blks, blks, *rem, *rem); - fseek(fp, 0, SEEK_SET); /* rewind file */ - fclose(fp); - - return blks; -} - -/* read program file and output to a simulated mpx3.x volmgr savetape */ -/* mkvmtape [opt] volmtape, filename, filename, ... */ -int main(argc, argv) -int argc; -char *argv[]; -{ - FILE *fp, *dp, *fopen(); - int targc; - char **targv; - unsigned char username[32]; - unsigned char bootname[32]; - unsigned char imgname[32]; - unsigned char vfmtname[32]; -// unsigned char volname[32]; -// unsigned char dirname[32]; - char *p; - int i, n, eof; -#define DOPROG 1 -#define DOADD 2 -#define DOOTHER 4 -#define DOTEXT 8 -#define DOLIB 16 -#define DOUSER 32 -#define DOBOOT 64 -#define DOIMG 128 -#define DOVFMT 256 -#define DOVOL 512 -#define DODIR 1024 -#define DOMSTR 2048 -#define DOMASK (DOBOOT|DOIMG|DOVFMT) - unsigned int option = DOTEXT; /* what to do */ - unsigned char *fnp; /* file name pointer */ - unsigned int size; /* size in 768 byte sectors */ - unsigned int word; /* just a temp word variable */ - unsigned char name[128]; /* LM name */ - unsigned int typ; /* file type requested by user */ - char *userp = username; /* pointer to username */ - char *bootp = bootname; /* pointer to boot file name */ - char *imgp= imgname; /* pointer to image file name */ - char *vfmtp = vfmtname; /* pointer to j.vfmt file name */ -// int ofd; /* output file number */ - int32 filen; /* file number */ -// uint32 *dirp = dir; /* directory entry pointer */ -// uint32 *volp = vol; /* volume entry pointer */ -// char *dirp = dirname; /* directory entry pointer */ -// char *volp = volname; /* volume entry pointer */ - char *dirp = sysname; /* directory entry pointer */ - char *volp = sysname; /* volume entry pointer */ - int32 totent; /* total smd entries */ - char j_vfmt[] = {"!VOLSYST!DIRSYST!FIL J.VFMT "}; - char j_mount[] = {"!VOLSYST!DIRSYST!FIL J.MOUNT "}; - char j_swapr[] = {"!VOLSYST!DIRSYST!FIL J.SWAPR "}; - char volmgr[] = {"!VOLSYST!DIRSYST!FIL VOLMGR "}; - -// memset((char *)dir, 0, 4608); /* zero smd storage */ - memset((char *)data, 0, 4608); /* zero data storage */ - for (i=0; i<32; i++) - username[i] = 0; /* use zero for system username */ - typ = 0xee; /* set type */ - if (argc <= 1) { /* see if correct # args */ - fprintf(stderr, - "Usage: %s [-ptloa] [-bboot] [-iimage] [-jj.vfmt] [-uusername] vmgrtape file1 file2 ...\n", - *argv); - exit(1); - } - while(--argc > 0) { -//printf("argc %d argv %s\n", argc, *argv); - p = *++argv; - if (*p++ == '-') { - if (*p == '\0') { - fprintf(stderr, "Error: no option specified\n"); - fprintf(stderr, - "Usage: %s [-ptloa] [-bboot] [-iimage] [-jj.vfmt] [-uusername] vmgrtape file1 file2 ...\n", - *argv); - exit(1); - } -//printf("doing options %s\n", p); - while (*p != '\0') { - switch (*p++) { - case 'b': - case 'B': - if (option & DOADD) { /* error if append specified with boot command */ - fprintf(stderr, "Error: -b cannot be specified with -a option\n"); - goto error1; /* we are done here */ - } - option |= DOBOOT; /* save boot code, mpx image, and j.vfmt */ - if (*p == '\0') { - p = *++argv; /* next parameter */ - --argc; /* one less arg */ - }; - bootp = p; - while (*p != '\0') - p++; - typ = 0xca; /* set type */ - break; - case 'i': - case 'I': - option |= DOIMG; /* save mpx image filename */ - if (*p == '\0') { - p = *++argv; /* next parameter */ - --argc; /* one less arg */ - }; - imgp = p; - while (*p != '\0') - p++; - typ = 0xca; /* set type */ - break; - case 'j': - case 'J': - option |= DOVFMT; /* save j.vfmt file name */ - if (*p == '\0') { - p = *++argv; /* next parameter */ - --argc; /* one less arg */ - }; - vfmtp = p; - while (*p != '\0') - p++; - typ = 0xca; /* set type */ - break; - case 'm': - case 'M': - option |= DOMSTR; /* output master SDT */ - break; - case 'p': - case 'P': - option |= DOPROG; /* save program modules */ - typ = 0xca; /* set type */ - break; - case 'A': - case 'a': - if (option & DOBOOT) { /* error if boot specified with append command */ - fprintf(stderr, "Error: -a cannot be specified with -b option\n"); - goto error1; /* we are done here */ - } - option |= DOADD; /* append to save tape */ - break; - case 'O': - case 'o': - option |= DOOTHER; /* other type files */ - typ = 0x00; /* set type */ - break; - case 'T': - case 't': - option |= DOTEXT; /* save text files */ - typ = 0xee; /* set type */ - break; - case 'L': - case 'l': - option |= DOLIB; /* save library files */ -// typ = 0xff; /* set type */ - typ = 0x00; /* set type */ - break; - case 'V': - case 'v': - option |= DOVOL; /* save volume name files */ - if (*p == '\0') { - p = *++argv; /* next parameter */ - --argc; /* one less arg */ - }; - volp = p; /* save volume pointer */ - while (*p != '\0') - p++; - break; - case 'D': - case 'd': - option |= DODIR; /* save directory name for files */ - if (*p == '\0') { - p = *++argv; /* next parameter */ - --argc; /* one less arg */ - }; - dirp = p; - while (*p != '\0') - p++; - break; - case 'U': - case 'u': - option |= DOUSER; /* save username for files */ - if (*p == '\0') { - p = *++argv; /* next parameter */ - --argc; /* one less arg */ - }; - userp = p; - while (*p != '\0') - p++; - break; - default: - fprintf(stderr, "Error: no option specified\n"); -error1: - fprintf(stderr, - "Usage: %s [-ptloam] [-bboot] [-iimage] [-jj.vfmt] [-uusername] vmgrtape file1 file2 ...\n", - *argv); - exit(1); - break; - } /* end switch */ - continue; - } /* end while */ - } - else { -//printf("option set to %x\n", option); - if (option & DOADD) { - long bytes; - /* open read/write */ - if ((dp = fopen(*argv, "r+")) == NULL) { - /* file not there, create one by opening w+ */ - if ((dp = fopen(*argv, "w")) == NULL) { - fprintf(stderr, "error: can't create/open simulated tape disk file %s\n", *argv); - exit(1); - } -//printf("1 opened output in w mode, write at start\n"); - } -//else -//printf("2 opened output in r+ mode write at end\n"); - - fseek(dp, 0, SEEK_END); /* seek to end */ - bytes = ftell(dp); /* get filesize in bytes */ -//printf("1 file length %ld %lx bytes\n", bytes, bytes); -//67 printf("1 start writing at %ld %lx bytes offset\n", bytes-8, bytes-8); -//printf("1 start writing at %ld %lx bytes offset\n", bytes-4, bytes-4); - fseek(dp, 0, SEEK_SET); /* rewind file to beginning */ - /* at this point, we are at the end of the tape */ - /* we should see 3 EOF's w/ or w/o an EOM */ - if (bytes > 8) { /* see if file written to already */ - /* we need to find the EOT */ - int32 n1, n2, hc, tc, n; - int EOFcnt = 0; -readmore: - fseek(dp, bytes-4, SEEK_SET); /* seek back to EOF/EOM code */ - n1 = fread((char *)(&hc), 1, (size_t)4, dp); /* read 4 byte record size */ - if (n1 <=0) /* check for read error */ - goto doabort; /* bad tape format */ - -//printf("2 file length %ld %lx bytes\n", bytes, bytes); -//67printf("2 start writing at %ld %lx bytes offset\n", bytes-8, bytes-8); -printf("2 start writing at %ld %lx bytes offset\n", bytes-4, bytes-4); - if (hc & 0xffff0000) /* check for garbage */ - hc = 0; /* assume EOF on disk */ - - if (hc == 0) { /* check for EOF on file */ - /* EOF found */ - if (++EOFcnt == 2) { - /* we have second EOF, we need to backup 4 bytes */ -//backup4: - /* we are setting after 2nd EOF, start writing there */ -// bytes -= 4; /* backup 4 bytes */ - fseek(dp, bytes-4, SEEK_SET); /* backspace over 2nd EOF */ -//printf("3 file length %ld %lx bytes\n", bytes, bytes); -//printf("3 start writing at %ld %lx bytes offset\n", bytes-8, bytes-8); - goto getout; /* start our processing */ - } - /* we have first EOF, keep reading */ - bytes -= 4; /* backup 4 bytes */ - goto readmore; /* read more records */ - } else - if (hc == -1) { /* check for EOM */ - if (EOFcnt != 0) - /* we have an EOM before an EOF, so bad tape */ - goto doabort; /* bad tape format */ - bytes -= 4; /* backup 4 bytes */ - goto readmore; /* read more records */ - } - - /* we have data, so no EOF */ - EOFcnt = 0; /* reset EOF count */ - - /* read the data */ - tc = hc; /* save record size */ - n = fread(bigdata, 1, (size_t)hc, dp); /* read in record size */ - if (n <= 0) { /* check for read error */ - goto doabort; /* bad tape format */ - } - n2 = fread((char *)(&hc), 1, (size_t)4, dp); /* read 4 byte record size */ - if (n2 <= 0) { /* check for read error */ -doabort: - /* error, abort the operation */ - fprintf(stderr, "error: formatting error on simulated tape disk file %s\n", *argv); - exit(1); - } - /* verify counts & sizes */ - if ((tc != hc) || (hc != n)) - goto doabort; /* bad tape format */ - goto readmore; /* read more records */ - } - } - else { - if ((dp = fopen(*argv, "w")) == NULL) { - fprintf(stderr, "error: can't create/open simulated tape disk file %s\n", *argv); - exit(1); - } -//printf("3 opened output in w mode, write at start\n"); - } -getout: -//printf("opening %s file for tape\n", *argv); - *++argv; - break; /* go handle files now */ - } - continue; - } - /* end while --argc */ - - if (!DOADD) { - if ((option & DOMASK) && ((option & DOMASK) != DOMASK)) { - fprintf(stderr, "Error: incorrect number of sdt files, must be three\n"); - fprintf(stderr, "Usage: %s [-ptloa] [-uusername] vmgrtape, file1 file2 ...\n", *argv); - exit(1); - } - } - /* process the bootfile first */ - if (option & DOBOOT) { - int32 w2, n1, n2, nw, hc, blks, rem; - fnp = bootp; /* get file name pointer */ - memset((char *)data, 0, 0x800); /* zero data storage */ -#define USE_FILENAME -#ifdef USE_FILENAME - if ((fp = fopen(bootp, "r")) == NULL) { - fprintf(stderr, "error: can't open boot file %s\n", bootp); - exit(1); - } - fseek(fp, 0, SEEK_END); /* seek to end */ - word = ftell(fp); /* get filesize in bytes */ -//printf("bootfile %s is %x (%d) bytes\n", bootp, word, word); - fseek(fp, 0, SEEK_SET); /* rewind file */ - /* bootfile must be <= 0x780 chars */ -// if (word > 0x780) { -// fprintf(stderr, "error: boot file %s greater than 0x780 bytes\n", bootp); -// exit(1); -// } - w2 = fread((char *)data, 1, word, fp); /* read the boot file */ - fclose(fp); -#else - /* go cut the boot code from the volmgr load module */ -// w2 = readboot("volmgr", (char *)data, 0x1c9a0, 0x1d144); /* 7a4 volmgr 3.4+ */ -// w2 = readboot("volmgr", (char *)data, 0x1c9a0, 0x1d140); /* 7a0 volmgr ?? */ - w2 = readboot("volmgr", (char *)data, 0x24860, 0x24f48); /* 6ec volmgr 3.5u02 */ - word = w2; /* get filesize in bytes */ -#endif - /* we have data to write */ - hc = (w2 + 1) & ~1; /* make byte count even */ -// hc = (0x780 + 1) & ~1; /* make byte count even */ - /* write actual byte count to 32 bit word as header */ - n1 = fwrite((char *)(&hc), 1, (size_t)sizeof(hc), dp); - /* write the data mod 2 */ - nw = fwrite((unsigned char *)data, 1, (size_t)hc, dp); - /* write the byte count in 32 bit word as footer */ - n2 = fwrite((char *)(&hc), 1, (size_t)sizeof(hc), dp); - if (n1 != sizeof(hc) || nw != hc || n2 != sizeof(hc)) { - fprintf(stderr, "write (%d) failure\n", nw); - fprintf(stderr, "Operation aborted\n"); - exit(1); - } -//printf("write boot file %s (size %d bytes)\n", bootp, word, word); - /* setup for mpx image file */ - memset((char *)data, 0, 0x800); /* zero data storage */ - - if (option & DOMSTR) { - /* get blocks in image file */ - blks = getblks(mstrall, &rem); - /* write 1st mpx image file */ - writefile(dp, mstrall, blks, 1, rem); /* write max of "blks" blocks to file */ - - /* write EOF (zero) to file */ - filen = 0; /* zero count */ - fwrite((char *)(&filen), 1, (size_t)sizeof(filen), dp); - - blks = getblks(mstrext, &rem); - /* write 2nd mpx image file */ - writefile(dp, mstrext, blks, 1, rem); /* write max of "blks" blocks to file */ - - /* write EOF (zero) to file */ - filen = 0; /* zero count */ - fwrite((char *)(&filen), 1, (size_t)sizeof(filen), dp); - - blks = getblks(mstrout, &rem); - /* write 3rd mpx image file */ - writefile(dp, mstrout, blks, 1, rem); /* write max of "blks" blocks to file */ - - /* write EOF (zero) to file */ - filen = 0; /* zero count */ - fwrite((char *)(&filen), 1, (size_t)sizeof(filen), dp); - } else { - /* get blocks in image file */ - blks = getblks(imgp, &rem); - - /* write mpx image file */ - writefile(dp, imgp, blks, 1, rem); /* write max of "blks" blocks to file */ - } - /* get blocks in j.vfmt file */ - blks = getblks(vfmtp, &rem); - /* write j.vfmt file */ - writefile(dp, vfmtp, blks, 1, rem); /* write 1 blk at a time */ -// writefile(dp, vfmtp, 0, 1); /* write 1 blk at a time */ - - /* write EOF (zero) to file */ - filen = 0; /* zero count */ - fwrite((char *)(&filen), 1, (size_t)sizeof(filen), dp); - - /* write j.mount file */ - blks = getblks("j.mount", &rem); - writefile(dp, "j.mount", blks, 1, rem); /* one blk at a time */ -// writefile(dp, "j.mount", 0, 1); /* one blk at a time */ - - /* write j.swapr file */ - blks = getblks("j.swapr", &rem); - writefile(dp, "j.swapr", blks, 1, rem); /* one blk at a time */ -// writefile(dp, "j.swapr", 0, 1); /* one blk at a time */ - - /* write volmgr file */ - blks = getblks("volmgr", &rem); - writefile(dp, "volmgr", blks, 1, rem); /* one blk at a time */ -// writefile(dp, "volmgr", 0, 1); /* all of file 1 blk at a time */ - - /* write EOF (zero) to file */ - filen = 0; /* zero count */ - fwrite((char *)(&filen), 1, (size_t)sizeof(filen), dp); - - /* do second EOF */ - fwrite((char *)(&filen), 1, (size_t)sizeof(filen), dp); - - /* do third EOF */ - fwrite((char *)(&filen), 1, (size_t)sizeof(filen), dp); - filen = -1; /* make in -1 for EOM */ - /* do EOM */ - fwrite((char *)(&filen), 1, (size_t)sizeof(filen), dp); -//printf("setting at %ld bytes in file after EOM\n", ftell(dp)); - fclose(dp); - exit(0); - } - - /* process save files */ - if ((argc-1) <= 0) { - fprintf(stderr, "Error: incorrect number of parameters\n"); - goto error1; /* we are done here */ - } - /* save up to 127 file names in 6144 byte record */ - if (argc > 127) { - fprintf(stderr, "Error: only 127 files max at a time\n"); - goto error1; /* we are done here */ - } -/*------------------------------------------------------------------------*/ - savecnt = 0; /* no files "yet */ - /* make first pass over files and get filenames and sizes */ - /* got tapefile and options, handle files now */ - targc = argc; /* save argc to reread list */ - targv = argv; /* save argv to reread list */ -//printf("AT 3 argc %d argv %s\n", argc, *argv); - filen = 0; /* no files yet */ - totent = 0; /* no files yet */ - - /* save up to 127 file names in 6144 byte record */ - if (argc > 127) { - fprintf(stderr, "Error: only 127 files max at a time\n"); - goto error1; /* we are done here */ - } - /* filename/directory/volume */ - /* wd 1 is 1 for type 1 record */ - /* wd 2 will be # of 48 byte pathnames */ - memset((char *)dirlist, 0, sizeof(dirlist)); /* zero data storage */ - - /* populate the 48 byte entry starting at byte 2 */ -// dirp = (uint32 *)dir; /* get word pointer for directory */ -// volp = (uint32 *)vol; /* get word pointer for volume */ -// dirp = dirname; /* get word pointer for directory */ -// volp = volname; /* get word pointer for volume */ -// dirp = sysname; /* get word pointer for directory */ - volp = sysname; /* get word pointer for volume */ - n = 2; - dirlist[0] = n << 24; /* set record type to 1 */ - while (--argc > 0) { - uint32 smd[32]; /* dir entry data */ -// int blks, eof; - - for (i=0; i<16; i++) /* zero smd entry */ - smd[i] = 0x20; /* make blank */ - p = *argv++; - i = strlen(p); /* filename size */ - if (i == 0 || i > 16) { - fprintf(stderr, "error: Filename too long (%d>16) %s, Aborting\n", i, p); - exit(1); - } -//printf("argc %d argv3 %s\n", argc, p); - if ((fp = fopen(p, "r")) == NULL) { - fprintf(stderr, "error: can't open user file %s\n", p); - exit(1); - } - fnp = p; /* get file name pointer */ - - /* create dir entry for this file */ - /* first is 16 char filename */ - memset(name, ' ', 16); /* blank directory */ - for (i=0; i<16; i++) { - if (p[i] == '\0') /* check for null termination char */ - break; - name[i] = toupper(p[i]); /* uppercase filename */ - } - /* populate the 16 byte file name entry */ - dirlist[n+0] = name[3] << 24 | name[2] << 16 | name[1] << 8 | name[0]; - dirlist[n+1] = name[7] << 24 | name[6] << 16 | name[5] << 8 | name[4]; - dirlist[n+2] = name[11] << 24 | name[10] << 16 | name[9] << 8 | name[8]; - dirlist[n+3] = name[15] << 24 | name[14] << 16 | name[13] << 8 | name[12]; - n += 4; - - /* populate the 16 byte directory/user name entry */ - memset(name, ' ', 16); /* blank directory */ - for (i=0; i<16; i++) { - if (dirp[i] == '\0') /* check for null termination char */ - break; - name[i] = toupper(dirp[i]); /* uppercase directory name */ - } - /* set directory name */ - dirlist[n+0] = name[3] << 24 | name[2] << 16 | name[1] << 8 | name[0]; - dirlist[n+1] = name[7] << 24 | name[6] << 16 | name[5] << 8 | name[4]; - dirlist[n+2] = name[11] << 24 | name[10] << 16 | name[9] << 8 | name[8]; - dirlist[n+3] = name[15] << 24 | name[14] << 16 | name[13] << 8 | name[12]; - n += 4; - - /* populate the 16 byte volume name entry */ - memset(name, ' ', 16); /* blank directory */ - for (i=0; i<16; i++) { - if (dirp[i] == '\0') /* check for null termination char */ - break; - name[i] = toupper(dirp[i]); /* uppercase directory name */ - } - /* set volume name */ - dirlist[n+0] = sysname[3] << 24 | sysname[2] << 16 | sysname[1] << 8 | sysname[0]; - dirlist[n+1] = sysname[7] << 24 | sysname[6] << 16 | sysname[5] << 8 | sysname[4]; - dirlist[n+2] = sysname[11] << 24 | sysname[10] << 16 | sysname[9] << 8 | sysname[8]; - dirlist[n+3] = sysname[15] << 24 | sysname[14] << 16 | sysname[13] << 8 | sysname[12]; - n += 4; - - filen++; /* bump the file count */ - totent++; /* bump total count */ - } - -//printf("AT write file list with %d entries\n", filen); - /* dirlist now has 1-127 filename entries to save */ - /* write out the directory entries for the files to save */ - if (filen != 0) { - /* we need to write out the directory entries */ - int32 n1, n2, nw; - int32 hc = (6144 + 1) & ~1; /* make byte count even */ - /* put record type 1 in dirlist[0] byte swapped */ - dirlist[0] = 0x01000000; /* record type 1 */ - /* put the number of entries into dirlist[1] */ - dirlist[1] = (filen&0xff) << 24 | (filen&0xff00) << 16 | - (filen&0xff0000) >> 8 | ((filen&0xff000000) >> 16); - - /* now output the record */ - /* write actual byte count to 32 bit word as header */ - n1 = fwrite((char *)(&hc), 1, (size_t)sizeof(hc), dp); - /* write the data mod 2 */ - nw = fwrite((unsigned char *)dirlist, 1, (size_t)hc, dp); - /* write the byte count in 32 bit word as footer */ - n2 = fwrite((char *)(&hc), 1, (size_t)sizeof(hc), dp); - if (n1 != sizeof(hc) || nw != hc || n2 != sizeof(hc)) - { - fprintf(stderr, "write (%d) failure\n", nw); - fprintf(stderr, "Operation aborted\n"); - exit(1); - } -// filen = 0; /* restart count */ - } - - /* write EOF (zero) to file */ - eof = 0; /* zero count */ - fwrite((char *)(&eof), 1, (size_t)sizeof(eof), dp); - - /* totcnt has total number of files to output */ - memset((char *)data, 0, 4608); /* zero data storage */ - argc = targc; /* restore argc for reread */ - argv = targv; /* restore argv for reread */ - n = 2; - /* read each file and output to save tape file in 6 sector blocks */ - while (--argc > 0) { -// int32 n1, n2, nw, k; - int32 n1, n2, nw; - int32 hc = (1536 + 1) & ~1; /* make byte count even */ - int blks, rem; - - p = *argv++; -//printf("at 4 argc %d argv %s\n", argc, p); - blks = getblks(p, &rem); - - if ((fp = fopen(p, "r")) == NULL) { - fprintf(stderr, "error: can't open user file %s\n", p); - exit(1); - } - fnp = p; /* get file name pointer */ - - if (typ != 0xca) { - /* we need to write the resource descriptor in 2 blks to file */ - /* followed by file content is 8 blk chunks */ - fseek(fp, 0, SEEK_END); /* seek to end */ - word = ftell(fp); /* get filesize in bytes */ - fseek(fp, 0, SEEK_SET); /* rewind file */ - size = (word/768); /* filesize in sectors */ - if (word%768 != 0) /* see if byte left over */ - size += 1; /* partial sector, add 1 */ - } else { - size = blks; - } - /* round up mod 4 */ - size += 3; - size &= ~3; - fclose(fp); - /*******************************/ - memset((char *)resdes, 0, sizeof(resdes)); /* zero resource descriptor storage */ - /* wd 0 record type 2, wd 1 is zero of phase error flag n/u */ - resdes[0] = 0x02000000; /* 2 byte swapped */ - /* 48 char file/directory/volume name (122 wds) */ - /* copy name from dirlist written earlier */ - resdes[0+2] = dirlist[n+0]; /* file */ - resdes[1+2] = dirlist[n+1]; - resdes[2+2] = dirlist[n+2]; - resdes[3+2] = dirlist[n+3]; - resdes[4+2] = dirlist[n+4]; /* directory, system*/ - resdes[5+2] = dirlist[n+5]; - resdes[6+2] = dirlist[n+6]; - resdes[7+2] = dirlist[n+7]; - resdes[8+2] = dirlist[n+8]; /* volume, system */ - resdes[9+2] = dirlist[n+9]; - resdes[10+2]= dirlist[n+10]; - resdes[11+2]= dirlist[n+11]; - /* 16 word resource create block */ - resdes[0+12+2] = dirlist[n+8]; /* RCB.OWNR owner, system */ - resdes[1+12+2] = dirlist[n+9]; /* only 8 bytes */ - resdes[2+12+2] = dirlist[n+8]; /* RCB.USER group, system */ - resdes[3+12+2] = dirlist[n+9]; /* only 8 bytes */ -//SS n += 12; - resdes[4+12+2]=flip(0x80f00000); /* RCB.OWRI owner rights */ - resdes[5+12+2]=flip(0x80b00000); /* RCB.UGRI group rights */ - resdes[6+12+2]=flip(0x80800000); /* RCB.OTRI other rights */ - if (typ == 0xca) - resdes[7+12+2]=flip(0x00040110); /* res mgmt flags */ - else - resdes[7+12+2]=flip(0x00040110); /* res mgmt flags */ -// resdes[21]=flip(0x0004011c); /* res mgmt flags */ - resdes[11+12+2]=flip(285); /* RCB.OSIZ org dir (0x120) size */ -// resdes[11+12+2]=flip(size); /* org file size */ - resdes[13+12+2]=flip(0x53480); /* RCB.FAST Res ID buffer address n/u */ -// resdes[27]=flip(1000); /* file starting address n/u */ - resdes[15+12+2]=flip(0x00fbfeef); /* RCB.OPTS option flags */ -// resdes[29]=flip(0x00fbfeef); /* RCB.OPTS option flags */ - /* rest of block is zero */ - - /* second block is resosurce descriptor from disk M.RDCOM */ - resdes[0+192] = dirlist[n+8]; /* RD.IDNAM volume, system */ - resdes[1+192] = dirlist[n+9]; - resdes[2+192]= dirlist[n+10]; - resdes[3+192]= dirlist[n+11]; - - resdes[4+192]=flip(0x00003190); /* RD.DATE creation date */ - resdes[5+192]=flip(0x0e8c8000); /* RD.TIME creation time */ - resdes[6+192]=flip(0x000003c0); /* RD.DOFF abs blk of res des */ - resdes[7+192]=flip(0x0000000a); /* RD.RDFLG / RD.RTYPE resource type, perm file */ - - resdes[8+192]=flip(0x000029cf); /* RD.CRDAT creation date */ - resdes[9+192]=flip(0x1dd8e074); /* RD.CRTIM creation time */ - //202 10+192 RD.XPDAT - //203 11+192 RD.XPTIM - - //204 12+192 RD.RDDAT - //205 13+192 RD.RDTIM - resdes[14+192]=flip(0x000029cf); /* RD.CHDAT last chge date */ - resdes[15+192]=flip(0x1dd8e074); /* RD.CHTIM last chge time */ - - resdes[16+192]=flip(0x00003190); /* RD.SVDAT last save date */ - resdes[17+192]=flip(0x0e8c8000); /* RD.SVTIM last save time */ - //210 18+192 RD.RSDAT - //211 19+192 RD.RSTIM - - resdes[20+192] = dirlist[n+8]; /* RD.CHOWN ownername last changer, system */ - resdes[21+192] = dirlist[n+9]; - resdes[22+192] = dirlist[n+8]; /* RD.CROWN ownername creator, system */ - resdes[23+192] = dirlist[n+9]; - - //216 24+192 RD.RDCNT - //217 25+192 RD.AFLGS - resdes[26+192] = dirlist[n+8]; /* RD.OWNR ownername of resource, system */ - resdes[27+192] = dirlist[n+9]; - - resdes[28+192] = dirlist[n+8]; /* RD.UGRP group of resource, system */ - resdes[29+192] = dirlist[n+9]; - resdes[30+192]=flip(0xf8400000); /* RD.AOWNR owner access */ - resdes[31+192]=flip(0xf8400000); /* RD.AUGRP group access */ -// resdes[223]=flip(0xf8e00000); /* RD.AUGRP group access */ - resdes[32+192]=flip(0x80000000); /* RD.AOTHR other access */ - //225 33+192 reserved - resdes[34+192]=flip(0x00000001); /* RD.LNKCT resource link count */ - //227 35+192 Port numbers - - //228-244 - resdes[52+192] = dirlist[n+8]; /* RD.RDOWN ownername at last access, system */ - resdes[53+192] = dirlist[n+9]; - //247-255 - - resdes[64+192]=flip(0xca1000f0); /* RD.SFLGS space definition flags */ - if (typ == 0xca) - resdes[64+192]=flip(0xca1000f0); /* RD.SFLGS space definition flags */ - else - if (typ == 0xee) - resdes[64+192]=flip(0xee1000f1); /* RD.SFLGS space definition flags */ - else - if (typ == 0x00) - resdes[64+192]=flip(0x001000f1); /* RD.SFLGS space definition flags */ - resdes[65+192]=flip(0x00000040); /* RD.MXEXT max extends */ - resdes[66+192]=flip(0x00000010); /* RD.MNEXT min incr */ - //259 67+192 RD.MXSIZ - - resdes[68+192]=flip(size-1); /* RD.EOFBL eof block */ - resdes[69+192]=flip(size); /* RD.EOMBL eom block */ - resdes[70+192]=flip(0x00000001); /* RD.NUMSG # of segment */ - //263 71+192 RD.XSABA - - resdes[72+192]=resdes[6]; /* RD.DNAME directory, system*/ - resdes[73+192]=resdes[7]; - resdes[74+192]=resdes[8]; - resdes[75+192]=resdes[9]; - - resdes[76+192]=flip(0x00000cd6); /* RD.PAREN parent blk number */ - resdes[77+192]=flip(0x00000001); /* RD.NUMCR segments at creation */ - //270 78+192 reserved - //271 79+192 reserved - - resdes[80+192]=resdes[2]; /* RD.DIRP filename*/ - resdes[81+192]=resdes[3]; - resdes[82+192]=resdes[4]; - resdes[83+192]=resdes[5]; - - resdes[84+192]=flip(0x00000100); /* RD.DADD parent blk number */ - resdes[85+192]=flip(0x000005c0); /* RD.DIDX parent dir index number */ - //278 86+192 res - // to - //287 95+192 res - - /* Segment definitions (RD.SEGDF) Wds 96/97 */ - resdes[96+192]=flip(0x0000fda8); /* file abs blk addr */ - resdes[97+192]=flip(size); /* eom block */ - - /* all others are zero */ - n += 12; /* next directory entry */ - - /* we have data to write */ - /* write actual byte count to 32 bit word as header */ - n1 = fwrite((char *)(&hc), 1, (size_t)sizeof(hc), dp); - /* write the data mod 2 */ - nw = fwrite((unsigned char *)resdes, 1, sizeof(resdes), dp); - /* write the byte count in 32 bit word as footer */ - n2 = fwrite((char *)(&hc), 1, (size_t)sizeof(hc), dp); - if (n1 != sizeof(hc) || nw != hc || n2 != sizeof(hc)) - { - fprintf(stderr, "rd write (%d) failure\n", nw); - fprintf(stderr, "Operation aborted\n"); - exit(1); - } - /*******************************/ - /* write file up to 8 blks at a time */ - if (typ != 0xca) { - writefile(dp, fnp, 0, 8, 0); /* all of file 8 blk at a time */ - } else { - writefile(dp, fnp, size, 8, 0); /* all of file 8 blk at a time */ - } - -//printf("File written at 4 argc %d argv %s\n", argc, fnp); - - /* write EOF (zero) to file */ - eof = 0; /* zero count */ - fwrite((char *)(&eof), 1, (size_t)sizeof(eof), dp); - } - /* we have saved the files in the image, write 2 eof's & 1 EOM */ - /* write EOF (zero) to file */ - filen = 0; /* zero count */ - fwrite((char *)(&filen), 1, (size_t)sizeof(filen), dp); - /* do second EOF */ - fwrite((char *)(&filen), 1, (size_t)sizeof(filen), dp); - filen = -1; /* make in -1 for EOM */ - /* do EOM */ - fwrite((char *)(&filen), 1, (size_t)sizeof(filen), dp); -//printf("setting at %lx (%ld) bytes in file after EOM\n", ftell(dp), ftell(dp)); - fclose(dp); - exit(0); -} diff --git a/SEL32/taptools/mpxblk.c b/SEL32/taptools/mpxblk.c deleted file mode 100644 index 4b8b297..0000000 --- a/SEL32/taptools/mpxblk.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * mpxblk.c - * - * This program converts a unix/dos ascii file to an mpx blocked file - * trailing blanks are not deleted from the source file - * input - stdin - * output - stdout - */ - -#include -#include -#include -//#include -#define MPXMAX 254 -int mpxbb(); -int getloi(); -#define BLKSIZE 768 - -int main (argc, argv) -int argc; -char *argv[]; -{ - char s[MPXMAX]; - int i; -// int fn = fileno(stdout); - FILE *fn = stdout; - - while (1) { -// if ((i = getloi(s, MPXMAX)) == 0) { - if ((i = getloi(stdin, s, MPXMAX)) == 0) { - mpxbb(fn, s, 0, 1); /* last write to output */ - exit(0); - } - if (i == 1 && s[0] == '\n') - s[0] = ' '; /* replace single n/l with blank */ - if (s[i-1] == '\n') - i--; /* remove trailing n/l */ - if (mpxbb(fn, s, i, 0) < 0) { /* last data record out */ - fprintf(stderr, "output file error\n"); - exit(1); - } - } -} - -/* get a line of input. */ -/* terminate line on \n or \r\n */ -/* allow max of 254 chars in a line */ - -//int getloi(s, lim) -int getloi(ifp, s, lim) -FILE *ifp; -char s[]; -int lim; -{ - int c, i; - - for(i = 0; --lim > 0; ) { -// c = getchar(); - c = fgetc(ifp); - switch (c) { - case '\n': - /* terminate on \n */ - s[i++] = c; - goto linedone; - case '\r': -// c = getchar(); - c = fgetc(ifp); - /* terminate on \r\n */ - if (c == '\n') { - s[i++] = c; - goto linedone; - } - /* put back the character */ -// ungetc(c, stdin); - ungetc(c, ifp); - /* output the \r to the stream */ - c = '\r'; - /* drop through */ - default: - s[i++] = c; - break; - case EOF: - return (0); - break; - } - } -linedone: - return (i); -} - -/* - ** output line of text from the source - */ - -static unsigned char bb[BLKSIZE]; /* blocking buffer */ -static char first = 0; /* 1st time thru flag */ - -/* - * mpxbb - make up mpx block file output - * input - buffer address - * - byte count - * - last write flag - */ - -int -// mpxbb(fd, buf, cnt, last) -mpxbb(fd, buf, cnt, last) -//int fd; -FILE *fd; -unsigned char *buf; -int cnt; -int last; -{ - int boff; /* next write address offset */ - - if (!first) { /* is this 1st time thru */ - first = 1; /* set the flag */ - memset (bb, '\0', BLKSIZE); /* zero the buffer */ - bb[3] = 4; /* next write byte offset */ - bb[4] = 0x60; /* set beg/end of block */ - bb[5] = 0; /* 1st block count is 0 bytes */ - } - boff = (bb[2] << 8) | (bb[3]); /* get next write address offset */ - if (last) - goto alldone; /* close out the file */ - - /* see if enough room in buffer for this record */ - /* add current offset + 2 (for last record info) plus new */ - /* record size plus 4 (2 for this rec, 2 for last) */ - if ((boff + 2 + cnt + 4) >= BLKSIZE) { - /* not enough space, write out this record */ -// if (write(fd, bb, BLKSIZE) < 0) - if (fwrite(bb, (size_t)1, BLKSIZE, fd) <= 0) - return(-1); - memset (bb, '\0', BLKSIZE); /* zero the buffer */ - bb[4] = 0x60; /* set beg/end of block */ - bb[5] = 0; /* 1st block count is 0 bytes */ - /* after 1st write */ - boff = 4; /* init count at 4 bytes */ - } - /* we have enough room, move in the record */ - /* clear last record end of block flag, set up this record */ - /* info and last rec info at end of data, and update cnt */ - bb[boff] &= ~0x20; /* clear end of block flag */ - bb[boff+2] = 0x00; /* clear this blocks flags */ - bb[boff+3] = cnt; /* set this record count */ - memcpy(&bb[boff+4], buf, cnt); /* copy in the data */ - boff += (cnt+4); /* update count */ - bb[boff] = 0x20; /* set eob status flag */ - bb[boff+1] = cnt; /* set last rec byte count */ - bb[2] = (boff & 0xff00) >> 8; /* set hi byte of count */ - bb[3] = (boff & 0xff); /* set lo byte of count */ - return(cnt); /* done */ - -alldone: - /* that was the last record, set eof flag in bb, write it and exit */ - /* see if enough room in buffer for EOM record */ - /* add current offset + 2 (for last record info) plus new */ - /* EOF record size of 4 (2 for this rec, 2 for last) */ - if ((boff + 2 + 4) >= BLKSIZE) { - /* not enough space, write out this record */ -// if (write(fd, bb, BLKSIZE) < 0) - if (fwrite(bb, (size_t)1, BLKSIZE, fd) <= 0) - return(-1); - memset (bb, '\0', BLKSIZE); /* zero the buffer */ - bb[4] = 0x60; /* set beg/end of block */ - bb[5] = 0; /* 1st block count is 0 bytes */ - /* after 1st write */ - boff = 4; /* init count at 4 bytes */ - } - bb[boff] &= ~0x20; /* clear end of block flag */ -/* bb[boff+2] = 0xa0; /* clear this blocks flags */ - bb[boff+2] = 0x80; /* clear this blocks flags */ - bb[boff+3] = 0; /* set record count of 0 */ - bb[boff+4] = 0xa0; /* set EOF/EOB flags */ - boff += 4; /* 4 more bytes */ - bb[2] = (boff & 0xff00) >> 8; /* set hi byte of count */ - bb[3] = (boff & 0xff); /* set lo byte of count */ - /* write out EOF record */ -// if (write(fd, bb, BLKSIZE) < 0) - if (fwrite(bb, (size_t)1, BLKSIZE, fd) <= 0) - return(-1); - first = 0; /* reset 1st time flag */ - return(cnt); /* get out, done */ -} - diff --git a/SEL32/taptools/renum.c b/SEL32/taptools/renum.c deleted file mode 100644 index cc085a2..0000000 --- a/SEL32/taptools/renum.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * renum.c - * - * This program truncates a line or expands a line with blanks to - * have a line length of 72 chars. A 7 digit line number is then - * append to the line. Numbers are in the form XXXX.000. - * input - stdin - * output - stdout - */ - -#include -#include - -/* get a line of input. */ -int ln = 1; -int getloi(s, lim) /* right from the book. */ -char s[]; -int lim; -{ - int c, i, j; - char line[12]; - - for (i=0; --lim > 0;) - { - if ((c = getchar()) == EOF) - return 0; - if (c == '\r') - continue; - if (c == '\n') - break; - s[i++] = c; - } - if (i > 72) /* truncate at char 72 */ - i = 72; - for (; i<72; i++) - s[i] = ' '; -// sprintf(line, "%04d.000", ln++); - sprintf(line, "%04d.%01d00", ln/10, ln%10); - ln++; - for (j=0; j<8; j++) - s[72+j] = line[j]; - s[80] = '\n'; - s[81] = '\0'; - return (i); -} - -int main (argc, argv) -int argc; -char *argv[]; -{ - char s[BUFSIZ]; - - while (1) { - if (getloi(s, BUFSIZ) == 0) - exit(0); - /* output line of text from the source */ - printf("%s", s); - } -} - diff --git a/SEL32/taptools/sdtfmgrcopy.c b/SEL32/taptools/sdtfmgrcopy.c deleted file mode 100644 index deb83fe..0000000 --- a/SEL32/taptools/sdtfmgrcopy.c +++ /dev/null @@ -1,384 +0,0 @@ -/* - * sdtfmgrcopy.c - * - * This program scans a metatape file and prints file count and sizes. - * input - stdin or specified filename - * output - stdout - */ - -#include -#include -//#include -//#include -//#include -#include -//#include - -int lfilen, filen = 1; -int smd = 0; -int EOFcnt = 0; -int count=0, lcount=0; -int size=0, tsize=0; -int size_512K = 512 * 1024; -int ln; -//int inp, outp; -FILE *infp, *outfp; -#define PRINTABLE(x) ((x < 32) || (x > 126)) ? '.' : x - -/* get a line of input. */ -int getloi(char *s, int lim) -{ -// int c, i; - int n1, n2, hc, tc, n; - -// errno = 0; - /* read the byte count in 32 bit word as header */ -// n1 = read(inp, (char *)(&hc), (size_t)4); - n1 = fread((char *)(&hc), (size_t)1, (size_t)4, infp); - if (n1 <= 0) - hc = -1; /* at EOM on disk file */ - - /* check for EOF & EOM on tape data */ - if (hc & 0xffff0000) /* check for garbage, assume EOM */ - hc = -1; /* at EOM on disk file */ - - /* check for EOF & EOM on tape data */ - if (hc == 0) { - /* we are at tape EOF */ - if (++EOFcnt < 2) { /* if 1st EOF, print file info */ -// printf("EOF found after file %d\n", filen); - lfilen = filen; - filen++; /* set next file number */ - smd = 1; /* look for smd again */ - } - count = 0; /* file record count back to zero */ - lcount = 0; /* last record count back to zero */ - tsize += size; /* add to total tape size */ - size = 0; /* file size back to zero */ - ln = -1; /* set ln to -1 showing we are at EOF */ - - /* we have EOF */ - return 0; /* return EOF on tape data */ - } - if (hc == -1) { - printf("EOM found after file %d\n", filen); - return -1; /* at EOM on disk file */ - } - - /* read the data */ -// n = read(inp, s, (size_t)hc); - n = fread(s, (size_t)1, (size_t)hc, infp); - - /* if odd byte record, read extra byte and throw it away */ - if (n & 0x1) { -// n2 = read(inp, (char *)(&tc), (size_t)1); - n2 = fread((char *)(&tc), (size_t)1, (size_t)1, infp); - if (n2 <= 0) - return -1; /* at EOM on disk file */ - } - - /* read the byte count in 32 bit word as trailer */ -// n2 = read(inp, (char *)(&tc), (size_t)4); - n2 = fread((char *)(&tc), (size_t)1, (size_t)4, infp); - count++; /* bump record count */ - size += n; /* update bytes read */ - EOFcnt = 0; /* not an EOF */ - if (n != ln) { - ln = n; - lcount = count; - } - /* return bytes in buffer */ - return n; -} - -int main (int argc, char *argv[]) -{ - char *buf; - size_t size_512K = 512 * 1024; - size_t buf_size = 512 * 1024; -// char *cp, *np; - int ll; - char path[64], command[128]; -// int sdt = 1; - int sdt = 0; - - smd = 1; - - if (argc != 2) { - //fprintf(stderr, "usage: %s infile\n", argv[0]); - printf("usage: %s infile\n", argv[0]); - exit(1); - } /* end of if */ - -// if ((inp = open(argv[1], O_RDONLY, 0666)) < 0) { - if ((infp = fopen(argv[1], "r")) == NULL) { - //fprintf(stderr,"%s: fopen: unable to open input file %s\n", argv[0], argv[1]); - printf("%s: fopen: unable to open input file %s\n", argv[0], argv[1]); - return (1); - } -// outp = -1; - outfp = NULL; - - /* get a 512k buffer */ - if ((buf = malloc(buf_size)) == NULL) { - //fprintf(stderr, "Can't allocate memory for tscan\n"); - printf("Can't allocate memory for tscan\n"); - return (4); - } - /* init counts */ - ln = -2; /* look for 2 eof */ - count = 0; - size = 0; - tsize = 0; - lcount = 0; - filen = 1; - lfilen = 0; - printf("\nfile %d:\n", filen); - - /* get lines until eof */ - while ((ll=getloi(buf, buf_size)) != EOF) { - printf("got ll = %d filen %d\n", ll, filen); - if (ll == 1920) { - sdt = 1; /* process SDT tape */ - smd = 0; - printf("process sdt ll = %d\n", ll); - } - if (ll == 4608) { - sdt = 0; /* process SMD tape */ - smd = 1; - printf("process smd ll = %d\n", ll); - } - - if (ll == 0) { - /* eof found, process new file */ - printf("\nfile %d:\n", filen); - smd = 1; - sdt = 0; - continue; /* go look for another SDT bootfile or SMD entry */ - } else - if (ll != 1920 && ll != 4608) { - printf("File is not in MPX filemgr format and can not be processed!\n"); - break; - } else { - int cc = 0; -// unsigned int curchar; - char filename[16]; - int i, j, m; - - /* SDT entries have 1920 bytes as first record. This is */ - /* followed by multiple 768 byte records to finish the SDT image */ - /* read the boot data from the sdt tape */ - /* check for SDT entry instead of SMD entry */ -// if (ll == 1920) -// if (sdt == 1 && filen == 1) - if (sdt == 1) { - int no, ct = 0;; - /* get more sdt data */ - /* open output file, create it if necessary */ -// if (outp == -1) { - if (outfp == NULL) { - sprintf(filename, "bootfile%d\0", filen); -// if ((outp = open("bootfile", O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) -// if ((outp = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { - if ((outfp = fopen(filename, "w")) == NULL) { - printf("Can't open bootfile\n"); -// close(inp); - fclose(infp); - free(buf); - return (3); - } - } - printf("got2 ll = %d writing to bootfile -> %s\n", ll, filename); -// no = write(outp, buf, ll); - no = fwrite(buf, (size_t)1, (size_t)ll, outfp); - if (no != ll) - // fprintf(stderr, "write (%d) != read (%d) on file %s\n", no, ll, path); - printf("write (%d) != read (%d) on file bootfile\n", no, ll); - /* get lines until eof */ - while ((ll=getloi(buf, buf_size)) > 0) { - ct++; -// no = write(outp, buf, ll); - no = fwrite(buf, (size_t)1, (size_t)ll, outfp); - if (no != ll) - // fprintf(stderr, "write (%d) != read (%d) on file %s\n", no, ll, path); - printf("write (%d) != read (%d) on file bootfile\n", no, ll); - } - sdt = 0; - smd = 1; -// close(outp); - fclose(outfp); -// outp = -1; - outfp = NULL; - printf("wrote %d records to bootfile %s\n", ct, filename); - continue; /* go look for another SDT bootfile or SMD entry */ - } else - - /* filemgr smd entries are 8 words, and are in 1152 words (4608 bytes) - * (6 sector) blocks. Saved data files are modulo 1152 words also */ - /* 8 wds per SMD entry, 24 entries per sector, 144 entries per 6 sector - * block. */ -// printf("gotx ll = %d filen %d\n", ll, filen); -// if (filen == 1) - if (smd == 1) { - /* check for SMD entry instead of SDT entry */ - /* read smd entry */ - char file[20], dir[20]; - int l = 0; - int smddone = 0; - int totent = 0; - char *buf2 = buf; -// printf("\nfile %d: %d\n", filen, ll); - /* see how many entries here */ - while(!smddone) { - /* process entries in this record */ - for (j=0; j<144; j++) { - int k = l++ * 32; - int w1 = (buf[k+13] & 0xff) << 16 | (buf[k+14] & 0xff) << 8 | (buf[k+15] & 0xff); - /* stop processing on first zero smd entry */ - if (w1 <= 0) { - smddone = 1; - break; - } - totent++; - /* get file/dir name */ - for (i=0; i<8; i++) { - file[i] = tolower(buf[k+0+i]); - if (file[i] == ' ') - file[i] = '\0'; - } - file[8] = '\0'; - for (i=0; i<8; i++) { - dir[i] = tolower(buf[k+0+16+i]); - if (dir[i] == ' ') - dir[i] = '\0'; - } - dir[8] = '\0'; - if (dir[0] == '\0') - sprintf(dir, "%s", "system"); - sprintf(path, "./%s/%s", dir, file); - // see if active file - if ((buf[k+12] & 0x80) == 0) - // not active goon - printf("inactive file: w1 = %d path = %s\n", w1, path); - else - printf("active file: w1 = %d path = %s\n", w1, path); - } - if (smddone) - break; - buf2 += 4608; /* next buffer */ - ll=getloi(buf2, 4608); - } - printf("%d smd entries found\n", totent); - /* we have directory entries */ - for (j=0; j= 0) - if (outfp != NULL) -// close(outp); - fclose(outfp); -// outp = -1; - outfp = NULL; - -#ifndef DO_LATER - /* open output file, create it if necessary */ -// if ((outp = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { - if ((outfp = fopen(path, "w")) == NULL) { - //fprintf(stderr, "Can't open %s\n", path); - printf("Can't open %s\n", path); -// close(inp); - fclose(infp); - free(buf); - return (3); - } -#endif - /* get the file data */ - for (m=0; m<((w1+5)/6); m++) { - char data[5000]; /* data buffer */ - ll=getloi(data, 4608); - - /* process file data for file */ - if (ll == 4608) { -#ifndef DO_LATER - /* blks/w1 have number of blocks to write */ - int bcnt, no; /* block count */ - if (blks >= 6) { - blks -= 6; /* enough for 6 block, write them */ - bcnt = 6*768; /* write all 6 blocks */ - } else { - bcnt = blks*768;/* just write what we need */ - blks = 0; - } - /* only write number of sectors on save tape, not all 4608 */ - /* if zero, just reading excess blocks */ - if (bcnt != 0) { -// no = write(outp, data, bcnt); - no = fwrite(data, (size_t)1, (size_t)bcnt, outfp); - if (no != bcnt) - //fprintf(stderr, "write (%d) != read (%d) on file %s\n", no, bcnt, path); - printf("write (%d) != read (%d) on file %s\n", no, bcnt, path); - } -#else - if (m == 0) - printf("reading file %s\n", path); -#endif - } else { - printf("Bad file size read! %d instead of 4608\n", ll); -/// if (ll == -1) break; - if (ll == -1) - goto dostop; - } - } /* end writing file */ - } /* end of smd scan */ - } /* read smd entries 4608 byte records */ - } /* process read of smd or sdt */ - } /* end of getloi read */ -dostop: -// close(inp); - fclose(infp); - free(buf); -// if (outp >= 0) - if (outfp != NULL) -// close(outp); - fclose(outfp); - exit(0); -} diff --git a/SEL32/taptools/small.c b/SEL32/taptools/small.c deleted file mode 100644 index c6ebea0..0000000 --- a/SEL32/taptools/small.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * small.c - * - * This program deletes trailing blanks from a source file - * option - -a to remove all trailing spaces - * -h help - * input - file or stdin - * output - file or stdout - */ - -#include -#include - -int getloi(); -int putloi(); -int all = 0; /* do all, set non zero by -a */ - -int main(argc, argv) -int argc; -char *argv[]; -{ - FILE *ifp=NULL, *ofp=NULL, *fopen(); - int iu=0, ou=0; - char *p, *name = *argv; - char s[BUFSIZ]; - - all = 0; - if (argc <= 1) { -doerr: - fprintf(stderr, "Usage: %s [-ah] [infile] [outfile]\n", name); - exit(1); - } - /* check for any options */ - while(--argc > 0) { - p = *++argv; - if (*p == '-') { - if (*++p == '\0') { - fprintf(stderr, "Error: no option specified\n"); - goto doerr; - } - while (*p != '\0') { - switch (*p++) { - case 'a': /* user wants all spaces removed */ - case 'A': - all = 1; /* remove all trailing blanks */ - break; - case 'h': /* user wants help */ - case 'H': - default: - goto doerr; - } - continue; - } - continue; - } - /* process in, then out file */ - if (ifp == NULL) { - fprintf(stderr, "4 argc %x argv %s\n", argc, p); - if ((ifp = fopen(*argv, "r")) == NULL) { - fprintf(stderr, - "Error: can't open input file %s\n", *argv); - exit(1); - } - continue; - } - /* process out file */ - if (ofp == NULL) { - if ((ofp = fopen(*argv, "w")) == NULL) { - fprintf(stderr, - "Error: can't open output file %s\n", *argv); - exit(1); - } - continue; - } - fprintf(stderr, - "Error: too many parameters %s\n", *argv); - goto doerr; - } - if (ifp == NULL) { - ifp = stdin; /* use stdin */ - iu = 1; - } - if (ofp == NULL) { - ofp = stdout; /* use stdout */ - ou = 1; - } - fflush(stderr); - - /* copy in to out */ - while (1) { - if (getloi(ifp, s, BUFSIZ) <= 0) { /* read til EOF */ - if (iu == 0) - fclose(ifp); - if (ou == 0) - fclose(ofp); - exit(0); - } - putloi(ofp, s); - } - exit(0); -} - -/* get a line of input. */ -int getloi(ifp, s, lim) /* right from the book. */ -FILE *ifp; -char s[]; -int lim; -{ - int c, i, cr=0; - -#ifdef _WIN32 - cr = 1; /* if on windows, add c/r */ -#endif - for (i=0; --lim > 0;) { - if ((c = fgetc(ifp)) == EOF) - return 0; - if (c == '\r') { - cr = 1; - continue; - } - if (c == '\n') - break; - s[i++] = c; - } - if (i > 72) /* truncate at char 72 */ - i = 72; - for (; i<72; ) - s[i++] = ' '; - if (cr) /* only put in c/r if one wanted */ - s[i++] = '\r'; - s[i++] = '\n'; /* add a newline */ - s[i] = '\0'; - - if (all == 0) /* see if all spaces to be removed */ - return (i); /* no, just return */ - - /* the user wants to keep removing spaces */ - if ((i > 1) && ((s[i-1] == '\n') || s[i-1] == '\r')) { - while (((s[i-2] == ' ') || (s[i-2] == '\r') || - (s[i-2] == '\n')) && (i > 1)) - --i; - if (cr) { /* put in c/r if required */ - s[i-1] = '\r'; - i++; - } - s[i-1] = '\n'; /* add the newline */ - } - s[i] = '\0'; - return (i); -} - -/* - ** output line of text from the source - */ -int putloi(ofp, s) -FILE *ofp; -char *s; -{ - fprintf(ofp, "%s", s); /* printf the line */ - return(0); -} diff --git a/SEL32/taptools/tap2disk.c b/SEL32/taptools/tap2disk.c deleted file mode 100644 index 3053d3c..0000000 --- a/SEL32/taptools/tap2disk.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * tap2disk.c - * - * This program scans a metadata tape (.tap format) and copies - * a file until EOF is found. Only one file is read from the - * the tape. This utility is used to transfer tar files from - * SEL32 UTX to Linux. - * - * command: tap2disk output - * input - .tap formatted file being read - * output - disk file containing .tap file contents - */ - -#include -#include - -int filen = 1; -int EOFcnt = 0; -int count=0, lcount=0; -int size=0, tsize=0; -int oldsize, newsize; -FILE *outfp; -//int inp; -FILE *infp; -int ln; - -/* get a line of input. */ -int getloi(char *s, int lim) -{ -// int c, i; - int n1, n2, hc, tc, n; - - /* read the byte count in 32 bit word as header */ -// n1 = read(inp, (char *)(&hc), (size_t)4); - n1 = fread((char *)(&hc), (size_t)1, (size_t)4, infp); - if (n1 <= 0) { - hc = -1; /* at EOM on disk file */ - return hc; /* return EOM */ - } - - /* check for EOF & EOM on tape data */ - if (hc & 0xffff0000) { /* check for garbage, assume EOF */ - hc = -1; /* at EOM on disk file */ - return hc; /* return EOM */ - } - - /* check for EOF & EOM on tape data */ - if (hc == 0) { - /* we are at tape EOF */ - if (++EOFcnt < 2) { /* if 1st EOF, print file info */ - if (ln > 0) { - if (count - lcount > 1) - fprintf(stderr, "file %d: records %d to %d: size %d\n", filen, lcount, count - 1, ln); - else - fprintf(stderr, "file %d: record %d: size %d\n", filen, lcount, ln); - } - fprintf(stderr, "file %d: EOF after %d records: %d bytes\n\n", filen, count, size); - filen++; /* set next file number */ - } else { - fprintf(stderr, "second EOF after %d files: %d bytes\n", filen-1, tsize+size); - } - count = 0; /* file record count back to zero */ - lcount = 0; /* last record count back to zero */ - tsize += size; /* add to total tape size */ - size = 0; /* file size back to zero */ - ln = -1; /* set ln to -1 showing we are at EOF */ - return 0; /* return EOF on tape data */ - } - - /* check for EOM */ - if (hc == -1) { - return -1; /* at EOM on disk file */ - } - - /* read the data */ -// n = read(inp, s, (size_t)hc); - n = fread(s, (size_t)1, (size_t)hc, infp); - if (n <= 0) - return -1; /* at EOM on disk file */ - - /* if odd byte record, read extra byte and throw it away */ - if (n & 0x1) { -// n2 = read(inp, (char *)(&tc), (size_t)1); - n2 = fread((char *)(&tc), (size_t)1, (size_t)1, infp); - if (n2 <= 0) - return -1; /* at EOM on disk file */ - } - - /* read the byte count in 32 bit word as trailer */ -// n2 = read(inp, (char *)(&tc), (size_t)4); - n2 = fread((char *)(&tc), (size_t)1, (size_t)4, infp); - if (n2 <= 0) - return -1; /* at EOM on disk file */ - - count++; /* bump record count */ - size += n; /* update bytes read */ - EOFcnt = 0; /* not an EOF */ - if (n != ln) { - if (ln > 0) { - if (count - lcount > 1) - fprintf(stderr, "file %d: records %d to %d: size %d\n", filen, lcount, count - 1, ln); - else - fprintf(stderr, "file %d: record %d: size %d\n", filen, lcount, ln); - } - ln = n; - lcount = count; - } - /* return bytes in buffer */ - return n; -} - -void putrec(int cnt, char *buf) -{ -// int n1, n2, nw; - int nw; - int hc = (cnt + 1) & ~1; /* make byte count even */ - int ac = cnt; /* get actual byte count */ - -//printf("writing %d chars\n", cnt); -#if 0 - /* write actual byte count to 32 bit word as header */ - n1 = fwrite((char *)(&hc), (size_t)1, (size_t)4, outfp); -#endif - /* write the data mod 2 */ - nw = fwrite((char *)buf, (size_t)1, (size_t)hc, outfp); -#if 0 - /* write the byte count in 32 bit word as footer */ - n2 = fwrite((char *)(&hc), (size_t)1, (size_t)4, outfp); -#endif -#if 0 - if (n1 != 4 || nw != hc || n2 != 4) -#else - if (nw != hc) -#endif - { - fprintf(stderr, "write (%d) failure\n", nw); - fprintf(stderr, "Operation aborted\n"); - fclose(outfp); -// close(inp); - fclose(infp); - free(buf); - exit(1); - } -} - -int main (int argc, char *argv[]) -{ - char *buf; - size_t buf_size = 256 * 1024; - size_t ll, gotboth = 0; - int zero = 0; - - if (argc != 3) { - fprintf(stderr, "usage: %s infile outfile\n", argv[0]); - exit(1); - } - - /* open input file */ -// if ((inp = open(argv[1], O_RDONLY, 0666)) < 0) { - if ((infp = fopen(argv[1],"r")) == NULL) { - fprintf(stderr,"%s: fopen: unable to open input file %s\n", argv[0], argv[1]); - return (1); - } - -// close(inp); /* close input */ - fclose(infp); /* close input */ - outfp = fopen(argv[1],"r"); /* reopen */ - fseek(outfp, 0, SEEK_END); /* seek to end */ - oldsize = ftell(outfp); /* get filesize in bytes */ - fclose(outfp); /* now close it */ - - /* open input file */ -// if ((inp = open(argv[1], O_RDONLY, 0666)) < 0) { - if ((infp = fopen(argv[1],"r")) == NULL) { - fprintf(stderr,"%s: fopen: unable to open input file %s\n", argv[0], argv[1]); - return (1); - } - - /* open output file */ - outfp = fopen(argv[2],"w"); - if (outfp == NULL) { - fprintf(stderr,"%s: fopen: unable to open output file %s\n", argv[0], argv[2]); - exit(1); - } - - /* init counts */ - ln = -2; /* look for 2 eof */ - count = 0; - size = 0; - tsize = 0; - lcount = 0; - - /* get a 256k buffer */ - if ((buf = malloc(buf_size)) == NULL) { - fprintf(stderr, "Can't allocate memory for %s\n", argv[0]); - return (4); - } - - /* get buffers until eof */ -domore: - while ((ll=getloi(buf, buf_size)) > 0) { -//printf("got %d char\n", ll); - /* we have data to write */ - putrec(ll, buf); /* write the buffer */ - gotboth = 0; - } -//printf("we have EOF %d\n", gotboth+1); - /* we have an EOF or an EOM */ - if (ll == 0) { - /* we have EOF, write a zero */ - fwrite((char *)(&zero), (size_t)1, (size_t)4, outfp); - gotboth++; /* one more EOF */ - if (gotboth == 2) { - /* we have written both EOF's, now write EOM */ - ll = -1; - } else { - goto domore; /* get more data */ - } - } - -//printf("we have EOM, DONE\n"); - /* We have EOM, see if EOF's needed */ - switch (gotboth) { - case 0: /* we have written no EOFs, so write two */ - fwrite((char *)(&zero), (size_t)1, (size_t)4, outfp); - /* drop through */ - case 1: /* we have written 1 EOF, so write one more */ - fwrite((char *)(&zero), (size_t)1, (size_t)4, outfp); - /* drop through */ - default: - case 2: /* we have written 2 EOFs, now do EOM */ - zero = -1; - fwrite((char *)(&zero), (size_t)1, (size_t)4, outfp); - } - fprintf(stderr, "EOM after 2 EOFs %d files: %d bytes\n", filen-1, tsize); - - newsize = ftell(outfp); /* get filesize in bytes */ - fprintf(stderr, "Size of file changed from %d to %d\n", oldsize, newsize); - - /* we done */ - fclose(outfp); -// close(inp); - fclose(infp); - free(buf); - exit(0); -} diff --git a/SEL32/taptools/tapdump.c b/SEL32/taptools/tapdump.c deleted file mode 100644 index c257e16..0000000 --- a/SEL32/taptools/tapdump.c +++ /dev/null @@ -1,274 +0,0 @@ -/* - * tapdump.c - * - * This program scans a metatape file and displays the file content as - * a side by side hex dump of the contents. - * input - stdin or specified filename - * output - stdout - */ - -#include -#include -//#include -//#include -//#include -//#include -#define NOTDUMP - -int filen = 1; -int EOFcnt = 0; -int count=0, lcount=0; -int size=0, tsize=0; -int size_512K = 512 * 1024; -int ln; -//int inp; -FILE *infp; -#define PRINTABLE(x) ((x < 32) || (x > 126)) ? '.' : x - -/* get a line of input. */ -int getloi(char *s, int lim) -{ -// int c, i; - int n1, n2, hc, tc, n; - -// errno = 0; - /* read the byte count in 32 bit word as header */ -// n1 = read(inp, (char *)(&hc), (size_t)4); - n1 = fread((char *)(&hc), (size_t)1, (size_t)4, infp); - if (n1 <= 0) - hc = -1; /* at EOM on disk file */ - - /* check for EOF & EOM on tape data */ - if (hc & 0xffff0000) /* check for garbage, assume EOM */ - hc = -1; /* at EOM on disk file */ - - if (hc == 0) { - /* we are at tape EOF */ - if (++EOFcnt < 2) { /* if 1st EOF, print file info */ -#ifndef NOTDUMP - if (ln > 0) { - if (count - lcount > 1) - fprintf(stderr, "file %d: records %d to %d: size %d (%x)\n", filen, lcount, count-1, ln, ln); - else - fprintf(stderr, "file %d: record %d: size %d (%x)\n", filen, lcount, ln, ln); - } - fprintf(stderr, "file %d: eof after %d records: %d bytes (%x)\n", filen, count, size, size); - fprintf(stderr, "file %d EOFcnt %d offset %x\n", filen, EOFcnt, tsize); -#endif - filen++; /* set next file number */ - } else { -#ifndef NOTDUMP - fprintf(stderr, "second eof after %d files: %d bytes (%x)\n", filen, size, size); - fprintf(stderr, "second file %d EOFcnt %d offset %x\n", filen, EOFcnt, tsize); -#endif - } - count = 0; /* file record count back to zero */ - lcount = 0; /* last record count back to zero */ - tsize += size; /* add to total tape size */ - size = 0; /* file size back to zero */ - ln = -1; /* set ln to -1 showing we are at EOF */ - - /* we have EOF */ - return 0; /* return EOF on tape data */ - } - if (hc == -1) { -#ifndef NOTDUMP - /* we have EOM */ - fprintf(stderr, "mpx eot\n"); - /* print out total tape size in bytes */ - fprintf(stderr, "total length: %ld bytes (%x)\n", tsize, tsize); -#endif - return -1; /* at EOM on disk file */ - } - /* read the data */ -// n = read(inp, s, (size_t)hc); - n = fread(s, (size_t)1, (size_t)hc, infp); - - /* if odd byte record, read extra byte and throw it away */ - if (n & 0x1) { -// n2 = read(inp, (char *)(&tc), (size_t)1); - n2 = fread((char *)(&tc), (size_t)1, (size_t)1, infp); - if (n2 <= 0) - return -1; /* at EOM on disk file */ - } - - /* read the byte count in 32 bit word as trailer */ -// n2 = read(inp, (char *)(&tc), (size_t)4); - n2 = fread((char *)(&tc), (size_t)1, (size_t)4, infp); - count++; /* bump record count */ - size += n; /* update bytes read */ - EOFcnt = 0; /* not an EOF */ - if (n != ln) { -#ifndef NOTDUMP - if (ln > 0) { - if (count - lcount > 1) - fprintf(stderr, "file %d: records %d to %d: size %d (%x)\n", filen, lcount, count-1, ln, ln); - else - fprintf(stderr, "file %d: record %d: size %d (%x)\n", filen, lcount, ln, ln); - } -#endif - ln = n; - lcount = count; - } - /* return bytes in buffer */ - return n; -} - -int main (int argc, char *argv[]) -{ -// char in[BUFSIZ], out[BUFSIZ]; - char *buf; - size_t size_512K = 512 * 1024; - size_t buf_size = 512 * 1024; -// char *cp, *np; - int ll, gotboth = 0; - int lfilen = filen; - unsigned int fileaddr, file_byte_count=0, curchar, buffptr, bufflen; - int skipfile = 0, skip, cc; - - if (argc != 2) { - fprintf(stderr, "usage: %s infile\n", argv[0]); - exit(1); - } /* end of if */ - -// if ((inp = open(argv[1], O_RDONLY, 0666)) < 0) { - if ((infp = fopen(argv[1], "r")) == NULL) { - fprintf(stderr,"%s: fopen: unable to open input file %s\n", argv[0], argv[1]); - return (1); - } - - /* get a 512k buffer */ - if ((buf = malloc(buf_size)) == NULL) { - fprintf(stderr, "Can't allocate memory for %s\n", argv[0]); - return (4); - } - /* init counts */ - ln = -2; /* look for 2 eof */ - count = 0; - size = 0; - tsize = 0; - lcount = 0; - filen = 1; - lfilen = filen; - buffptr = 0; - bufflen = 16; - fileaddr = 0; - skip = 0; - cc = 0; - file_byte_count = 0; - printf("\nfile %d:\n", filen); - - /* get lines until eof */ - while ((ll=getloi(buf, buf_size)) != EOF) { - if (ll == 0) { - /* eof found, process new file */ - skipfile = 0; - file_byte_count = 0; - fileaddr = 0; - printf("\nfile %d:\n", filen); - buffptr = 0; - } else { -// int cc = 0; - char buff[257]; - int ans; -// buffptr = 0; - - /* see if skipping to next file */ - if (skipfile == 1) { - buffptr = 0; - cc = 0; - skip = 0; - continue; - } - - /* process the returned buffer */ - while (cc < ll) { - if (skip != 0) { - printf(" %06x : ",fileaddr); - while (buffptr < skip) { - buff[buffptr++] = 0x20; - printf(" "); - if (!(buffptr % 4)) - printf(" "); - } /* end of while */ - skip = 0; - } - if (!buffptr) - printf(" %06x : ",fileaddr); - curchar = (unsigned int)buf[cc++] & 0xff; - file_byte_count++; - printf("%02x", curchar & 0xff); - buff[buffptr++] = PRINTABLE(curchar); - if (!(buffptr % 4)) - printf(" "); - if (buffptr >= bufflen) { - buff[buffptr] = 0; - printf(" |%s|\n",buff); - buffptr = 0; - fileaddr += bufflen; - if (!(fileaddr % 256)) { -// if (!(file_byte_count % 256)) { -// if (!(file_byte_count % 768)) { - printf("\n - continue, q = quit, s = skip > "); - ans = getchar(); - if (ans == 'q') { -// close(inp); - fclose(infp); - free(buf); - exit(1); - } - if (ans == 's') { - skipfile = 1; - cc = 0; - skip = 0; - } - if (ans != '\n') - while ((ans=getchar()) != '\n' ) - ; - } /* end of if */ - if (skipfile == 1) - break; - } /* end of if */ - } /* end of while */ - - if ((ll % 256) == 0) { - cc = 0; - continue; - } - if (buffptr && !skipfile) { - buff[buffptr] = 0; -// fileaddr += buffptr; - skip = buffptr; - while (buffptr++ < bufflen) { - printf(" "); - if (!(buffptr % 4)) - printf(" "); - } /* end of while */ - printf(" |%s|\n",buff); - - /* see what user wants to do */ - printf("\n - continue, q = quit > "); - ans = getchar(); - if (ans == 'q') { -// close(inp); - fclose(infp); - free(buf); - exit(1); - } - if (ans != '\n') - while ((ans=getchar()) != '\n' ) - ; - buffptr = 0; - file_byte_count = 0; -// else -// skipfile = 0; - } /* end of if */ - printf("ll %x buf_size %x skip %x skipfile %x fileaddr %x\n", - ll, buf_size, skip, skipfile, fileaddr); - } - } -// close(inp); - fclose(infp); - free(buf); - exit(0); -} diff --git a/SEL32/taptools/tape2disk.c b/SEL32/taptools/tape2disk.c deleted file mode 100644 index c05dcec..0000000 --- a/SEL32/taptools/tape2disk.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * tape2disk.c - * - * MPX uses 2 EOF in a row to separate sections of MPX3.x master SDT tapes. - * It uses 3 EOF in a row to indicate the EOT on MPX 3.X tapes. So we - * cannot assume EOT is at the 1st or 2nd EOF in a row. We keep looking - * for a third one. For user SDT tapes or MPX 1.X master SDT tapes use - * option -f for 2 EOFs. Use option -v for 3 eof's on VOLM tapes. For - * non MPX tapes, the 2nd EOF means EOT. Some tapes (Unix) have only one - * EOF and will terminate on EOT detected. Leave off the output file name - * to just scan the tape and output record sizes and counts. - */ - -#include -#include -//#include -#include /* for exit() */ -#ifdef _WIN32 -#include /* for O_RDONLY, O_WRONLY, O_CREAT */ -#include /* for _read, _open, _write, _close */ -#define open _open -#define read _read -#define write _write -#define close _close -#else -#include /* for O_RDONLY, O_WRONLY, O_CREAT */ -#include /* for open, read, write */ -#include -#endif - -#if defined(_MSC_VER) && (_MSC_VER < 1600) -typedef __int8 int8; -typedef __int16 int16; -typedef __int32 int32; -typedef unsigned __int8 uint8; -typedef unsigned __int16 uint16; -typedef unsigned __int32 uint32; -typedef signed __int64 t_int64; -typedef unsigned __int64 t_uint64; -//typedef t_int64 off_t; -#else -/* All modern/standard compiler environments */ -/* any other environment needa a special case above */ -#include -typedef int8_t int8; -typedef int16_t int16; -typedef int32_t int32; -typedef uint8_t uint8; -typedef uint16_t uint16; -typedef uint32_t uint32; -#endif /* end standard integers */ -//#define FMGRTAPE /* defined for filemgr tapes, undefined for volmgr tape */ - -int usefmgr = 1; /* use fmgr format with 2 EOF's, else 3 EOF's */ -char *buff; /* buffer for read/write */ -int filen = 1; /* file number being processed */ -long count=0, lcount=0; /* number of blocks for file */ -#ifndef _WIN32 -extern void RUBOUT(); /* handle user DELETE key signal */ -#endif -off_t size=0, tsize=0; /* number of bytes in file, total */ -int ln; -char *inf, *outf; -int copy; -int32 size_256K = 256 * 1024; - -int main(argc, argv) -int argc; -char **argv; -{ - int n, nw, inp, outp; -// struct mtop op; - int32 buf_size = size_256K; - int EOFcnt = 0; /* count the number of EOFs in a row. */ - char *name = *argv; - char *p = *++argv; - - if (argc <= 1 || argc > 4) { - fprintf(stderr, "Usage: tape2disk -vf src [dest]\n"); - exit(1); - } - if (*p == '-') { - char ch = *++p; - argc--; /* one less arg */ - if (ch == 'v') - usefmgr = 0; /* use volmgr format */ - else - if (ch == 'f') - usefmgr = 1; /* use fmgr format */ - else { - fprintf(stderr, "Invalid option %c\n", ch); - fprintf(stderr, "Usage: tape2disk -vf src [dest]\n"); - exit(1); - } - } - inf = argv[1]; - if (argc == 3) { - outf = argv[2]; - copy = 1; - } - if ((inp = open(inf, O_RDONLY, 0666)) < 0) { - fprintf(stderr, "Can't open %s\n", inf); - exit(1); - } - if (copy) { - /* open output file, create it if necessary */ - if ((outp = open(outf, O_WRONLY|O_CREAT, 0666)) < 0) { - fprintf(stderr, "Can't open %s\n", outf); - exit(3); - } - } - /* get a 256k buffer */ - if ((buff = malloc(buf_size)) == NULL) { - fprintf(stderr, "Can't allocate memory for tapecopy\n"); - exit(4); - } -#ifndef _WIN32 - if (signal(SIGINT, SIG_IGN) != SIG_IGN) - (void)signal(SIGINT, RUBOUT); -#endif - - ln = -2; - for (;;) { - count++; - /* read record */ - while ((n = read(inp, buff, buf_size)) < 0) { - perror("Unknown read error"); -// errno = 0; - exit(6); /* abort on error, comment out to ignore tape errors */ - } - if (n > 0) { - /* we read some data, see if scanning or writing */ - EOFcnt = 0; /* not at EOF anymore */ - if (copy) { - int32 n1, n2; - /* we have data to write */ - int32 hc = (n + 1) & ~1; /* make byte count even */ - int32 wc = n; /* get actual byte count */ - /* write actual byte count to 32 bit word as header */ - n1 = write(outp, (char *)(&wc), (int32)4); - /* write the data mod 2 */ - nw = write(outp, buff, (int32)hc); - /* write the byte count in 32 bit word as footer */ - n2 = write(outp, (char *)(&wc), (int32)4); - if (n1 != 4 || nw != hc || n2 != 4) { - fprintf(stderr, "write (%d) !=" " read (%d)\n", nw, n); - fprintf(stderr, "COPY " "Aborted\n"); - exit(5); - } - } - size += n; /* update bytes read */ - if (n != ln) { /* must be last record of file if different */ - if (ln > 0) { - /* we read something */ - if ((count - lcount) > 1) - printf("file %d: records %ld to %ld: size %d\n", - filen, lcount, count - 1, ln); - else - printf("file %d: record %ld: size %d\n", filen, lcount, ln); - } - ln = n; /* save last record size */ - lcount = count; /* also record count */ - } - } else { - /* we did not read data, it must be an EOF */ - /* if ln is -1, last operation was EOF, now we have a second */ - /* see if fmgr or volm */ - if (usefmgr) { - /* filemgr has 2 EOF's at end of tape */ - if (++EOFcnt > 1) { - /* two EOFs mean we are at EOT */ - printf("fmgr eot\n"); - break; - } - } else { - /* volmgr has 3 EOF's at end of tape */ - if (++EOFcnt > 2) { - /* three EOFs mean we are at EOT on MPX */ - printf("volm eot\n"); - break; - } - } - if (ln > 0) { - if ((count - lcount) > 1) - printf("file %d: records %ld to %ld: size %d\n", - filen, lcount, count - 1, ln); - else - printf("file %d: record %ld: size %d\n", filen, lcount, ln); - } - if (usefmgr) { - printf("file %d: eof after %ld records: %ld bytes\n", - filen, count - 1, size); - } else { - if (EOFcnt == 2) /* if 2nd EOF, print file info */ - printf("second eof after %d files: %ld bytes\n", filen, size); - } - - if (copy) { - /* write a sudo EOF to disk file as a zero 4 byte record */ - int n1, hc = 0; - /* write the EOF */ - /* write a zero as the byte count in 32 bit word as EOF */ - n1 = write(outp, (char *)(&hc), (int32)4); - if (n1 != 4) { - perror("Write EOF"); - exit(6); - } - } - if (usefmgr) - filen++; /* advance number of files */ - else - if (EOFcnt < 2) /* not really a file if 2nd EOF */ - filen++; /* advance number of files */ - count = 0; /* file record count back to zero */ - lcount = 0; /* last record count back to zero */ - tsize += size; /* add to total tape size */ - size = 0; /* file size back to zero */ - ln = n; /* set ln to -1 showing we are at EOF */ - } - } - if (copy) { - /* write a sudo EOM to disk file as a -1 4 byte record */ - int32 n1, hc = 0xffffffff; - /* write the EOM to disk */ - /* write a -1 as the byte count in 32 bit word as EOM */ - n1 = write(outp, (char *)(&hc), (size_t)sizeof(hc)); - if (n1 != 4) { - perror("Write EOM"); - return(6); - } - (void)close(outp); - } - /* print out total tape size in bytes */ - (void)printf("total length: %ld bytes\n", tsize); - exit(0); -} - -#ifndef _WIN32 -/* entered when user hit the DELETE key */ -void RUBOUT() -{ - if (count > lcount) - --count; - if (count) - if (count > lcount) - (void)printf("file %d: records %ld to %ld: size" " %d\n", filen, lcount, count, ln); - else - (void)printf("file %d: record %ld: size %d\n", filen, lcount, ln); - (void)printf("interrupted at file %d: record %ld\n", filen, count); - (void)printf("total length: %ld bytes\n", tsize + size); - exit(1); -} -#endif diff --git a/SEL32/taptools/tapscan.c b/SEL32/taptools/tapscan.c deleted file mode 100644 index 8e01d24..0000000 --- a/SEL32/taptools/tapscan.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * tapscan.c - * - * This program scans a metatape file and prints file count and sizes. - * input - stdin or specified filename - * output - stdout - */ - -#include -#include -//#include -//#include -//#include -//#include - -int filen = 1; -int EOFcnt = 0; -int count=0, lcount=0; -int size=0, tsize=0; -int size_512K = 512 * 1024; -int ln; -//int inp; -FILE *infp; - -/* get a line of input. */ -int getloi(char *s, int lim) -{ -// int c, i; - int n1, n2, hc, tc, n; - -// errno = 0; - /* read the byte count in 32 bit word as header */ -// n1 = read(inp, (char *)(&hc), (size_t)4); - n1 = fread((char *)(&hc), (size_t)1, (size_t)4, infp); - if (n1 <= 0) - hc = -1; /* at EOM on disk file */ - - /* check for EOF & EOM on tape data */ - if (hc & 0xffff0000) /* check for garbage, assume EOM */ - hc = -1; /* at EOM on disk file */ - - /* check for EOF & EOM on tape data */ - if (hc == 0) { - /* we are at tape EOF */ - if (++EOFcnt < 2) { /* if 1st EOF, print file info */ - if (ln > 0) { - if (count - lcount > 1) - fprintf(stderr, "file %d: records %d (0x%x) to %d (0x%x): size %d (0x%x)\n", - filen, lcount, lcount, count-1, count-1, ln, ln); - else - fprintf(stderr, "file %d: record %d (0x%x): size %d (0x%x)\n", - filen, lcount, lcount, ln, ln); - } - fprintf(stderr, "file %d: eof after %d (0x%x) records: %d (0x%x) bytes\n", - filen, count, count, size, size); - filen++; /* set next file number */ - } else { - fprintf(stderr, "second eof after %d (0x%x) files: %d (0x%x) bytes\n", - filen-1, filen-1, size, size); - } - count = 0; /* file record count back to zero */ - lcount = 0; /* last record count back to zero */ - tsize += size; /* add to total tape size */ - size = 0; /* file size back to zero */ - ln = -1; /* set ln to -1 showing we are at EOF */ - - /* we have EOF */ - return 0; /* return EOF on tape data */ - } - if (hc == -1) { - /* we have EOM */ - fprintf(stderr, "mpx eot\n"); - /* print out total tape size in bytes */ - fprintf(stderr, "total length: %ld (0x%lx) bytes\n", tsize, tsize); - return -1; /* at EOM on disk file */ - } - /* read the data */ -// n = read(inp, s, (size_t)hc); - n = fread(s, (size_t)1, (size_t)hc, infp); - - /* if odd byte record, read extra byte and throw it away */ - if (n & 0x1) { -// n2 = read(inp, (char *)(&tc), (size_t)1); - n2 = fread((char *)(&tc), (size_t)1, (size_t)1, infp); - if (n2 <= 0) - return -1; /* at EOM on disk file */ - } - - /* read the byte count in 32 bit word as trailer */ -// n2 = read(inp, (char *)(&tc), (size_t)4); - n2 = fread((char *)(&tc), (size_t)1, (size_t)4, infp); - count++; /* bump record count */ - size += n; /* update bytes read */ - EOFcnt = 0; /* not an EOF */ - if (n != ln) { - if (ln > 0) { - if (count - lcount > 1) - fprintf(stderr, "file %d: records %d (0x%x) to %d (0x%x): size %d (0x%x)\n", - filen, lcount, lcount, count-1, count-1, ln, ln); - else - fprintf(stderr, "file %d: record %d (0x%x): size %d (0x%x)\n", - filen, lcount, lcount, ln, ln); - } - ln = n; - lcount = count; - } - /* return bytes in buffer */ - return n; -} - -int main (int argc, char *argv[]) -{ -// char in[BUFSIZ], out[BUFSIZ]; - char *buf; - size_t size_512K = 512 * 1024; - size_t buf_size = 512 * 1024; -// char *cp, *np; - int ll, gotboth = 0; - - if (argc != 2) { - fprintf(stderr, "usage: %s infile\n", argv[0]); - exit(1); - } /* end of if */ - - /* open input file */ - infp = fopen(argv[1],"r"); - if (infp == NULL) { - fprintf(stderr,"%s: fopen: unable to open input file %s\n", argv[0], argv[1]); - exit(1); - } /* end of if */ - - /* get a 512k buffer */ - if ((buf = malloc(buf_size)) == NULL) { - fprintf(stderr, "Can't allocate memory for %s\n", argv[0]); - return (4); - } - - /* init counts */ - ln = -2; /* look for 2 eof */ - count = 0; - size = 0; - tsize = 0; - lcount = 0; - - /* get lines until eof */ - while (((ll=getloi(buf, buf_size)) != EOF)) { - ; - } -// close(inp); - fclose(infp); - free(buf); - exit(0); -} diff --git a/SEL32/taptools/volmcopy.c b/SEL32/taptools/volmcopy.c deleted file mode 100644 index 915f71a..0000000 --- a/SEL32/taptools/volmcopy.c +++ /dev/null @@ -1,307 +0,0 @@ -/* - * volmcopy.c - * - * This program scans a metatape file and prints file count and sizes. - * It is only for volmgr save images. Save images have the following format: - * One or more 6144 byte records containing a list of files saved 16 char file - * name followed my 16 char directory name followed by 16 char volume name. - * A 1536 byte file definition entry will be followed by 1 to 8 768 byte - * file data records followed by an EOF for each file. If the file size is - * greater than 6144 bytes, 1 or more 6144 byte records are output followed - * by last record modulo 768 bytes. Two EOFs in a row define the EOT. - * input - stdin or specified filename - * output - stdout - */ - -#include -#include -//#include -//#include -//#include -#include -//#include -#include - -int filen = 1; -int EOFcnt = 0; -int count=0, lcount=0; -int size=0, tsize=0; -int size_512K = 512 * 1024; -int ln; -//int inp, outp; -FILE *infp, *outfp; -#define PRINTABLE(x) ((x < 32) || (x > 126)) ? '.' : x - -/* get a line of input. */ -int getloi(char *s, int lim) -{ -// int c, i; - int n1, n2, hc, tc, n; - -// errno = 0; - /* read the byte count in 32 bit word as header */ -// n1 = read(inp, (char *)(&hc), (size_t)4); - n1 = fread((char *)(&hc), (size_t)1, (size_t)4, infp); - if (n1 <= 0) - hc = -1; /* at EOM on disk file */ - - /* check for EOF & EOM on tape data */ - if (hc & 0xffff0000) /* check for garbage, assume EOM */ - hc = -1; /* at EOM on disk file */ - - /* check for EOF & EOM on tape data */ - if (hc == 0) { - /* we are at tape EOF */ - if (++EOFcnt < 2) { /* if 1st EOF, print file info */ - filen++; /* set next file number */ - } - count = 0; /* file record count back to zero */ - lcount = 0; /* last record count back to zero */ - tsize += size; /* add to total tape size */ - size = 0; /* file size back to zero */ - ln = -1; /* set ln to -1 showing we are at EOF */ - - /* we have EOF */ - return 0; /* return EOF on tape data */ - } - if (hc == -1) - return -1; /* at EOM on disk file */ - - /* read the data */ -// n = read(inp, s, (size_t)hc); - n = fread(s, (size_t)1, (size_t)hc, infp); - - /* if odd byte record, read extra byte and throw it away */ - if (n & 0x1) { -// n2 = read(inp, (char *)(&tc), (size_t)1); - n2 = fread((char *)(&tc), (size_t)1, (size_t)1, infp); - if (n2 <= 0) - return -1; /* at EOM on disk file */ - } - - /* read the byte count in 32 bit word as trailer */ -// n2 = read(inp, (char *)(&tc), (size_t)4); - n2 = fread((char *)(&tc), (size_t)1, (size_t)4, infp); - count++; /* bump record count */ - size += n; /* update bytes read */ - EOFcnt = 0; /* not an EOF */ - if (n != ln) { - ln = n; - lcount = count; - } - /* return bytes in buffer */ - return n; -} - -int main (int argc, char *argv[]) -{ - unsigned char *buf; - size_t size_512K = 512 * 1024; - size_t buf_size = 512 * 1024; -// char *cp, *np; - int ll; - int lfilen = filen; - unsigned int mpxtime[2]; - char path[64], command[128], dtime[64]; - time_t utime=0; - struct tm *dt; - - if (argc != 2) { - fprintf(stderr, "usage: %s infile\n", argv[0]); - exit(1); - } /* end of if */ - -// if ((inp = open(argv[1], O_RDONLY, 0666)) < 0) { - if ((infp = fopen(argv[1], "r")) == NULL) { - fprintf(stderr,"%s: fopen: unable to open input file %s\n", argv[0], argv[1]); - return (1); - } -// outp = -1; - outfp = NULL; - - /* get a 512k buffer */ - if ((buf = malloc(buf_size)) == NULL) { - fprintf(stderr, "Can't allocate memory for tscan\n"); - return (4); - } - /* init counts */ - ln = -2; /* look for 2 eof */ - count = 0; - size = 0; - tsize = 0; - lcount = 0; - filen = 1; - lfilen = filen; - printf("\nfile %d:\n", filen); - path[0] = '\0'; - command[0] = '\0'; - - /* get lines until eof */ - while ((ll=getloi(buf, buf_size)) != EOF) { - if (ll == 0) { - /* eof found, process new file */ -// printf("\nfile %d:\n", filen); - printf("file %d:\n", filen); - } else { - int cc = 0; -// unsigned int curchar; - - /* dump first 2 words */ - int w1, w2, i, j; - w1 = (buf[0] & 0xff) << 24 | buf[1] << 16 | buf[2] << 8 | (buf[3] & 0xff); - w2 = (buf[4] & 0xff) << 24 | buf[5] << 16 | buf[6] << 8 | (buf[7] & 0xff); -// printf("w1 = %x, w2 = %x count = %d\n", w1, w2, count); - if (count == 1 && w1 == 1) { - char file[20], dir[20], vol[20]; - int off = 8; - int l = 0; -printf("Directory with %d entries\n", w2); - /* we have directory entries */ - for (j=0; j (6144-48-off)) { - ll=getloi(buf, buf_size); - off = 0; - l = 0; - k = 0; -// printf("reread: got ll= %d\n", ll); - } - for (i=0; i<16; i++) { - file[i] = tolower(buf[k+off+i]); - if (file[i] == ' ') - file[i] = '\0'; - } - file[16] = '\0'; - for (i=0; i<16; i++) { - dir[i] = tolower(buf[k+off+16+i]); - if (dir[i] == ' ') - dir[i] = '\0'; - } - dir[16] = '\0'; - for (i=0; i<16; i++) { - vol[i] = tolower(buf[k+off+32+i]); - if (vol[i] == ' ') - vol[i] = '\0'; - } - vol[16] = '\0'; - sprintf(path, "./%s/%s", vol, dir); -#if 0 - /* create the directory/file */ - sprintf(command, "mkdir -p %s", path); - system(command); -#endif - sprintf(path, "./%s/%s/%s", vol, dir, file); -#if 0 - sprintf(command, "touch %s", path); - system(command); -#endif -// printf("path0 = %s\n", path); - } - } else - if (count == 1 && w1 == 2 && w2 == 0) { - char file[20], dir[20], vol[20]; -// if (outp >= 0) - if (outfp != NULL) { -// close(outp); - fclose(outfp); - sprintf(command, "touch -a -m -t %s %s", dtime, path); -// sprintf(command, "touch -t %s %s", dtime, path); -// printf("1cmd [%s] path[%s]\n", command, path); -// fflush(stdout); - system(command); - } -// outp = -1; - outfp = NULL; - /* process file definition */ - /* we have a 1536 byte file definition entry */ - for (i=0; i<16; i++) { - file[i] = tolower(buf[8+i]); - if (file[i] == ' ') - file[i] = '\0'; - } - file[16] = '\0'; - for (i=0; i<16; i++) { - dir[i] = tolower(buf[24+i]); - if (dir[i] == ' ') - dir[i] = '\0'; - } - dir[16] = '\0'; - for (i=0; i<16; i++) { - vol[i] = tolower(buf[40+i]); - if (vol[i] == ' ') - vol[i] = '\0'; - } - vol[16] = '\0'; - - i = 0x300 + 0x38; /* last modified date */ -// i = 0x300 + 0x20; /* creation date */ - /* get last modification time for file */ - /* day number since 1/1/1960 */ -// printf("D %02x%02x%02x%02x M %02x%02x%02x%02x\n", -// buf[i+0],buf[i+1],buf[i+2],buf[i+3],buf[i+4],buf[i+5],buf[i+6],buf[i+7]); - mpxtime[0] = buf[i+0] << 24 | buf[i+1] << 16 | buf[i+2] << 8 | (buf[i+3] & 0xff); - /* .1ms count in day 0-864,000,000 */ - mpxtime[1] = (buf[i+4] << 24) | (buf[i+5] << 16) | (buf[i+6] << 8) | (buf[i+7] & 0xff); - /* get UNIX time, secs sense 1970, not 1960 */ - utime =(time_t)((mpxtime[0]-3653)*86400)+(time_t)(mpxtime[1]/10000); - dt = gmtime(&utime); - j = dt->tm_year+1900; - if (j > 2037) - j -= 100; - sprintf(dtime, "%04d%02d%02d%02d%02d", j, dt->tm_mon+1, - dt->tm_mday, dt->tm_hour, dt->tm_min); -// printf("mpx day %x ms %x utime %ld dtime %s\n", mpxtime[0], mpxtime[1], utime, dtime); -// fflush(stdout); - - sprintf(path, "./%s/%s", vol, dir); - /* create the directory/file */ -// printf("dir path = %s\n", path); - sprintf(command, "mkdir -p %s", path); - system(command); - sprintf(path, "./%s/%s/%s", vol, dir, file); - printf("size bytes %d[0x%x] path = %s\n", ll, ll, path); -// fflush(stdout); - - /* open output file, create it if necessary */ -// if ((outp = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { - if ((outfp = fopen(path, "w")) == NULL) { - (void)fprintf(stderr, "Can't open %s\n", path); -// close(inp); - fclose(infp); - free(buf); - return (3); - } -// printf("opened path = %s ll = %d\n", path, ll); -// fflush(stdout); - /* process file data for file */ - if (ll > 1536) { -// int no = write(outp, buf+1536, ll-1536); - int no = fwrite(buf+1536, (size_t)1, (size_t)(ll-1536), outfp); - if (no != ll) - fprintf(stderr, "write (%d) != read (%d) on file %s\n", no, ll, path); - } - } else - if (count > 1) { - /* process file data for file */ -// int no = write(outp, buf, ll); - int no = fwrite(buf, (size_t)1, (size_t)ll, outfp); - if (no != ll) - fprintf(stderr, "write (%d) != read (%d) on file %s\n", no, ll, path); - } - } - } -// close(inp); - fclose(infp); - free(buf); -// if (outp >= 0) - if (outfp != NULL) { -// close(outp); - fclose(outfp); - sprintf(command, "touch -a -m -t %s %s", dtime, path); -// sprintf(command, "touch -t %s %s", dtime, path); -// printf("2cmd [%s]\n", command); -// fflush(stdout); - system(command); - } - exit(0); -} diff --git a/SEL32/tests/.gitignore b/SEL32/tests/.gitignore new file mode 100644 index 0000000..d1e714b --- /dev/null +++ b/SEL32/tests/.gitignore @@ -0,0 +1,6 @@ +#ignore testcode and testcpu files. +testcode0.l +testcode0.mem +testcode.mem +testcpu.l +testcpu.s diff --git a/SEL32/tests/cpu.icl b/SEL32/tests/cpu.icl index 770319f..2f2b272 100644 --- a/SEL32/tests/cpu.icl +++ b/SEL32/tests/cpu.icl @@ -1,25 +1,114 @@ -# Example ICL file for 32/7x -# this line ignored -*DEV04=0E150400,02 Cartridge disc with two platters -*DEV08=0E160800,04 Moving head disc -*DEV10=0E181000,04 9-Track magnetic tape -*DEV20=0E1A2000,10 GPMC with 16 terminals -*DEV60=0E1E6000,08 ADS -*DEV78=01207800 Primary card reader -*DEV7A=00217802 Primary line printer -*DEV7E=02237801 Primary Teletype -*INT00=1F Power fail/Auto restart -*INT01=1E System Overide -*INT12=1D Memory parity -*INT13=1C Console Interrupt -*INT24=1B Nonpresent memory -*INT25=1A Undefined instruction trap -*INT26=19 Privlege violation -*INT27=18 Call Monitor -*INT28=16 Real-time clock -*INT29=17 Arithmetic exception -*INT2A=15 External interrupt -*INT2B=14 External interrupt -*INT2C=13 External interrupt -*INT2D=12 External interrupt -*END +*COM CONCEPT/VIRTUAL ICL FILE #111039-003C 27JUN88 HEADER CVICL800 +*DEV04=0F040400 +*DEV08=0F050800 +*DEV0C=0F060C00 +*DEV10=0F071000 +*DEV14=0F081400,4 +*DEV18=0F091800 +*DEV20=0E0A2000,10 +*DEV30=0E0B3000,10 +*DEV40=0E0C4000,10 +*DEV50=0E0D5000,4 +*DEV56=0F0E5600 +*DEV57=036B5704 +*DEV5E=0F0F5E00 +*DEV5F=035B5F04 +*DEV66=0F106600 +*DEV67=034B6704 +*DEV6E=0F116E00 +*DEV6F=033B6F04 +*DEV76=0F127600 +*DEV77=032B7704 +*DEV7E=0F137E00 +*DEV7F=031B7F04 +*INT00=7F0F +*INT01=7F0E +*INT02=7F0D +*INT03=7F0C +*INT14=7F0B +*INT15=7F0A +*INT16=7F09 +*INT17=7F08 +*INT18=7F06 +*INT19=7F07 +*INT1A=7F05 +*INT1C=7F03 +*INT1D=7F02 +*INT1E=7F01 +*INT1F=7F00 +*INT20=770F +*INT21=770E +*INT22=770D +*INT23=770C +*INT24=770B +*INT25=770A +*INT26=7709 +*INT27=7708 +*INT28=7707 +*INT29=7706 +*INT2A=7705 +*INT2C=7703 +*INT2D=7702 +*INT2E=7701 +*INT2F=7700 +*INT30=6F0F +*INT31=6F0E +*INT32=6F0D +*INT33=6F0C +*INT34=6F0B +*INT35=6F0A +*INT36=6F09 +*INT37=6F08 +*INT38=6F07 +*INT39=6F06 +*INT3A=6F05 +*INT3C=6F03 +*INT3D=6F02 +*INT3E=6F01 +*INT3F=6F00 +*INT40=670F +*INT41=670E +*INT42=670D +*INT43=670C +*INT44=670B +*INT45=670A +*INT46=6709 +*INT47=6708 +*INT48=6707 +*INT49=6706 +*INT4A=6705 +*INT4C=6703 +*INT4D=6702 +*INT4E=6701 +*INT4F=6700 +*INT50=5F0F +*INT51=5F0E +*INT52=5F0D +*INT53=5F0C +*INT54=5F0B +*INT55=5F0A +*INT56=5F09 +*INT57=5F08 +*INT58=5F07 +*INT59=5F06 +*INT5A=5F05 +*INT5C=5F03 +*INT5D=5F02 +*INT5E=5F01 +*INT5F=5F00 +*INT60=570F +*INT61=570E +*INT62=570D +*INT63=570C +*INT64=570B +*INT65=570A +*INT66=5709 +*INT67=5708 +*INT68=5707 +*INT69=5706 +*INT6A=5705 +*INT6C=5703 +*INT6D=5702 +*INT6E=5701 +*INT6F=5700 +*END diff --git a/SEL32/tests/testcode.mem b/SEL32/tests/testcode.mem deleted file mode 100644 index 84754745e31348e2ce0e30b296664e237466722d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 60 zcmZQzVqjuqX6j^MV_^T;z@V_Efq`W$0|V!J1_q@!3=EnL3=9Gc3=RyZ7#RLvV_;+e NV&>}%j9frDMgUY{3?Bdh diff --git a/SEL32/tests/testcode0.l b/SEL32/tests/testcode0.l deleted file mode 100644 index 6362fb7..0000000 --- a/SEL32/tests/testcode0.l +++ /dev/null @@ -1,1009 +0,0 @@ - 00001 * PRE FILE FOR NON-EXTENDED MODE OF MPX-32 REV 3 RELEASE 3.6 MPX_NON - 00072 C.3227 SETT - 00073 C.TRACF SETF - 00074 C.MEMO SETF - 00075 BOPT_MPX SETF - 00076 C.FWMID SETF EMMM-35A - 00077 C.DPMODE SETF EMMM-35B - 00078 C.DPDEV SETF EMMM-35B - 00079 MPX_SVC SET 6 ECAL-35 - 00080 C.MPXOUT SETF EOUT-35 - 00081 *.EXTD35 SETT E2CCM35 EIPU360 - 00082 *.SEAR SETF E2CCM35 EIPU360 - 00083 *.RISCFL SETT E2CCM35A EIPU360 - 00084 *.INITF SETF E2CCM35B EIPU360 - 00085 *.SEGRFL SETF E2CCM35A E2SEG35 - 00086 *.SEGRFL SETT E2SEG35 EIPU360 - 00087 *.BRSTK SETT E2CCM35C EIPU360 - 00088 *.BUFIO SETT S920301 EIPU360 - 00089 REIS EOUT-35 - 00090 LIST NOMAC - 00091 P00000 M.SETREV 3.6,1 EIPU360 - 00092 LIST MAC - 00093 *TAPE & FLOPPY DISC BOOTSTRAP LOADER(S) HEADER FUPBOO 0001.000 - 00094 P00000 M.PGM FUPBOOT,MPX-32,3.6.1,00 0002.000 - PROGRAM FUPBOOT MPX-32_3.6.1.00 - ENDM - - 00096 * 0004.000 - 00097 ************************************************************************0005.000 - 00098 * *0006.000 - 00099 * PROPRIETARY INFORMATION *0007.000 - 00100 * ----------------------- *0008.000 - 00101 * THE INFORMATION CONTAINED HEREIN IS PROPRIETARY TO ENCORE *0009.000 - 00102 * COMPUTER CORPORATION AND/OR ITS VENDORS, AND ITS USE, DISCLOSURE, *0010.000 - 00103 * OR DUPLICATION IS SUBJECT TO THE RESTRICTIONS STATED IN THE *0011.000 - 00104 * STANDARD ENCORE COMPUTER CORPORATION LICENSE TERMS AND CONDITIONS *0012.000 - 00105 * OR THE APPROPRIATE THIRD-PARTY SUBLICENSE AGREEMENT. *0013.000 - 00106 * *0014.000 - 00107 * RESTRICTED RIGHTS *0015.000 - 00108 * ----------------- *0016.000 - 00109 * USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT *0017.000 - 00110 * TO RESTRICTIONS AS SET FOURTH IN SUBDIVISION (c) (1) (ii) OF *0018.000 - 00111 * THE RIGHTS IN TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT *0019.000 - 00112 * 252.227.7013 *0020.000 - 00113 ************************************************************************0021.000 - 00114 * (C) COPYRIGHT 1989 ENCORE COMPUTER CORPORATION *0022.000 - 00115 * ALL RIGHTS RESERVED *0023.000 - 00116 ************************************************************************0024.000 - 00117 * 0025.000 - - 00119 ************************************************************************0027.000 - 00120 * *0028.000 - 00121 ** **0029.000 - 00122 *** ***0030.000 - 00123 **** * * * W A R N I N G * * * ****0031.000 - 00124 ***** *****0032.000 - 00125 **** SOME PARAMETERS (AMONG THE ONES THAT ARE DEF'ED) ****0033.000 - 00126 *** ARE INITIALIZED BY THE SDT MODULE/ROUTINE(S) ***0034.000 - 00127 ** **0035.000 - 00128 * *0036.000 - 00129 ************************************************************************0037.000 - 00130 * 0038.000 - 00131 * EXTERNAL DEFINITIONS 0039.000 - 00132 * 0040.000 - - 00134 * (C) COPYRIGHT 1989 ENCORE COMPUTER CORPORATION 0042.000 - 00135 * ALL RIGHTS RESERVED 0043.000 - - 00137 DEF BOOTL # BYTES IN BOOTSTRAP 0045.000 - 00138 DEF MTB STARTING ADDRESS OF BOOTSTRAP LOADER 0046.000 - 00139 DEF SDTFLG SDT LOAD FLAGS 0047.000 - 00140 DEF MAXSECT MAXIMUM STARTING SECTOR FOR FLOPPY 0048.000 - 00141 DEF IOCD.ZR REZERO COMMAND CODE 0049.000 - 00142 DEF IOCD1 IOCD #1 FOR IPL 0050.000 - 00143 DEF IOCD.BKR BACKSPACE RECORD COMMAND CODE 0051.000 - - 00145 ************************************************************************0053.000 - 00146 * *0054.000 - 00147 * SYSTEM DISTRIBUTION BOOTSTRAP LOADER *0055.000 - 00148 * (MAG TAPE OR FLOPPY) *0056.000 - 00149 * *0057.000 - 00150 ************************************************************************0058.000 - 00151 * *0059.000 - 00152 * THE FOLLOWING LOADER IS COPIED TO THE BEGINNING OF THE *0060.000 - 00153 * SYSTEM DISTRIBUTION MEDIUM. IT IS EXECUTED BY ENTERING *0061.000 - 00154 * THE ADDRESS OF THE DEVICE UPON WHICH THE MEDIUM (TAPE *0062.000 - 00155 * OR FLOPPY) IS MOUNTED VIA THE CPU FRONT PANEL AND *0063.000 - 00156 * DEPRESSING THE IPL SWITCH. *0064.000 - 00157 * *0065.000 - 00158 * THIS SYSTEM DISTRIBUTION BOOTSTRAP LOADS CODE IN *0066.000 - 00159 * MPX-32 LOAD MODULE FORMAT AND WILL DEFAULT TO A STARTING *0067.000 - 00160 * LOCATION OF X'800' (32/7X) OR X'780' (32/27) UNLESS A *0068.000 - 00161 * DIFFERENT BIAS VALUE IS ENTERED IN R3 PRIOR TO DEPRESSING *0069.000 - 00162 * IPL ON THE CPU FRONT PANEL. 0070.000 - 00163 * THIS VERSION OF THE BOOTSTRAP IS THE MPX 2.0 VERSION. 0071.000 - 00164 * IT HAS BEEN MODIFIED TO READ ONLY THE OPERATING SYSTEM 0072.000 - 00165 * IMAGE, AND THEN TRANSFER CONTROL TO SYSINIT, WHICH WILL 0073.000 - 00166 * INITIALIZE THE SYSTEM AND ACTIVATE THE KEY LOAD MODULES 0074.000 - 00167 * THAT FOLLOW THE SYSTEM ON THE SDT TAPE. THIS BOOT SHOULD 0075.000 - 00168 * NOT BE USED WITH ANY EARLIER VERSION OF MPX. 0076.000 - 00169 * *0077.000 - 00170 ************************************************************************0078.000 - 00171 LIST NOMAC 0079.000 - 00172 P00000 M.REQS 0080.000 - 00173 P00000 M.PR. 0081.000 - 00174 P00000 M.COMM. 0082.000 - 00175 P00000 M.BREGS 0083.000 - 00176 P00000 M.TSA. 0084.000 - - 00178 * 0086.000 - 00179 * BOOTSTRAP EQUATES AND CONSTANTS 0087.000 - 00180 * 0088.000 - - 00182 00010 MT EQU X'10' MT CHANNEL ADDRESS 0090.000 - 00183 00001 DELAY EQU 1 0091.000 - 00184 00002 ACTIVE EQU 2 0092.000 - 00185 00000 MTBUF EQU 0 START 0F MT BUFFER IS L0C 0 0093.000 - 00186 0B000 MTREAD EQU X'B000' 800BPI,PACKED,ODD PARITY - READ TD 0094.000 - 00187 00800 BKSPCREC EQU X'0800' BACKSPACE RECORD TD 0095.000 - 00188 00200 MTSKF EQU X'0200' SKIPFILE CT COMMAND CODE 0096.000 - 00189 00007 EORFFLG EQU 7 SET = CLASS F 0097.000 - 00190 00008 INTRLVL EQU 8 BOOT INTRPT PRIORITY LEVEL 0098.000 - 00191 FFFFB RCNT EQU -5 XIO ERROR RETRY COUNT 0099.000 - 00192 00724 IOCB27 EQU X'724' IOCB LOC FOR 32/27 TAPE I/O 0100.000 - - 00194 P00000 BOUND 1W 0102.000 - - 00196 P00000 BOUND 8W START ON AN 8W BOUNDARY 0104.000 - 00197 P00000 MTB EQU $ SETUP CONFIGURATION RAM 0105.000 - 00198 P00000 EC000029 00028 BU BOOT.ST-MTB 0106.000 - 00199 P00004 00004000 DATAW X'00004000' 2ND WD OF NEW PSD BLOCKED 0107.000 - 00200 P00008 53000000 IOCD1 GEN 8/X'53',24/0 BKSR OR RZR TO RE-READ 0108.000 - 00201 P0000C 60000001 GEN 8/X'60',24/1 CMD CHAIN; SUPRESS INCOR LGTH0109.000 - 00202 P00010 02000000 IOCD2 GEN 8/X'02',24/0 READ/ADDRESS 0 0110.000 - 00203 P00014 000006EC 006EC GEN 8/0,24/BOOTLEN # BYTES IN BOOTSTRAP (*SDT) 0111.000 - 00204 P00018 BOUND 1D 0112.000 - 00205 P00018 8000002C 0002C FORCEPSD GEN 8/X'80',24/W(REALST-MTB) PRIV ONLY 0113.000 - 00206 P0001C 00004000 DATAW X'00004000' 2ND WD OF PSD -- BLOCKED 0114.000 - 00207 P00020 0000F000 CLAS.MSK DATAW X'F000' MSK, BITS 16-19=1 "F", 0 "E" 0115.000 - 00208 P00024 0000000F CPUMASK DATAW X'0000000F' GET MACHINE TYPE 0116.000 - 00209 P00028 BOOT.ST EQU $ 0117.000 - 00210 P00028 F9800018 00018 LPSD FORCEPSD-MTB FORCE PRIV ONLY 0118.000 - 00211 P0002C REALST EQU $ 0119.000 - 00212 P0002C D40001B8 001B8 STW R0,GPR0-MTB SAVE USER IMAGE CHOICE EMST-35 0120.000 - 00213 P00030 D5000380 00380 STW R2,NUMSKIP-MTB SAVE SYSBUILD FILE SKIP NO. 0121.000 - - 00215 * 0123.000 - 00216 * NOTE: THE CPU MODEL INDICATOR IS CONTAINED IN BITS 28-31 OF THE 0124.000 - 00217 * CPU STATUS WORD. THIS FIELD SHOULD BE INTERPRETED AS AN INTEGER, 0125.000 - 00218 * DEFINED AS FOLLOWS: 0126.000 - 00219 * 0 - CONCEPT-32/2000 EMST-35 0127.000 - 00220 * 1 - RESERVED EMST-35 0128.000 - 00221 * 2 - CONCEPT-32/27 EMST-35 0129.000 - 00222 * 3 - CONCEPT-32/67 EMST-35 0130.000 - 00223 * 4 - CONCEPT-32/87 EMST-35 0131.000 - 00224 * 5 - CONCEPT-32/97 EMST-35 0132.000 - 00225 * 6 - RESERVED EMST-35 0133.000 - 00226 * 7 - RESERVED EMST-35 0134.000 - 00227 * 0135.000 - - 00229 P00034 0109 RDSTS R2 READ CPU STATUS WORD 0137.000 - 00230 P00038 85000024 00024 ANMW R2,CPUMASK-MTB GET MACHINE TYPE 0138.000 - 00231 P0003C D508023D 0023D STB R2,MACH-MTB SAVE IT 0139.000 - 00232 P00040 C9050001 CI R2,1 TEST FOR 32/75 0140.000 - 00233 P00044 F200004D 0004C BNE NOT1-MTB IF NOT, GO ON EMST-35 0141.000 - 00234 P00048 F8800191 00190 BL ERR.B-MTB IF MACH TYPE = 1, ERROR EMST-35 0142.000 - 00235 P0004C C9050005 NOT1 CI R2,5 IS MACH TYPE > 5? EMST-35 0143.000 - 00236 P00050 EF000059 00058 BLE NOTBIG-MTB IF NOT, GO ON EMST-35 0144.000 - 00237 P00054 F8800191 00190 BL ERR.B-MTB IF SO, ERROR EMST-35 0145.000 - 00238 P00058 C9050000 NOTBIG CI R2,0 IS MACH TYPE < 0? EMST-35 0146.000 - 00239 P0005C EE800065 00064 BGE SET27-MTB MACHINE TYPE OK - GO ON EMST-35 0147.000 - 00240 P00060 F8800191 00190 BL ERR.B-MTB IF SO, ERROR EMST-35 0148.000 - 00241 * BGT SET27-MTB BRANCH FOR 32/27 OR 32/87 EMST-35 0149.000 - 00242 * 0150.000 - 00243 * 32/7X SCRATCHPAD SET-UP 0151.000 - 00244 * 0152.000 - 00245 * LI R5,X'8F' DRT INDEX IN SPAD EMST-35 0153.000 - 00246 * SLL R5,16 FORM SPAD SETTING EMST-35 0154.000 - 00247 * TSCR R5,R4 R4 = DEVICE PROTOCOL EMST-35 0155.000 - 00248 * ANMW R4,CLAS.MSK-MTB MASK OUT CLASS EMST-35 0156.000 - 00249 * BCT ZR,ECLAS7X-MTB IF 'E' CLASS ... BRANCH EMST-35 0157.000 - 00250 * SBM EORFFLG,CLASS-MTB SHOW 'F' CLASS EMST-35 0158.000 - 00251 * SBM EORFFLG,DEVTBL-MTB SET CLASS IN DEVICE TBL EMST-35 0159.000 - 00252 * LI R4,SI.TRAP-MTB R4 = SPAD TRAP ADDRESS EMST-35 0160.000 - 00253 * STW R4,INTRTBL-MTB STORE IN INTRPT TABLE EMST-35 0161.000 - 00254 * ZR R2 STATUS IN WORDS 0,1 EMST-35 0162.000 - 00255 * BL STATF.I-MTB CHECK STATUS EMST-35 0163.000 - 00256 * BL BTERR1-MTB ERROR...HALT, R0=ABT AD EMST-35 0164.000 - 00257 *ECLAS7X EQU $ 'E' CLASS TAPE DRIVE EMST-35 0165.000 - 00258 * LW R5,IPL7X-MTB R5 = IPLDEV SPAD LOC. EMST-35 0166.000 - 00259 * TSCR R5,R4 R4 = IPL DEVICE ADDR. EMST-35 0167.000 - 00260 * STB R4,CH.SA+1B-MTB SAVE SUBADDR FOR XIO EMST-35 0168.000 - 00261 * ARMW R4,DEVTBL-MTB ADD CH/SUBA TO DEV WORD EMST-35 0169.000 - 00262 * SRLD R4,8 SUBADDRESS TO R5 EMST-35 0170.000 - 00263 * LI R4,X'10' USE BAS AD 10 FOR INT ENT 11AUG81BS EMST-35 0171.000 - 00264 * TBM EORFFLG,CLASS-MTB 'F' CLASS DEVICE? EMST-35 0172.000 - 00265 * BS CHONLY-MTB IF YES ... USE CH ONLY EMST-35 0173.000 - 00266 * SRL R5,24 RIGHT JUSTIFY SUBADDR EMST-35 0174.000 - 00267 * ADR R5,R4 ADD CHAN AND SUBADDR EMST-35 0175.000 - 00268 * SLL R5,16 ADD SUBA TO DEV ENT AD/E-CLAS 11AUG81 EMST-35 0176.000 - 00269 * ARMW R5,DEVTBL+2W-MTB UPDAT DEV ENT AD 11AUG81BS EMST-35 0177.000 - 00270 *CHONLY SLL R4,16 FORM SPAD SETTING EMST-35 0178.000 - 00271 * ARMW R4,INTRTBL-MTB ADD TO INTRPT WORD EMST-35 0179.000 - 00272 * LW R1,DEVTBL-MTB R1 = SPAD DEVICE ENTRY EMST-35 0180.000 - 00273 * LW R2,DEVTBL+2W-MTB R2 = SPAD LOCATION EMST-35 0181.000 - 00274 * TRSC R1,R2 DEVICE WORD TO SPAD EMST-35 0182.000 - 00275 * ZR R2 NEED AT LOC 10 IF SUBA 14AUG81 BS EMST-35 0183.000 - 00276 * SBR R2,11 SINCE I/O IS TO CHAN X'10'114AUG81 BS EMST-35 0184.000 - 00277 * TRSC R1,R2 TRANSFER TO SPAD 14AUG81 BS EMST-35 0185.000 - 00278 * LW R1,INTRTBL-MTB R1 = SPAD INTRPT ENTRY EMST-35 0186.000 - 00279 * LW R2,INTRTBL+1W-MTB R2 = SPAD LOCATION EMST-35 0187.000 - 00280 * TRSC R1,R2 INTRPT WORD TO SPAD EMST-35 0188.000 - 00281 * BU BOOTTD-MTB SPAD SET ... CONTINUE EMST-35 0189.000 - 00282 * 0190.000 - 00283 * 32/27 SCRATCHPAD SET-UP 0191.000 - 00284 * 0192.000 - 00285 P00064 CA8000F8 SET27 LI R5,X'F8' R5 = SPAD DRT INDEX 0193.000 - 00286 P00068 72D0 SLL R5,16 FORM SPAD SETTING 0194.000 - 00287 P0006A 2E5F TSCR R5,R4 R4 = DEVICE PROTOCOL 0195.000 - 00288 P0006C 86000020 00020 ANMW R4,CLAS.MSK-MTB MASK OUT CLASS 0196.000 - 00289 P00070 EE000099 00098 BCT ZR,ECLASPX-MTB IF 'E' CLASS ... BRANCH 0197.000 - 00290 P00074 9B88023C 0023C SBM EORFFLG,CLASS-MTB SHOW 'F' CLASS 0198.000 - 00291 P00078 9B880220 00220 SBM EORFFLG,DEVTBL+1W-MTB SET CLASS IN DEVICE TBL 0199.000 - 00292 P0007C CA0000F1 LI R4,X'F1' LOAD SPAD ITBA INDEX 0200.000 - 00293 P00080 7250 SLL R4,16 FORM SPAD SETTING 0201.000 - 00294 P00084 3680035C 0035C LA R5,ITBA-MTB R5 = ITBA FOR BOOT 0202.000 - 00295 P00088 2E5E TRSC R5,R4 BOOT ITBA TO SPAD 0203.000 - 00296 P0008A 0D20 ZR R2 STATUS IN WORDS 0,1 0204.000 - 00297 P0008C F88003F5 003F4 BL STATF.I-MTB CHECK STATUS 0205.000 - 00298 * BL BTERR1-MTB ERROR...HALT, R0=ABORT ADDR EMST-35 0206.000 - 00299 P00090 F88003CD 003CC BL ERR.3-MTB ERROR...HALT, R0=ABORT ADDR EMST-35 0207.000 - 00300 P00094 EC0000A5 000A4 BU GETIPL-MTB FETCH IPL ADDRESS 0208.000 - 00301 P00098 ECLASPX EQU $ 0209.000 - 00302 P00098 CA8000F2 LI R5,X'F2' IOCDBA SPAD INDEX 0210.000 - 00303 P0009C CA000700 LI R4,X'700' IOCD BASE ADDRESS 0211.000 - 00304 P000A0 72D0 SLL R5,16 SHIFT INDEX INTO POS. 0212.000 - 00305 P000A2 2ECE TRSC R4,R5 INIT IOCDBA IN SPAD 0213.000 - 00306 P000A4 AE800238 00238 GETIPL LW R5,IPL27-MTB R5 = IPLDEV SPAD LOC. 0214.000 - 00307 P000A8 2E5F TSCR R5,R4 R4 = IPL DEVICE ADDR. 0215.000 - 00308 P000AC D60806D1 006D1 STB R4,CH.SA+1B-MTB SAVE SUBADDR FOR XIO 0216.000 - 00309 P000B0 86000214 00214 ANMW R4,SPAD.MSK-MTB REMOVE ALL BUT CHANNEL 7-29-81BS0217.000 - 00310 * TRSC R4,R5 THIS INST. NOT NEEDED 7-30-81BS 0218.000 - 00311 P000B4 8A000220 00220 ORMW R4,DEVTBL+1W-MTB R4 = SPAD DEVICE WORD 0219.000 - 00312 P000B8 AD000224 00224 LW R2,DEVTBL+2W-MTB R2 = SPAD LOCATION 0220.000 - 00313 P000BC 2D4E TRSC R4,R2 DEVICE WORD TO SPAD 0221.000 - 00314 P000C0 AD000230 00230 LW R2,INTRTBL+2W-MTB R2 = INTRPT SPAD LOC. 0222.000 - 00315 P000C4 2D4E TRSC R4,R2 INTRPT WORD TO SPAD 0223.000 - 00316 P000C8 36000694 00694 LA R4,MTTCW-MTB R4 = MAG TAPE TCW LOCATION 0224.000 - 00317 P000CC D6000724 00724 STW R4,IOCB27 TCW ADDR TO IOCD 0225.000 - 00318 P000D0 CA000780 LI R4,X'780' 32/27 LOAD POINT 0226.000 - 00319 P000D4 D6000218 00218 STW R4,DEFAULT-MTB SET 32/27 DEFAULT LOAD PT. 0227.000 - 00320 * 0228.000 - 00321 * INITIALIZE CHANNEL FOR 'F' CLASS I/O 0229.000 - 00322 * 0230.000 - 00323 *BOOTTD TBM EORFFLG,CLASS-MTB CK IF "F" CLASS EMST-35 0231.000 - 00324 * BCF SET,NOT.F-MTB BR IF "E" EMST-35 0232.000 - 00325 P000D8 F88000E1 000E0 BL DO.INCH-MTB DO THE INCH 0233.000 - 00326 P000DC EC0001FD 001FC BU MTB1-MTB CONTINUE 0234.000 - 00327 *NOT.F TD MT,X'8000' TEST STATUS FOR 'E' CLASS EMST-35 0235.000 - 00328 * BANY E.ERR-MTB BRANCH IF ANY ERRORS EMST-35 0236.000 - 00329 * TBM MASTER,SDTFLG-MTB TEST FOR MASTER SDT BOOTEMST-35 0237.000 - 00330 * BNS MTB1-MTB NO, GO ON EMST-35 0238.000 - 00331 * 0239.000 - 00332 * SKIP THE TAPE AHEAD 1 FILE TO FIND THE 32/75 MASTER IMAGE 0240.000 - 00333 * THIS IS DONE WITH INTERRUPTS BECAUSE THE CONTROLLER DOES 0241.000 - 00334 * NOT RETURN A BUSY STATUS ON A TD INSTRUCTION. AND IT IS 0242.000 - 00335 * NICE TO KNOW WHEN THE SKIPFILE IS DONE!!! 0243.000 - 00336 * 0244.000 - 00337 * UEI UNBLOCK EXTERNAL INTERRUPTS EMST-35 0245.000 - 00338 * DI X'18' DISABLE THE INTERRUPT EMST-35 0246.000 - 00339 * EI X'18' RE--ENABLE IT EMST-35 0247.000 - 00340 * 0248.000 - 00341 * THE CD BELOW HAS ITS ICB @ X'7BC' AND WILL RETURN TO 0249.000 - 00342 * LABEL MTB1 WITH INTERRUPTS BLOCKED 0250.000 - 00343 * 0251.000 - 00344 * CD MT,MTSKF DO THE SKIPFILE EMST-35 0252.000 - 00345 * WAIT WAIT FOR I/O COMPLETE EMST-35 0253.000 - 00346 *E.ERR BL BTERR1.MTB ERROR...HALT, R0=ABORT ADDR EMST-35 0254.000 - - 00348 * 0256.000 - 00349 * NOTE: THERE ARE THREE IMAGES ON THE MASTER SDT: EMST-35 0257.000 - 00350 * MSTRALL (DEFAULT IMAGE FOR CONCEPT-32/XX MACHINES, EMST-35 0258.000 - 00351 * VALID OPTION FOR CONCEPT-32/2000) EMST-35 0259.000 - 00352 * MSTREXT (EXTENDED MPX - VALID OPTION FOR ALL CONCEPT EMST-35 0260.000 - 00353 * MACHINES EXCEPT 32/27) EMST-35 0261.000 - 00354 * MSTROUT (DEFAULT IMAGE FOR CONCEPT-32/2000 - INVALID EMST-35 0262.000 - 00355 * OPTION FOR ALL OTHER MACHINES) EMST-35 0263.000 - 00356 * EMST-35 0264.000 - 00357 * THE USER CAN CHOOSE AN IMAGE OTHER THAN THE DEFAULT BY EMST-35 0265.000 - 00358 * SETTING GPR0 TO ONE OF THE FOLLOWING VALUES BEFORE IPL: EMST-35 0266.000 - 00359 * (NOTE ABOVE CONSTRAINTS) EMST-35 0267.000 - 00360 * GPR0 = 1 -- MSTRALL EMST-35 0268.000 - 00361 * GPR0 = 2 -- MSTREXT EMST-35 0269.000 - 00362 * EMST-35 0270.000 - 00363 P000E0 DO.INCH EQU $ 'F' CLASS INCH 0271.000 - 00364 P000E0 D40001C0 001C0 STW R0,INCH.RT-MTB SAVE RETURN ADDRESS 0272.000 - 00365 P000E4 A508066E 0066E TBM MASTER,SDTFLG-MTB IS THIS A MASTER SDT 0273.000 - 00366 P000E8 F080013D 0013C BNS SKF.L1-MTB NO, SKIP THE SKIPFILES 0274.000 - 00367 P000EC AE88023D 0023D LB R5,MACH-MTB GET THE MACHINE TYPE BYTE 0275.000 - 00368 * CI R5,2 IS THIS A 32/27 BOOT? EMST-35 0276.000 - 00369 * BEQ SKF.L1-MTB YES, NO FILE SKIPS EMST-35 0277.000 - 00370 * SBM 1,IOCD.SM+1W-MTB SET CMD CHAIN BIT TO EMST-35 0278.000 - 00371 * DO ONE SKIP FILE ON TAPE BOOT EMST-35 0279.000 - 00372 * SBM 1,INCH.FP+1W-MTB SET CMD CH BIT FOR FLP EMST-35 0280.000 - 00373 * TO DO ONE SKIP FILE EMST-35 0281.000 - 00374 * CI R5,1 IS THIS A 32/75 BOOT? EMST-35 0282.000 - 00375 * BEQ SKF.L1-MTB YES, ONLY 1 SKIPFILE FOR 75 EMST-35 0283.000 - 00376 * SBM 1,IOCD.SK1+1W-MTB DO TWO SKIPFILES EMST-35 0284.000 - 00377 P000F0 AC0001B8 001B8 LW R0,GPR0-MTB GET USER'S IMAGE CHOICE EMST-35 0285.000 - 00378 P000F4 F18000FD 000FC BNN GPR0CHK2-MTB IF NOT < 0, CHECK IF > 2 EMST-35 0286.000 - 00379 P000F8 F8800189 00188 BL ERR.A-MTB IF SO, INVALID - HALT EMST-35 0287.000 - 00380 P000FC C8050002 GPR0CHK2 CI R0,2 IS GPR0 > 2? EMST-35 0288.000 - 00381 P00100 EF000109 00108 BLE GPR0OK-MTB IF NOT, VALUE IS OK EMST-35 0289.000 - 00382 P00104 F8800189 00188 BL ERR.A-MTB IF SO, INVALID - HALT EMST-35 0290.000 - 00383 P00108 CA850000 GPR0OK CI R5,0 IS THIS A 32/2000? EMST-35 0291.000 - 00384 P0010C F2000121 00120 BNE NOTOUT-MTB NO, CAN'T USE MAPPED OUT EMST-35 0292.000 - 00385 P00110 C8050000 CI R0,0 DO THEY WANT MAPPED OUT? EMST-35 0293.000 - 00386 P00114 F2000121 00120 BNE NOTOUT-MTB NO, CHOOSE ANOTHER IMAGE EMST-35 0294.000 - 00387 P00118 988801EC 001EC SBM 1,IOCD.SK1+1W-MTB SKIP SECOND IMAGE ON TAPE EMST-35 0295.000 - 00388 P0011C EC000135 00134 BU SKIPF1-MTB GO SKIP THE FIRST IMAGE, TOO EMST-35 0296.000 - 00389 P00120 C8050002 NOTOUT CI R0,2 DO THEY WANT EXTENDED? EMST-35 0297.000 - 00390 P00124 F200013D 0013C BNE SKF.L1-MTB NO - GO GET FIRST IMAGE EMST-35 0298.000 - 00391 P00128 CA850002 CI R5,2 IS THIS A 32/27? EMST-35 0299.000 - 00392 P0012C F2000135 00134 BNE SKIPF1-MTB NO - SKIP FIRST IMAGE EMST-35 0300.000 - 00393 P00130 F8800199 00198 BL ERR.C-MTB MSTREXT INVALID FOR 32/27 EMST-35 0301.000 - 00394 P00134 988801D4 001D4 SKIPF1 SBM 1,IOCD.SM+1W-MTB SET CMD CHAIN BIT TO EMST-35 0302.000 - 00395 * DO ONE SKIP FILE ON TAPE BOOT EMST-35 0303.000 - 00396 P00138 988801E4 001E4 SBM 1,INCH.FP+1W-MTB SET CMD CHAIN BIT FOR EMST-35 0304.000 - 00397 * FLOPPY TO DO ONE FILE SKIP EMST-35 0305.000 - 00398 P0013C SKF.L1 EQU $ 0306.000 - 00399 P0013C A488066E 0066E TBM FLP,SDTFLG-MTB IPL FROM FLOPPY? 0307.000 - 00400 P00140 F080014D 0014C BNS INIT.TAP-MTB IF NOT ... INIT FOR TAPE 0308.000 - 00401 P00144 368001E0 001E0 LA R5,INCH.FP-MTB FETCH FLOPPY IOCD ADDRESS 0309.000 - 00402 P00148 EC000151 00150 BU $+2W-MTB JOIN COMMON CODE 0310.000 - 00403 P0014C 368001C8 001C8 INIT.TAP LA R5,INCH.TP-MTB FETCH TAPE IOCL ADDRESS 0311.000 - 00404 P00150 D6800354 00354 STW R5,IOCLA STORE IOCL PTR. IN CONTROL BLK 0312.000 - 00405 P00154 AE8006D1 006D0 LH R5,CH.SA-MTB FETCH LOGICAL CHANNEL 0313.000 - 00406 P00158 FEE70000 ECI R5,0 ENABLE CHANNEL INTERRUPT 0314.000 - 00407 P0015C 0007 UEI UNBLOCK INTERRUPTS 0315.000 - 00408 P00160 F8800405 00404 BL DO.SIO-MTB INITIALIZE CHANNEL 0316.000 - 00409 P00164 F88003F1 003F0 BL CK.STATF-MTB CHECK STATUS 0317.000 - 00410 * BL BTERR1-MTB ERROR...HALT, R0=ABORT ADDR EMST-35 0318.000 - 00411 P00168 F88003CD 003CC BL ERR.3-MTB ERROR...HALT, R0=ABORT ADDR EMST-35 0319.000 - 00412 P0016C A488066E 0066E TBM FLP,SDTFLG-MTB IPL FROM FLOPPY? 0320.000 - 00413 P00170 F080017D 0017C BNS IOCL.TAP-MTB IF NOT ... SET IOCL FOR TAPE 0321.000 - 00414 P00174 340003A0 003A0 LA R0,IOCD.SK-MTB FETCH ADDR. OF SEEK IOCD 0322.000 - 00415 P00178 EC000181 00180 BU $+2W-MTB JOIN COMMON CODE 0323.000 - 00416 P0017C 34000390 00390 IOCL.TAP LA R0,IOCD.RD-MTB FETCH ADDR. OF READ IOCD 0324.000 - 00417 P00180 D4000354 00354 STW R0,IOCLA STORE IOCL PTR. IN CONTROL BLK 0325.000 - 00418 P00184 EC1001C1 001C0 BU *INCH.RT-MTB RETURN TO CALLER 0326.000 - 00419 * EMST-35 0327.000 - 00420 * ERROR PROCESSING EMST-35 0328.000 - 00421 * EMST-35 0329.000 - 00422 P00188 AF0001A2 001A0 ERR.A LD R6,ERRA.MSG-MTB INVALID VALUE IN GPR0 EMST-35 0330.000 - 00423 P0018C EC0003D5 003D4 BU ERR.HALT-MTB HALT MACHINE EMST-35 0331.000 - 00424 P00190 AF0001AA 001A8 ERR.B LD R6,ERRB.MSG-MTB INVALID MACHINE TYPE EMST-35 0332.000 - 00425 P00194 EC0003D5 003D4 BU ERR.HALT-MTB HALT MACHINE EMST-35 0333.000 - 00426 P00198 AF0001B2 001B0 ERR.C LD R6,ERRC.MSG-MTB INVALID IMAGE FOR MACHINE EMST-35 0334.000 - 00427 P0019C EC0003D5 003D4 BU ERR.HALT-MTB HALT MACHINE EMST-35 0335.000 - 00428 P001A0 494E5620 ERRA.MSG DATAD C'INV GPR0' EMST-35 0336.000 - P001A4 47505230 - 00429 P001A8 4D414348 ERRB.MSG DATAD C'MACHTYPE' EMST-35 0337.000 - P001AC 54595045 - 00430 P001B0 494E5620 ERRC.MSG DATAD C'INV IMAG' EMST-35 0338.000 - P001B4 494D4147 - 00431 P001B8 00000000 GPR0 DATAW 0 CONTAINS USER'S IMAGE CHOICE EMST-35 0339.000 - 00432 * 0340.000 - 00433 * INCH DATA AREA 0341.000 - 00434 * 0342.000 - 00435 P001BC 80000000 MODE DATAW X'80000000' MODE = PACKED, ODD PARITY (TAPE)0343.000 - 00436 P001C0 00000000 INCH.RT DATAW 0 CALLER'S RETURN ADDRESS 0344.000 - 00437 P001C8 BOUND 1D 0345.000 - 00438 P001C8 00000320 00320 INCH.TP GEN 8/0,24/W(INCH.BUF-MTB) TAPE INCH BUFFER 0346.000 - 00439 P001CC 40000001 GEN 8/X'40',24/1 COMMAND CHAIN; 1 BYTE 0347.000 - 00440 P001D0 830001BC 001BC IOCD.SM GEN 8/X'83',24/W(MODE-MTB) SET MODE 0348.000 - 00441 P001D4 00000001 GEN 8/0,24/1 1 BYTE 0349.000 - 00442 P001D8 080001E8 001E8 IOCD.TIC GEN 8/X'08',24/W(IOCD.SK1-MTB) TRANSFER TO SKIPFILE 0350.000 - 00443 P001DC 00000000 DATAW 0 IOCD'S IF NEEDED 0351.000 - 00444 P001E0 000003B0 003B0 INCH.FP GEN 8/0,24/A(IOSTAT-MTB) STATUS ADDRESS 0352.000 - 00445 P001E4 00000001 GEN 16/0,16/1 1 BYTE 0353.000 - 00446 P001E8 63000000 IOCD.SK1 GEN 8/X'63',24/0 SKIP ONE FILE 0354.000 - 00447 P001EC 00000001 DATAW 1 0355.000 - 00448 P001F0 63000000 IOCD.SK2 GEN 8/X'63',24/0 0356.000 - 00449 P001F4 00000001 DATAW 1 0357.000 - - 00451 P001F8 FCC10000 INT.RET DI X'18' DISABLE THE INTERRUPT ON RETURN 0359.000 - 00452 P001FC MTB1 EQU $ INITIALIZE LOAD POINTER 0360.000 - 00453 P001FC C9850000 CI R3,0 WAS A LOAD BIAS SUPPLIED? 0361.000 - 00454 P00200 F2000209 00208 BNE $+2W-MTB ..YES, SKIP NEXT INSTRUCTION 0362.000 - 00455 P00204 AD800218 00218 LW R3,DEFAULT-MTB ELSE FORCE DEFULT LOAD POINT 0363.000 - 00456 P00208 85800240 00240 ANMW R3,WORDMASK-MTB MASK TO WORD BOUND 0364.000 - 00457 P0020C D58006BC 006BC STW R3,BIAS-MTB SAVE BIAS VALUE 0365.000 - 00458 P00210 EC000429 00428 BU READPR-MTB ..THEN READ PREAMBLE BLOCK 1 0366.000 - - 00460 P00214 0000FF00 SPAD.MSK DATAW X'0000FF00' MASK ALL BUT CHANNEL OF SPAD WORD 0368.000 - 00461 P00218 00000800 DEFAULT DATAW X'800' DEFAULT START LOAD POINT 0369.000 - 00462 P0021C 0E670000 DEVTBL DATAW X'0E670000' 32/7X SPAD DEVICE WORD 0370.000 - 00463 P00220 0E770000 DATAW X'0E770000' 32/27 SPAD DEVICE WORD 0371.000 - 00464 P00224 00100000 DATAW X'00100000' USE SPAD=CH10+SA0 0372.000 - 00465 P00228 000006D4 INTRTBL DATAW MT.ICB-MTB 32/7X SPAD INTR ENTRY 0373.000 - 00466 * SETS TCW ADDR TO 77C 0374.000 - 00467 P0022C 00980000 DATAW X'00980000' 32/7X SPAD INTR LOC 0375.000 - 00468 P00230 00880000 DATAW X'00880000' 32/27 SPAD INTR LOC 0376.000 - 00469 P00234 00840000 IPL7X DATAW X'00840000' 32/7X IPL DEVICE SPAD LOC. 0377.000 - 00470 P00238 00F40000 IPL27 DATAW X'00F40000' 32/27 IPL DEVICE SPAD LOCATION 0378.000 - 00471 P0023C 0E CLASS DATAB X'0E' DEVICE CLASS EMST-35 0379.000 - 00472 P0023D 00 MACH DATAB 0 SAVE AREA FOR MACHINE TYPE EMST-35 0380.000 - 00473 P00240 0007FFFC WORDMASK DATAW X'7FFFC' WORD MASK EMST-35 0381.000 - 00474 P00244 ICLEND EQU $ 0382.000 - 00475 P00244 00000000 REZ X'300'+MTB-ICLEND PAD SO THAT READPR WILL 0383.000 - P00248 00000000 - P0024C 00000000 - P00250 00000000 - P00254 00000000 - P00258 00000000 - P0025C 00000000 - P00260 00000000 - P00264 00000000 - P00268 00000000 - P0026C 00000000 - P00270 00000000 - P00274 00000000 - P00278 00000000 - P0027C 00000000 - P00280 00000000 - P00284 00000000 - P00288 00000000 - P0028C 00000000 - P00290 00000000 - P00294 00000000 - P00298 00000000 - P0029C 00000000 - P002A0 00000000 - P002A4 00000000 - P002A8 00000000 - P002AC 00000000 - P002B0 00000000 - P002B4 00000000 - P002B8 00000000 - P002BC 00000000 - P002C0 00000000 - P002C4 00000000 - P002C8 00000000 - P002CC 00000000 - P002D0 00000000 - P002D4 00000000 - P002D8 00000000 - P002DC 00000000 - P002E0 00000000 - P002E4 00000000 - P002E8 00000000 - P002EC 00000000 - P002F0 00000000 - P002F4 00000000 - P002F8 00000000 - P002FC 00000000 - 00476 * BEGIN AT X'300' LEAVING 000 TO 2FF 0384.000 - 00477 * AS THE 192W MT BUFFER 0385.000 - 00478 P00300 BOUND 8W 0386.000 - 00479 P00300 00000000 SAVEREG REZ 8W REGISTER SAVE AREA 0387.000 - P00304 00000000 - P00308 00000000 - P0030C 00000000 - P00310 00000000 - P00314 00000000 - P00318 00000000 - P0031C 00000000 - 00480 P00320 00000000 INCH.BUF REZ 8W EXT. I/O INCH BUFFER 0388.000 - P00324 00000000 - P00328 00000000 - P0032C 00000000 - P00330 00000000 - P00334 00000000 - P00338 00000000 - P0033C 00000000 - 00481 P00340 00000344 00344 SI.TRAP ACW SI.BLKA-MTB SPAD TRAPS HERE..TO SI BLK 0389.000 - 00482 P00344 00000000 SI.BLKA REZ 2W XIO CONTROL BLK (OLD PSD) 0390.000 - P00348 00000000 - 00483 P0034C 80000418 00418 NEW.PSD GEN 8/X'80',24/W(HNDLR-MTB) NEW PSD 0391.000 - 00484 P00350 00008000 DATAW X'00008000' RETAIN CURRENT BLOCK MODE 0392.000 - 00485 P00354 00000000 REZ 2W IOCLA AND STATUS ADDRESS 0393.000 - P00358 00000000 - 00486 00344 SI.BLK EQU SI.BLKA-MTB SI POINTER-CLASS F 0394.000 - 00487 00354 IOCLA EQU SI.BLK+4W IOCLA...REL TO SI BLK 0395.000 - 00488 00358 STAT.ADR EQU SI.BLK+5W STATUS POINTER 0396.000 - 00489 P0035C 00000000 ITBA REZ 4*INTRLVL INTRPT TBL FOR 32/27 BOOT 0397.000 - P00360 00000000 - P00364 00000000 - P00368 00000000 - P0036C 00000000 - P00370 00000000 - P00374 00000000 - P00378 00000000 - 00490 P0037C 00000344 00344 ACW SI.BLKA-MTB POINTER TO SI BLOCK 0398.000 - 00491 P00380 00000000 NUMSKIP DATAW 0 NO. OF FILES/BLKS SYSBUILD TO SKIP 0399.000 - 00492 P00384 18000001 00001 MTHTCW GEN 12/384,20/H(MTBUF) HANDLER TCW 0400.000 - 00493 *CH.SA DATAH X'1000' LOG CH & PHYS SUBAD (INSRT) EMST-35 0401.000 - 00494 *MAXSECT DATAH 0 MAX START SECT FOR FLOPPY EMST-35 0402.000 - 00495 *CLASS DATAB X'0E' DEVICE CLASS EMST-35 0403.000 - 00496 *SDTFLG DATAB 0 SDT LOAD FLAGS EMST-35 0404.000 - 00497 *MACH DATAB 0 SAVE AREA FOR MACHINE TYPE EMST-35 0405.000 - 00498 00000 PHX EQU 0 32/27 CPU 0406.000 - 00499 00001 FLP EQU 1 IPL FROM FLOPPY 0407.000 - 00500 00002 MASTER EQU 2 IPL FROM MASTER SDT 0408.000 - - 00502 * 0410.000 - 00503 * IOCD CHAIN FOR 'F' CLASS TAPE 0411.000 - 00504 * 0412.000 - 00505 P00388 BOUND 1D 0413.000 - 00506 P00388 53000000 IOCD.BKR GEN 8/X'53',24/0 BKSR 0414.000 - 00507 P0038C 40000001 GEN 8/X'40',24/1 COM.CHAIN/1 BYTE 0415.000 - 00508 P00390 02000000 IOCD.RD GEN 8/X'02',24/0 READ/ADDR X'0' 0416.000 - 00509 P00394 00000300 GEN 16/0,16/X'300' BYTE CNT (192W) 0417.000 - 00510 * 0418.000 - 00511 * IOCD CHAIN FOR IOP FLOPPY 0419.000 - 00512 * 0420.000 - 00513 P00398 37000000 IOCD.ZR GEN 8/X'37',24/0 REZERO 0421.000 - 00514 P0039C 40000000 GEN 8/X'40',24/0 COMMAND CHAIN, 0 BYTE 0422.000 - 00515 P003A0 170003B8 003B8 IOCD.SK GEN 8/X'17',24/A(SEEKINFO-MTB) BINARY SEEK 0423.000 - 00516 P003A4 40000004 GEN 8/X'40',24/4 COMMAND CHAIN, 4 BYTES0424.000 - 00517 P003A8 02000000 IOCD.RD2 GEN 8/X'02',24/0 READ, ADDRESS X'0' 0425.000 - 00518 P003AC 00000300 GEN 8/0,24/X'300' 768 BYTES (192W) 0426.000 - 00519 P003B0 00000000 IOSTAT REZ 1D IO STATUS DBLWORD 0427.000 - P003B4 00000000 - 00520 P003B8 00000006 SEEKINFO DATAW 6 SEEK INITIALIZED TO 6 0428.000 - - 00522 * 0430.000 - 00523 * ALL UNRECOVERABLE ERRORS DURING THE LOAD OPERATION 0431.000 - 00524 * BRANCH AND LINK TO THIS POINT. EMST-35 0432.000 - 00525 * R0 CONTAINS THE ABORT ADDRESS. EMST-35 0433.000 - 00526 * R4,R5 CONTAIN BOOTSTRAP FAIL MESSAGE EMST-35 0434.000 - 00527 * R6,R7 CONTAIN TYPE OF FAILURE EMST-35 0435.000 - 00528 * 0436.000 - 00529 P003BC AF0003EA 003E8 ERR.1 LD R6,ERR1.MSG-MTB BAD LOAD MODULE EMST-35 0437.000 - 00530 P003C0 EC0003D5 003D4 BU ERR.HALT-MTB EMST-35 0438.000 - 00531 P003C4 AF0006C2 006C0 ERR.2 LD R6,ERR2.MSG-MTB CHECKSUM ERROR EMST-35 0439.000 - 00532 P003C8 EC0003D5 003D4 BU ERR.HALT-MTB EMST-35 0440.000 - 00533 P003CC AF0006CA 006C8 ERR.3 LD R6,ERR3.MSG-MTB I/O STATUS ERROR EMST-35 0441.000 - 00534 P003D0 EC0003D5 003D4 BU ERR.HALT-MTB EMST-35 0442.000 - 00535 *BTERR1 EQU $ EMST-35 0443.000 - 00536 P003D4 AE0003E2 003E0 ERR.HALT LD R4,BOOT.MSG-MTB BOOTFAIL MESSAGE EMST-35 0444.000 - 00537 P003D8 0000 HALT ERROR WHILE LOADING BOOTSTRAP 0445.000 - 00538 * BU BTERR1-MTB NO RECOVERY ALLOWED EMST-35 0446.000 - 00539 P003DC EC0003D5 003D4 BU ERR.HALT-MTB NO RECOVERY ALLOWED EMST-35 0447.000 - 00540 P003E0 424F4F54 BOOT.MSG DATAD C'BOOTFAIL' EMST-35 0448.000 - P003E4 4641494C - 00541 P003E8 4C4F4144 ERR1.MSG DATAD C'LOAD MOD' EMST-35 0449.000 - P003EC 204D4F44 - 00543 * 0451.000 - 00544 * STATUS CHECK FOR 'F' CLASS I/O 0452.000 - 00545 * 0453.000 - 00546 P003F0 CK.STATF EQU $ 0454.000 - 00547 P003F0 AD000358 00358 LW R2,STAT.ADR STATUS CELLS LOC. 0455.000 - 00548 P003F4 STATF.I EQU $ SPECIAL BOOT ENTRY 0456.000 - 00549 P003F4 CA00FFD3 LI R4,X'FFD3' ALLOW CONT.END/CH END/DEVEND 0457.000 - 00550 P003F8 B3400005 00004 LMH R6,2H,X2 CK STATUS 0458.000 - 00551 P003FC F2000403 00402 BNZ STAT.RET-MTB IF ERROR ... NORMAL RETURN 0459.000 - 00552 P00400 2283 ABR R0,29 IF NO ERROR ... RETURN + 1W 0460.000 - 00553 P00402 2800 STAT.RET TRSW R0 RETURN TO CALLER 0461.000 - - 00555 * 0463.000 - 00556 * 'F' CLASS I/O ROUTINE 0464.000 - 00557 * 0465.000 - 00558 P00404 AF8006D1 006D0 DO.SIO LH R7,CH.SA-MTB LOGICAL CHANNEL/SUBCHANNEL ADDR 0466.000 - 00559 P00408 FF970000 SIO R7,0 ISSUE I/O REQUEST 0467.000 - 00560 P0040C F3000415 00414 BCF 6,WAIT-MTB IF CC3/CC4 = 0 ... WAIT 0468.000 - 00561 * BU BTERR1-MTB OTHERWISE ... ERROR EMST-35 0469.000 - 00562 P00410 F88003CD 003CC BL ERR.3-MTB OTHERWISE ... ERROR EMST-35 0470.000 - 00563 P00414 0001 WAIT WAIT WAIT FOR INTERRUPT 0471.000 - 00564 P00416 2800 TRSW R0 RETURN TO CALLER 0472.000 - - 00566 * 0474.000 - 00567 * 'F' CLASS INTERRUPT HANDLER 0475.000 - 00568 * 0476.000 - 00569 P00418 BOUND 1W 0477.000 - 00570 *HNDLR LW R7,DACI-MTB FETCH DACI INSTRUCTION SHELLEMST-35 0478.000 - 00571 P00418 AF8006D1 006D0 HNDLR LH R7,CH.SA-MTB FETCH LOGICAL CHANNEL EMST-35 0479.000 - 00572 * LH R6,CH.SA-MTB FETCH LOGICAL CHANNEL EMST-35 0480.000 - 00573 * ORR R6,R7 FORM DACI INSTRUCTION EMST-35 0481.000 - 00574 * STW R7,DACI.EXE-MTB STORE IN-LINE EMST-35 0482.000 - 00575 P0041C A3080347 00347 ABM 30,SI.BLK BUMP RETURN ADDRESS BY 1H 0483.000 - 00576 P00420 FFFF0000 DACI R7,0 DEACTIVATE CHANNEL INTERRUPT EMST-35 0484.000 - 00577 *DACI.EXE DATAW 0 DEACTIVATE CHANNEL INTERRUPTEMST-35 0485.000 - 00578 P00424 F9800344 00344 LPSD SI.BLK I/O COMPLETED 0486.000 - 00579 *DACI DACI 0,0 DACI INSTRUCTION SHELL EMST-35 0487.000 - - 00581 * 0489.000 - 00582 * READ LOAD MODULE PREAMBLE AND SAVE PARAMETERS 0490.000 - 00583 * 0491.000 - 00584 P00428 READPR EQU $ READ LOAD MODULE PREAMBLE 0492.000 - 00585 * ZMW CBLKNUM-MTB INIT CURR BLK # IN BUFFER EMST-35 0493.000 - 00586 P00428 F88005D1 005D0 BL READBL-MTB READ 1ST BLOCK OF PREAMBLE 0494.000 - 00587 P0042C AE800014 00014 LW R5,MTBUF+PR.TRAN TRANSFER ADDRESS 0495.000 - 00588 P00430 D6800670 00670 STW R5,TRAN-MTB 0496.000 - - 00590 P00434 AE800028 00028 LW R5,MTBUF+PR.ORGC CSECT LOAD ORIGIN + COMMON DELTA0498.000 - 00591 P00438 D6800674 00674 STW R5,ORGC-MTB 0499.000 - - 00593 P0043C C900FFF9 LI R2,-7 SET UP LOOP COUNT 0501.000 - 00594 P00440 0C90 ZR R1 SET UP INDEX 0502.000 - 00595 P00442 0DB0 ZR R3 SET UP ANOTHER FOR LATER EMST-35 0503.000 - 00596 P00444 PR.CSECT EQU $ 0504.000 - 00597 P00444 AEA00034 00034 LW R5,MTBUF+PR.SFAC,R1 SAVE CSECT DATA START BLOCK # 0505.000 - 00598 P00448 D6A00678 00678 STW R5,SFAC-MTB,R1 TO DSECT LOAD ORIGIN + C DELTA 0506.000 - 00599 P0044C C8810004 ADI R1,1W INCR INDEX 0507.000 - 00600 P00450 F5000445 00444 BIB R2,PR.CSECT-MTB LOOP TO GET ALL 7 PARAMETERS 0508.000 - 00601 P00454 C900FFFA LI R2,-6 SETUP NEXT LOOP COUNT 0509.000 - 00602 * ZR R1 SETUP INDEX EMST-35 0510.000 - 00603 P00458 PR.DSECT EQU $ 0511.000 - 00604 * LW R5,MTBUF+PR.SFAD,R1 SAVE DSECT DAT ST BLK # EMST-35 0512.000 - 00605 P00458 AEE00058 00058 LW R5,MTBUF+PR.SFAD,R3 SAVE DSECT DAT ST BLK # EMST-35 0513.000 - 00606 * STW R5,SFAD-MTB,R1 TO DSECT RELOC CHECKSUM EMST-35 0514.000 - 00607 P0045C D6E00698 00698 STW R5,SFAD-MTB,R3 TO DSECT RELOC CHECKSUM EMST-35 0515.000 - 00608 * ADI R1,1W INCR INDEX EMST-35 0516.000 - 00609 P00460 C9810004 ADI R3,1W INCR INDEX EMST-35 0517.000 - 00610 P00464 F5000459 00458 BIB R2,PR.DSECT-MTB LOOP TO GET ALL 6 PARAMETERS 0518.000 - 00611 * 0519.000 - 00612 * SKIP RRS BLOCK 0520.000 - 00613 * 0521.000 - 00614 P00468 F88005D1 005D0 BL READBL-MTB READ RRS BLOCK AND IGNORE IT 0522.000 - 00615 * 0523.000 - 00616 * LOAD CSECT DATA 0524.000 - 00617 * 0525.000 - 00618 P0046C LDCSEC EQU $ 0526.000 - 00619 P0046C AD80067C 0067C LW R3,DBYTEC-MTB GET CSECT DATA BYTE COUNT 0527.000 - 00620 P00470 EE0004C5 004C4 BZ LDDSEC-MTB ..IF ZERO, GO LOAD DSECT 0528.000 - 00621 * ABR R3,31 ROUND UP TO NEAREST HALFWORD EMST-35 0529.000 - 00622 * SRL R3,1 CONVERT TO HALFWORD COUNT EMST-35 0530.000 - 00623 P00474 AD000674 00674 LW R2,ORGC-MTB GET CSECT RELATIVE LOAD POINT 0531.000 - 00624 * ADMW R2,BIAS-MTB ADD BIAS TO ABSOLUTIZE LD PT EMST-35 0532.000 - 00625 * STW R2,LOADPT-MTB SAVE LOAD POINT EMST-35 0533.000 - 00626 * LW R7,CBLKNUM-MTB GET CURRENT BLOCK NUMBER EMST-35 0534.000 - 00627 P00478 F8800559 00558 BL SETUP1-MTB COMMON SETUP ROUTINE EMST-35 0535.000 - 00628 P0047C 93800678 00678 CAMW R7,SFAC-MTB AND VALIDATE 0536.000 - 00629 P00480 EE000489 00488 BEQ LDCSEC1-MTB ..OK - CONTINUE 0537.000 - 00630 * HALT ELSE HALT - BAD LOAD MODULE EMST-35 0538.000 - 00631 * BU $-1W-MTB NO RECOVERY EMST-35 0539.000 - 00632 P00484 F88003BD 003BC BL ERR.1-MTB BAD LOAD MODULE EMST-35 0540.000 - 00633 P00488 LDCSEC1 EQU $ 0541.000 - 00634 * ZMW COMPCKSM-MTB ZERO CHECKSUM ACCUMULATOR EMST-35 0542.000 - 00635 * BL DATARD-MTB READ & STORE CSECT DATA ENBH-35 0543.000 - 00636 P00488 F8800579 00578 BL COMRD-MTB READ & STORE CSECT DATA ENBH-35 0544.000 - 00637 * LW R6,COMPCKSM-MTB GET COMPUTED CHECKSUM EMST-35 0545.000 - 00638 P0048C 93000680 00680 CAMW R6,DCHECKC-MTB AND VALIDATE AGAINST PREAMBLE CKSM 0546.000 - 00639 P00490 EE000499 00498 BEQ RELCSEC-MTB ..OK - GO PROCESS RELOC MATR 0547.000 - 00640 * HALT ELSE HALT - CSECT DATA CHECKSEMST-35 0548.000 - 00641 * BU $-1W-MTB NO RECOVERY EMST-35 0549.000 - 00642 P00494 F88003C5 003C4 BL ERR.2-MTB CHECKSUM ERROR EMST-35 0550.000 - 00643 * 0551.000 - 00644 * PROCESS CSECT RELOCATION MATRIX 0552.000 - 00645 * 0553.000 - 00646 P00498 RELCSEC EQU $ 0554.000 - 00647 P00498 AD800688 00688 LW R3,RBYTEC-MTB GET RELOCATION MATRIX BYTE COUNT 0555.000 - 00648 P0049C EE0004C5 004C4 BZ LDDSEC-MTB ..IF ZERO, GO LOAD DSECT 0556.000 - 00649 * ABR R3,31 ROUND UP TO NEAREST HALFWORD EMST-35 0557.000 - 00650 * SRL R3,1 CONVERT TO HALFWORD COUNT EMST-35 0558.000 - 00651 P004A0 AD0006B0 006B0 LW R2,LOADPT-MTB INITIALIZE R2 = LOAD POINT 0559.000 - 00652 * LW R7,CBLKNUM-MTB GET CURR BLOCK NUMBER EMST-35 0560.000 - 00653 P004A4 F8800563 00562 BL SETUP2-MTB COMMON SETUP ROUTINE EMST-35 0561.000 - 00654 P004A8 93800684 00684 CAMW R7,SFACR-MTB AND VALIDATE 0562.000 - 00655 P004AC EE0004B5 004B4 BEQ RELCSEC1-MTB ..OK - CONTINUE 0563.000 - 00656 * HALT ELSE HALT - BAD LOAD MODULE EMST-35 0564.000 - 00657 * BU $-1W-MTB NO RECOVERY EMST-35 0565.000 - 00658 P004B0 F88003BD 003BC BL ERR.1-MTB BAD LOAD MODULE EMST-35 0566.000 - 00659 P004B4 RELCSEC1 EQU $ 0567.000 - 00660 * ZMW COMPCKSM-MTB ZERO CHECKSUM ACCUMULATOR EMST-35 0568.000 - 00661 * BL RELOCRD-MTB PROCESS RELOCTION MATRIX ENBH-35 0569.000 - 00662 P004B4 F8800579 00578 BL COMRD-MTB PROCESS RELOCTION MATRIX ENBH-35 0570.000 - 00663 * LW R6,COMPCKSM-MTB GET COMPUTED CHECKSUM EMST-35 0571.000 - 00664 P004B8 9300068C 0068C CAMW R6,RCHECKC-MTB VALIDATE RELOCATION CHECKSUM 0572.000 - 00665 P004BC EE0004C5 004C4 BEQ LDDSEC-MTB ..OK - GO PROCESS DSECT DATA 0573.000 - 00666 * HALT ELSE HALT - DSECT REL CKSM EREMST-35 0574.000 - 00667 * BU $-1W-MTB NO RECOVERY EMST-35 0575.000 - 00668 P004C0 F88003C5 003C4 BL ERR.2-MTB CHECKSUM ERROR EMST-35 0576.000 - 00669 * 0577.000 - 00670 * LOAD DSECT DATA 0578.000 - 00671 * 0579.000 - 00672 P004C4 LDDSEC EQU $ 0580.000 - 00673 P004C4 AD80069C 0069C LW R3,DBYTED-MTB GET DSECT DATA BYTE COUNT 0581.000 - 00674 P004C8 C9810300 ADI R3,192W ADD A BLOCK FOR DEBUG BLOCK 0582.000 - 00675 * NOT CHECKSUMMED 0583.000 - 00676 P004CC EE000521 00520 BZ LDDONE-MTB ..IF ZERO,LOAD DONE, GO EXECUTE 0584.000 - 00677 * ABR R3,31 ROUND UP TO NEAREST HALFWORD EMST-35 0585.000 - 00678 * SRL R3,1 CONVERT TO HALFWORD COUNT EMST-35 0586.000 - 00679 P004D0 AD000690 00690 LW R2,ORGD-MTB GET DSECT RELATIVE LOAD POINT 0587.000 - 00680 * ADMW R2,BIAS-MTB ADD BIAS TO ABSOLUTIZE LD PT EMST-35 0588.000 - 00681 * STW R2,LOADPT-MTB SAVE LOAD POINT EMST-35 0589.000 - 00682 * LW R7,CBLKNUM-MTB GET CURRENT BLOCK NUMBER EMST-35 0590.000 - 00683 P004D4 F8800559 00558 BL SETUP1-MTB COMMON SETUP ROUTINE EMST-35 0591.000 - 00684 P004D8 93800698 00698 CAMW R7,SFAD-MTB VALIDATE AGAINST START BLOCK # 0592.000 - 00685 P004DC EE0004E5 004E4 BEQ LDDSEC1-MTB ..OK - CONTINUE 0593.000 - 00686 * HALT ELSE HALT - BAD LOAD MODULE EMST-35 0594.000 - 00687 * BU $-1W-MTB NO RECOVERY EMST-35 0595.000 - 00688 P004E0 F88003BD 003BC BL ERR.1-MTB BAD LOAD MODULE EMST-35 0596.000 - 00689 P004E4 LDDSEC1 EQU $ 0597.000 - 00690 * ZMW COMPCKSM-MTB ZERO CHECKSUM ACCUMULATOR EMST-35 0598.000 - 00691 * BL DATARD-MTB READ & STORE DSECT DATA ENBH-35 0599.000 - 00692 P004E4 F8800579 00578 BL COMRD-MTB READ & STORE DSECT DATA ENBH-35 0600.000 - 00693 * LW R6,COMPCKSM-MTB GET COMPUTED CHECKSUM EMST-35 0601.000 - 00694 P004E8 930006A0 006A0 CAMW R6,DCHECKD-MTB AND VALIDATE AGAINST PREAMBLE CKSM 0602.000 - 00695 P004EC EE0004F5 004F4 BEQ RELDSEC-MTB ..OK - GO PROCESS RELOC MATR 0603.000 - 00696 * HALT ELSE HALT - DSECT DATA CHECKSEMST-35 0604.000 - 00697 * BU $-1W-MTB NO RECOVERY EMST-35 0605.000 - 00698 P004F0 F88003C5 003C4 BL ERR.2-MTB CHECKSUM ERROR EMST-35 0606.000 - 00699 * 0607.000 - 00700 * PROCESS DSECT RELOCATION MATRIX 0608.000 - 00701 * 0609.000 - 00702 P004F4 RELDSEC EQU $ 0610.000 - 00703 P004F4 AD8006A8 006A8 LW R3,RBYTED-MTB GET RELOCATION MATRIX BYTE COUNT 0611.000 - 00704 P004F8 EE000521 00520 BZ LDDONE-MTB ..IF ZERO,DONE, GO EXECUTE 0612.000 - 00705 * ABR R3,31 ROUND UP TO NEAREST HALFWORD EMST-35 0613.000 - 00706 * SRL R3,1 CONVERT TO HALFWORD COUNT EMST-35 0614.000 - 00707 P004FC AD0006B0 006B0 LW R2,LOADPT-MTB INITIALIZE R2=LOAD POINT 0615.000 - 00708 * LW R7,CBLKNUM-MTB GET START BLOCK NUMBER EMST-35 0616.000 - 00709 P00500 F8800563 00562 BL SETUP2-MTB COMMON SETUP ROUTINE EMST-35 0617.000 - 00710 P00504 938006A4 006A4 CAMW R7,SFADR-MTB AND VALIDATE 0618.000 - 00711 P00508 EE000511 00510 BEQ RELDSEC1-MTB ..OK - CONTINUE 0619.000 - 00712 * HALT ELSE HALT - BAD LOAD MODULE EMST-35 0620.000 - 00713 * BU $-1W-MTB NO RECOVERY EMST-35 0621.000 - 00714 P0050C F88003BD 003BC BL ERR.1-MTB BAD LOAD MODULE EMST-35 0622.000 - 00715 P00510 RELDSEC1 EQU $ 0623.000 - 00716 * ZMW COMPCKSM-MTB ZERO CHECKSUM ACCUMULATOR EMST-35 0624.000 - 00717 * BL RELOCRD-MTB PROCESS RELOCATION MATRIX ENBH-35 0625.000 - 00718 P00510 F8800579 00578 BL COMRD-MTB PROCESS RELOCATION MATRIX ENBH-35 0626.000 - 00719 * LW R6,COMPCKSM-MTB GET COMPUTED CHECKSUM EMST-35 0627.000 - 00720 P00514 930006AC 006AC CAMW R6,RCHECKD-MTB VALIDATE RELOCATION CHECKSUM 0628.000 - 00721 P00518 EE000521 00520 BEQ LDDONE-MTB ..OK - DONE, GO EXECUTE 0629.000 - 00722 * HALT ELSE HALT - DSECT REL CKSM EREMST-35 0630.000 - 00723 * BU $-1W-MTB NO RECOVERY EMST-35 0631.000 - 00724 P0051C F88003C5 003C4 BL ERR.2-MTB CHECKSUM ERROR EMST-35 0632.000 - 00725 * 0633.000 - 00726 * MODULE LOAD COMPLETE 0634.000 - 00727 * 0635.000 - 00728 P00520 LDDONE EQU $ 0636.000 - 00729 P00520 A488066E 0066E TBM FLP,SDTFLG-MTB IPL FROM FLOPPY? 0637.000 - 00730 P00524 F080053D 0053C BNS TPGO-MTB IF NOT ... BRANCH 0638.000 - 00731 P00528 AF8006B8 006B8 LW R7,CBLKNUM-MTB GET NO. OF BLOCKS READ 0639.000 - 00732 P0052C EB800380 00380 ARMW R7,NUMSKIP-MTB ADD TO BLOCK COUNT FOR 'SYSINIT' 0640.000 - 00733 * LW R2,NUMSKIP-MTB GET SKIP COUNT FOR SYSINIT ENBH-35 0641.000 - 00734 P00530 AC000380 00380 LW R0,NUMSKIP-MTB GET SKIP COUNT FOR SYSINIT ENBH-35 0642.000 - 00735 P00534 AF800570 00570 LW R7,FL.CONST-MTB GET FLOPPY CONSTANT 0643.000 - 00736 * STW R7,X'0' PUT AT ZERO EMST-35 0644.000 - 00737 * BU *C.REGS GO TO SYSINIT EMST-35 0645.000 - 00738 P00538 EC000541 00540 BU LDGO-MTB COMMON EXIT EMST-35 0646.000 - 00739 P0053C AF800574 00574 TPGO LW R7,TP.CONST-MTB GET TAPE STARTUP FLAG 0647.000 - 00740 * STW R7,X'0' PUT AT ZERO EMST-35 0648.000 - 00741 P00540 D7800000 00000 LDGO STW R7,X'0' PUT AT ZERO EMST-35 0649.000 - 00742 P00544 AC800D94 00D94 LW R1,C.CTSAD GET ADDR OF SYSINIT TSA ENBH-35 0650.000 - 00743 P00548 CC380864 00864 LFBR B0,*T.MPXBR+3W,X1 LOAD THE BASE REGS ENBH-35 0651.000 - 00744 P0054C ACA005B8 005B8 LW R1,T.REGP,X1 GET THE GPR STACK POINTER ENBH-35 0652.000 - 00745 P00550 CD200008 00008 LF R2,T.R2,X1 LOAD GPR'S 2 TO 7 ENBH-35 0653.000 - 00746 P00554 F9A00020 00020 LPSD T.PSD1,X1 HANDOFF TO SYSINIT ENBH-35 0654.000 - 00747 *IGO BU *C.REGS GO TO SYSINIT FOR INITIALIZATION 0655.000 - 00748 * EMST-35 0656.000 - 00749 * COMMON SETUP ROUTINES EMST-35 0657.000 - 00750 * EMST-35 0658.000 - 00751 P00558 B90006BC 006BC SETUP1 ADMW R2,BIAS-MTB ADD BIAS TO ABSOLUTIZE LD PT EMST-35 0659.000 - 00752 P0055C D50006B0 006B0 STW R2,LOADPT-MTB SAVE LOAD POINT EMST-35 0660.000 - 00753 P00560 18A0 SBR R2,1 FLAG FOR DATA READ ENBH-35 0661.000 - 00754 P00562 23B3 SETUP2 ABR R3,31 ROUND UP TO NEAREST HALFWORD EMST-35 0662.000 - 00755 * SRL R3,1 CONVERT TO HW COUNT EMST-35 ENBH-35 0663.000 - 00756 P00564 AF8006B8 006B8 LW R7,CBLKNUM-MTB GET CURRENT BLOCK NUMBER EMST-35 0664.000 - 00757 P00568 F80006B4 006B4 ZMW COMPCKSM-MTB ZERO CHECKSUM ACCUMULATOR EMST-35 0665.000 - 00758 P0056C 7181 SRL R3,1 CONVERT TO HW COUNT EMST-35 ENBH-35 0666.000 - 00759 P0056E 2800 TRSW R0 GO BACK TO CALLER EMST-35 0667.000 - - 00761 P00570 464C4F50 FL.CONST DATAW C'FLOP' 0669.000 - 00762 P00574 54415045 TP.CONST DATAW C'TAPE' 0670.000 - 00764 * ENBH-35 0672.000 - 00765 * DATARD - READS BLOCK OF DATA & LOADS IN MEMOENBH-35 0673.000 - 00766 * ENBH-35 0674.000 - 00767 * ENTRY: ENBH-35 0675.000 - 00768 * R2 - LOAD POINTER ENBH-35 0676.000 - 00769 * R3 - HALFWORD COUNT ENBH-35 0677.000 - 00770 * EXIT: ENBH-35 0678.000 - 00771 * COMPUTED CHECKSUM IN COMPCKSM ENBH-35 0679.000 - 00772 * AND IN R6 EMST-35 ENBH-35 0680.000 - 00773 * SPACE ENBH-35 0681.000 - 00774 *ATARD EQU $ ENBH-35 0682.000 - 00775 * TRR R0,R5 SAVE RETURN REGISTER ENBH-35 0683.000 - 00776 * TRN R3,R3 NEGATE # HALFWORDS OF DATA ENBH-35 0684.000 - 00777 *R1 EQU $ READ 192W AT A TIME ENBH-35 0685.000 - 00778 * BL READBL-MTB FETCH NEXT BLOCK OF DATA TO MTBUFENBH-35 0686.000 - 00779 * LI R1,-384H SETUP LOOP COUNTER ENBH-35 0687.000 - 00780 *R2 EQU $ ENBH-35 0688.000 - 00781 * LH R6,MTBUF+384H,R1 GET NEXT HWORD OF DATA ENBH-35 0689.000 - 00782 * ARMW R6,COMPCKSM-MTB ADD TO CHECKSUM ACCUMULATORENBH-35 0690.000 - 00783 * STH R6,0,R2 STORE HALFWORD IN MEMORY ENBH-35 0691.000 - 00784 * ADI R2,1H INCREMENT LOAD POINTER ENBH-35 0692.000 - 00785 * BIB R3,$+2W-MTB INCR HW CNT-IF NOT DONE,SKIP ENBH-35 0693.000 - 00786 * BU DRXIT-MTB ..ALL DONE - EXIT EMST-35 ENBH-35 0694.000 - 00787 * BU COMXIT-MTB ..ALL DONE - EXIT EMST-35 ENBH-35 0695.000 - 00788 * BIH R1,DR2-MTB IF NOT DONE, GET NEXT HWORDENBH-35 0696.000 - 00789 * BU DR1-MTB ELSE SETUP TO READ NEXT BLKENBH-35 0697.000 - 00790 *DRXIT EQU $ DATA ALL LOADED EMST-35 ENBH-35 0698.000 - 00791 * TRR R5,R0 RESTORE RETURN REG EMST-35 ENBH-35 0699.000 - 00792 * TRSW R0 RETURN EMST-35 ENBH-35 0700.000 - 00793 * PAGE ENBH-35 0701.000 - 00794 * ENBH-35 0702.000 - 00795 * RELOCRD - READ & PROCESS RELOCATION MATRIX ENBH-35 0703.000 - 00796 * ENBH-35 0704.000 - 00797 * ENTRY: ENBH-35 0705.000 - 00798 * R2 - LOAD POINTER ENBH-35 0706.000 - 00799 * R3 - HALFWORD COUNT OF RELOCATION DATA ENBH-35 0707.000 - 00800 * EXIT: ENBH-35 0708.000 - 00801 * COMPUTED CHECKSUM IN COMPCKSM ENBH-35 0709.000 - 00802 * ENBH-35 0710.000 - 00803 * SPACE ENBH-35 0711.000 - 00804 *ELOCRD EQU $ ENBH-35 0712.000 - 00805 * TRR R0,R5 SAVE RETURN REGISTER ENBH-35 0713.000 - 00806 * TRN R3,R3 NEGATE # HWORDS OF RELOC ENBH-35 0714.000 - 00807 * LW R4,LOADPT-MTB SET R4 = RELOCATION BIAS ENBH-35 0715.000 - 00808 *EL1 EQU $ ENBH-35 0716.000 - 00809 * BL READBL-MTB RD NXT REL BLK INTO MTBUF ENBH-35 0717.000 - 00810 * LI R1,-384H SETUP LOOP COUNTER ENBH-35 0718.000 - 00811 *EL2 EQU $ ENBH-35 0719.000 - 00812 * LI R7,-16 SETUP FOR 16 BITS ENBH-35 0720.000 - 00813 * LH R6,MTBUF+384H,R1 GET NEXT HW OF RELOC MATRIXENBH-35 0721.000 - 00814 * ARMW R6,COMPCKSM-MTB ADD TO CHECKSUM ACCUMULATORENBH-35 0722.000 - 00815 *EL3 EQU $ ENBH-35 0723.000 - 00816 * TBR R6,16 BIT SET? ENBH-35 0724.000 - 00817 * BNS $+2W-MTB NO - SKIP NEXT INSTRUCTION ENBH-35 0725.000 - 00818 * ARMW R4,0,R2 ADD BIAS TO MEMORY LOCATION ENBH-35 0726.000 - 00819 * ADI R2,1W INCREMENT LOAD POINTER ENBH-35 0727.000 - 00820 * SLL R6,1 SHIFT RELOC WORD 1 BIT LEFT ENBH-35 0728.000 - 00821 * BIB R7,REL3-MTB IF NOT DONE, TEST NEXT BIT ENBH-35 0729.000 - 00822 * BIB R3,$+2W-MTB INC HW CNT-IF NOT DONE,SKIP ENBH-35 0730.000 - 00823 * BU RELXIT-MTB ..ALL DONE - EXIT EMST-35 ENBH-35 0731.000 - 00824 * BU COMXIT-MTB ..ALL DONE - EXIT EMST-35 ENBH-35 0732.000 - 00825 * BIH R1,REL2-MTB IF NOT DONE, GET NEXT HWORD ENBH-35 0733.000 - 00826 * BU REL1-MTB ELSE READ NXT BLK OF RELOC ENBH-35 0734.000 - 00827 *RELXIT EQU $ EMST-35 ENBH-35 0735.000 - 00828 * TRR R5,R0 RESTORE RETURN REG EMST-35 ENBH-35 0736.000 - 00829 * TRSW R0 RETURN EMST-35 ENBH-35 0737.000 - 00830 * SPACE ENBH-35 0738.000 - 00831 * ENBH-35 0739.000 - 00832 * COMMON EXIT FROM READ SUBROUTINES EMST-35 ENBH-35 0740.000 - 00833 * ENBH-35 0741.000 - 00834 *OMXIT LW R6,COMPCKSM-MTB GET COMPUTED CHECKSUEMST-35 ENBH-35 0742.000 - 00835 * TRR R5,R0 RESTORE RETURN REGISEMST-35 ENBH-35 0743.000 - 00836 * TRSW R0 RETURN EMST-35 ENBH-35 0744.000 - 00838 * ENBH-35 0746.000 - 00839 * COMMON READ SUBROUTINE FOR DATA AND RELOCATION MATRIX ENBH-35 0747.000 - 00840 * ENBH-35 0748.000 - 00841 * INPUTS: R2 = LOAD POINTER ENBH-35 0749.000 - 00842 * R3 = HALFWORD COUNT ENBH-35 0750.000 - 00843 * OUTPUT: COMPUTED CHECKSUM IN COMPCKSM ENBH-35 0751.000 - 00844 * AND IN R6 ENBH-35 0752.000 - 00845 * ENBH-35 0753.000 - 00846 P00578 COMRD CEQU $ ENBH-35 0754.000 - 00847 P00578 2E80 TRR R0,R5 SAVE RETURN ADDR ENBH-35 0755.000 - 00848 P0057A 2DB4 TRN R3,R3 NEGATE # HW EXPECTED ENBH-35 0756.000 - 00849 P0057C AE0006B0 006B0 LW R4,LOADPT-MTB SET R4=RELOC BIAS ENBH-35 0757.000 - 00850 P00580 RD1 CEQU $ ENBH-35 0758.000 - 00851 P00580 F88005D1 005D0 BL READBL-MTB READ BLOCK INTO MTBUF ENBH-35 0759.000 - 00852 P00584 C880FD00 LI R1,-384H LOOP COUNTER (192 W) ENBH-35 0760.000 - 00853 P00588 RD2 CEQU $ ENBH-35 0761.000 - 00854 P00588 AF200301 00300 LH R6,MTBUF+384H,R1 GET HW FROM BUFFER ENBH-35 0762.000 - 00855 P0058C EB0006B4 006B4 ARMW R6,COMPCKSM-MTB ADD TO CHECKSUM ENBH-35 0763.000 - 00856 P00590 24A0 TBR R2,1 IS THIS A DATA READ? ENBH-35 0764.000 - 00857 P00594 F08005A5 005A4 BNS RELRD-MTB RD & PROC RELOC MATRIX ENBH-35 0765.000 - 00858 P00598 D7400001 00000 DATRD STH R6,0,R2 STORE HW IN MEMORY ENBH-35 0766.000 - 00859 P0059C C9010002 ADI R2,1H INCREMENT LOAD PTR ENBH-35 0767.000 - 00860 P005A0 EC0005BD 005BC BU COMRD2-MTB JOIN COMMON CODE ENBH-35 0768.000 - 00861 P005A4 RELRD CEQU $ ENBH-35 0769.000 - 00862 P005A4 CB80FFF0 LI R7,-16 SETUP FOR 16 BITS ENBH-35 0770.000 - 00863 P005A8 RELRD2 CEQU $ ENBH-35 0771.000 - 00864 P005A8 2462 TBR R6,16 IS BIT 16 SET? ENBH-35 0772.000 - 00865 P005AA 7341 SLL R6,1 SHIFT FOR NEXT LOOP ENBH-35 0773.000 - 00866 P005AC F08005B5 005B4 BNS SKIPADD-MTB NO, DON'T ADD BIAS ENBH-35 0774.000 - 00867 P005B0 EA400000 00000 ARMW R4,0,R2 ADD BIAS TO MEMORY LOC ENBH-35 0775.000 - 00868 P005B4 C9010004 SKIPADD ADI R2,1W INCREMENT WORD COUNT ENBH-35 0776.000 - 00869 P005B8 F78005A9 005A8 BIB R7,RELRD2-MTB TEST NEXT BIT IN HW ENBH-35 0777.000 - 00870 P005BC COMRD2 CEQU $ ENBH-35 0778.000 - 00871 P005BC F58005C9 005C8 BIB R3,NEXTHW-MTB INCR HW COUNT ENBH-35 0779.000 - 00872 P005C0 AF0006B4 006B4 LW R6,COMPCKSM-MTB EXITING - GET CKSUM ENBH-35 0780.000 - 00873 P005C4 2C50 TRR R5,R0 EXITING - GET RET ADDR ENBH-35 0781.000 - 00874 P005C6 2800 TRSW R0 GO BACK TO CALLER ENBH-35 0782.000 - 00875 P005C8 F4A00589 00588 NEXTHW BIH R1,RD2-MTB GET ANOTHER HW ENBH-35 0783.000 - 00876 P005CC EC000581 00580 BU RD1-MTB GET ANOTHER BLOCK ENBH-35 0784.000 - 00877 * 0785.000 - 00878 * READBL - READ NEXT BLOCK INTO MT BUFFER 0786.000 - 00879 * 0787.000 - - 00881 P005D0 READBL EQU $ 0789.000 - 00882 P005D0 A38806BB 006BB ABM 31,CBLKNUM-MTB INCREMENT CURRENT BLOCK NUMBER 0790.000 - 00883 * TBM EORFFLG,CLASS-MTB F CLASS? EMST-35 0791.000 - 00884 * BCT SET,READBLF-MTB IF SO ... READ VIA XIO EMST-35 0792.000 - 00885 *MTH EQU $ MAG TAPE HANDLER EMST-35 0793.000 - 00886 * LW R1,MTHTCW-MTB GET HANDLER TCW EMST-35 0794.000 - 00887 * STW R1,MTTCW-MTB STORE IN TCW LOCATION EMST-35 0795.000 - 00888 *CDREAD CD MT,MTREAD READ A BLOCK EMST-35 0796.000 - 00889 *TDREAD TD MT,X'8000' DONE? EMST-35 0797.000 - 00890 * BCT DELAY,TDREAD-MTB NO - WAIT EMST-35 0798.000 - 00891 * BCT ACTIVE,TDREAD-MTB NO - WAIT EMST-35 0799.000 - 00892 * BCT ANY,RETRY-MTB ANY ERRORS? YES - RETREMST-35 0800.000 - 00893 * TRSW R0 ELSE RETURN EMST-35 0801.000 - - 00895 P005D4 READBLF EQU $ 'F' CLASS READ 0803.000 - 00896 P005D4 DC000300 00300 STF R0,SAVEREG-MTB SAVE REGS 0804.000 - 00897 P005D8 A488066E 0066E TBM FLP,SDTFLG-MTB IPL FROM FLOPPY? 0805.000 - 00898 P005DC F080063D 0063C BNS RD.TAPE-MTB IF NOT ... READ FROM TAPE 0806.000 - 00899 P005E0 AE0003BB 003BA LH R4,SEEKINFO+1H-MTB FETCH LAST SECTOR ADDR. 0807.000 - 00900 P005E4 CA010003 ADI R4,3 3 SECTOR INCREMENTS (192W) 0808.000 - 00901 P005E8 920006D3 006D2 CAMH R4,MAXSECT-MTB IS SECTOR NO. TOO LARGE? 0809.000 - 00902 P005EC EF0005F5 005F4 BLE $+2W-MTB IF NOT ... CONTINUE 0810.000 - 00903 * BL BTERR1-MTB ERROR...HALT, R0=ABORT ADDR EMST-35 0811.000 - 00904 P005F0 F88003CD 003CC BL ERR.3-MTB ERROR...HALT EMST-35 0812.000 - 00905 P005F4 D60003BB 003BA STH R4,SEEKINFO+1H-MTB UPDATE SEEK DATA 0813.000 - 00906 P005F8 C980FFFE LI R3,-2 TWO RETRY CYCLES 0814.000 - 00907 P005FC CA80FFFB RTRY1 LI R5,RCNT RETRY 'RCNT' TIMES 0815.000 - 00908 P00600 F8800405 00404 FLP.LOOP BL DO.SIO-MTB READ BLOCK 0816.000 - 00909 P00604 F88003F1 003F0 BL CK.STATF-MTB CHECK STATUS 0817.000 - 00910 P00608 EC000611 00610 BU $+2W-MTB IF ERROR ... ATTEMPT TO RETRY 0818.000 - 00911 P0060C EC000669 00668 BU OK.TOGO-MTB READ SUCCESSFUL ... RETURN 0819.000 - 00912 P00610 F6800601 00600 BIB R5,FLP.LOOP-MTB RETRY 'RCNT' TIMES 0820.000 - 00913 P00614 F580061D 0061C BIB R3,$+2W-MTB HAVE WE REZEROED? 0821.000 - 00914 * BL BTERR1-MTB ERROR...HALT, R0=ABORT ADDR EMST-35 0822.000 - 00915 P00618 F88003CD 003CC BL ERR.3-MTB ERROR...HALT, R0=ABORT ADDR EMST-35 0823.000 - 00916 P0061C 36800398 00398 LA R5,IOCD.ZR-MTB FETCH ADDR. OF REZERO IOCD 0824.000 - 00917 P00620 D6800354 00354 STW R5,IOCLA STORE IT IN CONTROL BLOCK 0825.000 - 00918 P00624 F8800405 00404 BL DO.SIO-MTB REZERO HEADS 0826.000 - 00919 P00628 F88003F1 003F0 BL CK.STATF-MTB CHECK STATUS 0827.000 - 00920 * BL BTERR1-MTB ERROR...HALT, R0=ABORT ADDR EMST-35 0828.000 - 00921 P0062C F88003CD 003CC BL ERR.3-MTB ERROR...HALT, R0=ABORT ADDR EMST-35 0829.000 - 00922 P00630 368003A0 003A0 LA R5,IOCD.SK-MTB FETCH ADDR OF SEEK CD 0830.000 - 00923 P00634 D6800354 00354 STW R5,IOCLA RESTORE IT IN CONTROL BLOCK 0831.000 - 00924 P00638 EC0005FD 005FC BU RTRY1-MTB RETRY ONE MORE CYCLE 0832.000 - 00925 * 0833.000 - 00926 P0063C CA80FFFB RD.TAPE LI R5,RCNT LOAD RETRY COUNT 0834.000 - 00927 P00640 F8800405 00404 BL DO.SIO-MTB READ BLOCK 0835.000 - 00928 P00644 F88003F1 003F0 TAP.LOOP BL CK.STATF-MTB CHECK STATUS 0836.000 - 00929 P00648 EC000651 00650 BU $+2W-MTB ERROR ... ATTEMPT TO RETRY 0837.000 - 00930 P0064C EC000669 00668 BU OK.TOGO-MTB SUCCESSFUL READ ... RETURN 0838.000 - 00931 P00650 37800388 00388 LA R7,IOCD.BKR-MTB FETCH BACKRECORD IOCD ADDR 0839.000 - 00932 P00654 D7800354 00354 STW R7,IOCLA STORE IT IN CONTROL BLOCK 0840.000 - 00933 P00658 F8800405 00404 BL DO.SIO-MTB BACKSPACE AND READ 0841.000 - 00934 P0065C 37800390 00390 LA R7,IOCD.RD-MTB FETCH ADDR OF READ IOCD 0842.000 - 00935 P00660 D7800354 00354 STW R7,IOCLA RESTORE IT IN CONTROL BLOCK 0843.000 - 00936 P00664 F6800645 00644 BIB R5,TAP.LOOP-MTB RETRY 'RCNT' TIMES 0844.000 - 00937 P00668 OK.TOGO EQU $ NORMAL RETURN SEQUENCE 0845.000 - 00938 P00668 CC000300 00300 LF R0,SAVEREG-MTB RESTORE REGS 0846.000 - 00939 P0066C 2800 TRSW R0 RETURN TO CALLER 0847.000 - 00940 * 0848.000 - 00941 * RETRY FOR 'E' CLASS I/O 0849.000 - 00942 * 0850.000 - 00943 * BOUND 1W EMST-35 0851.000 - 00944 *RETRY HALT EMST-35 0852.000 - 00945 *CDBKSPC CD MT,BKSPCREC BACKSPACE RECORD EMST-35 0853.000 - 00946 *TDBKSPC TD MT,X'8000' DONE? EMST-35 0854.000 - 00947 * BCT DELAY,TDBKSPC-MTB NO - WAIT EMST-35 0855.000 - 00948 *RETRY1 TD MT,X'2000' EMST-35 0856.000 - 00949 * TBM 13,0 BACKSPACE IN PROGRESS? EMST-35 0857.000 - 00950 * BS RETRY1-MTB YES - TEST AGAIN EMST-35 0858.000 - 00951 * TD MT,X'8000' DONE? EMST-35 0859.000 - 00952 * BCF ANY,MTH-MTB RE-READ BLOCK IF NO ERROR ONEMST-35 0860.000 - 00953 *RETRY2 HALT ELSE HALT EMST-35 0861.000 - 00954 * BU RETRY2-MTB NO RECOVERY EMST-35 0862.000 - 00955 *SDTEND EQU $ END OF SDT LOADER EMST-35 0863.000 - 00956 * REZ X'728'+MTB-SDTEND ZERO FILL TO X'728' FOREMST-35 0864.000 - 00957 * IOCD EMST-35 0865.000 - 00959 * 0867.000 - 00960 * LOCAL BOOTSTRAP STORAGE 0868.000 - 00961 * 0869.000 - - 00963 P0066E 00 SDTFLG DATAB 0 SDT LOAD FLAGS EMST-35 0871.000 - 00964 P00670 BOUND 1D 0872.000 - 00965 P00670 00000000 TRAN DATAW 0 TRANSFER ADDRESS 0873.000 - 00966 P00674 00000000 ORGC DATAW 0 CSECT LOAD ORIGIN + COMMON DELTA 0874.000 - 00967 P00678 00000000 SFAC DATAW 0 START CSECT DATA BLOCK # 0875.000 - 00968 P0067C 00000000 DBYTEC DATAW 0 CSECT DATA BYTE COUNT 0876.000 - 00969 P00680 00000000 DCHECKC DATAW 0 CSECT DATA CHECKSUM 0877.000 - 00970 P00684 00000000 SFACR DATAW 0 START CSECT REL MATRIX BLOCK # 0878.000 - 00971 P00688 00000000 RBYTEC DATAW 0 CSECT REL BYTE COUNT 0879.000 - 00972 P0068C 00000000 RCHECKC DATAW 0 CSECT REL CHECKSUM 0880.000 - 00973 P00690 00000000 ORGD DATAW 0 DSECT LOAD ORIGIN + COMMON DELTA 0881.000 - 00974 P00694 00000000 MTTCW DATAW 0 MAG TAPE TCW LOCATION 0882.000 - 00975 P00698 00000000 SFAD DATAW 0 START DSECT DATA BLOCK # 0883.000 - 00976 P0069C 00000000 DBYTED DATAW 0 DSECT DATA BYTE COUNT 0884.000 - 00977 P006A0 00000000 DCHECKD DATAW 0 DSECT DATA CHECKSUM 0885.000 - 00978 P006A4 00000000 SFADR DATAW 0 START DSECT REL MATRIX BLOCK # 0886.000 - 00979 P006A8 00000000 RBYTED DATAW 0 DSECT REL BYTE COUNT 0887.000 - 00980 P006AC 00000000 RCHECKD DATAW 0 DSECT REL CHECKSUM 0888.000 - 00981 P006B0 00000000 LOADPT DATAW 0 MEMORY LOAD POINTER 0889.000 - 00982 P006B4 00000000 COMPCKSM DATAW 0 CHECKSUM ACCUMULATOR 0890.000 - 00983 P006B8 00000000 CBLKNUM DATAW 0 CURRENT BLOCK NUMBER 0891.000 - 00984 *WORDMASK DATAW X'7FFFC' WORD MASK EMST-35 0892.000 - 00985 P006BC 00000000 BIAS DATAW 0 BIAS SUPPLIED IN R3 AT IPL 0893.000 - 00986 P006C0 43484543 ERR2.MSG DATAD C'CHECKSUM' EMST-35 0894.000 - P006C4 4B53554D - 00987 P006C8 494F2045 ERR3.MSG DATAD C'IO ERROR' EMST-35 0895.000 - P006CC 52524F52 - 00988 P006D0 1000 CH.SA DATAH X'1000' LOG CH & PHYS SUBAD (INSRT) EMST-35 0896.000 - 00989 P006D2 0000 MAXSECT DATAH 0 MAX START SECT FOR FLOPPY EMST-35 0897.000 - 00990 P006D4 ORG MTTCW+X'40' SI LOC IS 40B FROM TCW 0898.000 - 00991 P006D4 000006D4 MT.ICB DATAW $-MTB ICB POINTS TO ITSELF 0899.000 - 00992 P006D8 00000000 DATAW 0 OLD PSD2 0900.000 - 00993 P006DC 800001F8 001F8 GEN 1/1,31/A(INT.RET-MTB) NEW PSD 0901.000 - 00994 P006E0 00004000 DATAW X'4000' INTERRUPTS BLOCKED 0902.000 - 00995 P006E4 00000000 DATAW 0,0 REST OF ICB 0903.000 - P006E8 00000000 - 00996 P006EC BOOTEND EQU $ 0904.000 - 00997 006EC BOOTLEN EQU BOOTEND-MTB # OF BYTES IN BOOTSTRAP LOADER 0905.000 - 00998 * 0906.000 - 00999 * END OF BOOTSTRAP 0907.000 - 01000 * 0908.000 - 01001 P006EC 000006EC BOOTL DATAW BOOTLEN # BYTES IN BOOTSTRAP 0909.000 - 01002 P006F0 END 0910.000 -* 0000 ERRORS IN FUPBOOT diff --git a/SEL32/tests/testcode0.mem b/SEL32/tests/testcode0.mem deleted file mode 100644 index 683cb3123db5bd48192c72f7e54e0ae5ee75bf44..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1776 zcmd^AU1*zC7=F$<`A$=?bAySw5x!|IB5Y+BTek}XiEY*unx(49g^Ud6_zX*gHQv|olm)o}(QfoIA7~k38~fHVn-MPO?=~FvhdFL=H*-fh zHpBAsh0OZA@h%c`%st3BRU?%ukgnYOmA_gWWSx8#pJ~aQtI2t&RLb2f zt`#9Zb)l+^Uo`PcgM9~{vwM>RJLA#r{i(rZ%-DVLXs@{xGC%i+vLk$dCm|-;CHxS- zc_B4!?4zD>AMaiRO6zBq?Rk=c(|x>ST=uamSseRGD{{BR?$Brj@@=%A%XxzLQfwc^udi-PvMXuMzN5Jp! zJ!0wFB|v{+or#mxj$=iTXSDvd&>rH&cqGZd$U%U zztO~PQj~+DB3Z{=SW(8ISpss@aqh-m|I0bYnwYlXUv*%A1wC1X9uGKATr|0L=u2;; zL)h1!NT#C6SSRhcRNy%8wK7F(DB4QgW=_z7TqJ93HUd!+<_@i^-%?{S_|ltE_Fujg z;dd+G`;)BCSI8hkus&jRo-=lX q_Y`VX?th5g`(xeD9C|k1m#||41Brq4R%Ln>4}z$B|6#2KwfheMjmlR5 diff --git a/SEL32/tests/testcpu.l b/SEL32/tests/testcpu.l deleted file mode 100644 index 5519bf1..0000000 --- a/SEL32/tests/testcpu.l +++ /dev/null @@ -1,25 +0,0 @@ - 00001 00000 ABS - 00002 P00000 DSECT - 00003 P00000 ORG 0 - 00004 P00000 START EQU $ - 00005 P00000 0002 NOP - 00006 P00002 0002 NOP - 00007 P00004 0103 LCS 2 - 00008 P00006 0289 RDSTS 5 - 00009 P00008 0006 BEI - 00010 P0000A 0007 UEI - 00011 P0000C F9800020 P00020 LPSD L20 - 00012 P00010 AC800004 00004 LW 1,4 - 00013 P00014 AD000009 00008 LH 2,8 - 00014 P00018 AF000022 P00020 LD 6,L20 - 00015 P0001C EC000029 P00028 BU GON - 00016 P00020 BOUND 1D - 00017 P00020 80000010 L20 DATAW X'80000010' - 00018 P00024 00004000 DATAW X'00004000' - 00019 P00028 CA0000FF GON LI 4,X'FF' - 00020 P0002C D6000100 00100 STW 4,X'100' - 00021 P00030 D6000103 00102 STH 4,X'102' - 00022 P00034 D700010A 00108 STD 6,X'108' - 00023 P00038 EC000001 P00000 BU START - 00024 P0003C P00000 END START -* 0000 ERRORS IN MAIN diff --git a/SEL32/tests/testcpu.s b/SEL32/tests/testcpu.s deleted file mode 100644 index 3e3a38b..0000000 --- a/SEL32/tests/testcpu.s +++ /dev/null @@ -1,24 +0,0 @@ - ABS - DSECT - ORG 0 -START EQU $ - NOP - NOP - LCS 2 - RDSTS 5 - BEI - UEI - LPSD L20 - LW 1,4 - LH 2,8 - LD 6,L20 - BU GON - BOUND 1D -L20 DATAW X'80000010' - DATAW X'00004000' -GON LI 4,X'FF' - STW 4,X'100' - STH 4,X'102' - STD 6,X'108' - BU START - END START diff --git a/SEL32/util/makecode.c b/SEL32/util/makecode.c deleted file mode 100644 index 011ba74..0000000 --- a/SEL32/util/makecode.c +++ /dev/null @@ -1,2298 +0,0 @@ -/* - * makecode.c - * - * This program uncompresses an MPX compressed object file and - * dumps the object records into a file named "testcode.mem" - * as absolute data. This code can then be loaded into the - * sel32 simulator using the "load testcode.mem" command. The - * assembler code must be assembled as asbolute code with - * origin at 0. - * - * input - stdin or specified file name - * output - file testcode.mem in local directory. - * - */ - -#include -#include -#include -#include -#include - -//#undef DOTRACE -#define DOTRACE - -//#define JUNK -#ifdef JUNK -//#define QUIET -//#define QUIET1 -//#define QUIET8 -#endif - -#define uint32 unsigned int -#define int32 int -void codedump(int sect); -int rbl(unsigned char *buf, int n); -void putloi(unsigned char *s, int cnt); -int getloi(unsigned char *s, int lim); -int rmopen(int cfcb); -int rmclose(int cfcb); -int rmread(int cfcb, unsigned char *buffer); - -int binary = 1; -int dounix; /* set if doing unix object */ -int first; /* set after 1st time */ -int ifd; /* input file number */ - -int main(int argc, char *argv[]) -{ - unsigned char s[BUFSIZ]; - int i; - -#ifndef JUNK - setbuf(stdout, 0); -#endif - - if (argc == 1) - { /* no file given, use stdin */ - ifd = fileno(stdin); - } - else - { - if ((ifd = open(*++argv, O_RDWR)) < 0) - { - fprintf(stderr, "file %s not found\n", *argv); - exit(1); - } - } - - while (1) - { - memset(s, '\0', BUFSIZ); - if ((i = rbl(s, (int)BUFSIZ)) <= 0) - exit(0); - s[i] = '\0'; - putloi(s, i); - } -} - -/* get a line of input. */ - -int getloi(s, lim) /* right from the book. */ -unsigned char s[]; -int lim; -{ - int c, i, j; - - j = rmread(ifd, s); - if (j <= 0) - return (0); - if (!binary) - { - s[j] = '\n'; - for (i = 0; --lim > 0 && i < j;) - { - c = s[i]; - - s[i++] = c; - if ((*s != 0xbf) && (*s != 0x9f)) - { - if (c == '\n') - { - if ((s[i - 1] == '\n') && (i > 1)) - { - while ((s[i - 2] == ' ') && (i > 1)) - --i; - s[i - 1] = '\n'; - } - s[i] = '\0'; - return (i); - } - } - } - return (i); - } - return (j); -} - -int com_org[256]; /* common origin */ -int com_size[256]; /* common size (mod 32 bytes) */ -int com_base[256]; /* common base address in dsect */ -int last_ds; /* endi of last common defined */ -/* com_addr is always dsect sect_addr */ -char comname[8]; /* name of common, blank filled */ -int sect_org[256]; /* sect origin */ -int sect_size[256]; /* sect size */ -int sect_base[256]; /* sect base */ -unsigned char *sect_addr[256]; /* sect address */ -int curr_sect; /* current section */ -int doem; /* 1st time flag */ -#define MEM_SIZE 0x40000 /* 256k memory */ - /*#define MEM_START 0x20000*//* where to start */ -#define MEM_START 0x00000 /* where to start */ -unsigned char *sa; - -struct dpr { /* datapool reference table */ - char name[8]; /* datapool item name */ - unsigned int refa; /* address of reference */ -}; - -#define DP_SIZE 100 /* datapool reference size */ -int ndpr; -int dp_size; /* # allocated */ -struct dpr *datapool; /* enough for 100 references */ - -struct extr { /* external reference table */ - char name[8]; /* item name */ - unsigned int refa; /* address of reference */ - unsigned int sba; /* string back to next reference */ -}; - -#define EXT_SIZE 100 /* external reference size */ -int nextr; -int ext_size; /* # allocated */ -struct extr *external; /* enough for 100 references */ - -struct defr { /* definition reference table */ - char name[8]; /* item name */ - unsigned int refa; /* address of reference */ -}; - -#define DEF_SIZE 100 /* external definition size */ -int ndefr; -int def_size; /* # allocated */ -struct defr *defined; /* enough for 100 references */ - -unsigned int endaddr; /* end transfer address, if given */ - -/* - ** output line of text from the source - */ -void putloi(unsigned char *s, int cnt) -{ - int i, j, k, l; - int seq; - int bc = s[1]; - int type, objcnt, repeat, bound; - int exttype, offset; - int temp1, temp2; - struct dpr *pdpp; - struct extr *pextp; - struct defr *pdefp; - - if (!doem) - { - temp1 = MEM_SIZE; - curr_sect = 0; /* dsect */ - sect_base[curr_sect] = MEM_START; /* assume dsect start */ - sect_org[curr_sect] = 0; /* origin */ -#ifdef NOT_NOW - sect_size[curr_sect] = MEM_SIZE; /* size */ -#endif - /* get area momory */ - sect_addr[curr_sect] = (unsigned char *)calloc(MEM_SIZE, 1); - - /* get datapool ref storage */ - datapool = (struct dpr *)calloc(DP_SIZE, sizeof(struct dpr)); - dp_size = DP_SIZE; /* # allocated */ - ndpr = 0; /* no ref yet */ - - /* get external ref storage */ - external = (struct extr *)calloc(EXT_SIZE, sizeof(struct extr)); - ext_size = EXT_SIZE; /* # allocated */ - nextr = 0; /* no ref yet */ - - /* get external def storage */ - defined = (struct defr *)calloc(DEF_SIZE, sizeof(struct defr)); - def_size = DEF_SIZE; /* # allocated */ - ndefr = 0; /* no ref yet */ - - doem = 1; - } -/* if(*s == 0xdf)printf("**last record\n"); */ - seq = s[4] << 8 | s[5]; -#ifdef QUIET - fprintf(stderr, "**record %x cnt %d\n", seq, bc); -#endif - offset = 6; - doit: - if (offset >= bc + 6) - return; - type = (s[offset] >> 4) & 0x0f; /* get object record type */ - objcnt = s[offset] & 0x0f; /* get object record count */ - if (objcnt == 0) - objcnt = 16; /* zero cnt means 16 */ - - switch (type) - { - case 0: /* absolute data */ - sa = sect_addr[curr_sect]; /* address of section */ -#ifdef QUIET - fprintf(stderr, "addr %x abs data cnt = %d data = ", - sect_org[curr_sect] + sect_base[curr_sect], objcnt); -#endif - for (k = 0; k < objcnt; k++) - { -#ifdef QUIET - if (k > 0 && (k % 4 == 0)) - printf(" "); - fprintf(stderr, "%.2x", s[k + offset + 1]); -#endif - /* put data in memory */ - sa[sect_org[curr_sect]++] = s[k + offset + 1]; - } - if (!first) - { - first = 1; /* we been here */ - type = 0; - for (k = 0; k < 4; k++) - { - type |= (s[k + offset + 1] << ((3 - k) * 8)); - } - if (type == 0x2243223a) - dounix = 1; /* doing c object */ - } -#ifdef QUIET - fprintf(stderr, "\n"); -#endif - offset += (objcnt + 1); - break; - - case 1: /* program origin */ -#ifdef QUIET8 - fprintf(stderr, "%s program origin addr = ", (s[offset + 1] & 0x80) ? "rel" : "abs"); -#endif - s[offset + 1] &= 0x7f; /* turn off rel bit */ - temp1 = 0; /* clear for new org */ - for (k = 0; k < objcnt; k++) - { -#ifdef QUIET8 - fprintf(stderr, "%.2x", s[k + offset + 1]); -#endif - temp1 = (temp1 << 8) | s[offset + 1 + k]; - } -#ifdef QUIET8 - fprintf(stderr, "\n"); -#endif - sect_org[curr_sect] = temp1; /* set new origin */ - offset += (objcnt + 1); - break; - - case 2: /* absolute data repeat */ -#ifdef OLD_JUNK - fprintf(stderr, "DUMP abs data repeat cnt = %d\n", objcnt); - for (k = 0; k < objcnt + 1; k++) - { - if (k > 0 && (k % 20 == 0)) - fprintf(stderr, "\n"); - fprintf(stderr, "%.2x ", s[offset + k]); - } - fprintf(stderr, "\n"); -#endif - sa = sect_addr[curr_sect]; /* address of section */ - repeat = s[offset + 1]; - if (repeat == 0) - repeat = 1; -#ifdef QUIET - fprintf(stderr, "abs data repeat cnt = %d\n", repeat); -#endif - for (i = 0; i < repeat; i++) - { - for (k = 0; k < objcnt - 1; k++) - { -#ifdef QUIET - fprintf(stderr, "%.2x ", s[k + offset + 2]); -#endif - /* put data in memory */ - sa[sect_org[curr_sect]++] = s[k + offset + 2]; - } - } -#ifdef QUIET - fprintf(stderr, "\n"); -#endif - offset += (objcnt + 1); - break; - - case 3: /* transfer address */ -#ifdef OLD_JUNK - fprintf(stderr, "DUMP transfer address cnt = %d\n", objcnt); - for (k = 0; k < objcnt + 1; k++) - { - if (k > 0 && (k % 20 == 0)) - fprintf(stderr, "\n"); - fprintf(stderr, "%.2x ", s[offset + k]); - } - fprintf(stderr, "\n"); -#endif -#ifdef QUIET - fprintf(stderr, "transfer address cnt = %d addr = ", objcnt); -#endif - temp1 = 0; - s[offset + 1] &= 0x7f; /* turn off rel bit */ - for (k = 0; k < objcnt; k++) - { - temp1 = (temp1 << 8) | s[k + offset + 1]; -#ifdef QUIET - fprintf(stderr, "%.2x", s[k + offset + 1]); -#endif - } - temp1 += sect_base[curr_sect]; - endaddr = temp1; -#ifdef QUIET - fprintf(stderr, "\n"); -#endif - offset += (objcnt + 1); - break; - - case 4: /* relocatable data */ - sa = sect_addr[curr_sect]; /* address of section */ -#ifdef QUIET - fprintf(stderr, "addr %x rel data cnt = %d data = ", - sect_org[curr_sect] + sect_base[curr_sect], objcnt); -#endif - for (k = 0; k < objcnt; k++) - { - if (k == 0) - temp1 = 0; - temp1 = (temp1 << 8) | s[offset + 1 + k]; - if (k > 0 && (k % 4 == 3)) - { - temp1 += sect_base[curr_sect]; -#ifdef QUIET - fprintf(stderr, "%.8x", temp1); - fprintf(stderr, " "); -#endif - /* put data in memory */ - for (i = 0; i < 4; i++) - sa[sect_org[curr_sect]++] = (temp1 >> ((3 - i) * 8)) & 0xff; - temp1 = 0; - } - } -#ifdef QUIET - fprintf(stderr, "\n"); -#endif - offset += (objcnt + 1); - break; - - case 5: /* program name */ - bound = s[offset + 1 + objcnt - 1]; - repeat = s[offset + 1 + objcnt - 2]; - /* see if 'C' object */ - if (repeat == 0x04) - dounix = 1; /* doing c object */ -#ifdef JUNK - fprintf(stderr, "program name = "); -#endif -#ifdef QUIET9 - fprintf(stderr, " PROGRAM "); - for (k = 0; k < objcnt - 3; k++) - { - fprintf(stderr, "%c", s[k + offset + 1]); - } - fprintf(stderr, "\n"); -#endif -#ifdef QUIET1 - fprintf(stderr, " bound = %x obj type = %x", bound, repeat); - fprintf(stderr, "\n"); -#endif - offset += (objcnt + 1); - break; - - case 6: /* relocatable data repeat */ - sa = sect_addr[curr_sect]; /* address of section */ - repeat = s[offset + 1]; - if (repeat == 0) - repeat = 1; -#ifdef QUIET - fprintf(stderr, "rel data repeat cnt = %d\n", repeat); -#endif - for (j = 0; j < repeat; j++) - { - for (k = 0; k < objcnt - 1; k++) - { - if (k == 0) - temp1 = 0; - temp1 = (temp1 << 8) | s[offset + 2 + k]; - if (k > 0 && (k % 4 == 3)) - { - temp1 += sect_base[curr_sect]; -#ifdef QUIET - fprintf(stderr, "%.8x", temp1); - fprintf(stderr, " "); -#endif - /* put data in memory */ - for (i = 0; i < 4; i++) - sa[sect_org[curr_sect]++] = (temp1 >> ((3 - i) * 8)) & 0xff; - temp1 = 0; - } - } - } -#ifdef QUIET - fprintf(stderr, "\n"); -#endif - offset += (objcnt + 1); - break; - - case 7: /* external definition */ -#ifdef JUNK - fprintf(stderr, "%s external def name = ", (s[offset + 1 + objcnt - 3] & 0x80) ? "rel" : "abs"); -#endif - s[offset + 1 + objcnt - 3] &= 0x7f; /* turn off rel bit */ - bound = s[offset + 1 + objcnt - 3] << 16 | s[offset + 1 + objcnt - 2] << 8 | s[offset + 1 + objcnt - 1]; - if (ndefr >= def_size) - { /* we need to resize */ - defined = (struct defr *)realloc((void *)defined, (def_size + 10) * sizeof(struct defr)); - def_size += 10; /* 10 more */ - } - pdefp = &defined[ndefr]; /* ref data address */ -#ifdef QUIET9 - fprintf(stderr, " DEF "); - memset(pdefp->name, ' ', 8); /* blank name buffer */ - for (k = 0; k < objcnt - 3; k++) - { - fprintf(stderr, "%c", s[k + offset + 1]); - pdefp->name[k] = s[k + offset + 1]; - } -#endif - pdefp->refa = bound + sect_base[curr_sect]; - ndefr++; /* next reference */ -#ifdef JUNK - fprintf(stderr, " address = %x", bound); -#endif -#ifdef QUIET9 - fprintf(stderr, "\n"); -#endif - offset += (objcnt + 1); - break; - - case 8: /* forward reference */ -#ifdef QUIET9 - fprintf(stderr, "%s forward reference addr = ", (s[offset + 1] & 0x80) ? "rel" : "abs"); -#endif - s[offset + 1] &= 0x7f; /* turn off rel bit */ -#ifdef QUIET9 - for (k = 0; k < objcnt - 3; k++) - { - fprintf(stderr, "%.2x", s[k + offset + 1]); - } - fprintf(stderr, " sb addr = "); - for (k = 3; k < objcnt; k++) - { - fprintf(stderr, "%.2x", s[k + offset + 1]); - } - fprintf(stderr, "\n"); -#endif - offset += (objcnt + 1); - break; - - case 9: /* external reference */ -#ifdef JUNK - fprintf(stderr, "%s external ref name = ", (s[offset + 1 + objcnt - 3] & 0x80) ? "rel" : "abs"); -#endif - s[offset + 1 + objcnt - 3] &= 0x7f; /* turn off rel bit */ - bound = s[offset + 1 + objcnt - 3] << 16 | s[offset + 1 + objcnt - 2] << 8 | s[offset + 1 + objcnt - 1]; - if (nextr >= ext_size) - { /* we need to resize */ - external = (struct extr *)realloc((void *)external, (ext_size + 10) * sizeof(struct extr)); - ext_size += 10; /* 10 more */ - } - pextp = &external[nextr]; /* ref data address */ -#ifndef QUIET9 - fprintf(stderr, " EXT "); - memset(pextp->name, ' ', 8); /* blank name buffer */ - for (k = 0; k < objcnt - 3; k++) - { - fprintf(stderr, "%c", s[k + offset + 1]); - pextp->name[k] = s[k + offset + 1]; - } -#endif - pextp->refa = sect_org[curr_sect] + sect_base[curr_sect]; - pextp->sba = bound + sect_base[curr_sect]; - nextr++; /* next reference */ -#ifdef JUNK - fprintf(stderr, " sb addr = %x", bound); -#endif -#ifdef QUIET9 - fprintf(stderr, "\n"); -#endif - offset += (objcnt + 1); - break; - - case 10: /* common definition */ -#ifdef QUIET9 - fprintf(stderr, "common def name = "); -#endif - /* get common block number */ - repeat = s[offset + 1 + objcnt - 3]; - /* get common size */ - bound = s[offset + 1 + objcnt - 2] << 8 | s[offset + 1 + objcnt - 1]; -#ifdef QUIET9 - for (k = 0; k < objcnt - 3; k++) - { - fprintf(stderr, "%c", s[k + offset + 1]); - } - fprintf(stderr, " block = %d size = %x\n", repeat, bound); -#endif - offset += (objcnt + 1); - break; - - case 11: /* common reference */ - /* get common block number */ - i = s[offset + 1]; /* block number */ - sa = sect_addr[0]; /* address in dsect */ -#ifdef QUIET8 - fprintf(stderr, "common ref block = %d cnt %d data = ", i, objcnt - 1); -#endif - for (k = 0; k < objcnt - 1; k++) - { - if (k == 0) - temp1 = 0; - temp1 = (temp1 << 8) | s[offset + 2 + k]; - if (k > 0 && (k % 4 == 3)) - { -#ifdef QUIET8 - fprintf(stderr, "%.8x", temp1); - fprintf(stderr, " "); -#endif - temp1 += com_base[i] + sect_base[0]; -#ifdef QUIET8 - fprintf(stderr, "(%.8x)", temp1); - fprintf(stderr, " "); -#endif - /* put data in memory */ - for (j = 0; j < 4; j++) - sa[sect_org[curr_sect]++] = (temp1 >> ((3 - j) * 8)) & 0xff; - temp1 = 0; -#ifdef QUIET8 - if (k > 0 && (k % 20 == 0)) - fprintf(stderr, "\n"); -#endif - } - } -#ifdef QUIET8 - if (k % 20 != 0) - fprintf(stderr, "\n"); -#endif - offset += (objcnt + 1); - break; - - case 12: /* datapool reference */ - sa = sect_addr[curr_sect]; /* address of section */ -#ifdef JUNK - fprintf(stderr, "datapool ref number %d size %d\n", ndpr, dp_size); -#endif - fprintf(stderr, "DATAPOOL COMMON "); - if (ndpr >= dp_size) - { /* we need to resize */ - datapool = (struct dpr *)realloc((void *)datapool, (dp_size + 10) * sizeof(struct dpr)); - dp_size += 10; /* 10 more */ - } - pdpp = &datapool[ndpr]; /* ref data address */ - memset(pdpp->name, ' ', 8); /* blank name buffer */ - for (k = 0; k < objcnt - 4; k++) - { - fprintf(stderr, "%c", s[k + offset + 1]); - pdpp->name[k] = s[k + offset + 1]; - } - pdpp->refa = sect_org[curr_sect] + sect_base[curr_sect]; - ndpr++; /* next reference */ -#ifdef JUNK - fprintf(stderr, " at %x addr = ", sect_org[curr_sect] + sect_base[curr_sect]); -#endif - for (k = 0; k < 4; k++) - { - if (k == 0) - temp1 = 0; - temp1 = (temp1 << 8) | s[k + offset + objcnt + 1 - 4]; - if (k > 0 && (k % 4 == 3)) - { -/* temp1 += sect_base[curr_sect]; */ - /* put data in memory */ - for (i = 0; i < 4; i++) - sa[sect_org[curr_sect]++] = (temp1 >> ((3 - i) * 8)) & 0xff; - temp1 = 0; - } -#ifdef JUNK - fprintf(stderr, "%.2x", s[k + offset + objcnt + 1 - 4]); -#endif - } - fprintf(stderr, "\n"); - offset += (objcnt + 1); - break; - - case 13: /* escape to extended functions */ - objcnt = s[offset] & 0x0f; /* get sub type */ - exttype = s[offset + 1]; /* get ext type */ - - switch (exttype) - { - case 0: /* undefined */ - for (k = 0; k < s[offset + 2]; k++) - { - if (k > 0 && (k % 20 == 0)) - fprintf(stderr, "\n"); - fprintf(stderr, "%.2x ", s[offset + k]); - } - fprintf(stderr, "\n"); - offset += s[offset + 2]; - break; - - case 1: /* section definition */ -#ifdef QUIET8 - fprintf(stderr, "section def bound = %x num = %d size = ", s[offset + 3], s[offset + 4]); - temp1 = 0; - for (k = 0; k < 3; k++) - { - fprintf(stderr, "%.2x", s[offset + 5 + k]); - temp1 = (temp1 << 8) | s[offset + 5 + k]; - } - fprintf(stderr, " name = "); - for (k = 0; k < 8; k++) - { - fprintf(stderr, "%c", s[offset + 8 + k]); - } - fprintf(stderr, "\n"); -#endif - curr_sect = s[offset + 4]; /* sect # */ - if (curr_sect == 0) - sect_base[curr_sect] = 0x20000; /* assume dsect start */ - if (curr_sect == 1) - { - /* assume csect start */ - temp2 = (temp1 / 0x2000) + 1; /* mod page size */ - sect_base[curr_sect] = 0x80000 - (temp2 * 0x2000); - } - sect_org[curr_sect] = 0; /* origin */ - - temp2 = sect_size[curr_sect]; /* get old size */ - if (temp2 == 0 && curr_sect == 0) - temp2 = MEM_SIZE; /* initial allocation */ - sect_size[curr_sect] = temp1; /* new size */ - /* get area momory */ - if (sect_addr[curr_sect]) - { /* if we got one */ - /* resize */ - sect_addr[curr_sect] = (unsigned char *)realloc((void *)sect_addr[curr_sect], temp1); - /* clear new memory */ - if ((temp1 - temp2) > 0) - memset(sect_addr[curr_sect] + temp2, 0, temp1 - temp2); - } - else /* get a new one */ - sect_addr[curr_sect] = (unsigned char *)calloc(temp1, 1); - - offset += s[offset + 2]; - break; - - case 2: /* section origin */ -#ifdef QUIET8 - fprintf(stderr, "section origin bound = %x sect %s origin = ", - s[offset + 3], s[offset + 4] == 0 ? "DSECT" : s[offset + 4] == 1 ? "CSECT" : "UNKNOWN"); - temp1 = 0; - for (k = 0; k < 3; k++) - { - fprintf(stderr, "%.2x", s[offset + 5 + k]); - temp1 = (temp1 << 8) | s[offset + 5 + k]; - } - fprintf(stderr, "\n"); -#endif - curr_sect = s[offset + 4]; /* sect # */ - sect_org[curr_sect] = temp1; /* origin */ - offset += s[offset + 2]; - break; - - case 3: /* section relocatable ref */ - repeat = s[offset + 5]; - sa = sect_addr[curr_sect]; /* address of section */ - if (repeat == 0) - repeat = 1; /* 0 is 1 */ -#ifdef QUIET - fprintf(stderr, "addr %x sect rel ref %s rep cnt = %d data = ", - sect_org[curr_sect] + sect_base[curr_sect], - s[offset + 4] == 0 ? "DSECT" : s[offset + 4] == 1 ? "CSECT" : "UNKNOWN", repeat); -#endif - for (k = 0; k < (s[offset + 2] - 6); k++) - { - if (k == 0) - temp1 = 0; - temp1 = (temp1 << 8) | s[offset + 6 + k]; - if (k > 0 && (k % 4 == 3)) - { - temp1 += sect_base[s[offset + 4]]; -#ifdef QUIET - fprintf(stderr, "%.8x", temp1); - fprintf(stderr, " "); -#endif - /* put data in memory */ - for (i = 0; i < 4; i++) - sa[sect_org[curr_sect]++] = (temp1 >> ((3 - i) * 8)) & 0xff; - temp1 = 0; - } -#ifdef QUIET - if (k > 0 && (k % 20 == 0)) - fprintf(stderr, "\n"); -#endif - } -#ifdef QUIET - if (k % 20 != 0) - fprintf(stderr, "\n"); -#endif - offset += s[offset + 2]; - break; - - case 4: /* section transfer address */ -#ifdef QUIET - fprintf(stderr, "section transfer address num = %d address = ", s[offset + 4]); - for (k = 0; k < 3; k++) - { - fprintf(stderr, "%.2x", s[offset + 5 + k]); - } - fprintf(stderr, "\n"); -#endif - offset += s[offset + 2]; - break; - - case 5: /* section external def */ -#ifdef QUIET - fprintf(stderr, "sect ext def num = %d address = ", s[offset + 4]); - for (k = 0; k < 3; k++) - { - fprintf(stderr, "%.2x", s[offset + 5 + k]); - } - fprintf(stderr, " name = "); - for (k = 0; k < s[offset + 2] - 8; k++) - { - fprintf(stderr, "%c", s[offset + 8 + k]); - } - fprintf(stderr, "\n"); -#endif - offset += s[offset + 2]; - break; - - case 6: /* section external ref */ -#ifdef QUIET - fprintf(stderr, "section ext ref num = %d sb address = ", s[offset + 4]); - for (k = 0; k < 3; k++) - { - fprintf(stderr, "%.2x", s[offset + 5 + k]); - } - fprintf(stderr, " name = "); - for (k = 0; k < s[offset + 2] - 8; k++) - { - fprintf(stderr, "%c", s[offset + 8 + k]); - } - fprintf(stderr, "\n"); -#endif - offset += s[offset + 2]; - break; - - case 7: /* section forward ref */ -#ifdef QUIET - fprintf(stderr, "sect forward ref num = %d address = ", s[offset + 4]); - for (k = 0; k < 3; k++) - { - fprintf(stderr, "%.2x", s[offset + 5 + k]); - } - fprintf(stderr, " num = %d sb addr = ", s[offset + 8]); - for (k = 0; k < 3; k++) - { - fprintf(stderr, "%.2x", s[offset + 9 + k]); - } - fprintf(stderr, "\n"); -#endif - offset += s[offset + 2]; - break; - - case 8: /* large common def */ -#ifdef QUIET8 - fprintf(stderr, "large com def num = %d sb size = ", s[offset + 4]); -#endif - i = s[offset + 4]; /* common number */ - temp1 = 0; /* size of common */ - for (k = 0; k < 3; k++) - { -#ifdef QUIET8 - fprintf(stderr, "%.2x", s[offset + 5 + k]); -#endif - temp1 = (temp1 << 8) | s[offset + 5 + k]; - } - /* common is on 32 byte boundry and mod 32 bytes */ - /* set dsect origin mod 32 bytes */ - sect_org[0] = (sect_org[0] + 31) & ~31; - com_base[i] = sect_org[0]; /* addr of common in dsect */ - com_org[i] = 0; /* curr origin in common */ - com_size[i] = temp1; /* common size */ -#ifdef QUIET8 - fprintf(stderr, " org %x base %x", com_org[i], com_base[i]); - fprintf(stderr, " name = "); -#endif - memset(comname, ' ', 8); /* blank name buffer */ - if (ndefr >= def_size) - { /* we need to resize */ - defined = (struct defr *)realloc((void *)defined, (def_size + 10) * sizeof(struct defr)); - def_size += 10; /* 10 more */ - } - pdefp = &defined[ndefr]; /* ref data address */ - /* copy in common name */ - memset(pdefp->name, ' ', 8); /* blank name buffer */ - for (k = 0; k < s[offset + 2] - 8; k++) - { - comname[k] = s[offset + 8 + k]; - pdefp->name[k] = s[k + offset + 8]; -#ifdef QUIET8 - fprintf(stderr, "%c", s[offset + 8 + k]); -#endif - } -#ifdef QUIET8 - fprintf(stderr, "\n"); -#endif -#ifdef QUIET8 - fprintf(stderr, "%.8s COMMON c_%d(%d)\n", comname, i, temp1); -#endif - /* set next dsect origin */ - sect_org[0] += ((temp1 + 31) & ~31); /* new origin */ - last_ds = sect_org[0]; /* save new ds start */ - pdefp->refa = com_base[i] + sect_base[0]; - ndefr++; /* next reference */ - offset += s[offset + 2]; - break; - - case 9: /* large common origin */ - i = s[offset + 4]; /* block number */ -#ifdef QUIET8 - fprintf(stderr, "large com origin num = %d sb origin = ", s[offset + 4]); -#endif - temp1 = 0; /* size of common */ - for (k = 0; k < 3; k++) - { - temp1 = (temp1 << 8) | s[offset + 5 + k]; -#ifdef QUIET8 - fprintf(stderr, "%.2x", s[offset + 5 + k]); -#endif - } -#ifdef QUIET8 - fprintf(stderr, "\n"); -#endif - /* reset origin in common block */ - com_org[i] = temp1; /* new origin in common */ - offset += s[offset + 2]; - break; - - case 10: /* large common ref */ - i = s[offset + 4]; /* block number */ - sa = sect_addr[0]; /* address in dsect */ - repeat = s[offset + 5]; - if (repeat == 0) - repeat = 1; /* 0 is 1 */ -#ifdef QUIET8 - fprintf(stderr, "large com ref num = %d rep cnt = %d data = ", s[offset + 4], repeat); -#endif - - for (j = 0; j < repeat; j++) - { - for (k = 0; k < (s[offset + 2] - 6); k++) - { - if (k == 0) - temp1 = 0; - temp1 = (temp1 << 8) | s[offset + 6 + k]; - if (k > 0 && (k % 4 == 3)) - { -#ifdef QUIET8 - fprintf(stderr, "%.8x", temp1); - fprintf(stderr, " "); -#endif - temp1 += com_base[i] + sect_base[0]; - /* put data in memory */ - for (l = 0; l < 4; l++) - sa[sect_org[curr_sect]++] = (temp1 >> ((3 - l) * 8)) & 0xff; - temp1 = 0; - } -#ifdef QUIET8 - if (k > 0 && (k % 20 == 0)) - fprintf(stderr, "\n"); -#endif - } -#ifdef QUIET8 - if (k % 20 != 0) - fprintf(stderr, "\n"); -#endif - } - offset += s[offset + 2]; - break; - - case 11: /* debugger information */ -#ifdef NOTNOW - fprintf(stderr, "debugger info: flg: %d len: %d %s %s type: ", - objcnt, s[offset + 2], s[offset + 3] & 2 ? "abs" : "rel", - s[offset + 3] & 1 ? "CSECT" : "DSECT"); - switch (s[offset + 4]) - { - case 0: - fprintf(stderr, "int * 1"); - break; - case 1: - fprintf(stderr, "int * 2"); - break; - case 2: - fprintf(stderr, "int * 4"); - break; - case 3: - fprintf(stderr, "int * 8"); - break; - case 4: - fprintf(stderr, "real * 4"); - break; - case 5: - fprintf(stderr, "real * 8"); - break; - case 6: - fprintf(stderr, "complex * 8"); - break; - case 7: - fprintf(stderr, "complex * 16"); - break; - case 8: - fprintf(stderr, "bit logical"); - break; - case 9: - fprintf(stderr, "logical * 1"); - break; - case 10: - fprintf(stderr, "logical * 4"); - break; - case 11: - fprintf(stderr, "char * n"); - break; - case 12: - fprintf(stderr, "type 12"); - break; - case 13: - fprintf(stderr, "type 13"); - break; - case 14: - fprintf(stderr, "statement label"); - break; - case 15: - fprintf(stderr, "proceedure"); - break; - default: - fprintf(stderr, "unknown type %d", s[offset + 4]); - break; - } -#endif - bound = 0; - for (k = 0; k < 3; k++) - { - bound = (bound << 8) | (s[offset + 5 + k]); - } -#ifdef QUIET8 - fprintf(stderr, "\n* %s address: %x bitnum: %x", - s[offset + 3] & 1 ? "csect" : "dsect", bound >> 3, bound & 7); - fprintf(stderr, " size: %d symbol: ", s[offset + 8] << 8 | s[offset + 9]); - /* now print the 8 chars of the symbol */ - for (k = 0; k < s[offset + 2] - 10; k++) - { - fprintf(stderr, "%c", s[offset + 10 + k]); - } - /* see if common */ - if (s[offset + 2] == 26) - { - fprintf(stderr, " common: "); - for (k = 0; k < 8; k++) - { - fprintf(stderr, "%c", s[offset + 18 + k]); - } - } - fprintf(stderr, "\n"); -#endif - offset += s[offset + 2]; - break; - - case 12: /* object creation information */ - /* object creation date/time */ - if (objcnt == 0) - { -#ifdef QUIET8 - fprintf(stderr, "* OBJECT CREATED "); -#ifdef JUNK - fprintf(stderr, "object creation date/time: "); -#endif - for (k = 0; k < 8; k++) - { - fprintf(stderr, "%c", s[offset + 4 + k]); - } - fprintf(stderr, " "); - for (k = 0; k < 8; k++) - { - fprintf(stderr, "%c", s[offset + 12 + k]); - } - fprintf(stderr, "\n"); -#endif - offset += s[offset + 2]; - break; - } - /* product id leader */ - if (objcnt == 1) - { -#ifdef QUIET8 - fprintf(stderr, "* product id: "); - for (k = 0; k < s[offset + 2] - 4; k++) - { - fprintf(stderr, "%c", s[offset + 4 + k]); - } - fprintf(stderr, "\n"); -#endif - offset += s[offset + 2]; - break; - } - /* generating processor info */ - if (objcnt == 2) - { -#ifdef QUIET8 - fprintf(stderr, "* generating processor info: opt wd1 = "); - for (k = 0; k < 4; k++) - { - fprintf(stderr, "%.2x", s[offset + 4 + k]); - } - fprintf(stderr, " opt wd2 = "); - for (k = 0; k < 4; k++) - { - fprintf(stderr, "%.2x", s[offset + 8 + k]); - } -#ifdef FUTURE - fprintf(stderr, " rev lev = "); - for (k = 0; k < 4; k++) - { - fprintf(stderr, "%.2x", s[offset + 12 + k]); - } -#endif - fprintf(stderr, "\n"); - fprintf(stderr, "* rrs cnt = "); - for (k = 0; k < 2; k++) - { - fprintf(stderr, "%.2x", s[offset + 16 + k]); - } - fprintf(stderr, " incl cnt = "); - for (k = 0; k < 2; k++) - { - fprintf(stderr, "%.2x", s[offset + 18 + k]); - } -/* fprintf(stderr, "\n"); */ - fprintf(stderr, " pathname: "); - for (k = 0; k < s[offset + 2] - 20; k++) - { - fprintf(stderr, "%c", s[offset + 20 + k]); - } - fprintf(stderr, "\n"); -#endif - offset += s[offset + 2]; - break; - } - - /* required resources info */ - if (objcnt == 3) - { -#ifdef QUIET8 - repeat = s[offset + 3]; - fprintf(stderr, "* required resource info: %s lfc = ", - repeat & 1 ? "FORT incl file" : "req obj file"); - for (k = 0; k < 3; k++) - { - fprintf(stderr, "%c", s[offset + 5 + k]); - } - fprintf(stderr, "\n"); - repeat = s[offset + 10]; - fprintf(stderr, "* acc mode = "); - for (k = 0; k < 4; k++) - { - fprintf(stderr, "%.2x", s[offset + 12 + k]); - } - fprintf(stderr, " opts = "); - for (k = 0; k < 4; k++) - { - fprintf(stderr, "%.2x", s[offset + 16 + k]); - } - fprintf(stderr, " pathname: "); - for (k = 0; k < s[offset + 2] - 20; k++) - { - fprintf(stderr, "%c", s[offset + 20 + k]); - } - fprintf(stderr, "\n"); -#ifdef OLD_JUNK - fprintf(stderr, "PNAM LEN %d PATH LEN %d\n", repeat, s[offset + 2] - 20); -#endif -#endif - offset += s[offset + 2]; - break; - } -#ifdef QUIET8 - for (k = 0; k < s[offset + 2]; k++) - { - if (k > 0 && (k % 20 == 0)) - fprintf(stderr, "\n"); - fprintf(stderr, "%.2x ", s[offset + k]); - } - fprintf(stderr, "\n"); -#endif - offset += s[offset + 2]; - break; - - case 13: /* multiple datapool ref */ -#ifdef QUIET8 - fprintf(stderr, "multiple datapool ref sym ="); - for (k = 0; k < (s[offset + 2] - 12); k++) - { - fprintf(stderr, "%c ", s[offset + 4 + k]); - } - fprintf(stderr, "\naddr = "); - for (k = 0; k < 4; k++) - { - fprintf(stderr, "%.2x ", s[offset + 2] - 8 + k); - } - fprintf(stderr, " pool num = "); - for (k = 0; k < 4; k++) - { - fprintf(stderr, "%.2x ", s[offset + 2] - 4 + k); - } - fprintf(stderr, "\n"); -#endif - offset += s[offset + 2]; - break; - - case 14: /* new debugger information */ -#ifdef QUIET9 -#ifdef NOT_NOW - fprintf(stderr, "new debugger info (hex dump)\n"); - for (k = 0; k < s[offset + 2]; k++) - { - if (k > 0 && (k % 20 == 0)) - fprintf(stderr, "\n"); - fprintf(stderr, "%.2x ", s[offset + k]); - } - fprintf(stderr, "\n"); -#endif - fprintf(stderr, "new debugger info: flags: %x type: ", s[offset + 3]); -#endif -#ifdef QUIET9 - if (dounix) - { - /* see if we have an enum */ - if (s[offset + 4] & 0x20) - { - fprintf(stderr, "enum "); - } - /* see if stack variable */ - if (s[offset + 3] & 0x10) - { - fprintf(stderr, "stack "); - } - /* see if register variable */ - if (s[offset + 3] & 0x04) - { - fprintf(stderr, "register "); - } - /* see if pointer */ - if (s[offset + 3] & 0x20) - { - int indcnt = s[offset + 5]; - /* print number of indirections */ - while (indcnt--) - fprintf(stderr, "*"); - } - switch (s[offset + 4] & ~0x20) - { - case 0: - fprintf(stderr, "char"); - break; - case 1: - fprintf(stderr, "short"); - break; - case 2: - fprintf(stderr, "int"); - break; - case 3: - fprintf(stderr, "long"); - break; - case 4: - fprintf(stderr, "float"); - break; - case 5: - fprintf(stderr, "double"); - break; - case 6: - fprintf(stderr, "struct "); - for (k = 0; k < 8; k++) - { - fprintf(stderr, "%c", s[offset + 20 + k]); - } - break; - case 7: - fprintf(stderr, "union "); - for (k = 0; k < 8; k++) - { - fprintf(stderr, "%c", s[offset + 20 + k]); - } - break; - case 8: - fprintf(stderr, "uchar"); - break; - case 9: - fprintf(stderr, "ushort"); - break; - case 10: - fprintf(stderr, "uint"); - break; - case 11: - fprintf(stderr, "ulong"); - break; - case 12: - fprintf(stderr, "enum"); - break; - case 13: - fprintf(stderr, "struct def"); - break; - case 14: - fprintf(stderr, "statement label"); - break; - case 15: - fprintf(stderr, "entry point"); - break; - case 16: - fprintf(stderr, "illegal"); - break; - case 17: - fprintf(stderr, "CSECT load origin"); - break; - case 18: - fprintf(stderr, "DSECT load origin"); - break; - default: - fprintf(stderr, "unknown type %d", s[offset + 4]); - break; - } - } - else - { - /* see if we have a parameter */ - if ((s[offset + 4] & 0x60) == 0x20) - { - fprintf("parameter "); - } - switch (s[offset + 4] & ~0x20) - { - case 0: - fprintf(stderr, "int * 1"); - break; - case 1: - fprintf(stderr, "int * 2"); - break; - case 2: - fprintf(stderr, "int * 4"); - break; - case 3: - fprintf(stderr, "int * 8"); - break; - case 4: - fprintf(stderr, "real * 4"); - break; - case 5: - fprintf(stderr, "real * 8"); - break; - case 6: - fprintf(stderr, "complex * 8"); - break; - case 7: - fprintf(stderr, "complex * 16"); - break; - case 8: - fprintf(stderr, "bit logical"); - break; - case 9: - fprintf(stderr, "logical * 1"); - break; - case 10: - fprintf(stderr, "logical * 4"); - break; - case 11: - fprintf(stderr, "char * n"); - break; - case 12: - fprintf(stderr, "type 12"); - break; - case 13: - fprintf(stderr, "type 13"); - break; - case 14: - fprintf(stderr, "statement label"); - break; - case 15: - fprintf(stderr, "proceedure"); - break; - default: - fprintf(stderr, "unknown type %d", s[offset + 4]); - break; - } - } - fprintf(stderr, " rsvd: %x size: %d\n", s[offset + 5], s[offset + 6] * 256 + s[offset + 7]); -#endif - repeat = 0; - for (k = 0; k < 4; k++) - { - repeat = (repeat << 8) | s[offset + 8 + k]; - } -#ifdef QUIET8 - fprintf(stderr, "* %s address: %x, bitnum: %d symbol: ", - s[offset + 3] & 1 ? "csect" : "dsect", repeat >> 3, repeat & 7); - for (k = 0; k < 8; k++) - { - fprintf(stderr, "%c", s[offset + 12 + k]); - } - fprintf(stderr, "\n"); -#endif - /* only look at ISC type if len is > 20 */ - if (s[offset + 2] <= 20) - goto wedone; - /* only look at ISC type if flags is zero */ - /* and not a parameter */ - if (s[offset + 3] <= 1 && s[offset + 4] < 0x20) - { -#ifdef QUIET8 - /* do ISC record */ - fprintf(stderr, "* ISC type: "); - switch (s[offset + 20] & 0x7f) - { - case 0: - fprintf(stderr, "no src"); - break; - case 1: - fprintf(stderr, "declaration"); - break; - case 2: - fprintf(stderr, "xeq statement"); - break; - case 3: - fprintf(stderr, "cont line"); - break; - case 4: - fprintf(stderr, "comment"); - break; - case 5: - fprintf(stderr, "FORTRAN err"); - break; - default: - fprintf(stderr, "undefined %x", s[offset + 20] & 0x7f); - break; - } - fprintf(stderr, " caret %d\n", s[offset + 21]); -#endif - /* only process source if caret is zero */ - if (s[offset + 21] != 0) - goto wedone; - - if (s[offset + 20] & 0x80) - { - /* uncompressed source */ - int srccnt = s[offset + 22]; - int blkcnt = s[offset + 23]; - -#ifdef QUIET8 - for (k = 0; k < blkcnt; k++) - { - fprintf(stderr, " "); /* blanks */ - } - for (k = 0; k < srccnt; k++) - { - fprintf(stderr, "%c", s[offset + 24 + k]); /* source */ - } -#endif - } - else - { - /* compressed source */ - unsigned char chr; - int srccnt = s[offset + 22]; - int blkcnt = s[offset + 23]; - int j = 0; - int l = offset + 24; - -#ifdef QUIET8 - for (k = 0; k < blkcnt; k++) - { - fprintf(stderr, " "); /* blanks */ - } - for (k = 0; k < srccnt; k++) - { - switch (j) - { - case 0: - chr = ((s[offset + l]) >> 2) & 0x3f + 32; - j++; - break; - case 1: - chr = (((s[offset + l++] & 3) << 4) | ((s[offset + l] & 0xf0) >> 4) + 32); - j++; - break; - case 2: - chr = (((s[offset + l++] & 0xf) << 2) | ((s[offset + l] & 0xc0) >> 6) + 32); - j++; - break; - case 3: - chr = ((s[offset + l] & 0x3f) + 32); - j = 0; - break; - } - fprintf(stderr, "%c", chr); /* source */ - } -#endif - } -#ifdef QUIET8 - fprintf(stderr, "\n"); -#endif - } - else - { /* else handle Encore debug record */ - int srccnt; - unsigned int srcval; - unsigned int srcval2; - int sv; /* switch value */ - int xx = 20; /* array info offset */ - - /* First look for a parameter. Flags will be zero. */ - /* Type will be >= 32 (0x20) */ - if (dounix) - { - sv = s[offset + 3] & 0x48; - } - else - { - sv = s[offset + 3]; - } - switch (s[offset + 3]) - { /* switch on flags */ - case 0x00: /* parameter */ - switch (s[offset + 4] & 0x1f) - { - case 0: /* int * 1 */ - case 9: /* logical * 1 */ -#ifdef QUIET8 - /* wd 5 byte 0 has value */ - fprintf(stderr, "* param value: 0x"); - fprintf(stderr, "%.2x", s[offset + 20]); - fprintf(stderr, "\n"); -#endif - break; - case 1: /* int * 2 */ - /* wd 5 bytes 0-1 has value */ - srcval = s[offset + 20] << 8 | s[offset + 21]; -#ifdef QUIET8 - fprintf(stderr, "* param value: 0x"); - fprintf(stderr, "%.4x", srcval); - fprintf(stderr, "\n"); -#endif - break; - case 2: /* int * 4 */ - case 4: /* real * 4 */ - case 10: /* logical * 4 */ - /* wd 5 bytes 0-3 has value */ - srcval = s[offset + 20] << 24 - | s[offset + 21] << 16 | s[offset + 22] << 8 | s[offset + 23]; -#ifdef QUIET8 - fprintf(stderr, "* param value: 0x"); - fprintf(stderr, "%.8x", srcval); - fprintf(stderr, "\n"); -#endif - break; - case 3: /* int * 8 */ - case 5: /* real * 8 */ - case 6: /* complex * 8 */ - /* wd 5-6 bytes 0-3 has value */ - srcval = s[offset + 20] << 24 - | s[offset + 21] << 16 | s[offset + 22] << 8 | s[offset + 23]; - srcval2 = s[offset + 24] << 24 - | s[offset + 25] << 16 | s[offset + 26] << 8 | s[offset + 27]; -#ifdef QUIET8 - fprintf(stderr, "* param value: 0x"); - fprintf(stderr, "%.8x %.8x", srcval, srcval2); - fprintf(stderr, "\n"); -#endif - break; - case 7: /* complex * 16 */ - /* wd 5-6 bytes 0-3 has value */ - srcval = s[offset + 20] << 24 - | s[offset + 21] << 16 | s[offset + 22] << 8 | s[offset + 23]; - srcval2 = s[offset + 24] << 24 - | s[offset + 25] << 16 | s[offset + 26] << 8 | s[offset + 27]; -#ifdef QUIET8 - fprintf(stderr, "* param value: 0x"); - fprintf(stderr, "%.8x %.8x ", srcval, srcval2); -#endif - /* wd 7-8 bytes 0-3 has value */ - srcval = s[offset + 28] << 24 - | s[offset + 29] << 16 | s[offset + 30] << 8 | s[offset + 31]; - srcval2 = s[offset + 32] << 24 - | s[offset + 33] << 16 | s[offset + 34] << 8 | s[offset + 35]; -#ifdef QUIET8 - fprintf(stderr, "%.8x %.8x", srcval, srcval2); - fprintf(stderr, "\n"); -#endif - break; - case 8: /* bit logical */ - /* wd 5 bit 0 has value */ -#ifdef QUIET8 - fprintf(stderr, "* param value: "); - fprintf(stderr, "%s\n", s[offset + 20] & 0x80 ? ".TRUE. (1)" : ".FALSE. (0)"); -#endif - break; - case 11: /* char * n */ - /* size has array length */ - /* wds 5 - 8 has char values */ - srccnt = s[offset + 6] << 8 | s[offset + 7]; -#ifdef QUIET8 - fprintf(stderr, "* param value (%d): ", srccnt); - if (srccnt > 16) - srccnt = 16; - for (k = 0; k < srccnt; k++) - { - fprintf(stderr, "%c", s[offset + 20 + k]); - } - fprintf(stderr, "\n"); -#endif - break; - default: - goto jumpit; - } - break; - case 0x04: /* datapool */ - if (dounix) - { - /* register variable, ignore */ - break; - } - else - { -#ifdef QUIET8 - /* print datapool name */ - fprintf(stderr, "* len = %d Dpool: ", s[offset + 2]); -#endif - } -#ifdef QUIET8 - for (k = 0; k < 8; k++) - { - fprintf(stderr, "%c", s[offset + 20 + k]); - } - fprintf(stderr, "\n"); -#endif - break; - case 0x08: /* common symbol */ -#ifdef QUIET8 - if (dounix) - { - /* print struct/union ref name */ - fprintf(stderr, "* len = %d S/U ref: ", s[offset + 2]); - } - else - { - /* print common name */ - fprintf(stderr, "* len = %d Common: ", s[offset + 2]); - } - for (k = 0; k < 8; k++) - { - fprintf(stderr, "%c", s[offset + 20 + k]); - } - fprintf(stderr, "\n"); -#endif - break; - case 0x48: /* array of structures */ - xx = 28; /* account for struct name */ - case 0x40: /* array info present */ -#ifdef QUIET8 - fprintf(stderr, "* array dims: %d bnds: %d len: %d lbflags %x sbflags %x\n", - s[offset + xx + 0], s[offset + xx + 1], s[offset + xx + 4], - s[offset + xx + 2] << 8 | s[offset + xx + 3], - s[offset + xx + 6] << 8 | s[offset + xx + 7]); - fprintf(stderr, "* wds: "); - for (k = 0; k < s[offset + xx + 4] - 8; k++) - { - if (k > 0 && (k % 4 == 0)) - { - if ((k % 20 == 0)) - fprintf(stderr, "\n"); - else - fprintf(stderr, " "); - } - fprintf(stderr, "%.2x", s[offset + xx + 8 + k]); - } - fprintf(stderr, "\n"); -#endif - break; - case 0x50: /* array parameters */ -#ifdef QUIET8 - fprintf(stderr, "* array param dims: %d bnds: %d len: %d lbflags %x sbflags %x\n", - s[offset + 20], s[offset + 21], s[offset + 24], - s[offset + 22] << 8 | s[offset + 23], s[offset + 26] << 8 | s[offset + 27]); - fprintf(stderr, "* wds: "); - for (k = 0; k < s[offset + 24] - 8; k++) - { - if (k > 0 && (k % 20 == 0)) - fprintf(stderr, "\n"); - fprintf(stderr, "%.2x ", s[offset + 28 + k]); - } - fprintf(stderr, "\n"); -#endif - break; - case 0x01: /* CSECT */ - case 0x02: /* absolute address */ - case 0x10: /* parameter/stack variable */ - case 0x20: /* ext memory address/pointer */ -#ifdef QUIET8 - fprintf(stderr, "* unprocessed flags %x\n", s[offset + 3]); -#endif - default: - jumpit: -#ifdef QUIET8 - fprintf(stderr, "* Encore record flags = %x\n", s[offset + 3]); - fprintf(stderr, "Encore debugger info (hex dump)\n"); - for (k = 0; k < s[offset + 2]; k++) - { - if (k > 0 && (k % 20 == 0)) - fprintf(stderr, "\n"); - fprintf(stderr, "%.2x ", s[offset + k]); - } - fprintf(stderr, "\n"); -#endif - break; - } - } - wedone: - offset += s[offset + 2]; - break; - case 15: /* undefined */ -#ifdef QUIET8 - for (k = 0; k < s[offset + 2]; k++) - { - if (k > 0 && (k % 20 == 0)) - fprintf(stderr, "\n"); - fprintf(stderr, "%.2x ", s[offset + k]); - } - fprintf(stderr, "\n"); -#endif - offset += s[offset + 2]; - break; - } - break; - - case 14: /* common origin */ - /* get common block number */ - repeat = s[offset + 1]; - /* get common size */ - bound = s[offset + 2] << 8 | s[offset + 3]; -#ifdef QUIET8 - fprintf(stderr, "common origin block = %x origin = %x\n", repeat, bound); -#endif - offset += (objcnt + 1); - break; - - case 15: /* object termination */ -#ifdef QUIET - fprintf(stderr, "program object termination\n"); -#endif - offset += (objcnt + 1); - - /* define dsect start */ - if ((ndefr + 1) >= def_size) - { /* we need to resize */ - defined = (struct defr *)realloc((void *)defined, (def_size + 10) * sizeof(struct defr)); - def_size += 10; /* 10 more */ - } - pdefp = &defined[ndefr]; /* ref data address */ - strcpy(pdefp->name, "DS"); /* dsect start */ - ndefr++; /* next reference */ - pdefp->refa = sect_base[0] + last_ds; /* ds start */ - pdefp++; - - if (sect_size[1]) - { - /* define csect start */ - strcpy(pdefp->name, "CS"); /* dsect start */ - ndefr++; /* next reference */ - pdefp->refa = sect_base[0]; /* section start */ - pdefp++; - } - - /* dump csect/dsect */ - curr_sect = 0; /* dsect */ - /* if no size given, use last origin address */ - if (sect_size[curr_sect] == 0) - sect_size[0] = sect_org[0]; -#ifdef NODUMP - fprintf(stderr, "DSECT contents %x bytes\n", sect_size[0]); - sa = sect_addr[0]; /* address of section */ - temp2 = 0; - for (j = 0; j < sect_size[0]; j += 4) - { - fprintf(stderr, "%.4x ", j); - for (i = 0; i < 4; i++) - { - fprintf(stderr, "%0.2x", sa[j + i]); - } - fprintf(stderr, " "); - for (i = 0; i < 4; i++) - { - if (sa[j + i] >= 0x20 && sa[j + i] < 0x7f) - fprintf(stderr, "%c", sa[j + i]); - else - fprintf(stderr, ".", sa[j + i]); - } - fprintf(stderr, "\n"); - } -#endif -#ifdef DOTRACE - if (sect_size[0]) - codedump(0); /* go dump the code */ -#endif - - curr_sect = 1; /* csect */ -#ifdef NODUMP - fprintf(stderr, "CSECT contents %x bytes\n", sect_size[1]); - sa = sect_addr[1]; /* address of section */ - temp2 = 0; - for (j = 0; j < sect_size[1]; j += 4) - { - fprintf(stderr, "%.4x ", j); - for (i = 0; i < 4; i++) - { - fprintf(stderr, "%02x", sa[j + i]); - } - fprintf(stderr, " "); - for (i = 0; i < 4; i++) - { - if (sa[j + i] >= 0x20 && sa[j + i] < 0x7f) - fprintf(stderr, "%c", sa[j + i]); - else - fprintf(stderr, ".", sa[j + i]); - } - fprintf(stderr, "\n"); - } -#endif -#ifdef DONOTDOCSECT - if (sect_size[1]) - codedump(1); /* dump the instructions */ -#endif - - /* we may have several objects, start over */ - free((void *)datapool); /* free storage */ - free((void *)external); /* free storage */ - free((void *)defined); /* free storage */ - for (i = 0; i < 256; i++) /* check all sections */ - if (sect_addr[i]) /* if we got one */ - free((void *)sect_addr[i]); /* free memory */ - doem = 0; /* reinitialize if more object */ - break; - } - goto doit; -} - -unsigned char line[BUFSIZ]; -int cmpop = 0; -int cmpflg = 0; -int bcnt = 0; -unsigned char *bptr = 0; -int recl = 0; - -int rbl(unsigned char *buf, int n) -{ - int count = 0; - unsigned char *cp; - int i; - - unsigned char *linadrs = line; - - if (!cmpop) - { /* see if we tested for compressed */ - cmpop = 1; /* set comp tested flag */ - /* read in the first record */ - if ((recl = getloi(line, BUFSIZ)) == 0) - return (0); /* this means eof */ - linadrs = line; - if (*linadrs == 0xbf || *linadrs == 0x9f) - { /* is this file compressed */ - cmpflg = 1; /* set comp data flag */ - bcnt = linadrs[1]; /* set record count */ - bptr = &linadrs[6]; /* set data address */ - } - else - goto re00; - } - - if (cmpflg) - { /* reading compressed data? */ - if (bcnt == 0) - { /* any data left in buffer */ - re18: - /* read in a data record */ - if ((recl = getloi(line, BUFSIZ)) == 0) - return (0); /* this means eof */ - linadrs = line; - if ((*linadrs & 0xdf) != 0x9f) /* is this valid rec */ - return (EOF); /* error if not */ - bcnt = linadrs[1]; /* set record count */ - bptr = &linadrs[6]; /* set data address */ - } - re20: - /* see if any blanks */ - if (i = *bptr++) - { /* next buffer pointer */ - if (i == 0xff) - goto re60; /* if eol, get out */ - while (i--) - { - if (count < n) - { - *buf++ = ' '; /* put blank in buffer */ - count++; - } - } - } - if (--bcnt <= 0) - goto re18; /* read next record */ - - if (i = *bptr++) - { /* next buffer pointer */ - while (i--) - { - if (count < n) - *buf++ = *bptr; /* put char in buffer */ - bcnt--; /* decr count */ - bptr++; /* next buffer pointer */ - count++; - } - } - if (--bcnt <= 0) - goto re18; /* read next record */ - goto re20; - - re60: - bcnt--; /* decr count */ - if ((*--buf == ' ') && (count == 1)) - { - *buf = '\n'; /* put new line at eol */ - *++buf = '\0'; /* put new line at eol */ - } - else - { - count++; - *++buf = '\n'; /* put new line at eol */ - *++buf = '\0'; /* put new line at eol */ - } -/* fprintf(stderr, "ret cnt = %ld\n", count); */ - return (count); - } - else - { - /* non compressed read here */ - /* read the next record */ - if ((recl = getloi(line, BUFSIZ)) == 0) - return (0); /* this means eof */ - - re00: - /* here we need to strip off blank put in during write */ - /* this is because mpx does not support zero length blocks */ - if (!binary) - { - if ((recl == 1) && (*linadrs == ' ')) - recl = 0; - /* now append new line to end of buffer */ - *(cp = linadrs + recl) = '\n'; /* point to last char */ - } - else - { - cp = linadrs + recl - 1; /* point to last char */ - } - - /* copy this layer buffer to upper caller's buffer */ - -/* fprintf(stderr, "recl = %x, cp = %x, linadrs = %x\n", recl, cp, linadrs); */ - while (count < n) - { - if (linadrs > cp) - break; - *buf++ = *linadrs++; - count++; - } - } - -/* fprintf(stderr, "ret1 cnt = %ld\n", count); */ - return (count); -} - -/*~!bbio.c*/ -/* Name: bbio.c Part No.: _______-____r - * - * Copyright 1991 - J B Systems, Morrison, CO - * - * The recipient of this product specifically agrees not to distribute, - * disclose, or disseminate in any way, to any one, nor use for its own - * benefit, or the benefit of others, any information contained herein - * without the expressed written consent of J B Systems. - * - * RESTRICTED RIGHTS LEGEND - * - * Use, duplication, or disclosure by the Government is subject to - * restriction as set forth in paragraph (b) (3) (B) of the Rights - * in Technical Data and Computer Software Clause in DAR 7-104.9 - * (a). - */ - -#ident "@(#)nbrtl:bbio.c 1.0" - -#include - -/********************************************************************/ -/* These routines handle blocked and optionally compressed MPX files */ - -#define IOCMAX 10 /* start with 10 for now */ - -struct ioc { - int iofcb; /* fcb for i/o */ - int afcb; /* callers fcb address */ - unsigned char *bufaddr; /* callers buffer address */ - int bufcnt; /* callers buffer size */ - unsigned char *cba; /* current buffer address */ - unsigned char *rcba; /* record control block pointer */ - int cpp; /* current pool position */ - int cfp; /* current file position */ - char cbn; /* current buffer number */ - char nab; /* number of active buffers */ - struct { /* ioc bit flags */ - unsigned openop:1; /* open flag */ - unsigned writop:1; /* last op was write */ - unsigned outaop:1; /* output active flag */ - unsigned compop:1; /* if set, tested for comp'ed file */ - unsigned cmpflg:1; /* if set, reading comp'ed file */ - unsigned iocaloc:1; /* ioc allocated */ - unsigned free:3; /* free flags, available */ - } flag; - int bcnt; /* compressed rec cur count */ - unsigned char *bptr; /* compressed rec pointer */ - unsigned char *bufa; /* start of contiguous buffers */ -}; - -struct ioc iocx[IOCMAX]; - -#define ERRFLAG 0x04000000 -#define EOFFLAG 0x02000000 -#define EOMFLAG 0x01000000 - -#define RCBEOF 0x80 /* bit 0 */ -#define RCBBOB 0x40 /* bit 1 */ -#define RCBEOB 0x20 /* bit 2 */ -#define RCBNULL 0x10 /* bit 3 */ -#define RCBCONT 0x08 /* bit 4 */ - -#define SBLR 0 -#define BCLR 1 -#define SBTR 2 -#define BCTR 3 - -#define BLKSIZE 768 -#define BLKS (10*BLKSIZE) - -/* forword definition */ -int bfredf(struct ioc *wioc); -int plredf(struct ioc *wioc); - -/* ircont - establish ioc address for this fcb */ -/* input - file number */ -/* output - ioc address */ -struct ioc *ircont(int cfcb) -{ - int i; - struct ioc *wioc; /* current ioc */ - - for (i = 0, wioc = &iocx[0]; i < IOCMAX; wioc = &iocx[++i]) - { - if (wioc->flag.iocaloc) - if (wioc->afcb == cfcb) - { - return (wioc); - } - } - /* not yet allocated, get a new one */ - for (i = 0, wioc = &iocx[0]; i < IOCMAX; wioc = &iocx[++i]) - { - if (!wioc->flag.iocaloc) - { - wioc->flag.iocaloc = 1; /* ioc allocated */ - if ((wioc->bufa = (unsigned char *)malloc(BLKS)) == 0) - { - fprintf(stderr, "ioc malloc error\n"); - return (0); - } - /* initialize new ioc */ - wioc->afcb = cfcb; /* save callers fcb address */ - wioc->iofcb = cfcb; /* use callers fcb for I/O */ - wioc->cba = wioc->bufa; /* set buffer addr in fcb */ - wioc->cbn = 0; /* no curr buf number */ - wioc->nab = 0; /* no active bufs */ - /* clear flags */ - wioc->flag.openop = 0; /* open ioc */ - wioc->flag.writop = 0; - wioc->flag.outaop = 0; - wioc->flag.compop = 0; - wioc->flag.cmpflg = 0; - wioc->cpp = 0; /* pool empty */ - wioc->bcnt = 0; /* no compress cnt */ - wioc->bptr = 0; /* no pointer either */ - wioc->cfp = 1; /* curr position is 1st blk */ - return (wioc); - } - } - fprintf(stderr, "no ioc space left\n"); - return (0); -} - -/* rmopen - open up a file stream */ -int rmopen(int cfcb) -{ - struct ioc *wioc; - - wioc = ircont(cfcb); - if (wioc->flag.openop) - return (1); /* return o.k. */ - /* not open yet, do open */ - wioc->flag.openop = 1; /* mark open */ - return (1); /* return o.k. */ -} - -/* rmclose - close a file stream */ -int rmclose(int cfcb) -{ - struct ioc *wioc; - - wioc = ircont(cfcb); - if (!wioc->flag.openop) - return (1); /* if not open, return o.k. */ - /* open, do close */ - wioc->flag.openop = 0; /* mark closed */ - wioc->flag.iocaloc = 0; /* mark unallocated */ - free(wioc->bufa); /* free buffer */ - return (1); -} - -/* rmread - read from file stream */ -int rmread(int cfcb, unsigned char *buffer) -{ - struct ioc *wioc; - int fillcnt, i, bytecnt; - unsigned char *buffp; - - rmopen(cfcb); /* make sure open */ - wioc = ircont(cfcb); - if (wioc->flag.writop) - fprintf(stderr, "read after write not allowed"); - if (wioc->cpp == 0) - { /* if no data in pool yet, read it in */ - bfredf(wioc); /* read in a block */ - wioc->rcba = wioc->cba + 4; - /* have we tested for comp data yet */ - if (!wioc->flag.compop) - { - wioc->flag.compop = 1; - /* test for comp rec */ - if (wioc->rcba[4] == 0xbf || wioc->rcba[4] == 0x9f) - { - wioc->flag.cmpflg = 1; /* this is comp data */ - wioc->bcnt = 0; /* init pointer */ - } - } - } - bytecnt = 0; /* no bytes to caller yet */ - buffp = buffer; /* save caller buff addr */ - if (wioc->flag.cmpflg) /* reading compressed */ - if (wioc->bcnt) - goto re07; /* any data left */ - re18: - if (wioc->rcba[SBLR] & RCBEOB) - { - re06: - if (bfredf(wioc) == -1) - return (-1); - wioc->rcba = wioc->cba + 4; - } -#define JIM /* define for non-library reading */ -#ifdef JIM - if (wioc->rcba[SBTR] & RCBEOF) - { -#else - if (wioc->rcba[SBTR] & RCBEOF) - { - wioc->rcba[SBTR] &= ~RCBEOF; - goto re06; -#endif - re05: - return (-1); /* return EOF */ - } - if (wioc->flag.cmpflg) - { /* reading compressed */ - if ((wioc->rcba[4] & 0xdf) != 0x9f) - { - return (-1); /* return EOF */ - } - wioc->bptr = wioc->rcba + 10; /* first data byte */ - wioc->bcnt = wioc->rcba[5]; /* get bytes this record */ - if (wioc->bcnt == 0) - { - re10: - wioc->rcba += (wioc->rcba[BCTR] + 4); - goto re18; - } - re07: - if (*wioc->bptr) - { /* got blanks */ - if (*wioc->bptr == 0xff) - { - wioc->bptr++; - if (--wioc->bcnt == 0) - { - wioc->rcba += (wioc->rcba[BCTR] + 4); - wioc->bptr = wioc->rcba + 10; - } - wioc->bufcnt = bytecnt; - return (bytecnt); - } - for (i = *wioc->bptr; i; *buffp++ = ' ', i--, bytecnt++); - } - wioc->bptr++; - if (--wioc->bcnt > 0) - { - if (i = *wioc->bptr) - { - wioc->bptr++; - wioc->bcnt--; - for (; i; i--) - { - *buffp++ = *wioc->bptr++; - bytecnt++; - wioc->bcnt--; - } - if (wioc->bcnt) - goto re07; - goto re10; - } - re24: - wioc->bptr++; - if (--wioc->bcnt > 0) - goto re07; - } - goto re10; - } - - /* process uncompressed record */ - wioc->bufcnt = wioc->rcba[BCTR]; - for (i = 0; i < wioc->bufcnt; i++) - buffer[i] = wioc->rcba[i + 4]; - wioc->rcba += (wioc->rcba[BCTR] + 4); - return (wioc->bufcnt); -} - -/* bfredf - read next buffer from file stream */ -int bfredf(struct ioc *wioc) -{ - unsigned char *cbaddr; - - /* see if next buffer in memory */ - if (wioc->cbn >= wioc->nab) - { - /* no, read in next pool */ - if (plredf(wioc) == -1) /* read next pool */ - return (-1); /* show EOF */ - wioc->cbn = 1; /* we start at 1st buffer */ - cbaddr = wioc->bufa; /* reset address pointer */ - } - else - { - wioc->cbn++; /* bump buffer number */ - cbaddr = wioc->cba + BLKSIZE; /* next buffer address */ - } - wioc->cba = cbaddr; /* set new address */ - /* check for cnt < 0x300 (768) */ - /* check for BOB on in control bits */ - return (1); /* return O.K. */ -} - -/* plredf - read next buffer pool from file stream */ -int plredf(struct ioc *wioc) -{ - int retc; - - /* read the file */ - retc = read(wioc->iofcb, wioc->bufa, BLKS); - if (retc <= 0) - { - return (-1); /* show EOF for error */ - } - /* compute # of block we read */ - wioc->nab = (retc + BLKSIZE - 1) / BLKSIZE; - wioc->cpp = wioc->cfp; /* update curr pool position */ - wioc->cfp += wioc->nab; /* update current file position */ - return 0; -} - -/* - * Dump without executing it to file "testcode.mem - */ -void codedump(int sect) -{ - int i; - uint32 *memory; /* memory address */ - int tr_start; /* first loc to trace */ - int tr_stop; /* last loc to trace */ - FILE *fp; - - if ((fp = fopen("testcode.mem", "w")) == NULL) - { - fprintf(stderr, "unable to open file 'testcode.mem' for output, aborting.\n"); - return; - } - tr_start = sect_base[sect]; /* starting psw */ - if (tr_start != 0) - { - fprintf(stderr, "program does not start at zero, aborting.\n"); - return; - } - memory = (uint32 *)sect_addr[sect]; /* real memory pointer */ - tr_stop = sect_base[sect] + sect_size[sect]; -#ifndef QUIET - fprintf(stderr, "tr_start %x tr_stop %x memory %x\n", tr_start, tr_stop, (uint32 *)memory); -#endif - /* write out the memory to disk */ - fwrite(memory, sizeof(char), sect_size[sect], fp); - while (tr_start < tr_stop) - { - uint32 data = *memory; - uint32 byte; - -#ifdef QUIET - fprintf(stderr, "addr %0x - data %0x\n", (int32)tr_start, *memory); -#else - fprintf(stderr, "addr %0x - data %0.2x%0.2x%0.2x%0.2x\n", (int32)tr_start, - (data >> 0) & 0xff, - (data >> 8) & 0xff, - (data >> 16) & 0xff, - (data >> 24) & 0xff); -#endif -#ifdef NOBIGENDIAN - byte = (data >> 24) & 0xff; - fputc(byte, fp); /* 1st char */ - byte = (data >> 16) & 0xff; - fputc(byte, fp); /* 2nd char */ - byte = (data >> 8) & 0xff; - fputc(byte, fp); /* 3rd char */ - byte = data & 0xff; - fputc(byte, fp); /* 4th char */ - fputc('\n', fp); /* cr */ -#endif - memory++; - tr_start += 4; - } - return; -} diff --git a/SEL32/util/makefile b/SEL32/util/makefile deleted file mode 100644 index 9485fb4..0000000 --- a/SEL32/util/makefile +++ /dev/null @@ -1,73 +0,0 @@ -# Makefile for utils -SHELL = /bin/sh - -# Adapt the flags in the following paragraph to your system -# for Linux -ROOT = . -OPTC = -O #-m32 - -#B = $(ROOT) -#B = $(ROOT)/bin -B = /system/bin -#I = $(ROOT)/include -I = -#L = $(ROOT)/lib -#D = $L/mylib.a -D = - -##CFLAGS= $(OPTC) -I$I -CFLAGS= $(OPTC) -I$I -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE - -# For Linux -#LFLAGS= -L$L -LFLAGS= - -PROGS = \ - $(ROOT)/makecode - -all: $(PROGS) - -#install :$(PROGS) -# @cp $(@F) $B -# @echo $(@F) installed in $B -# @echo -## @chmod 755 $(@F) - -##$(PROGS): $D $$(@F).c -## @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ -##$(PROGS): $D $$(@F).c -## @chmod 755 $@ -## @cp $(@F) $B -## @echo $(@F) installed in $B -## @echo - -$B/makecode: $D makecode.c - @-$(CC) $(CFLAGS) $(@F).c $(LFLAGS) -o $@ - @chmod 755 $@ - @cp $(@F) $B - @echo $(@F) installed in $B - -# Some makes don't understand the $$ notation above. In this case -# you have to type out the compile paragraph for each PROG. Sigh. -# Here's a start, good luck. -# -#$B/abshw: abshw.c -# $(CC) $(CFLAGS) $? $(LFLAGS) -o $@ -# @chmod 751 $@ -# @echo $(@F) installed in $B - -remake : clobber - @make ROOT=$(ROOT) OPTC=$(OPTC) - -clean : - @-rm -f a.out junk* JUNK* core - @-rm -f *.o - -clobber : clean - @-rm -f $(PROGS) - -install : $(PROGS) - @cp $(PROGS) $B - @echo $(PROGS) installed in $B - @echo -# @chmod 755 $(@F)