SunPwrAdGen.mesa
Copyright Ó 1989 by Xerox Corporation. All rights reserved.
Last Edited by: Gasbarro April 14, 1989 11:16:50 am PDT
DIRECTORY
FS, IO, Rope;
SunPwrAdGen: CEDAR PROGRAM
IMPORTS FS, IO, Rope
~ BEGIN
MakeFiles: PROC [min, max: CARD] RETURNS [r: Rope.ROPE ← "rcsabel.bat "] ~ {
rest: IO.STREAMFS.StreamOpen["SunPwrAdTail.abl"];
out: IO.STREAMNIL;
make: IO.STREAMFS.StreamOpen["rcsabel.bat", $create];
t: CARD ← 0;
name: Rope.ROPE;
FOR i: CARD IN [min..max] DO
name ← IO.PutFR["adr%03g", IO.int[i]];
make.PutF["IF NOT EXIST U%03g.JED ABELRCS %g\n\l", IO.int[i], IO.rope[name]];
r ← Rope.Cat[r, name, ".abl "];
out ← FS.StreamOpen[Rope.Concat[name, ".abl"], $create];
out.PutF["MODULE SunPwrAd\n\l"];
out.PutF["TITLE 'Sun power controller address pal'\n\l\n\l"];
out.PutF["U%03g DEVICE 'P16R4';\n\l\n\l", IO.int[i]];
out.PutF["nS0, nS1, nS2, nS3, nS4, nS5, nS6 PIN 2, 3, 4, 5, 6, 7, 8;\n\l"];
out.PutF["SerIn, nForceOn, OnB PIN 9, 12, 13;\n\l"];
out.PutF["nJump PIN 19;\n\l"];
out.PutF["nCmd, OnA PIN 18, 17;\n\l"];
out.PutF["nHdrEven, nBad0To7, nBadAdr PIN 16, 15, 14;\n\l\n\l"];
t ← i;
FOR j: NAT IN [0..9) DO
out.PutF["A%g = %g;\n\l", IO.int[j], IO.int[t MOD 2]];
t ← t/2;
ENDLOOP;
IO.SetIndex[rest, 0];
WHILE NOT IO.EndOf[rest] DO
out.PutRope[rest.GetLineRope[]];
out.PutRope["\n\l"];
ENDLOOP;
IO.Close[out];
ENDLOOP;
IO.Close[rest];
IO.Close[make];
};
END.