|
|
DataMuseum.dkPresents historical artifacts from the history of: Bogika Butler |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Bogika Butler Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 13824 (0x3600)
Types: TextFile
Names: »EOSLOAD.SA«
└─⟦e12db5ad4⟧ Bits:30009789/_.ft.Ibm2.50007357.imd Mogens Pelles Zilog 80,000 / EOS projekt
└─⟦this⟧ »EOSLOAD.SA«
æ*****************************************************************
Copyright 1984 by
NCR Corporation
Dayton, Ohio U.S.A.
All Rights Reserved
******************************************************************
EOS Software produced by:
NCR Systems Engineering - Copenhagen
Copenhagen
DENMARK
*****************************************************************å
æ E O S - L O A D version 2.03, EAR, 83-12-08 å
PROGRAM eosload (input,output);
LABEL
start, ask, stop;
CONST
spRel = 0;
epRel = 8;
dsRel = 0;
ssRel = 11;
nlRel = 13;
lsRel = 16;
TYPE
hexdigit = 0..15;
byte = -128..127;
word = -32768..32767;
long = integer;
longtype = (single, double, four);
informtype = (miss_in, versados, unix);
outformtype = (miss_out, binary, contiguous);
longfield =
RECORD
CASE longtype OF
single : (l : long);
double : (w : packed array Æ1..2Å of word);
four : (b : packed array Æ1..4Å of byte);
END; ælongfieldå
rectype = (librec, eoshead1, eoshead2, code, unixrec);
sad =
RECORD
rsv, atr : word;
segname : packed array Æ1..4Å of char;
segstart : longfield;
segsize : longfield;
END;
mid =
RECORD
first : word;
last : word;
END;
progrec =
RECORD
CASE rectype OF
librec:
(head1 : packed array Æ1..22Å of byte;
entry : longfield;
head2 : packed array Æ1..22Å of byte;
sads : array Æ1..8Å of sad;
mids : array Æ1..20Å of mid);
eoshead1:
(headsize : word;
progsize : long;
progkind : word;
progadr : word;
objName : packed array Æ1..16Å of char;
dummy : packed array Æ13..127Å of word);
eoshead2:
(eos : packed array Æ0..127Å of word);
code :
(data : packed array Æ0..255Å of byte);
unixrec:
(magic : long ;
textSz : long ;
dataSz : long ;
bssSz : long ;
symSz : long ;
trelSz : long ;
drelSz : long ;
entryPoint: long ;
dummy1 : packed array Æ8..63Å of long);
END; æprogrecå
progfile = FILE OF progrec;
fname = STRING Æ40Å;
VAR
filename, inname, outname, unixname : fname;
moduleName : packed array Æ1..16Å of char;
infile, outfile, unixfile : progfile;
prog, lib, unixHead, nulr : progrec;
loadSize, segSize, noTempB: longfield;
inForm : informtype;
outForm : outformtype;
terminate : boolean;
c : char;
d : array Æ1..2Å of char;
i, pdAddr, segAddr, codeSec, eosSec, nullSec, recno,
aEntryPoint, aDesSize, aLoadSize, aNoLoads, aNoLocP,
aNoTmpB1, aNoTmpB2, aNoTempP, aSegPtr, aSegSize,
noLoads, noLocP, noSegs, noTempP, segRel, error : word;
extraBss, bssSize, codesize, dataSize, eossize, nullSize, totalsize : long;
æ$Eå
PROCEDURE printhex (VAR lng : longfield);
TYPE
index = 1..8;
VAR
i, j : index;
val : word;
digit : array Æ1..2Å of hexdigit;
BEGIN
write ('$');
FOR i:= 1 TO 4 DO
BEGIN
val := lng.bÆiÅ;
IF val < 0 THEN val := val + 256;
digitÆ1Å := val DIV 16;
digitÆ2Å := val MOD 16;
FOR j := 1 TO 2 DO
BEGIN
IF digitÆjÅ < 10 THEN
write (digitÆjÅ:1)
ELSE
write (CHR (ORD('A') + digitÆjÅ - 10));
END; æjå
END; æiå
END; æprinthexå
PROCEDURE copyrec (VAR terminate : boolean);
BEGIN
write (outfile, prog);
terminate := eof (infile);
IF NOT terminate THEN
BEGIN
recno := recno + 1;
read (infile, prog);
END;
END; æcopyrecå
PROCEDURE insertlong (VAR adr : word;
lng : longfield);
BEGIN
IF adr > 127 THEN æinsert in later sectorå
ELSE
IF adr = 127 THEN æinsert 1st word into this sectorå
prog.eosÆadrÅ := lng.wÆ1Å
ELSE
IF adr >= 0 THEN æinsert both words into this sectorå
BEGIN
prog.eosÆadrÅ := lng.wÆ1Å;
prog.eosÆadr+1Å := lng.wÆ2Å;
END
ELSE
IF adr = -1 THEN æinsert 2nd word into this sectorå
prog.eosÆ0Å := lng.wÆ2Å;
æELSE field has been inserted previouslyå
adr := adr - 128;
END; æinsertlongå
PROCEDURE insertWord (VAR adr : word;
value : word );
BEGIN
IF adr > 127 THEN æinsert in later sectorå
ELSE
IF adr >= 0 THEN æinsert in this sectorå
prog.eosÆadrÅ := value;
æELSE word inserted previouslyå
adr := adr - 128;
END; æinsertWordå
PROCEDURE getWord (VAR adr : word;
VAR value : word );
BEGIN
IF adr > 127 THEN æget from later sectorå
ELSE
IF adr >= 0 THEN æget from this sectorå
value := prog.eosÆadrÅ;
æELSE field got previouslyå
adr := adr - 128;
END; ægetWordå
PROCEDURE appendSize (VAR name : fname;
size : integer);
VAR
i, digit : integer;
text: packed array Æ1..5Å of char;
BEGIN
i:=0;
REPEAT
i := i+1;
digit := size MOD 10;
size := size DIV 10;
textÆiÅ := CHR ( ORD ('0') + digit );
UNTIL size = 0 ;
FOR i := i DOWNTO 1 DO name := concat(name,textÆiÅ);
END; æappendSizeå
BEGIN
æ$A=2å
start:
writeln('type i/o formats: VUBC or ?? ');
dÆ1Å:= '?' ; dÆ2Å:= '?' ;
readln(dÆ1Å,dÆ2Å);
inform:= miss_in; outform:= miss_out;
FOR i:= 1 TO 2 DO
BEGIN
IF (dÆiÅ='v') OR (dÆiÅ='V') THEN inform:= versados;
IF (dÆiÅ='u') OR (dÆiÅ='U') THEN inform:= unix;
IF (dÆiÅ='b') OR (dÆiÅ='B') THEN outform:= binary;
IF (dÆiÅ='c') OR (dÆiÅ='C') THEN outform:= contiguous;
END;
IF (inform=miss_in) OR (outform=miss_out) THEN
BEGIN
writeln('two letters must be typed, to tell the input and output formats');
writeln('U: input format is unix load format');
writeln('V: input format is versados load format');
writeln('B: output format is versados binary');
writeln('C: output format is versados contiguous');
GOTO start;
END;
IF inform=unix THEN
BEGIN
writeln ('type name of UnixUtil loadfile');
readln (filename);
inname := concat (filename, '.LO'); æinName = unixUtil/pascal progå
writeln ('type unix program name');
readln (filename);
unixname := concat (filename, '.LU'); æunixName = C programå
writeln ('type ObjDir module name:');
readln (moduleName);
END
ELSE
BEGIN
unixname := '';
writeln ('type eos program name');
readln (filename);
inname := concat (filename, '.LO');
END;
IF outform=binary THEN outname := concat (filename, '.EO;B')
ELSE outname := concat (filename, '.EO;C=');
writeln ('convert ', unixname, ', ', inname, ' to ', outname);
IF inform = unix THEN
writeln ('ObjDir module name = ', moduleName);
ask:
writeln ('Ok (y/n)?');
readln (c);
IF (c='n') OR (c= 'N') THEN GOTO start;
IF (c<>'y') AND (c<>'Y') THEN GOTO ask;
reset (infile, inname);
æread and save LIB header block of pascal programå
IF eof (infile) THEN BEGIN error := 4; GOTO stop; END;
read (infile, lib);
æprint LIB headerå
writeln;
writeln ('Loader Information Block of file: ', inname);
writeln;
write ('Entry point: ');
printhex (lib.entry);
writeln;
writeln ('Program segments:');
writeln (' Segment Startaddr Segsize Sectors');
i:= 1;
REPEAT
write (' ':5, lib.sadsÆiÅ.segname, ' ':4);
printhex (lib.sadsÆiÅ.segstart);
write (' ':4);
printhex (lib.sadsÆiÅ.segsize);
writeln (lib.sadsÆiÅ.segsize.l div 256);
i:= i+1;
UNTIL lib.sadsÆiÅ.segsize.l <= 0;
writeln;
æcheck LIB headerå
codeSize := lib.sadsÆ1Å.segSize.l;
codeSec := codeSize DIV 256;
eosSize := lib.sadsÆ2Å.segSize.l;
eosSec := eosSize DIV 256;
totalSize := codeSize + eosSize;
bssSize := 0;
dataSize := 0;
nullSize := 0;
noSegs := 1;
IF (i <> 3) OR
(lib.sadsÆ1Å.segName <> 'SEG1') OR
(lib.sadsÆ2Å.segName <> 'SEG2') OR
(lib.sadsÆ2Å.segStart.l <> codeSize)
THEN
BEGIN error := 1; goto stop; END;
æskip code segmentå
FOR i:= 1 TO codesec DO
BEGIN
IF eof(infile) THEN
BEGIN error := 2; goto stop; END
ELSE
get (infile);
END;
æfind size of UNIX c programå
IF inform = unix THEN
BEGIN
reset (unixfile, unixname);
read (unixfile, unixhead);
writeln ('unix load header:m,t,d,b ', unixhead.magic,
unixhead.textSz, unixhead.dataSz, unixhead.bssSz);
writeln ('type size of additional bss bytes');
readln (extraBss);
codeSize := 32 + unixHead.textSz;
dataSize := unixHead.dataSz;
bssSize := unixHead.bssSz;
nullSize := bssSize + extraBss;
totalSize := (eosSize + codeSize + dataSize + nullSize
+ 255) DIV 256 * 256;
codeSec := (codeSize + dataSize + 255) DIV 256;
nullSec := (codeSize + dataSize + bssSize + 255) DIV 256 - codeSec;
noSegs := 2;
lib.entry.l:= 32; æ unix header is present in run time text å
END;
IF outform = contiguous THEN
appendSize (outname, eosSec + codeSec + nullSec);
rewrite (outfile, outname);
æcopy EOS head to output file:
insert headSize,totalSize and find addr of ProgDescrAdd å
read (infile, prog);
recno := 1;
prog.headSize := eosSize;
prog.progSize := totalSize;
IF inform = unix THEN prog.objName := moduleName;
æfind addr of prog-descrå
pdAddr := prog.progAdr;
IF (pdAddr < 0) OR (ODD (pdAddr)) THEN
BEGIN error := 5; goto stop; END;
æcopy ProgDescription:
insert entryPoint and find addrFirstSegDescr, noSegDescr å
pdAddr := pdAddr DIV 2;
aSegPtr := pdAddr + spRel;
aNoLocP := aSegPtr + 1;
aNoTempP := aNoLocP + 1;
aNoTmpB1 := aNoTempP + 1;
aNoTmpB2 := aNoTmpB1 + 1;
aEntryPoint := pdAddr + epRel;
REPEAT
insertLong (aEntryPoint, lib.entry);
getWord (aSegPtr, segRel);
getWord (aNoLocP, noLocP);
getWord (aNoTempP, noTempP);
getWord (aNoTmpB1, noTempB.wÆ1Å);
getWord (aNoTmpB2, noTempB.wÆ2Å);
IF aEntryPoint >= 0 THEN copyRec (terminate);
UNTIL (aEntryPoint < 0) OR terminate;
IF terminate THEN
BEGIN error := 5; goto stop; END;
writeln ('No. of LocalPointers TempPointers TempBytes');
writeln (noLocP:17, noTempP:14, noTempB.l:13);
writeln;
æcopy SegmentDescription:
insert segmentSize,loadSize and find addr of next SegDescr å
writeln ('EOS segno Segment size Load Size');
segAddr := pdAddr;
FOR i := 1 TO noSegs DO
BEGIN
IF odd (segRel) THEN
BEGIN error := 6; goto stop; END;
segAddr := segAddr + (segRel DIV 2);
aDesSize := segAddr + dsRel;
aSegSize := segAddr + ssRel;
aNoLoads := segAddr + nlRel;
aLoadSize := segAddr + lsRel;
IF i = 1 THEN
BEGIN
segSize.l := codeSize;
loadSize.l := codeSize;
END
ELSE
IF i = 2 THEN æonly inform UNIX. OBS! Modif.Descr. is destroyedå
BEGIN
segSize.l := dataSize + nullSize;
loadSize.l := segSize.l - extraBss;
noLoads := 1;
END;
write (i:8, ' ');
printHex (segSize);
write (segSize.l:9, ' ');
printHex (loadSize);
writeln (loadSize.l:9);
REPEAT
insertLong (aSegSize, segSize);
IF i = 2 THEN insertWord (aNoLoads, noLoads);
insertLong (aLoadSize, loadSize);
getWord (aDesSize, segRel);
IF aLoadSize >= 0 THEN copyRec (terminate);
UNTIL (aLoadSize < 0) OR terminate;
IF (terminate AND (i < noSegs)) OR (aLoadSize >= 0) THEN
BEGIN error := 6; goto stop; END;
END; æfor iå
æcopy last sectors if anyå
WHILE not terminate DO copyRec (terminate);
writeln;
writeln (' ':9, recno, ' sectors moved to ', outname);
æcopy code segment to output fileå
IF inform = versados THEN
BEGIN
reset (infile);
get (infile); æskip LIB headerå
FOR i:= 1 TO codeSec DO
BEGIN
read (infile, prog);
write (outfile, prog);
END;
writeln ('Program: ', codesec, ' sectors moved to ', outname);
END
ELSE
BEGIN æ unix format å
reset (unixfile);
FOR i:= 0 TO 255 DO nulr.dataÆiÅ:= 0;
read (unixfile, prog);
prog.symSz:= dataSize + nullSize; æcommunicate bsmax to runtime systemå
write (outfile, prog);
FOR i:= 2 TO codeSec DO
BEGIN
read (unixfile, prog);
write (outfile, prog);
END;
FOR i:= 1 TO nullSec DO write (outfile, nulr);
writeln('unix program: ', codeSec, ' +', nullSec, ' moved to ', outname);
END ;
IF false THEN
BEGIN
stop: æerror messageså
write (inname);
CASE error OF
1: writeln (' is not correct load format');
2: writeln (' size error in SEG1 ', i, codesec);
3: writeln (' size error in SEG2 ', recno,eossec);
4: writeln (' is empty');
5: writeln (' illegal prog-descr address ', pdAddr*2);
6: writeln (' illegal segment-descr address ', segAddr*2);
END;
END;
END. æ eosLoad å
«eof»