(* MAS Storage definition module. The intention in setting up this module is to encapsulate all processor and RAM--storage dependencies. *) DEFINITION MODULE MASSTOR; (* Import lists and Definitions *) FROM MASELEM IMPORT GAMMAINT; FROM Portab IMPORT STRING; (* error indicators *) CONST spotless = 0; harmless = 1; severe = 2; fatal = 3; confusion = 9; TYPE LIST = GAMMAINT; P0 = PROCEDURE(); VAR BETA, BETA1, SIL : LIST; NU, NORMNU, EMSNUP, EMSNU, GCC, GCCC, GCM, RHO, TAU, TAU0 : GAMMAINT; emsInUse : BOOLEAN; SPACEB, SPACEB1 : GAMMAINT; DebugProcessor : P0; (* procedure called by ERROR if debug requested *) history : INTEGER; (* highest error level encountered so far. *) PROCEDURE ADV(L : LIST; VAR a, LP : LIST); (*Advance. L is a non-null list. a=FIRST(L) and LP=RED(L). *) PROCEDURE CELLS(): GAMMAINT; (*Cells. Returns the used cells since storage initialization. *) PROCEDURE CLOCK(): GAMMAINT; (*Clock. Returns the current CPU clock reading in seconds. At ATARI ST the clock is in 2 seconds intervalls. *) PROCEDURE COMP(a, L : LIST): LIST; (*Composition. a is an object. L is a list. Returns the composition of a and L. *) PROCEDURE DEQUE(L : LIST): LIST; (*Dequeue. L is a non empty queue representing list. Returns a, the first object from the queue. L is updated. *) PROCEDURE EMPTYQUE(M : LIST): BOOLEAN; (*Empty Queue. Tests if a queue is empty. *) PROCEDURE ENQUE(a, L : LIST); (*Enqueue. a is an object. L is a queue representing list. Appends a to the quque L. *) PROCEDURE ERROR(a : INTEGER; s : STRING); (*Error. An error of severity a and indication s is reported. *) PROCEDURE ErrorHandler(a : P0): GAMMAINT; (*Error handler. Any error reported by the ERROR procedure is catched. *) PROCEDURE FIRST(L : LIST): LIST; (*First. L is a non-null list. a is the first element of L. *) PROCEDURE NEWQUE(): LIST; (*New Queue. Returns a new empty queue. *) PROCEDURE GENPROCESS(P : PROC; VAR S : ADDRESS; n : BOOLEAN); (*Generate a new process. The process working space is allocated unter control of the garbage collector if n is TRUE, else it is assumed that the last working space is reused. P is a parameter less procedure, S is the address of the generated process. If not enough space is available an error ocours. *) PROCEDURE INV(L : LIST): LIST; (*Inverse. L is a list. The inverse of L is returned. The list L is modified. *) PROCEDURE LENGTH(L : LIST): GAMMAINT; (*Length. L is a list. Returns length(L).*) PROCEDURE LIST1(a : LIST): LIST; (*List, 1 element. a is an object. L is the list (a). *) PROCEDURE LISTVAR(VAR L : LIST); (*List variable. L is a list. The address of L is made accessible to the garbage collector. *) PROCEDURE RED(L : LIST): LIST; (*Reductum. L is a non-null list. Returns the reductum of L. *) PROCEDURE SFIRST(L, a : LIST); (*Set first. L is a non-null list. a is an object. The first element of L is changed to a. *) PROCEDURE SRED(L, LP : LIST); (*Set reductum. L is a non-null list. LP is a list. The reductum of L is changed to LP. *) PROCEDURE SAVEPROCESS(); (*Save current process. Prepare transfer of two processes unter the control of the garbage collector. *) PROCEDURE TIME(): GAMMAINT; (*Time. Returns the CLOCK minus the garbage collection time TAU. At ATARI ST the clock is in 2 seconds intervalls. *) PROCEDURE addEmsToAvail(): LIST; (*Adds EMS-memory to AVAIL list. The number of EMS-cells added is returned. *) (* Dos-Interrupt Funktionen, in Topspeed-Modula nicht direkt verfgbar *) PROCEDURE InputReady(): BOOLEAN; PROCEDURE ReadKybdNoEcho(VAR c : CHAR); PROCEDURE saveCellSpace(VAR adr : ADDRESS; VAR amnt : CARDINAL) : BOOLEAN; PROCEDURE restoreCellSpace() : BOOLEAN; PROCEDURE AddressToPhys(Adresse : ADDRESS): GAMMAINT; PROCEDURE GetStackAdr(): GAMMAINT; END MASSTOR.