DEFINITION BIOS; (* SJ 11.7.92 / 9.3.93 *)

(* All parameters have the opposite order than the c bindings. This is
   necessary becauses the compiler pushes the first parameter first onto
   the stack whereas a c compiler pushes the last parameter first.
   Using a procedure defined here will not produce a subroutine call but
   a trap call.
*)

IMPORT SYSTEM;

CONST (* devices *)
   prt* = 0; aux* = 1; con* = 2; midi* = 3; kbd* = 4; scr* = 5;

   (* flags for Rwabs *)
   read* = 0; write* = 0; readnomc* = 2; writenomc* = 3;

   (* media change status *)
   nomc* = 0; maybemc* = 1; mc* = 2;

   (* shift bits *)
   rshift* = 0; lshift* = 1; control* = 2; altern* = 3; caps* = 4; rmbut* = 5;
   lmbut* = 6;

TYPE
   md*     = POINTER TO mdesc;
   mdesc*  = RECORD
               Next*   : md;
               Begad*  : SYSTEM.PTR;
               Length* : LONGINT;
               Owner*  : SYSTEM.PTR;
             END(*RECORD*);
   mpblock*= RECORD
               FreeList*  : md;
               AllocList* : md;
               Roving*    : SYSTEM.PTR;
             END(*RECORD*);
   mpb*    = POINTER TO mpblock;
   bpblock*= RECORD
               BytesPSec*  : INTEGER;
               SecPClus*   : INTEGER;
               BytesPClus* : INTEGER;
               SecPDir*    : INTEGER;
               SecPFAT*    : INTEGER;
               SecnumFAT*  : INTEGER;
               SecnumData* : INTEGER;
               NumClus*    : INTEGER;
               Flags*      : INTEGER;
             END(*RECORD*);
   bpb*    = POINTER TO bpblock;


PROCEDURE Getmpb*(MpbPtr : mpb);

PROCEDURE Bconstat*(Device : INTEGER) : INTEGER;

PROCEDURE Bconin*(Device : INTEGER) : LONGINT;

PROCEDURE Bconout*(Char,Device : INTEGER);

PROCEDURE Rwabs*(Drive,Recno,Count : INTEGER; Buffer : SYSTEM.PTR;
                 RwFlag : INTEGER) : INTEGER;

PROCEDURE Setexc*(Vector : SYSTEM.PTR; Vecnum : INTEGER) : SYSTEM.PTR;

PROCEDURE Tickcal*() : LONGINT;

PROCEDURE Getbpb*(Drive : INTEGER) : bpb;

PROCEDURE Bcostat*(Device : INTEGER) : INTEGER;

PROCEDURE Mediach*(Drive : INTEGER) : INTEGER;

PROCEDURE Drvmap*() : SET;

PROCEDURE Kbshift*(Shiftbits : INTEGER) : SET;

END BIOS.
