MODULE Kernel; (*       Definition     by NW  11.4.86 / 12.4.91     *)
               (* Implementation by S. Junker 26.8.93 / 29.8.93     *)
               (*               and D. Theisen    26.6.93           *)

(* implementation of Wirths module Kernel for Atari. For use in system
   modules. Direct use by client modules should be avoided. Some variables
   may be unused and not all procedures might work as they do in Wirths
   system.
*)

TYPE
  Sector* = RECORD END ;
  IntProc*  = PROCEDURE;

VAR
  ModList*:    S.PTR;
  NofPages*, NofSectors*, allocated*:  LONGINT;
  StackOrg*, HeapLimit*: LONGINT;
  FileRoot*, FontRoot*: LONGINT;
  SectNo*:     LONGINT;

  pc*, sb*, fp*, sp0*, sp1*, mod*, eia*: LONGINT; (*status upon trap*)
  err*, pcr*: INTEGER;

(* Block storage management*)

PROCEDURE New*(Bytes : LONGINT; Type : INTEGER) : S.PTR;
  (* allocates memory *)

PROCEDURE Free*(Adr : S.PTR);
  (* free memory accessed by Adr *)

PROCEDURE GC*;
  (* does a complete garbage collection *)

PROCEDURE PartialGC*() : BOOLEAN;
  (* does a part of the garbage collection. Returns TRUE if done completely *)

(* Miscellaneous procedures*)

PROCEDURE GetClock*(VAR time, date: LONGINT);

PROCEDURE SetClock*(time, date: LONGINT);

(*--------------------------------------------------*)
(* all following procedures are not implemented yet *)
(*--------------------------------------------------*)

(* Disk storage management*)

PROCEDURE AllocSector*(hint: LONGINT; VAR sec: LONGINT);
PROCEDURE MarkSector*(sec: LONGINT);
PROCEDURE FreeSector*(sec: LONGINT);
PROCEDURE GetSector*(src: LONGINT; VAR dest: Sector);
PROCEDURE PutSector*(dest: LONGINT; VAR src: Sector);
PROCEDURE ResetDisk*;

(* Miscellaneous procedures*)

PROCEDURE InstallIP*(P: IntProc; chan: INTEGER);
PROCEDURE InstallTrap*(P: IntProc);
PROCEDURE SetICU*(n: CHAR);

END Kernel.
