|##########|
|#MAGIC   #|CLABLJBN
|#PROJECT #|"IMPORTALL"
|#PATHS   #|"StdProject"
|#FLAGS   #|xx-x-x-xx---x-x-----------------
|#USERSW  #|--------------------------------
|#USERMASK#|--------------------------------
|#SWITCHES#|x----x----------
|##########|
DEFINITION MODULE Graphics;
(* $A- *)

|
| WB 23 May 1992 added CharLoc and changed ANYPTRs to POINTERs to ARRAYs
| WB 25 May 1992 added TextStr() and TextLengthStr for direct calling with
|                STRINGs
| WB 27 May 1992 re-added Groups. Who removed them ? Who created this file ?
| WB 26 Aug 1992 TextAttr.name should be a SysStringPtr. Need to do cosmetics
|


FROM System     IMPORT BITSET,LONGSET,SHORTSET,Regs,PROC, SysStringPtr;
FROM Hardware   IMPORT BltNodePtr,Beam0Flags,Beam0FlagSet;
FROM Exec       IMPORT Interrupt,Library,List,Message,MinList,Node,NodePtr,
		       NodeType,SignalSemaphore,SignalSemaphorePtr,TaskPtr,
		       MsgPortPtr,LibraryPtr;
FROM Utility    IMPORT HookPtr,StdTags;

TYPE WindowPtr = DEFERRED POINTER Intuition.WindowPtr;

TYPE
  ViewPortExtraPtr = POINTER TO ViewPortExtra;
  ViewPortPtr      = POINTER TO ViewPort;
  VTagListPtr      = POINTER TO VTagList;

|
|  BitMaps & Raster
|
  BitMapPtr       = POINTER TO BitMap;
  BitMap          = RECORD
		      bytesPerRow  : CARDINAL;
		      rows         : CARDINAL;
		      flags        : SHORTSET;
		      depth        : SHORTCARD;
		      pad          : CARDINAL;
		      planes       : ARRAY [0..7] OF ANYPTR;
		    END;

  BitScaleArgsPtr = POINTER TO BitScaleArgs;
  BitScaleArgs    = RECORD
		      srcX,
		      srcY         : CARDINAL;
		      srcWidth,
		      srcHeight    : CARDINAL;
		      srcXFactor,
		      srcYFactor   : CARDINAL;
		      destX,
		      destY        : CARDINAL;
		      destWidth,
		      destHeight   : CARDINAL;
		      xDestFactor,
		      yDestFactor  : CARDINAL;
		      srcBitMap    : BitMapPtr;
		      destBitMap   : BitMapPtr;
		      flags        : LONGSET;
		      xDDA,
		      yDDA         : CARDINAL;
		      reserved     : ARRAY [2] OF LONGINT;
		    END;
|
| Layers & Regions
|
  LayerInfoPtr       = POINTER TO LayerInfo;
  LayerPtr           = POINTER TO Layer;

  RectanglePtr       = POINTER TO Rectangle;
  Rectangle          = RECORD
			 minX : INTEGER;
			 minY : INTEGER;
			 maxX : INTEGER;
			 maxY : INTEGER;
		       END;

  ClipRectPtr        = POINTER TO ClipRect;
  ClipRect           = RECORD
			 next     : ClipRectPtr;
			 prev     : ClipRectPtr;
			 lobs     : LayerPtr;
			 bitMap   : BitMapPtr;
			 bounds   : Rectangle;
			 p1       : ClipRectPtr;
			 p2       : ClipRectPtr;
			 reserved : LONGINT;
			 flags    : LONGINT;
		       END;

  RegionRectanglePtr = POINTER TO RegionRectangle;
  RegionRectangle    = RECORD
			 next   : RegionRectanglePtr;
			 prev   : RegionRectanglePtr;
			 bounds : Rectangle;
		       END;

  RegionPtr          = POINTER TO Region;
  Region             = RECORD
			 bounds          : Rectangle;
			 regionRectangle : RegionRectanglePtr;
		       END;

CONST
  needsNoConcealedRasters = 1;

  isLessX                 = 1;
  isLessY                 = 2;
  isGrtrX                 = 4;
  isGrtrY                 = 8;

TYPE
  LayerFlags       = (layerSimple,layerSmart,layerSuper,lf3,layerUpdating,
		      lf5,layerBackdrop,layerRefresh,layerClipRectsLost);
  LayerFlagSet     = SET OF LayerFlags;

  RastPortPtr      = POINTER TO RastPort;
  Layer            = RECORD
		       front              : LayerPtr;
		       back               : LayerPtr;
		       clipRect           : ClipRectPtr;
		       rp                 : RastPortPtr;
		       bounds             : Rectangle;
		       reserved           : ARRAY [4] OF SHORTCARD;
		       priority           : CARDINAL;
		       flags              : LayerFlagSet;
		       superBitMap        : BitMapPtr;
		       superClipRect      : ClipRectPtr;
		       window             : WindowPtr;
		       scrollX            : INTEGER;
		       scrollY            : INTEGER;
		       cr                 : ClipRectPtr;
		       cr2                : ClipRectPtr;
		       crnew              : ClipRectPtr;
		       superSaveClipRects : ClipRectPtr;
		       cliprects          : ClipRectPtr;
		       layerInfo          : LayerInfoPtr;
		       lock               : SignalSemaphore;
		       backFill           : HookPtr;
		       reserved1          : LONGCARD;
		       clipRegion         : RegionPtr;
		       saveClipRects      : RegionPtr;
		       width,
		       height             : INTEGER;
		       reserved2          : ARRAY [18] OF SHORTCARD;
		       damageList         : RegionPtr;
		     END;

  LayerInfo        = RECORD
		       layer              : LayerPtr;
		       lp                 : LayerPtr;
		       obs                : LayerPtr;
		       freeClipRects      : MinList;
		       lock               : SignalSemaphore;
		       head               : List;
		       longreserved       : LONGINT;
		       flags              : LayerFlagSet;
		       count              : SHORTINT;
		       lockLayersCount    : SHORTINT;
		       layerInfoExtraSize : CARDINAL;
		       blitbuff           : ANYPTR;
		       layerInfoExtra     : ANYPTR;
		     END;

CONST
  lmnRegion          = -1;
  newLayerInfoCalled = 1;
  alertLayersNoMem   = $83010000;
|
| Colors
|

TYPE
  DisplayInfoPtr  = POINTER TO DisplayInfo;

  ColorMapType    = (cmapV33,cmapV36);

  ColorMapFlags   = (colormapTransparency,colorPlaneTransparency,
		     borderBlanking,borderNoTransparency,
		     videoControlBatch,userCopperClip);
  ColorMapFlagSet = SET OF ColorMapFlags;

  ColorMapPtr     = POINTER TO ColorMap;
  ColorMap        = RECORD
		      flags             : ColorMapFlagSet;
		      type              : ColorMapType;
		      count             : CARDINAL;
		      colorTable        : ANYPTR;
		      vpe               : ViewPortExtraPtr;
		      transparencyBits  : ANYPTR;
		      transparencyPlane : SHORTCARD;
		      reserved1         : SHORTCARD;
		      reserved2         : CARDINAL;
		      vp                : ViewPortPtr;
		      normalDisplayInfo : ANYPTR;
		      coerceDisplayInfo : ANYPTR;
		      batchItems        : VTagListPtr;
		      vpModeID          : LONGCARD;
		    END;


|
| Copper & Views
|
CONST
  move = 0;
  wait = 1;
  next = 2;

  sys  = 13;
  sht  = 14;
  lof  = 15;

TYPE
  CopListPtr     = POINTER TO CopList;

  CopInsPtr      = POINTER TO CopIns;
  CopIns         = RECORD
		     IF KEY opCode:CARDINAL
		       OF move THEN destAddr:INTEGER;
				    destData:INTEGER;
		       OF wait THEN vWaitPos:INTEGER;
				    hWaitPos:INTEGER;
		       OF next THEN nxtlist:CopListPtr;
		     END;
		   END;

  CprListPtr     = POINTER TO CprList;
  CprList        = RECORD
		     next     : CprListPtr;
		     start    : ANYPTR;
		     maxCount : INTEGER;
		   END;

  CopList        = RECORD
		     next      : CopListPtr;
		     copList   : CopListPtr;
		     viewPort  : ViewPortPtr;
		     copIns    : CopInsPtr;
		     copPtr    : CopInsPtr;
		     copLStart : ANYPTR;
		     copSStart : ANYPTR;
		     count     : INTEGER;
		     maxCount  : INTEGER;
		     dyOffset  : INTEGER;
		     cop2Start : ANYPTR;
		     cop3Start : ANYPTR;
		     cop4Start : ANYPTR;
		     cop5Start : ANYPTR;
		   END;

  UCopListPtr    = POINTER TO UCopList;
  UCopList       = RECORD
		     next         : UCopListPtr;
		     firstCopList : CopListPtr;
		     copList      : CopListPtr;
		   END;

  CopInitPtr     = POINTER TO CopInit;
  CopInit        = RECORD
		     vsyncHBlank : ARRAY [2]     OF CARDINAL;
		     diwstart    : ARRAY [4]     OF CARDINAL;
		     diagstrt    : ARRAY [4]     OF CARDINAL;
		     sprstrtup   : ARRAY [2*8*2] OF CARDINAL;
		     wait14      : ARRAY [2]     OF CARDINAL;
		     normHBlank  : ARRAY [2]     OF CARDINAL;
		     genloc      : ARRAY [4]     OF CARDINAL;
		     jump        : ARRAY [(2*2)] OF CARDINAL;
		     sprstop     : ARRAY [4]     OF CARDINAL;
		   END;
|
| Text & Gfx
|

TYPE
  FontStyles     = (underlined,bold,italic,extended,fs4,fs5,colorFont,
		    tagged);
  FontStyleSet   = SET OF FontStyles;

  FontFlags      = (romFont,diskFont,revPath,tallDot,wideDot,proportional,
		    designed,removed);
  FontFlagSet    = SET OF FontFlags;

CONST
  normalFont     = FontStyleSet:{};

TYPE
  FontTags       = TAGS OF StdTags
		     DeviceDPI  = $80000001 : RECORD x,y : CARDINAL END;
		   END;
  FontTagList    = ARRAY OF FontTags;
  FontTagListPtr = POINTER TO FontTagList;

  TextAttrPtr    = POINTER TO TextAttr;
  TextAttr       = RECORD
		     name    : SysStringPtr;
		     ySize   : CARDINAL;
		     style   : FontStyleSet;
		     flags   : FontFlagSet;
		   END;
  TTextAttrPtr   = POINTER TO TTextAttr;
  TTextAttr      = RECORD OF TextAttr
		     tags    : FontTagListPtr;
		   END;

CONST
  maxFontMatchWeight = 32767;

TYPE

  CharLocPtr     = POINTER TO CharLoc;
  CharLoc        = RECORD
		     pos,width  : INTEGER;
		   END;

  TextFontPtr    = POINTER TO TextFont;
  TextFont       = RECORD OF Message
		     ySize     : CARDINAL;
		     style     : FontStyleSet;
		     flags     : FontFlagSet;
		     xSize     : CARDINAL;
		     baseline  : CARDINAL;
		     boldSmear : CARDINAL;
		     accessors : CARDINAL;
		     loChar    : CHAR;
		     hiChar    : CHAR;
		     charData  : ANYPTR;
		     modulo    : CARDINAL;
		     charLoc   : POINTER TO ARRAY OF CharLoc;
		     charSpace : POINTER TO ARRAY OF INTEGER;
		     charKern  : POINTER TO ARRAY OF INTEGER;
		   END;

CONST
  noRemFont      = 0;

TYPE
  TextFontExtensionPtr= POINTER TO TextFontExtension;
  TextFontExtension = RECORD
			matchWord     : CARDINAL;
			flags0        : SHORTSET;
			flags1        : SHORTSET;
			backPtr       : TextFontPtr;
			origReplyPort : MsgPortPtr;
			tags          : FontTagListPtr;
			oFontPatchS   : ANYPTR;
			oFontPatchK   : ANYPTR;
		      END;

CONST
  ctColormask=  $000F;
  ctColorfont=  $0001;
  ctGreyfont=   $0002;
  ctAntialias=  $0004;

  ctbMapcolor=  0;
  ctfMapcolor=  $0001;

TYPE
  ColorFontColorsPtr= POINTER TO ColorFontColors;
  ColorFontColors   = RECORD
			reserved   : CARDINAL;
			count      : CARDINAL;
			colorTable : POINTER TO ARRAY OF CARDINAL;
		      END;

  ColorTextFontPtr  = POINTER TO ColorTextFont;
  ColorTextFont     = RECORD
			tf              : TextFont;
			flags           : CARDINAL;
			depth           : SHORTCARD;
			fgColor         : SHORTCARD;
			low             : SHORTCARD;
			high            : SHORTCARD;
			planePick       : SHORTCARD;
			planeOnOff      : SHORTCARD;
			colorFontColors : ColorFontColorsPtr;
			charData        : ARRAY [8] OF ANYPTR;
		      END;

  TextExtentPtr     = POINTER TO TextExtention;
  TextExtention     = RECORD
			width    : CARDINAL;
			height   : CARDINAL;
			extend   : Rectangle;
		      END;

|
| Gels
|
CONST
  ringtrigger =  1;
  anfracsize  =  6;
  animhalf    =$20;

  b2Norm      = 0;
  b2Swap      = 1;
  b2Bobber    = 2;

TYPE
  BobPtr            = POINTER TO Bob;
  SimpleSpritePtr   = POINTER TO SimpleSprite;
  DBufPacketPtr     = POINTER TO DBufPacket;
  SimpleSprite      = RECORD
			posctldata : ANYPTR;
			height     : CARDINAL;
			x          : CARDINAL;
			y          : CARDINAL;
			num        : INTEGER;
		      END;

  VSpriteFlags      = (vsprite,saveBack,overlay,mustDraw,vf4,vf5,vf6,vf7,
		       backSaved,bobUpdate,gelGone,vsOverflow,vf12,vf13,
		       vf14,vf15);
  VSpriteFlagSet    = SET OF VSpriteFlags;

  VSpritePtr        = POINTER TO VSprite;
  VSprite           = RECORD
			nextVSprite : VSpritePtr;
			prevVSprite : VSpritePtr;
			drawPath    : VSpritePtr;
			clearPath   : VSpritePtr;
			oldY        : INTEGER;
			oldX        : INTEGER;
			flags       : VSpriteFlagSet;
			y           : INTEGER;
			x           : INTEGER;
			height      : INTEGER;
			width       : INTEGER;
			depth       : INTEGER;
			meMask      : BITSET;
			hitMask     : BITSET;
			imageData   : ANYPTR;
			borderLine  : ANYPTR;
			collMask    : ANYPTR;
			sprColors   : ANYPTR;
			vsBob       : BobPtr;
			planePick   : SHORTSET;
			planeOnOff  : SHORTSET;
		      END;

  BobFlags          = (saveBob,bobIsComp,bf2,bf3,bf4,bf5,bf6,bf7,bWaiting,
		       bDrawn,bobsAway,bobNix,savePreserve,outStep,
		       bf14,bf15);
  BobFlagSet        = SET OF BobFlags;

  AnimCompPtr       = POINTER TO AnimComp;
  Bob               = RECORD
			flags       : BobFlagSet;
			saveBuffer  : ANYPTR;
			imageShadow : ANYPTR;
			before      : BobPtr;
			after       : BobPtr;
			bobVSprite  : VSpritePtr;
			bobComp     : AnimCompPtr;
			dBuffer     : DBufPacketPtr;
		      END;

  AnimObPtr         = POINTER TO AnimOb;
  AnimComp          = RECORD
			flags         : INTEGER;
			timer         : INTEGER;
			timeSet       : INTEGER;
			nextComp      : AnimCompPtr;
			prevComp      : AnimCompPtr;
			nextSeq       : AnimCompPtr;
			prevSeq       : AnimCompPtr;
			animCRoutine  : PROCEDURE;
			yTrans        : INTEGER;
			xTrans        : INTEGER;
			headOb        : AnimObPtr;
			animBob       : BobPtr;
		      END;

  AnimOb            = RECORD
			nextOb       : AnimObPtr;
			prevOb       : AnimObPtr;
			clock        : LONGINT;
			anOldY       : INTEGER;
			anOldX       : INTEGER;
			anY          : INTEGER;
			anX          : INTEGER;
			yVel         : INTEGER;
			xVel         : INTEGER;
			yAccel       : INTEGER;
			xAccel       : INTEGER;
			ringYTrans   : INTEGER;
			ringXTrans   : INTEGER;
			animORoutine : PROCEDURE;
			headComp     : AnimCompPtr;
		      END;

  DBufPacket        = RECORD
			bufY      : INTEGER;
			bufX      : INTEGER;
			bufPath   : VSpritePtr;
			bufBuffer : ANYPTR;
		      END;
CONST
   borderHit        = 0;
   topHit           = 1;
   bottomHit        = 2;
   leftHit          = 4;
   rightHit         = 8;

TYPE
  CollTablePtr      = POINTER TO CollTable;
  CollTable         = RECORD
			collPtrs : ARRAY [16] OF ANYPTR
		      END;
  GelsInfoPtr       = POINTER TO GelsInfo;
  GelsInfo          = RECORD
			sprRsrvd      : SHORTSET;
			flags         : SHORTCARD;
			gelHead       : VSpritePtr;
			gelTail       : VSpritePtr;
			nextLine      : ANYPTR;
			lastColor     : ANYPTR;
			collHandler   : CollTablePtr;
			leftmost      : INTEGER;
			rightmost     : INTEGER;
			topmost       : INTEGER;
			bottommost    : INTEGER;
			firstBlissObj : ANYPTR;
			lastBlissObj  : ANYPTR;
		      END;

|
| GfxNodes
|
CONST
  viewExtraType      = NodeType(1);
  viewportExtraType  = NodeType(2);
  specialMonitorType = NodeType(3);
  monitorSpecType    = NodeType(4);

TYPE
  ExtendedNodePtr    = POINTER TO ExtendedNode;
  ExtendedNode       = RECORD OF Node
			 subsystem : SHORTCARD;
			 subtype   : SHORTCARD;
			 library   : LibraryPtr;
			 init      : PROCEDURE():LONGINT;
		       END;

|
| Monitor
|

TYPE
  SpecialMonitorPtr= POINTER TO SpecialMonitor;

CONST
  toMonitor          = 0;
  fromMonitor        = 1;
  standardXoffset    = 9;
  standardYoffset    = 0;
  requestNtsc        = 1;
  requestPal         = 2;
  requestSpecial     = 4;
  requestA2024       = 8;
  standardMonitorMask= requestNtsc + requestPal;

  defaultMonitorName = "default.monitor";
  ntscMonitorName    = "ntsc.monitor";
  palMonitorName     = "pal.monitor";
  vgaMonitorName     = "vga.monitor";
  vga70MonitorName   = "vga70.monitor";

  standardNtscRows   = 262;
  standardPalRows    = 312;
  standardColorclocks= 226;
  standardDeniseMax  = 455;
  standardDeniseMin  = 93;
  standardNtscBeamcon= Beam0FlagSet:{};
  standardPalBeamcon = displayPal; |???

  specialBeamcon     = Beam0FlagSet:{varVBlank,loLDis,varVSync,varBeam,
				     csBlank};

  minNtscRow         = 21;
  minPalRow          = 29;
  standardViewX      = $81;
  standardViewY      = $2C;
  standardHbstrt     = $06;
  standardHsstrt     = $0B;
  standardHsstop     = $1C;
  standardHbstop     = $2C;
  standardVbstrt     = $122;
  standardVsstrt     = $2A6;
  standardVsstop     = $3AA;
  standardVbstop     = $1066;

  vgaColorclocks     = standardColorclocks DIV 2;
  vgaTotalRows       = standardNtscRows*2;
  vgaDeniseMin       = 59;
  minVgaRow          = 29;
  vgaHbstrt          = $08;
  vgaHsstrt          = $0E;
  vgaHsstop          = $1C;
  vgaHbstop          = $1E;
  vgaVbstrt          = $000;
  vgaVsstrt          = $153;
  vgaVsstop          = $235;
  vgaVbstop          = $CCD;

  vga70Colorclocks   = standardColorclocks DIV 2;
  vga70TotalRows     = 449;
  vga70DeniseMin     = 59;
  minVga70Row        = 35;
  vga70Hbstrt        = $08;
  vga70Hsstrt        = $0E;
  vga70Hsstop        = $1C;
  vga70Hbstop        = $1E;
  vga70Vbstrt        = $000;
  vga70Vsstrt        = $2A6;
  vga70Vsstop        = $388;
  vga70Vbstop        = $F73;

  vga70Beamcon       = specialBeamcon/Beam0FlagSet:{vSyncTrue};

  broadcastHbstrt    = $01;
  broadcastHsstrt    = $06;
  broadcastHsstop    = $17;
  broadcastHbstop    = $27;
  broadcastVbstrt    = $000;
  broadcastVsstrt    = $2A6;
  broadcastVsstop    = $54C;
  broadcastVbstop    = $1C40;
  broadcastBeamcon   = Beam0FlagSet:{loLDis,csBlank};
  ratioFixedpart     = 4;
  ratioUnity         = LONGCARD(1) SHL ratioFixedpart;

TYPE
  LongProc         = PROCEDURE():LONGINT;

  MonitorSpecPtr   = POINTER TO MonitorSpec;
  MonitorSpec      = RECORD OF ExtendedNode
		       flags                  : BITSET;
		       ratioh                 : LONGINT;
		       ratiov                 : LONGINT;
		       totalRows              : CARDINAL;
		       totalColorclocks       : CARDINAL;
		       deniseMaxDisplayColumn : CARDINAL;
		       beamCon0               : CARDINAL;
		       minRow                 : CARDINAL;
		       special                : SpecialMonitorPtr;
		       openCount              : CARDINAL;
		       transform,
		       translate,
		       scale                  : LongProc;
		       xoffset                : CARDINAL;
		       yoffset                : CARDINAL;
		       legalView              : Rectangle;
		       maxoscan               : LongProc;
		       videoscan              : LongProc;
		       deniseMinDisplayColumn : CARDINAL;
		       displayCompatible      : LONGCARD;
		       displayInfoDataBase    : List;
		       displayInfoDataBaseSemaphore : SignalSemaphore;
		       reserved               : ARRAY [2] OF LONGINT;
		     END;

  AnalogSignalIntervalPtr = POINTER TO AnalogSignalInterval;
  AnalogSignalInterval=RECORD
		       strt,
		       stop   : CARDINAL;
		     END;

  SpecialMonitor   = RECORD OF ExtendedNode
		       flags     : BITSET;
		       doMonitor : LongProc;
		       reserved1,
		       reserved2,
		       reserved3 : LongProc;
		       hblank    : AnalogSignalInterval;
		       vblank    : AnalogSignalInterval;
		       hsync     : AnalogSignalInterval;
		       vsync     : AnalogSignalInterval;
		     END;

|
| DisplayInfo etc.
|

TYPE
  DisplayInfoHandle=ANYPTR;

CONST
  dtagDisp      = $80000000;
  dtagDims      = $80001000;
  dtagMntr      = $80002000;
  dtagName      = $80003000;

TYPE
  QueryHeaderPtr= POINTER TO QueryHeader;
  QueryHeader   = RECORD
		    structID   : LONGCARD;
		    displayID  : LONGCARD;
		    skipID     : LONGCARD;
		    length     : LONGCARD;
		  END;

TYPE
  PropertyFlags   = (isLace,isDualpf,isPf2pri,isHam,isEcs,isPal,isSprites,
		     isGenlock,isWb,isDraggable,isPanelled,isBeamsync,
		     isExtrahalfbrite,is13,is14,is15,is16);
  PropertyFlagSet = SET OF PropertyFlags;

CONST
  diAvailNochips        = $0001;
  diAvailNomonitor      = $0002;
  diAvailNotwithgenlock = $0004;

TYPE
  PointPtr        = POINTER TO Point;
  Point           = RECORD
		      x,y:INTEGER;
		    END;

  DisplayInfo     = RECORD OF QueryHeader
		      notAvailable      : CARDINAL;
		      propertyFlags     : PropertyFlagSet;
		      resolution        : Point;
		      pixelSpeed        : CARDINAL;
		      numStdSprites     : CARDINAL;
		      paletteRange      : CARDINAL;
		      spriteResolution  : Point;
		      pad               : ARRAY [4] OF SHORTCARD;
		      reserved2         : ARRAY [2] OF LONGINT;
		    END;

  DimensionInfoPtr= POINTER TO DimensionInfo;
  DimensionInfo   = RECORD OF QueryHeader
		      maxDepth          : CARDINAL;
		      minRasterWidth    : CARDINAL;
		      minRasterHeight   : CARDINAL;
		      maxRasterWidth    : CARDINAL;
		      maxRasterHeight   : CARDINAL;
		      nominal           : Rectangle;
		      maxOScan          : Rectangle;
		      videoOScan        : Rectangle;
		      txtOScan          : Rectangle;
		      stdOScan          : Rectangle;
		      pad               : ARRAY [14] OF SHORTCARD;
		      reserved          : ARRAY [2] OF LONGINT;
		    END;


CONST
  mcompatMixed  = 0;
  mcompatSelf   = 1;
  mcompatNobody =-1;

TYPE
  MonitorInfoPtr  = POINTER TO MonitorInfo;
  MonitorInfo     = RECORD OF QueryHeader
		      mspc              : MonitorSpecPtr;
		      viewPosition      : Point;
		      viewResolution    : Point;
		      viewPositionRange : Rectangle;
		      totalRows         : CARDINAL;
		      totalColorClocks  : CARDINAL;
		      minRow            : CARDINAL;
		      compatibility     : INTEGER;
		      pad               : ARRAY [36] OF SHORTCARD;
		      reserved          : ARRAY [2] OF LONGINT;
		    END;

CONST
  displayNameLen=32;
TYPE
  NameInfoPtr     = POINTER TO NameInfo;
  NameInfo        = RECORD
		      header   : QueryHeader;
		      name     : ARRAY [displayNameLen] OF CHAR;
		      reserved : ARRAY [2] OF LONGINT;
		    END;

CONST
  invalidID                = -1;

  monitorIDmask            = $FFFF1000;

  defaultMonitorID         = $00000000;
  ntscMonitorID            = $00011000;
  palMonitorID             = $00021000;
  vgaMonitorID             = $00031000;
  a2024MonitorID           = $00041000;
  protoMonitorID           = $00051000;

  loresKey                 = $00000000;
  hiresKey                 = $00008000;
  superKey                 = $00008020;
  hamKey                   = $00000800;
  loreslaceKey             = $00000004;
  hireslaceKey             = $00008004;
  superlaceKey             = $00008024;
  hamlaceKey               = $00000804;
  loresdpfKey              = $00000400;
  hiresdpfKey              = $00008400;
  superdpfKey              = $00008420;
  loreslacedpfKey          = $00000404;
  hireslacedpfKey          = $00008404;
  superlacedpfKey          = $00008424;
  loresdpf2Key             = $00000440;
  hiresdpf2Key             = $00008440;
  superdpf2Key             = $00008460;
  loreslacedpf2Key         = $00000444;
  hireslacedpf2Key         = $00008444;
  superlacedpf2Key         = $00008464;
  extrahalfbriteKey        = $00000080;
  extrahalfbritelaceKey    = $00000084;

  vgaextraloresKey         = $00031004;
  vgaloresKey              = $00039004;
  vgaproductKey            = $00039024;
  vgahamKey                = $00031804;
  vgaextraloreslaceKey     = $00031005;
  vgaloreslaceKey          = $00039005;
  vgaproductlaceKey        = $00039025;
  vgahamlaceKey            = $00031805;
  vgaextraloresdpfKey      = $00031404;
  vgaloresdpfKey           = $00039404;
  vgaproductdpfKey         = $00039424;
  vgaextraloreslacedpfKey  = $00031405;
  vgaloreslacedpfKey       = $00039405;
  vgaproductlacedpfKey     = $00039425;
  vgaextraloresdpf2Key     = $00031444;
  vgaloresdpf2Key          = $00039444;
  vgaproductdpf2Key        = $00039464;
  vgaextraloreslacedpf2Key = $00031445;
  vgaloreslacedpf2Key      = $00039445;
  vgaproductlacedpf2Key    = $00039465;
  vgaextrahalfbriteKey     = $00031084;
  vgaextrahalfbritelaceKey = $00031085;

  a2024tenhertzKey         = $00041000;
  a2024fifteenhertzKey     = $00049000;

|
| Ints
|
CONST
  blitMsgFault=4;

TYPE
  IsrvstrPtr       = POINTER TO Isrvstr;
  Isrvstr          = RECORD OF Node
		       iptr   : IsrvstrPtr;
		       code   : ANYPTR;
		       ccode  : ANYPTR;
		       carg   : LONGINT;
		     END;

|
| RastPort
|
TYPE
  AreaInfoPtr      = POINTER TO AreaInfo;
  AreaInfo         = RECORD
		       vctrTbl   : ANYPTR;
		       vctrPtr   : ANYPTR;
		       flagTbl   : ANYPTR;
		       flagPtr   : ANYPTR;
		       count     : INTEGER;
		       maxCount  : INTEGER;
		       firstX    : INTEGER;
		       firstY    : INTEGER;
		     END;

  TmpRasPtr        = POINTER TO TmpRas;
  TmpRas           = RECORD
		       rasPtr    : ANYPTR;
		       size      : LONGINT;
		     END;

  DrawModes        = (dm0,complement,inversvid);
  DrawModeSet      = SET OF DrawModes;

CONST
  jam1             = DrawModeSet:{};
  jam2             = DrawModeSet:{dm0};

TYPE

  Pen              = SHORTCARD;             | The actual pen variables
  PenArrayPtr      = POINTER TO PenArray;
  PenArray         = ARRAY OF CARDINAL;     | like in Intuition.DrawInfo

  RastPortFlags    = (firstDot,oneDot,dBuffer,areaOutline,noCrossFill=5,
		      rpf8=8);

  RastPortFlagSet  = SET OF RastPortFlags;
  RastPort         = RECORD
		       layer        : LayerPtr;
		       bitMap       : BitMapPtr;
		       areaPtrn     : ANYPTR;
		       tmpRas       : TmpRasPtr;
		       areaInfo     : AreaInfoPtr;
		       gelsInfo     : GelsInfoPtr;
		       mask         : SHORTSET;     | used to be SHORTCARD
		       fgPen        : SHORTCARD;
		       bgPen        : SHORTCARD;
		       aOlPen       : SHORTCARD;    | areafill outline pen
		       drawMode     : DrawModeSet;
		       areaPtSz     : SHORTCARD;
		       linPatCnt    : SHORTCARD;
		       dummy        : SHORTCARD;
		       flags        : RastPortFlagSet;
		       linePtrn     : CARDINAL;
		       x            : INTEGER;     | current position
		       y            : INTEGER;
		       minterms     : ARRAY [8] OF SHORTCARD;
		       penWidth     : INTEGER;
		       penHeight    : INTEGER;
		       font         : TextFontPtr;
		       algoStyle    : FontStyleSet;
		       txFlags      : FontFlagSet;
		       txHeight     : CARDINAL;
		       txWidth      : CARDINAL;
		       txBaseline   : CARDINAL;
		       txSpacing    : INTEGER;
		       user         : ANYPTR;
		       longreserved : ARRAY [0..1] OF LONGINT;
		       wordreserved : ARRAY [0..6] OF CARDINAL;
		       reserved     : ARRAY [0..7] OF SHORTCARD;
		     END;

|
| Viewport
|
TYPE
  VTags            = (VTAG_END     = 0,
		      ChromaKey_Clr = $8000000,
		      ChromaKey_Set,
		      BitPlaneKey_Clr,
		      BitPlaneKey_Set,
		      BorderBlank_Clr,
		      BorderBlank_Set,
		      BorderNotrans_Clr,
		      BorderNotrans_Set,
		      ChromaPen_Clr,
		      ChromaPen_Set,
		      ChromaPlane_Set,
		      AttachCm_Set,
		      NextBufCm,
		      BatchCm_Clr,
		      BatchCm_Set,
		      NormalDisp_Get,
		      NormalDisp_Set,
		      CoerceDisp_Get,
		      CoerceDisp_Set,
		      ViewPortExtra_Get,
		      ViewPortExtra_Set,
		      ChromaKey_Get,
		      BitPlaneKey_Get,
		      BorderNotTrans_Get,
		      ChromaPen_Get,
		      ChromaPlane_Get,
		      AttachCm_Get,
		      BatchCm_Get,
		      BatchItems_Get,
		      BatchItems_Set,
		      BatchItems_Add,
		      VpModeId_Get,
		      VpModeId_Set,
		      VpModeId_Clr,
		      UserClip_Get,
		      UserClip_Set,
		      UserClip_Clr);
  VTagList         = ARRAY OF VTags;

  ViewModes        = (vm0,genlocVideo,lace,vm3,vm4,superHires,pfba,
		      extraHalfbrite,genlocAudio,vm9,dualpf,ham,
		      extendedMode,vpHide,sprites,hires);
  ViewModeSet      = SET OF ViewModes;

  RasInfoPtr       = POINTER TO RasInfo;
  RasInfo          = RECORD
		       next              : RasInfoPtr;
		       bitMap            : BitMapPtr;
		       rxOffset          : INTEGER;
		       ryOffset          : INTEGER;
		     END;

  ViewPort         = RECORD
		       next              : ViewPortPtr;
		       colorMap          : ColorMapPtr;
		       dspIns            : CopListPtr;
		       sprIns            : CopListPtr;
		       clrIns            : CopListPtr;
		       uCopIns           : UCopListPtr;
		       dWidth            : INTEGER;
		       dHeight           : INTEGER;
		       dxOffset          : INTEGER;
		       dyOffset          : INTEGER;
		       modes             : ViewModeSet;
		       spritePriorities  : SHORTCARD;
		       extendedModes     : SHORTSET;
		       rasInfo           : RasInfoPtr;
		     END;

  ViewPtr          = POINTER TO View;
  View             = RECORD
		       viewPort          : ViewPortPtr;
		       lofCprList        : CprListPtr;
		       shfCprList        : CprListPtr;
		       dyOffset          : INTEGER;
		       dxOffset          : INTEGER;
		       modes             : ViewModeSet;
		     END;

  ViewExtraPtr     = POINTER TO ViewExtra;
  ViewExtra        = RECORD OF ExtendedNode
		       view     : ViewPtr;
		       monitor  : MonitorSpecPtr;
		     END;

  ViewPortExtra    = RECORD OF ExtendedNode
		       viewPort     : ViewPortPtr;
		       displayClip  : Rectangle;
		     END;


|
| GfxBase
|
  DisplayFlags     = (ntsc,genloc,pal,todaSafe,df4,df5,df6,df7,
		      df8,df9,df10,df11,df12,df13,df14,df15);
  DisplayFlagSet   = SET OF DisplayFlags;
  ChipRevs         = (hrAgnus,hrDenise,cr2,cr3,cr4,cr5,cr6,cr7);
  ChipRevSet       = SET OF ChipRevs;

TYPE
  GfxBasePtr       = POINTER TO GfxBaseType;
  GfxBaseType      = RECORD OF Library
		       actiView              : ViewPtr;
		       copinit               : CopInitPtr;
		       cia                   : ANYPTR;
		       blitter               : ANYPTR;
		       loFlist               : ANYPTR;
		       shFlist               : ANYPTR;
		       blthd                 : BltNodePtr;
		       blttl                 : BltNodePtr;
		       bsblthd               : BltNodePtr;
		       bsblttl               : BltNodePtr;
		       vbsrv                 : Interrupt;
		       timsrv                : Interrupt;
		       bltsrv                : Interrupt;
		       textFonts             : List;
		       defaultFont           : TextFontPtr;
		       modes                 : BITSET;
		       vBlank                : SHORTCARD;
		       debug                 : SHORTCARD;
		       beamSync              : INTEGER;
		       bplcon0               : BITSET;
		       spriteReserved        : SHORTCARD;
		       bytereserved          : SHORTCARD;
		       flags                 : BITSET;
		       blitLock              : INTEGER;
		       blitNest              : INTEGER;
		       blitWaitQ             : List;
		       blitOwner             : TaskPtr;
		       waitQ                 : List;
		       displayFlags          : DisplayFlagSet;
		       simpleSprites         : ANYPTR;
		       maxDisplayRow         : CARDINAL;
		       maxDisplayColumn      : CARDINAL;
		       normalDisplayRows     : CARDINAL;
		       normalDisplayColumns  : CARDINAL;
		       normalDPMX            : CARDINAL;
		       normalDPMY            : CARDINAL;
		       lastChanceMemory      : SignalSemaphorePtr;
		       lcMptr                : ANYPTR;
		       microsPerLine         : CARDINAL;
		       minDisplayColumn      : CARDINAL;
		       chipRevBits0          : ChipRevSet;
		       reservedPad           : SHORTCARD;
		       reserved              : ARRAY [4] OF SHORTCARD;
		       monitorId             : CARDINAL;
		       hedley                : ARRAY [8] OF ANYPTR;
		       hedleySprites         : ARRAY [8] OF ANYPTR;
		       hedleySprites1        : ARRAY [8] OF ANYPTR;
		       hedleyCount           : INTEGER;
		       hedleyFlags           : BITSET;
		       hedleyTmp             : INTEGER;
		       hashTable             : ANYPTR;
		       currentTotRows        : CARDINAL;
		       currentTotCclks       : CARDINAL;
		       hedleyHint            : SHORTCARD;
		       hedleyHint2           : SHORTCARD;
		       nreserved             : ARRAY [4] OF LONGINT;
		       a2024SyncRaster       : ANYPTR;
		       controlDeltaPal       : INTEGER;
		       controlDeltaNtsc      : INTEGER;
		       currentMonitor        : MonitorSpecPtr;
		       monitorList           : List;
		       defaultMonitor        : MonitorSpecPtr;
		       monitorListSemaphore  : SignalSemaphorePtr;
		       displayInfoDataBase   : ANYPTR;
		       actiViewCprSemaphore  : SignalSemaphorePtr;
		       utilityBase           : LibraryPtr;
		       execBase              : LibraryPtr;
		    END;

VAR GfxBase : GfxBasePtr;

LIBRARY GfxBase BY -156
  PROCEDURE AddAnimOb(     anOb  IN A0 : AnimObPtr;
		       VAR anKey IN A1 : AnimObPtr;
			   rp    IN A2 : RastPortPtr);

LIBRARY GfxBase BY -96
  PROCEDURE AddBob( Bob IN A0 : BobPtr;
		    rp  IN A1 : RastPortPtr);

LIBRARY GfxBase BY -480
  PROCEDURE AddFont( textFont IN A1 : TextFontPtr );

LIBRARY GfxBase BY -102
  PROCEDURE AddVSprite( vs IN A0 : VSpritePtr;
			rp IN A1 : RastPortPtr );

LIBRARY GfxBase BY -492
  PROCEDURE AllocRaster( width  IN D0 : CARDINAL;
			 height IN D1 : CARDINAL ): ANYPTR;

LIBRARY GfxBase BY -504
  PROCEDURE AndRectRegion( region    IN A0 : RegionPtr;
			   rectangle IN A1 : RectanglePtr );

LIBRARY GfxBase BY -624
  PROCEDURE AndRegionRegion( region1 IN A0 : RegionPtr;
			     region2 IN A1 : RegionPtr ): BOOLEAN;

LIBRARY GfxBase BY -162
  PROCEDURE Animate( VAR anKey IN A0 : AnimObPtr;
			 rp    IN A1 : RastPortPtr );

LIBRARY GfxBase BY -258
  PROCEDURE AreaDraw( rp IN A1 : RastPortPtr;
		      x  IN D0 : INTEGER;
		      y  IN D1 : INTEGER ): BOOLEAN;

LIBRARY GfxBase BY -186
  PROCEDURE AreaEllipse( rp IN A1 : RastPortPtr;
			 cX IN D0 : INTEGER;
			 cY IN D1 : INTEGER;
			 a  IN D2 : INTEGER;
			 b  IN D3 : INTEGER): BOOLEAN;

LIBRARY GfxBase BY -264
  PROCEDURE AreaEnd( rp IN A1 : RastPortPtr ): BOOLEAN;

LIBRARY GfxBase BY -252
  PROCEDURE AreaMove( rp IN A1 : RastPortPtr;
		      x  IN D0 : INTEGER;
		      y  IN D1 : INTEGER ): BOOLEAN;

LIBRARY GfxBase BY -474
  PROCEDURE AskFont( rp       IN A1 : RastPortPtr;
		     textAttr IN A0 : TextAttrPtr );

LIBRARY GfxBase BY -84
  PROCEDURE AskSoftStyle( rp IN A1 : RastPortPtr ): FontStyleSet;

LIBRARY GfxBase BY -654
  PROCEDURE AttemptLockLayerRom( layer IN A5 : LayerPtr ): BOOLEAN;

LIBRARY GfxBase BY -30
  PROCEDURE BltBitMap( srcBitMap IN A0 : BitMapPtr;
		       srcX      IN D0 : INTEGER;
		       srcY      IN D1 : INTEGER;
		       dstBitMap IN A1 : BitMapPtr;
		       dstX      IN D2 : INTEGER;
		       dstY      IN D3 : INTEGER;
		       sizeX     IN D4 : INTEGER;
		       sizeY     IN D5 : INTEGER;
		       minterm   IN D6 : SHORTCARD;
		       mask      IN D7 : SHORTCARD;
		       tempA     IN A2 : ANYPTR ): LONGCARD;

LIBRARY GfxBase BY -606
  PROCEDURE BltBitMapRastPort( srcbm   IN A0 : BitMapPtr;
			       srcX    IN D0 : INTEGER;
			       srcY    IN D1 : INTEGER;
			       destRp  IN A1 : RastPortPtr;
			       destX   IN D2 : INTEGER;
			       destY   IN D3 : INTEGER;
			       sizeX   IN D4 : INTEGER;
			       sizeY   IN D5 : INTEGER;
			       minterm IN D6 : SHORTCARD );

LIBRARY GfxBase BY -300
  PROCEDURE BltClear( memBlock  IN A1 : ANYPTR;
		      bytecount IN D0 : LONGCARD;
		      flags     IN D1 : LONGSET );

LIBRARY GfxBase BY -636
  PROCEDURE BltMaskBitMapRastPort( srcbm   IN A0 : BitMapPtr;
				   srcX    IN D0 : INTEGER;
				   srcY    IN D1 : INTEGER;
				   destRp  IN A1 : RastPortPtr;
				   destX   IN D2 : INTEGER;
				   destY   IN D3 : INTEGER;
				   sizeX   IN D4 : INTEGER;
				   sizeY   IN D5 : INTEGER;
				   minterm IN D6 : SHORTCARD;
				   bltmask IN A2 : ANYPTR );

LIBRARY GfxBase BY -312
  PROCEDURE BltPattern( rp      IN A1 : RastPortPtr;
			mask    IN A0 : ANYPTR;
			xl      IN D0 : INTEGER;
			yl      IN D1 : INTEGER;
			maxX    IN D2 : INTEGER;
			maxY    IN D3 : INTEGER;
			bytecnt IN D4 : INTEGER );

LIBRARY GfxBase BY -36
  PROCEDURE BltTemplate( srcTemplate IN A0 : ANYPTR;
			 srcX        IN D0 : INTEGER;
			 srcMod      IN D1 : INTEGER;
			 rp          IN A1 : RastPortPtr;
			 dstX        IN D2 : INTEGER;
			 dstY        IN D3 : INTEGER;
			 sizeX       IN D4 : INTEGER;
			 sizeY       IN D5 : INTEGER );

LIBRARY GfxBase BY -366
  PROCEDURE CBump( c IN A1 : UCopListPtr );

LIBRARY GfxBase BY -420
  PROCEDURE ChangeSprite( vp      IN A0 : ViewPortPtr;
			  s       IN A1 : SimpleSpritePtr;
			  newdata IN A2 : ANYPTR );

LIBRARY GfxBase BY -42
  PROCEDURE ClearEOL( rp IN A1 : RastPortPtr );

LIBRARY GfxBase BY -522
  PROCEDURE ClearRectRegion( region    IN A0 : RegionPtr;
			     rectangle IN A1 : RectanglePtr ): BOOLEAN;

LIBRARY GfxBase BY -528
  PROCEDURE ClearRegion( region IN A0 : RegionPtr );

LIBRARY GfxBase BY -48
  PROCEDURE ClearScreen(rp IN A1 : RastPortPtr);

LIBRARY GfxBase BY -552
  PROCEDURE ClipBlit( src     IN A0 : RastPortPtr;
		      srcX    IN D0 : INTEGER;
		      srcY    IN D1 : INTEGER;
		      dest    IN A1 : RastPortPtr;
		      destX   IN D2 : INTEGER;
		      destY   IN D3 : INTEGER;
		      xSize   IN D4 : INTEGER;
		      ySize   IN D5 : INTEGER;
		      minterm IN D6 : SHORTCARD );

LIBRARY GfxBase BY -78
  PROCEDURE CloseFont( font IN A1 : TextFontPtr );

LIBRARY GfxBase BY -372
  PROCEDURE CMove( c IN A1 : UCopListPtr;
		   a IN D0 : ANYPTR;
		   v IN D1 : INTEGER );

LIBRARY GfxBase BY -450
  PROCEDURE CopySBitMap( layer IN A0 : LayerPtr );

LIBRARY GfxBase BY -378
  PROCEDURE CWait( c IN A1 : UCopListPtr;
		   v IN D0 : INTEGER;
		   h IN D1 : INTEGER );

LIBRARY GfxBase BY -462
  PROCEDURE DisownBlitter();

LIBRARY GfxBase BY -534
  PROCEDURE DisposeRegion( region IN A0 : RegionPtr );

LIBRARY GfxBase BY -108
  PROCEDURE DoCollision( rp IN A1 : RastPortPtr );

LIBRARY GfxBase BY -246
  PROCEDURE Draw( rp IN A1 : RastPortPtr;
		  x  IN D0 : INTEGER;
		  y  IN D1 : INTEGER );

LIBRARY GfxBase BY -180
  PROCEDURE DrawEllipse( rp IN A1 : RastPortPtr;
			 cX IN D0 : INTEGER;
			 cY IN D1 : INTEGER;
			 a  IN D2 : INTEGER;
			 b  IN D3 : INTEGER );

LIBRARY GfxBase BY -114
  PROCEDURE DrawGList( rp IN A1 : RastPortPtr;
		       vp IN A0 : ViewPortPtr );

LIBRARY GfxBase BY -330
  PROCEDURE Flood( rp   IN A1 : RastPortPtr;
		   mode IN D2 : LONGCARD;
		   x    IN D0 : INTEGER;
		   y    IN D1 : INTEGER ): BOOLEAN;

LIBRARY GfxBase BY -576
  PROCEDURE FreeColorMap( colorMap IN A0 : ColorMapPtr );

LIBRARY GfxBase BY -546
  PROCEDURE FreeCopList( coplist IN A0 : CopListPtr );

LIBRARY GfxBase BY -564
  PROCEDURE FreeCprList( cprlist IN A0 : CprListPtr );

LIBRARY GfxBase BY -600
  PROCEDURE FreeGBuffers( anOb IN A0 : AnimObPtr;
			  rp   IN A1 : RastPortPtr;
			  db   IN D0 : BOOLEAN );

LIBRARY GfxBase BY -498
  PROCEDURE FreeRaster( p      IN A0 : ANYPTR;
			width  IN D0 : CARDINAL;
			height IN D1 : CARDINAL );

LIBRARY GfxBase BY -414
  PROCEDURE FreeSprite( pick IN D0 : INTEGER );

LIBRARY GfxBase BY -540
  PROCEDURE FreeVPortCopLists( vp IN A0 : ViewPortPtr );

LIBRARY GfxBase BY -570
  PROCEDURE GetColorMap( entries IN D0 : LONGINT ): ColorMapPtr;

LIBRARY GfxBase BY -168
  PROCEDURE GetGBuffers( anOb IN A0 : AnimObPtr;
			 rp   IN A1 : RastPortPtr;
			 db   IN D0 : BOOLEAN ): BOOLEAN;

LIBRARY GfxBase BY -582
  PROCEDURE GetRGB4( colorMap IN A0 : ColorMapPtr;
		     entry    IN D0 : LONGINT ): LONGINT;

LIBRARY GfxBase BY -408
  PROCEDURE GetSprite( sprite IN A0 : SimpleSpritePtr;
		       pick   IN D0 : INTEGER ): INTEGER;

LIBRARY GfxBase BY -282
  PROCEDURE InitArea( VAR areainfo   IN A0 : AreaInfo;
			  buffer     IN A1 : ANYPTR;
			  maxvectors IN D0 : INTEGER );

LIBRARY GfxBase BY -390
  PROCEDURE InitBitMap( VAR bm     IN A0 : BitMap;
			    depth  IN D0 : INTEGER;
			    width  IN D1 : INTEGER;
			    height IN D2 : INTEGER );

LIBRARY GfxBase BY -120
  PROCEDURE InitGels( head  IN A0 : VSpritePtr;
		      tail  IN A1 : VSpritePtr;
		      gInfo IN A2 : GelsInfoPtr );

LIBRARY GfxBase BY -174
  PROCEDURE InitGMasks( anOb IN A0 : AnimObPtr );

LIBRARY GfxBase BY -126
  PROCEDURE InitMasks( vs IN A0 : VSpritePtr );

LIBRARY GfxBase BY -198
  PROCEDURE InitRastPort( VAR rp IN A1 : RastPort );

LIBRARY GfxBase BY -468
  PROCEDURE InitTmpRas( VAR tmpras IN A0 : TmpRas;
			    buffer IN A1 : ANYPTR;
			    size   IN D0 : LONGINT );

LIBRARY GfxBase BY -360
  PROCEDURE InitView( VAR view IN A1 : View );

LIBRARY GfxBase BY -204
  PROCEDURE InitVPort( VAR vp IN A0 : ViewPort );

LIBRARY GfxBase BY -192
  PROCEDURE LoadRGB4( vp     IN A0 : ViewPortPtr;
		      colors IN A1 : ANYPTR;
		      count  IN D0 : INTEGER );

LIBRARY GfxBase BY -222
  PROCEDURE LoadView( view IN A1 : ViewPtr );

LIBRARY GfxBase BY -432
  PROCEDURE LockLayerRom( layer IN A5 : LayerPtr );

LIBRARY GfxBase BY -216
  PROCEDURE MakeVPort( view     IN A0 : ViewPtr;
		       viewport IN A1 : ViewPortPtr );

LIBRARY GfxBase BY -240
  PROCEDURE Move( rp IN A1 : RastPortPtr;
		  x  IN D0 : INTEGER;
		  y  IN D1 : INTEGER );

LIBRARY GfxBase BY -426
  PROCEDURE MoveSprite( vp     IN A0 : ViewPortPtr;
			sprite IN A1 : SimpleSpritePtr;
			x      IN D0 : INTEGER;
			y      IN D1 : INTEGER );

LIBRARY GfxBase BY -210
  PROCEDURE MrgCop( view IN A1 : ViewPtr );

LIBRARY GfxBase BY -516
  PROCEDURE NewRegion(): RegionPtr;

LIBRARY GfxBase BY -72
  PROCEDURE OpenFont( textAttr IN A0 : TextAttrPtr ): TextFontPtr;

LIBRARY GfxBase BY -510
  PROCEDURE OrRectRegion( region    IN A0 : RegionPtr;
			  rectangle IN A1 : RectanglePtr): BOOLEAN;

LIBRARY GfxBase BY -612
  PROCEDURE OrRegionRegion( region1 IN A0 : RegionPtr;
			    region2 IN A1 : RegionPtr ): BOOLEAN;

LIBRARY GfxBase BY -456
  PROCEDURE OwnBlitter();

LIBRARY GfxBase BY -336
  PROCEDURE PolyDraw( rp    IN A1 : RastPortPtr;
		      count IN D0 : INTEGER;
		      array IN A0 : ANYPTR );

LIBRARY GfxBase BY -276
  PROCEDURE QBlit( bp IN A1 : BltNodePtr );

LIBRARY GfxBase BY -294
  PROCEDURE QBSBlit( bsp IN A1 : BltNodePtr );

LIBRARY GfxBase BY -318
  PROCEDURE ReadPixel( rp IN A1 : RastPortPtr;
		       x  IN D0 : INTEGER;
		       y  IN D1 : INTEGER ): LONGINT;

LIBRARY GfxBase BY -306
  PROCEDURE RectFill( rp   IN A1 : RastPortPtr;
		      xMin IN D0 : INTEGER;
		      yMin IN D1 : INTEGER;
		      xMax IN D2 : INTEGER;
		      yMax IN D3 : INTEGER );

LIBRARY GfxBase BY -486
  PROCEDURE RemFont( textFont IN A1 : TextFontPtr );

LIBRARY GfxBase BY -132
  PROCEDURE RemIBob( bob IN A0 : BobPtr;
		     rp  IN A1 : RastPortPtr;
		     vp  IN A2 : ViewPortPtr );

LIBRARY GfxBase BY -138
  PROCEDURE RemVSprite( vs IN A0 : VSpritePtr );

LIBRARY GfxBase BY -396
  PROCEDURE ScrollRaster( rp   IN A1 : RastPortPtr;
			  dx   IN D0 : INTEGER;
			  dy   IN D1 : INTEGER;
			  xMin IN D2 : INTEGER;
			  yMin IN D3 : INTEGER;
			  xMax IN D4 : INTEGER;
			  yMax IN D5 : INTEGER );

LIBRARY GfxBase BY -588
  PROCEDURE ScrollVPort( vp IN A0 : ViewPortPtr );

LIBRARY GfxBase BY -342
  PROCEDURE SetAPen( rp  IN A1 : RastPortPtr;
		     pen IN D0 : CARDINAL );

LIBRARY GfxBase BY -348
  PROCEDURE SetBPen( rp  IN A1 : RastPortPtr;
		     pen IN D0 : CARDINAL );

LIBRARY GfxBase BY -144
  PROCEDURE SetCollision( num     IN D0 : LONGCARD;
			  routine IN A0 : PROC;
			  gInfo   IN A1 : GelsInfoPtr );

LIBRARY GfxBase BY -354
  PROCEDURE SetDrMd( rp   IN A1 : RastPortPtr;
		     mode IN D0 : DrawModeSet );

LIBRARY GfxBase BY -66
  PROCEDURE SetFont( rp   IN A1 : RastPortPtr;
		     font IN A0 : TextFontPtr );

LIBRARY GfxBase BY -234
  PROCEDURE SetRast( rp  IN A1 : RastPortPtr;
		     pen IN D0 : CARDINAL );

LIBRARY GfxBase BY -288
  PROCEDURE SetRGB4( vp IN A0 : ViewPortPtr;
		     n  IN D0 : CARDINAL;
		     r  IN D1 : CARDINAL;
		     g  IN D2 : CARDINAL;
		     b  IN D3 : CARDINAL );

LIBRARY GfxBase BY -630
  PROCEDURE SetRGB4CM( cm IN A0 : ColorMapPtr;
		       n  IN D0 : CARDINAL;
		       r  IN D1 : CARDINAL;
		       g  IN D2 : CARDINAL;
		       b  IN D3 : CARDINAL );

LIBRARY GfxBase BY -90
  PROCEDURE SetSoftStyle( rp     IN A1 : RastPortPtr;
			  style  IN D0 : FontStyleSet;
			  enable IN D1 : FontStyleSet ): FontStyleSet;

LIBRARY GfxBase BY -150
  PROCEDURE SortGList( rp IN A1 : RastPortPtr );

LIBRARY GfxBase BY -444
  PROCEDURE SyncSBitMap( layer IN A0 : LayerPtr );

LIBRARY GfxBase BY -60
  PROCEDURE Text( rp     IN A1 : RastPortPtr;
		  string IN A0 : ANYPTR;
		  count  IN D0 : LONGINT );

LIBRARY GfxBase BY -60
  PROCEDURE TextStr(     rp     IN A1 : RastPortPtr;
		     REF string IN A0 : STRING;
			 count  IN D0 : LONGINT );

LIBRARY GfxBase BY -54
  PROCEDURE TextLength( rp     IN A1 : RastPortPtr;
			string IN A0 : ANYPTR;
			count  IN D0 : INTEGER ): INTEGER;

LIBRARY GfxBase BY -54
  PROCEDURE TextLengthStr(     rp     IN A1 : RastPortPtr;
			   REF string IN A0 : STRING;
			       count  IN D0 : INTEGER ): INTEGER;

LIBRARY GfxBase BY -594
  PROCEDURE UCopperListInit( copperList IN A0 : UCopListPtr;
			     num        IN D0 : LONGINT ): UCopListPtr;


LIBRARY GfxBase BY -438
  PROCEDURE UnlockLayerRom( layer IN A5 : LayerPtr );

LIBRARY GfxBase BY -384
  PROCEDURE VBeamPos(): LONGINT;

LIBRARY GfxBase BY -228
  PROCEDURE WaitBlit();

LIBRARY GfxBase BY -402
  PROCEDURE WaitBOVP( vp IN A0 : ViewPortPtr );

LIBRARY GfxBase BY -270
  PROCEDURE WaitTOF();

LIBRARY GfxBase BY -324
  PROCEDURE WritePixel( rp IN A1 : RastPortPtr;
			 x  IN D0 : INTEGER;
			 y  IN D1 : INTEGER ): BOOLEAN;

LIBRARY GfxBase BY -558
  PROCEDURE XorRectRegion( region    IN A0 : RegionPtr;
			   rectangle IN A1 : RectanglePtr ): BOOLEAN;

LIBRARY GfxBase BY -618
  PROCEDURE XorRegionRegion( region1 IN A0 : RegionPtr;
			     region2 IN A1 : RegionPtr ): BOOLEAN;


LIBRARY GfxBase BY -660
  PROCEDURE GfxNew( gfxNodeType IN D0 : LONGINT ): ANYPTR;

LIBRARY GfxBase BY -666
  PROCEDURE GfxFree( gfxNodePtr IN A0 : ANYPTR );

LIBRARY GfxBase BY -672
  PROCEDURE GfxAssociate( associateNode IN A0 : ANYPTR;
			  gfxNodePtr    IN A1 : ANYPTR);

LIBRARY GfxBase BY -678
  PROCEDURE BitMapScale( VAR bitScaleArgs IN A0 : BitScaleArgs );

LIBRARY GfxBase BY -684
  PROCEDURE ScalerDiv( factor      IN D0 : CARDINAL;
		       numerator   IN D1 : CARDINAL;
		       denominator IN D2 : CARDINAL ): CARDINAL;

LIBRARY GfxBase BY -690
  PROCEDURE TextExtent(     rp         IN A1 : RastPortPtr;
			    string     IN A0 : ANYPTR;
			    count      IN D0 : INTEGER;
			VAR textExtent IN A2 : TextExtention );

LIBRARY GfxBase BY -690
  PROCEDURE TextExtentStr(     rp         IN A1 : RastPortPtr;
			  REF string     IN A0 : STRING;
			      count      IN D0 : INTEGER;
			  VAR textExtent IN A2 : TextExtention );

LIBRARY GfxBase BY -696
  PROCEDURE TextFit(     rp                    IN A1 : RastPortPtr;
			 string                IN A0 : ANYPTR;
			 strLen                IN D0 : CARDINAL;
		     VAR textExtent            IN A2 : TextExtention;
			 constrainingExtent    IN A3 : TextExtentPtr;
			 strDirection          IN D1 : INTEGER;
			 constrainingBitWidth  IN D2 : CARDINAL;
			 constrainingBitHeight IN D3 : CARDINAL):LONGCARD;

LIBRARY GfxBase BY -696
  PROCEDURE TextFitStr(    rp                    IN A1 : RastPortPtr;
		       REF string                IN A0 : STRING;
			   strLen                IN D0 : CARDINAL;
		       VAR textExtent            IN A2 : TextExtention;
			   constrainingExtent    IN A3 : TextExtentPtr;
			   strDirection          IN D1 : INTEGER;
			   constrainingBitWidth  IN D2 : CARDINAL;
			   constrainingBitHeight IN D3 : CARDINAL):LONGCARD;

LIBRARY GfxBase BY -702
  PROCEDURE GfxLookUp( associateNode IN A0 : ANYPTR ): ANYPTR;

LIBRARY GfxBase BY -708
  PROCEDURE VideoControl( VAR colorMap IN A0 : ColorMap;
			      tagarray IN A1 : VTagListPtr ): BOOLEAN;

LIBRARY GfxBase BY -714
  PROCEDURE OpenMonitor( VAR monitorName IN A1 : STRING;
			     displayID   IN D0 : LONGCARD): MonitorSpecPtr;

LIBRARY GfxBase BY -720
  PROCEDURE CloseMonitor( monitorSpec IN A0 : MonitorSpecPtr ): BOOLEAN;

LIBRARY GfxBase BY -726
  PROCEDURE FindDisplayInfo(displayID IN D0 : LONGCARD):DisplayInfoHandle;

LIBRARY GfxBase BY -732
  PROCEDURE NextDisplayInfo( displayID IN D0 : LONGCARD ): LONGCARD;

LIBRARY GfxBase BY -756
  PROCEDURE GetDisplayInfoData( handle    IN A0 : DisplayInfoHandle;
				buf       IN A1 : ANYPTR;
				size      IN D0 : LONGCARD;
				tagID     IN D1 : LONGCARD;
				displayID IN D2 : LONGCARD ): LONGCARD;

LIBRARY GfxBase BY -762
  PROCEDURE FontExtent(     font       IN A0 : TextFontPtr;
			VAR fontExtent IN A1 : TextExtention );

LIBRARY GfxBase BY -768
  PROCEDURE ReadPixelLine8( rp     IN A0 : RastPortPtr;
			    xstart IN D0 : CARDINAL;
			    ystart IN D1 : CARDINAL;
			    width  IN D2 : CARDINAL;
			    array  IN A2 : ANYPTR;
			    tempRP IN A1 : RastPortPtr ): LONGINT;

LIBRARY GfxBase BY -774
  PROCEDURE WritePixelLine8( rp     IN A0 : RastPortPtr;
			     xstart IN D0 : CARDINAL;
			     ystart IN D1 : CARDINAL;
			     width  IN D2 : CARDINAL;
			     array  IN A2 : ANYPTR;
			     tempRP IN A1 : RastPortPtr ): LONGINT;

LIBRARY GfxBase BY -780
  PROCEDURE ReadPixelArray8( rp     IN A0 : RastPortPtr;
			     xstart IN D0 : CARDINAL;
			     ystart IN D1 : CARDINAL;
			     xstop  IN D2 : CARDINAL;
			     ystop  IN D3 : CARDINAL;
			     array  IN A2 : ANYPTR;
			     temprp IN A1 : RastPortPtr ): LONGINT;

LIBRARY GfxBase BY -786
  PROCEDURE WritePixelArray8( rp     IN A0 : RastPortPtr;
			      xstart IN D0 : CARDINAL;
			      ystart IN D1 : CARDINAL;
			      xstop  IN D2 : CARDINAL;
			      ystop  IN D3 : CARDINAL;
			      array  IN A2 : ANYPTR;
			      temprp IN A1 : RastPortPtr ): LONGINT;

LIBRARY GfxBase BY -792
  PROCEDURE GetVPModeID( vp IN A0 : ViewPortPtr ): LONGCARD;

LIBRARY GfxBase BY -798
  PROCEDURE ModeNotAvailable( modeID IN D0 : LONGCARD ): LONGCARD;

LIBRARY GfxBase BY -804
  PROCEDURE WeighTAMatch( reqTextAttr    IN A0 : TextAttrPtr;
			  targetTextAttr IN A1 : TextAttrPtr;
			  targetTags     IN A2 : FontTagListPtr):CARDINAL;

LIBRARY GfxBase BY -810
  PROCEDURE EraseRect( rp   IN A1 : RastPortPtr;
		       xMin IN D0 : INTEGER;
		       yMin IN D1 : INTEGER;
		       xMax IN D2 : INTEGER;
		       yMax IN D3 : INTEGER );

LIBRARY GfxBase BY -816
  PROCEDURE ExtendFont( font     IN A0 : TextFontPtr;
			fontTags IN A1 : FontTagListPtr ): LONGCARD;

LIBRARY GfxBase BY -822
  PROCEDURE StripFont( font IN A0 : TextFontPtr );

GROUP

  ViewGrp       = RasInfo,            RasInfoPtr,         View,
		  ViewModes,          ViewModeSet,        ViewPort,
		  ViewPtr;

  RasterGrp     = BitMap,             RastPort,           RastPortFlags,
		  RastPortFlagSet,    RastPortPtr,
		  AllocRaster,        FreeRaster,         InitBitMap,
		  InitRastPort;

  DrMdGrp       = RasterGrp,
		  jam1,               jam2,
		  DrawModes,          DrawModeSet,
		  SetAPen,            SetBPen,            SetDrMd,
		  SetRast;
		  | SetDrPt             SetWrMsk,

  DrawGrp       = RastPortPtr,
		  ClearEOL,           ClearScreen,        Draw,
		  DrawEllipse,        Move,               PolyDraw,
		  ReadPixel,          ScrollRaster,       Text,
		  TextLength,         TextLengthStr,      TextStr,
		  WritePixel;
		  |DrawCircle,        |TestPixel,

  AreaGrp       = AreaInfo,           AreaInfoPtr,        RastPortPtr,
		  TmpRas,             TmpRasPtr,
		  AreaDraw,           AreaEllipse,
		  AreaEnd,            AreaMove,           (*BndryOff,*)
		  Flood,              InitArea,           InitTmpRas,
		  RectFill;
		  |SetAfPt,            SetOPen,           AreaCircle;

  ColorGrp      = ColorMap,           ColorMapPtr,        Pen,
		  PenArray,           PenArrayPtr,        ViewPortPtr,
		  FreeColorMap,       GetColorMap,        GetRGB4,
		  LoadRGB4,           SetRGB4,            SetRGB4CM;

  BltGrp        = BitMapPtr,          LONGSET,            RastPortPtr,
		  SHORTSET,
		  BltBitMap,          BltBitMapRastPort,  BltClear,
		  BltClear,           BltTemplate,        ClipBlit,
		  DisownBlitter,      OwnBlitter,         QBlit,
		  QBSBlit,            WaitBlit;

  CopGrp        = ViewGrp,
		  lof,                move,               next,
		  sht,                wait,
		  CopInit,            CopInitPtr,         CopIns,
		  CopInsPtr,          CopList,            CopListPtr,
		  CprList,            CprListPtr,         UCopList,
		  UCopListPtr,        ViewPortPtr,        ViewPtr,
		  CBump,              CMove,              CWait,
		  FreeCopList,        FreeVPortCopLists,  InitView,
		  InitVPort,          LoadView,           MakeVPort,
		  MrgCop,             ScrollRaster,       UCopList,
		  UCopperListInit,    VBeamPos,           WaitBOVP,
		  WaitTOF;
		  |CEnd

  LayerGrp      = ClipRect,           Isrvstr,            IsrvstrPtr,
		  Layer,              LayerFlags,         LayerFlagSet,
		  LayerInfo,          LayerPtr,           Rectangle,
		  RectanglePtr,       Region,             RegionPtr,
		  RegionRectangle,
		  AndRectRegion,      AndRegionRegion,
		  AttemptLockLayerRom,
		  ClearRectRegion,    ClearRegion,        CopySBitMap,
		  DisposeRegion,      LockLayerRom,       NewRegion,
		  OrRectRegion,       OrRegionRegion,     SyncSBitMap,
		  UnlockLayerRom,     XorRectRegion,      XorRegionRegion;

  FontGrp       = AddFont,            AskFont,            AskSoftStyle,
		  CloseFont,          OpenFont,           RemFont,
		  SetFont,            SetSoftStyle,       TextFont,
		  FontStyles,         FontStyleSet,       FontFlags,
		  FontFlagSet,        normalFont,         TextAttrPtr,
		  TextAttr,           TextFontPtr;

  GelGrp        = AddAnimOb,          AnimOb,             RastPortPtr,
		  AddBob,             Bob,                AddVSprite,
		  Animate,            ChangeSprite,       SimpleSprite,
		  ViewPortPtr,        DoCollision,        DrawGList,
		  FreeGBuffers,       FreeSprite,         GetGBuffers,
		  GetSprite,          |InitAnimate,       InitGels,
		  InitGMasks,         InitMasks,          VSprite,
		  VSpritePtr,         MoveSprite,         |RemBob,
		  RemIBob,            RemVSprite,         SetCollision,
		  PROC,               GelsInfoPtr,        SortGList,
		  DBufPacketPtr,      DBufPacket,         BobPtr,
		  AnimObPtr,          AnimCompPtr,        AnimComp,
		  BobFlags,           BobFlagSet,         VSpriteFlags,
		  VSpriteFlagSet,     SimpleSpritePtr,    CollTablePtr,
		  CollTable,          GelsInfo;

  GfxBasicGrp   = DrMdGrp,            DrawGrp,            AreaGrp,
		  ColorGrp;


  All           = ViewGrp,            RasterGrp,          DrMdGrp,
		  DrawGrp,            AreaGrp,            ColorGrp,
		  BltGrp,             CopGrp,             LayerGrp,
		  FontGrp,            GelGrp,             DisplayFlags,
		  DisplayFlagSet,     GfxBasePtr,         GfxBaseType,
		  GfxBase;

END Graphics.

