Skip to content

Commit

Permalink
Hochstrasser Modula-2 v2.01
Browse files Browse the repository at this point in the history
  • Loading branch information
davidly committed Jun 29, 2024
1 parent 0c597e0 commit 8e552cf
Show file tree
Hide file tree
Showing 114 changed files with 6,004 additions and 0 deletions.
52 changes: 52 additions & 0 deletions Hochstrasser Modula-2 v201/ACKERMAN.MOD
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
MODULE Ackermann;

FROM TERM1 IMPORT
Read,
Write, WriteCard, WriteLn, WriteString;

FROM ASCII IMPORT
bel;

VAR
p1,p2: CARDINAL;
ch: CHAR;


PROCEDURE Acker(m, n: CARDINAL): CARDINAL;
BEGIN
IF m = 0 THEN
RETURN n + 1;
ELSIF n = 0 THEN
RETURN Acker(m-1, 1);
ELSE
RETURN Acker(m-1, Acker(m, n-1));
END;
END Acker;

PROCEDURE ReadNum(VAR c: CARDINAL);
BEGIN
LOOP
Read(ch);
c := ORD(ch) - 30H;
IF c < 10 THEN EXIT; END;
Write(bel);
END;
Write(ch);
END ReadNum;

BEGIN
WriteString( 'Ackermann Function Calculation' ); WriteLn;
WriteString( '------------------------------' ); WriteLn;
WriteLn;
WriteString('Enter first parameter (1..4): ');
ReadNum(p1);
WriteLn;
WriteString('Enter second parameter (1..7): ');
ReadNum(p2);
WriteLn; WriteString('Hit any key to start Ackermann(');
WriteCard(p1,0); Write(','); WriteCard(p2,0); WriteString('): ');
Read(ch);
WriteLn; WriteCard(Acker(p1,p2), 10);
Write(bel);
END Ackermann.

49 changes: 49 additions & 0 deletions Hochstrasser Modula-2 v201/ASCII.DEF
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
(***************************************************************************)
(* *)
(* DEFINITION MODULE ASCII *)
(* *)
(* *)
(* Modula-2 Utility Library Module *)
(* *)
(* for the *)
(* *)
(* Modula-2 System for Z80 / CP/M *)
(* *)
(* by *)
(* *)
(* Hochstrasser Computing AG *)
(* Leonhardshalde 21 *)
(* 8001 Zuerich *)
(* Switzerland *)
(* *)
(* *)
(* *)
(* *)
(* created: Aug - 23 - 1984 pwh *)
(* last updated: Aug - 23 - 1984 pwh *)
(***************************************************************************)
DEFINITION MODULE ASCII;


EXPORT QUALIFIED
nul, soh, stx, etx, eot, enq, ack, bel,
bs, ht, lf, vt, ff, cr, so, si,
dle, dc1, dc2, dc3, dc4, nak, syn, etb,
can, em, sub, esc, fs, gs, rs, us,
del;


CONST

nul = 00C; soh = 01C; stx = 02C; etx = 03C;
eot = 04C; enq = 05C; ack = 06C; bel = 07C;
bs = 10C; ht = 11C; lf = 12C; vt = 13C;
ff = 14C; cr = 15C; so = 16C; si = 17C;
dle = 20C; dc1 = 21C; dc2 = 22C; dc3 = 23C;
dc4 = 24C; nak = 25C; syn = 26C; etb = 27C;
can = 30C; em = 31C; sub = 32C; esc = 33C;
fs = 34C; gs = 35C; rs = 36C; us = 37C;
del = 177C;

END ASCII.

Binary file added Hochstrasser Modula-2 v201/ASCII.MSY
Binary file not shown.
33 changes: 33 additions & 0 deletions Hochstrasser Modula-2 v201/CHAINING.DEF
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
(***************************************************************************)
(* *)
(* *)
(* DEFINITION MODULE Chaining *)
(* *)
(* Modula-2 Utility Library Module *)
(* *)
(* for the *)
(* *)
(* Modula-2 System for Z80 / CP/M *)
(* *)
(* by *)
(* *)
(* Hochstrasser Computing AG *)
(* Leonhardshalde 21 *)
(* 8001 Zuerich *)
(* Switzerland *)
(* *)
(* *)
(* *)
(* *)
(* created: Mar - 5 - 1984 pwh *)
(* last updated: Mar - 5 - 1985 pwh *)
(***************************************************************************)
DEFINITION MODULE Chaining;

EXPORT QUALIFIED
Chain;

PROCEDURE Chain(fileName: ARRAY OF CHAR);

END Chaining.

Binary file added Hochstrasser Modula-2 v201/CHAINING.MRL
Binary file not shown.
Binary file added Hochstrasser Modula-2 v201/CHAINING.MSY
Binary file not shown.
38 changes: 38 additions & 0 deletions Hochstrasser Modula-2 v201/CMDLIN.DEF
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
(***************************************************************************)
(* *)
(* *)
(* DEFINITION MODULE CmdLin *)
(* *)
(* Modula-2 Utility Library Module *)
(* *)
(* for the *)
(* *)
(* Modula-2 System for Z80 / CP/M *)
(* *)
(* by *)
(* *)
(* Hochstrasser Computing AG *)
(* Leonhardshalde 21 *)
(* 8001 Zuerich *)
(* Switzerland *)
(* *)
(* *)
(* *)
(* *)
(* created: Oct - 29 - 1984 pwh *)
(* last updated: Jan - 8 - 1985 pwh *)
(***************************************************************************)
DEFINITION MODULE CmdLin;

EXPORT QUALIFIED
ReadCommandLine;


(*--------------------------------------------------------------*)
(* PROCEDURE ReadCommandLine -- read command line into STRING *)
(* ComLin. *)
(*--------------------------------------------------------------*)
PROCEDURE ReadCommandLine(VAR ComLin: ARRAY OF CHAR);

END CmdLin.

143 changes: 143 additions & 0 deletions Hochstrasser Modula-2 v201/CMDLIN.MOD
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
(***************************************************************************)
(* *)
(* *)
(* IMPLEMENTATION MODULE CmdLin *)
(* *)
(* Modula-2 Utility Library Module *)
(* *)
(* for the *)
(* *)
(* Modula-2 System for Z80 / CP/M *)
(* *)
(* by *)
(* *)
(* Hochstrasser Computing AG *)
(* Leonhardshalde 21 *)
(* 8001 Zuerich *)
(* Switzerland *)
(* *)
(* *)
(* *)
(* created: Oct - 29 - 1984 pwh *)
(* last updated: Jan - 8 - 1985 pwh *)
(***************************************************************************)
IMPLEMENTATION MODULE CmdLin;

FROM SYSTEM IMPORT
ADR;

FROM Strings IMPORT
STRING,
Assign, Concat, Delete, Pos, Length;

FROM Moves IMPORT
MoveLeft, Fill;

FROM Terminal IMPORT
Write, WriteLn, ReadString;

FROM ASCII IMPORT
nul;


TYPE
CPMCmdLine = RECORD
length: CHAR;
text : STRING;
END;

ShortFCB = RECORD
drive : CHAR;
name : ARRAY [0..7] OF CHAR;
extension: ARRAY [0..2] OF CHAR;
END;

VAR
i, n, l: CARDINAL;
used: BOOLEAN;

(*--------------------------------------------------------------*)
(* PROCEDURE ReadCommandLine -- read command line into comLin. *)
(* Correctness is checked. comLin cannot be empty on return *)
(* from this procedure. *)
(*--------------------------------------------------------------*)
PROCEDURE ReadCommandLine(VAR comLin: ARRAY OF CHAR);
VAR
commandLine[80H]: CPMCmdLine;
fcb [5CH]: ShortFCB;
expString : STRING;

PROCEDURE AppendWithoutBlanks(VAR string : ARRAY OF CHAR;
newPart: ARRAY OF CHAR);
BEGIN
Concat(expString,newPart,expString);
n := Pos(' ',expString);
IF n <= HIGH(expString) THEN
Delete(expString,n,HIGH(expString) + 1 - n);
END;
END AppendWithoutBlanks;

PROCEDURE SkipBlanks;
BEGIN
i := 0;
WHILE comLin[0] = ' ' DO Delete(comLin,0,1); END;
END SkipBlanks;

PROCEDURE Prompt;
BEGIN
REPEAT
WriteLn; Write('*'); ReadString(comLin);
SkipBlanks;
UNTIL comLin[0] # nul;
END Prompt;

BEGIN (* ReadCommandLine *)
IF NOT used THEN (* get it first time *)
used := TRUE;
Assign(comLin,commandLine.text);
i := 0; n := 0;
IF fcb.drive > nul THEN (* construct expected command line *)
expString[0] := CHR(ORD(fcb.drive) + ORD('@'));
expString[1] := ':';
expString[2] := 0C;
END;
AppendWithoutBlanks(expString,fcb.name);
Concat(expString,'.', expString);
AppendWithoutBlanks(expString,fcb.extension);
SkipBlanks;
n := 0;
LOOP
IF (expString[n] = nul) OR
(expString[n] = '.') & (comLin[i] # '.') THEN
i := 0;
EXIT;
END;

IF comLin[i] # expString[n] THEN
WHILE (i <= HIGH(comLin)) &
(comLin[i] # ' ') & (comLin[i] # nul) DO
i := i + 1;
END;
EXIT;
END;

n := n + 1;
i := i + 1;
END;

IF comLin[i] = nul THEN (* commandline empty *)
Prompt;
END;
ELSE
Prompt;
END;
MoveLeft(ADR(comLin[i]), ADR(comLin), HIGH(comLin) + 1 - i);
i := 0;
WHILE (i <= HIGH(comLin)) & (comLin[i] # nul) DO i := i + 1; END;
Fill(ADR(comLin[i]),HIGH(comLin)+1-i, 0C);
END ReadCommandLine;

BEGIN
used := FALSE;
END CmdLin.

Binary file added Hochstrasser Modula-2 v201/CMDLIN.MRL
Binary file not shown.
Binary file added Hochstrasser Modula-2 v201/CMDLIN.MSY
Binary file not shown.
47 changes: 47 additions & 0 deletions Hochstrasser Modula-2 v201/CONTROLS.DEF
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
(***************************************************************************)
(* *)
(* DEFINITION MODULE Controls *)
(* *)
(* *)
(* Modula-2 Utility Library Module *)
(* *)
(* for the *)
(* *)
(* Modula-2 System for Z80 / CP/M *)
(* *)
(* by *)
(* *)
(* Hochstrasser Computing AG *)
(* Leonhardshalde 21 *)
(* 8001 Zuerich *)
(* Switzerland *)
(* *)
(* *)
(* *)
(* *)
(* created: Sep - 12 - 1984 pwh *)
(* last updated: Sep - 12 - 1984 pwh *)
(***************************************************************************)
DEFINITION MODULE Controls;


EXPORT QUALIFIED
CtrlAt,CtrlA, CtrlB, CtrlC, CtrlD, CtrlE, CtrlF, CtrlG,
CtrlH, CtrlI, CtrlJ, CtrlK, CtrlL, CtrlM, CtrlN, CtrlO,
CtrlP, CtrlQ, CtrlR, CtrlS, CtrlT, CtrlU, CtrlV, CtrlW,
CtrlX, CtrlY, CtrlZ;


CONST

CtrlAt= 00C; CtrlA = 01C; CtrlB = 02C; CtrlC = 03C;
CtrlD = 04C; CtrlE = 05C; CtrlF = 06C; CtrlG = 07C;
CtrlH = 10C; CtrlI = 11C; CtrlJ = 12C; CtrlK = 13C;
CtrlL = 14C; CtrlM = 15C; CtrlN = 16C; CtrlO = 17C;
CtrlP = 20C; CtrlQ = 21C; CtrlR = 22C; CtrlS = 23C;
CtrlT = 24C; CtrlU = 25C; CtrlV = 26C; CtrlW = 27C;
CtrlX = 30C; CtrlY = 31C; CtrlZ = 32C;


END Controls.

Binary file added Hochstrasser Modula-2 v201/CONTROLS.MSY
Binary file not shown.
Loading

0 comments on commit 8e552cf

Please sign in to comment.