DEFINITION XBIOS; (* SJ 11.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 (* mouse modi *)
  off* = 0; rel* = 1; abs* = 2; key* = 4;

  (* resolutions *)
  low* = 0; mid* = 1; high* = 2;

  (* floppies *)
  flopa* = 0; flopb* = 1;

  (* devices *)
  aux* = 0; ikbd* = 1; midi* = 2;

  (* disk types *)
  sssd* = 0; dssd* = 1; ssdd* = 2; dsdd* = 3;

  (* exec flag *)
  noexec* = 0; exec* = 1;

  (* cursor function *)
  curoff* = 0; curon* = 1; blink* = 2; noblink* = 3; setrate* = 4; getrate* = 5;

  (* timers *)
  timera* = 0; timerb* = 1; timerc* = 2; timerd* = 3;

  (* bits for printer configuration *)
  typewheel* = 0; color* = 1; epson* = 2; nlq* = 3; serial* = 4; singlesheet* = 5;


TYPE
   PROC         = PROCEDURE;
   mparam*      = RECORD
                    Ystart* : INTEGER; (* 0 = unten, 1 = oben Y = 0 *)
                    ToIKBD* : INTEGER; (* Fachliteratur *)
                    ScaleX* : INTEGER;
                    ScaleY* : INTEGER;
                    MaxX*   : INTEGER; (* Diese vier Werte nur falls Absolut *)
                    MaxY*   : INTEGER;
                    AbsX*   : INTEGER;
                    AbsY*   : INTEGER;
                  END(*RECORD*);
   mpar*        = POINTER TO mparam;
   palettedesc* = ARRAY 16 OF INTEGER;
   palette*     = POINTER TO palettedesc;
   siobufdesc*  = RECORD
                    Buffer* : SYSTEM.PTR;
                    Size*   : INTEGER;
                    Tail*   : INTEGER;
                    Head*   : INTEGER;
                    Low*    : INTEGER;
                    High*   : INTEGER;
                  END(*RECORD*);
   siobuf*      = POINTER TO siobufdesc;
   keytabdesc*  = RECORD
                   Unshift*,Shift*,Capslock* : POINTER TO ARRAY 128 OF CHAR;
                 END(*RECORD*);
   keytab*      = POINTER TO keytabdesc;
   sysvecs*     = RECORD
                    Midivec* : PROC;
                    Kbderr*  : PROC;
                    Midierr* : PROC;
                    Statvec* : PROC;
                    Mousevec*: PROC;
                    Clockvec*: PROC;
                    Joyvec*  : PROC;
                    Midisys* : PROC;
                    Ikbdsys* : PROC;
                  END(*RECORD*);
   sysvec*      = POINTER TO sysvecs;
   prtdesc*     = RECORD
                    Screen*  : SYSTEM.PTR;
                    Offset*  : INTEGER;
                    Width*   : INTEGER;
                    Height*  : INTEGER;
                    LeftMar* : INTEGER;
                    RightMar*: INTEGER;
                    ScrRes*  : INTEGER;
                    PrtRes*  : INTEGER;
                    Palette* : palette;
                    PrtType* : INTEGER;
                    PrtPort* : INTEGER;
                    Mask*    : LONGINT;
                  END(*RECORD*);
   prtpar*      = POINTER TO prtdesc;


PROCEDURE Initmouse*(Vector : PROC; Param : mpar; Mode : INTEGER);

PROCEDURE Physbase*() : SYSTEM.PTR;

PROCEDURE Logbase*() : SYSTEM.PTR;

PROCEDURE Getrez*() : INTEGER;

PROCEDURE Setscreen*(Resol : INTEGER; Physbase,Logbase : SYSTEM.PTR);

PROCEDURE Setpalette*(Palette : palette);

PROCEDURE Setcolor*(Color,Register : INTEGER) : INTEGER;

PROCEDURE Floprd*(Count,Side,Track,Sector,Floppy : INTEGER;
                  Filler : LONGINT; Buffer : SYSTEM.PTR) : INTEGER;

PROCEDURE Flopwr*(Count,Side,Track,Sector,Floppy : INTEGER;
                  Filler : LONGINT; Buffer : SYSTEM.PTR) : INTEGER;

PROCEDURE Flopfmt*(Virgin : INTEGER; Magic : LONGINT; Interleave,Side,Track,Secno,
                   Floppy : INTEGER; Filler : LONGINT;
                   Buffer : SYSTEM.PTR) : INTEGER;

PROCEDURE Midiws*(DataPtr : SYSTEM.PTR; Count : INTEGER);

PROCEDURE Mfpint*(Vector : PROC; Vecnum : INTEGER);

PROCEDURE Iorec*(Device : INTEGER) : siobuf;

PROCEDURE Rsconf*(Scr,Tsr,Rsr,Ucr,Flowctl,Speed : INTEGER);

PROCEDURE Keytbl*(Capslock,Shift,Unshift : SYSTEM.PTR) : keytab;

PROCEDURE Random*() : LONGINT;

PROCEDURE Protobt*(ExecFlag,Disktype : INTEGER; SerialNo : LONGINT;
                   Buffer : SYSTEM.PTR);

PROCEDURE Flopver*(Count,Side,Track,Sector,Floppy : INTEGER;
                   Filler : LONGINT; Buffer : SYSTEM.PTR) : INTEGER;

PROCEDURE Scrdump*();

PROCEDURE Cursconf*(Operand,Function : INTEGER) : INTEGER;

PROCEDURE Settime*(DateTime : LONGINT);

PROCEDURE Gettime*() : LONGINT;

PROCEDURE Bioskeys*();

PROCEDURE Ikbdws*(DataPtr : SYSTEM.PTR; Count : INTEGER);

PROCEDURE Jdisint*(Intno : INTEGER);

PROCEDURE Jenabint*(Intno : INTEGER);

PROCEDURE Giaccess*(Regno,Data : INTEGER) : INTEGER;

PROCEDURE Offgibit*(Data : INTEGER);

PROCEDURE Ongibit*(Data : INTEGER);

PROCEDURE Xbtimer*(Vector : PROC; Data,Control,Timer : INTEGER);

PROCEDURE Dosound*(DataPtr : SYSTEM.PTR);

PROCEDURE Setprt*(Config : INTEGER) : INTEGER;

PROCEDURE Kbdvbase*() : sysvec;

PROCEDURE Kbrate*(Repeat,Initial : INTEGER) : INTEGER;

PROCEDURE Prtblk*(Parameter : prtpar);

PROCEDURE Vsync*();

PROCEDURE Supexec*(Code : PROC);

END XBIOS.
