1 {
2     This file is part of the Free Pascal run time library.
3 
4     A file in Amiga system run time library.
5     Copyright (c) 1998-2003 by Nils Sjoholm
6     member of the Amiga RTL development team.
7 
8     See the file COPYING.FPC, included in this distribution,
9     for details about the copyright.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 
15  **********************************************************************}
16 
17  {
18     History:
19 
20     Found bugs in,
21     WritePixelArray8,
22     WritePixelLine8,
23     ReadPixelArray8,
24     ReadPixelLine8,
25     WriteChunkyPixels.
26     They all had one argument(array_) defined as pchar,
27     should be pointer, fixed.
28     20 Aug 2000.
29 
30     InitTmpRas had wrong define for the buffer arg.
31     Changed from pchar to PLANEPTR.
32     23 Aug 2000.
33 
34     Compiler had problems with Text, changed to GText.
35     24 Aug 2000.
36 
37     Added functions and procedures with array of const.
38     For use with fpc 1.0.7. They are in systemvartags.
39     11 Nov 2002.
40 
41     Added the defines use_amiga_smartlink and
42     use_auto_openlib.
43     13 Jan 2003.
44 
45     Update for AmifaOS 3.9.
46     Changed start code for unit.
47     Bugs in ChangeSprite, GetRGB32, LoadRGB32,
48     LoadRGB4 and PolyDraw, fixed.
49     01 Feb 2003.
50 
51     Changed integer > smallint,
52             cardinal > longword.
53     09 Feb 2003.
54 
55     nils.sjoholm@mailbox.swipnet.se
56 
57 }
58 {$PACKRECORDS 2}
59 
60 unit agraphics;
61 
62 INTERFACE
63 
64 uses exec, hardware, utility;
65 
66 
67 const
68 
69     BITSET      = $8000;
70     BITCLR      = 0;
71 
72 type
73 
74 
75     pRectangle = ^tRectangle;
76     tRectangle = record
77         MinX,MinY       : Word;
78         MaxX,MaxY       : Word;
79     end;
80 
81     pRect32 = ^tRect32;
82     tRect32 = record
83         MinX,MinY       : Longint;
84         MaxX,MaxY       : Longint;
85     end;
86 
87     pPoint = ^tPoint;
88     tPoint = record
89         x,y     : Word;
90     end;
91 
92     TPLANEPTR = PByte;
93 
94     pBitMap = ^tBitMap;
95     tBitMap = record
96         BytesPerRow     : Word;
97         Rows            : Word;
98         Flags           : Byte;
99         Depth           : Byte;
100         pad             : Word;
101         Planes          : Array [0..7] of TPLANEPTR;
102     end;
103 {* flags for AllocBitMap, etc. *}
104 const
105      BMB_CLEAR       = 0;
106      BMB_DISPLAYABLE = 1;
107      BMB_INTERLEAVED = 2;
108      BMB_STANDARD    = 3;
109      BMB_MINPLANES   = 4;
110 
111      BMF_CLEAR       = (1 shl BMB_CLEAR);
112      BMF_DISPLAYABLE = (1 shl BMB_DISPLAYABLE);
113      BMF_INTERLEAVED = (1 shl BMB_INTERLEAVED);
114      BMF_STANDARD    = (1 shl BMB_STANDARD);
115      BMF_MINPLANES   = (1 shl BMB_MINPLANES);
116 
117 {* the following are for GetBitMapAttr() *}
118      BMA_HEIGHT      = 0;
119      BMA_DEPTH       = 4;
120      BMA_WIDTH       = 8;
121      BMA_FLAGS       = 12;
122 
123 
124 { structures used by and constructed by windowlib.a }
125 { understood by rom software }
126 type
127     pClipRect = ^tClipRect;
128     tClipRect = record
129         Next    : pClipRect;    { roms used to find next ClipRect }
130         prev    : pClipRect;    { ignored by roms, used by windowlib }
131         lobs    : Pointer;      { ignored by roms, used by windowlib (LayerPtr)}
132         BitMap  : pBitMap;
133         bounds  : tRectangle;    { set up by windowlib, used by roms }
134         _p1,
135         _p2     : Pointer;    { system reserved }
136         reserved : Longint;     { system use }
137     end;
138 
139     pLayer = ^tLayer;
140     tLayer = record
141         front,
142         back            : pLayer;       { ignored by roms }
143         ClipRect        : pClipRect;  { read by roms to find first cliprect }
144         rp              : Pointer;      { (RastPortPtr) ignored by roms, I hope }
145         bounds          : tRectangle;    { ignored by roms }
146         reserved        : Array [0..3] of Byte;
147         priority        : Word;        { system use only }
148         Flags           : Word;        { obscured ?, Virtual BitMap? }
149         SuperBitMap     : pBitMap;
150         SuperClipRect   : pClipRect;  { super bitmap cliprects if
151                                                 VBitMap != 0}
152                                         { else damage cliprect list for refresh }
153         Window          : Pointer;      { reserved for user interface use }
154         Scroll_X,
155         Scroll_Y        : Word;
156         cr,
157         cr2,
158         crnew           : pClipRect;  { used by dedice }
159         SuperSaveClipRects : pClipRect; { preallocated cr's }
160         _cliprects      : pClipRect;  { system use during refresh }
161         LayerInfo       : Pointer;      { points to head of the list }
162         Lock            : tSignalSemaphore;
163         BackFill        : pHook;
164         reserved1       : ULONG;
165         ClipRegion      : Pointer;
166         saveClipRects   : Pointer;      { used to back out when in trouble}
167         Width,
168         Height          : smallint;
169         reserved2       : Array [0..17] of Byte;
170         { this must stay here }
171         DamageList      : Pointer;      { list of rectangles to refresh
172                                                 through }
173     end;
174 
175 const
176 
177 { internal cliprect flags }
178 
179     CR_NEEDS_NO_CONCEALED_RASTERS       = 1;
180     CR_NEEDS_NO_LAYERBLIT_DAMAGE        = 2;
181 
182 
183 { defines for code values for getcode }
184 
185     ISLESSX     = 1;
186     ISLESSY     = 2;
187     ISGRTRX     = 4;
188     ISGRTRY     = 8;
189 
190 
191 {------ Font Styles ------------------------------------------------}
192 
193     FS_NORMAL           = 0;    { normal text (no style bits set) }
194     FSB_EXTENDED        = 3;    { extended face (wider than normal) }
195     FSF_EXTENDED        = 8;
196     FSB_ITALIC          = 2;    { italic (slanted 1:2 right) }
197     FSF_ITALIC          = 4;
198     FSB_BOLD            = 1;    { bold face text (ORed w/ shifted) }
199     FSF_BOLD            = 2;
200     FSB_UNDERLINED      = 0;    { underlined (under baseline) }
201     FSF_UNDERLINED      = 1;
202 
203     FSB_COLORFONT       = 6;       { this uses ColorTextFont structure }
204     FSF_COLORFONT       = $40;
205     FSB_TAGGED          = 7;       { the TextAttr is really an TTextAttr, }
206     FSF_TAGGED          = $80;
207 
208 
209 {------ Font Flags -------------------------------------------------}
210     FPB_ROMFONT         = 0;    { font is in rom }
211     FPF_ROMFONT         = 1;
212     FPB_DISKFONT        = 1;    { font is from diskfont.library }
213     FPF_DISKFONT        = 2;
214     FPB_REVPATH         = 2;    { designed path is reversed (e.g. left) }
215     FPF_REVPATH         = 4;
216     FPB_TALLDOT         = 3;    { designed for hires non-interlaced }
217     FPF_TALLDOT         = 8;
218     FPB_WIDEDOT         = 4;    { designed for lores interlaced }
219     FPF_WIDEDOT         = 16;
220     FPB_PROPORTIONAL    = 5;    { character sizes can vary from nominal }
221     FPF_PROPORTIONAL    = 32;
222     FPB_DESIGNED        = 6;    { size is "designed", not constructed }
223     FPF_DESIGNED        = 64;
224     FPB_REMOVED         = 7;    { the font has been removed }
225     FPF_REMOVED         = 128;
226 
227 {***** TextAttr node, matches text attributes in RastPort *********}
228 
229 type
230 
231     pTextAttr = ^tTextAttr;
232     tTextAttr = record
233         ta_Name : STRPTR;       { name of the font }
234         ta_YSize : Word;       { height of the font }
235         ta_Style : Byte;        { intrinsic font style }
236         ta_Flags : Byte;        { font preferences and flags }
237     end;
238 
239     pTTextAttr = ^tTTextAttr;
240     tTTextAttr = record
241         tta_Name : STRPTR;       { name of the font }
242         tta_YSize : Word;       { height of the font }
243         tta_Style : Byte;        { intrinsic font style }
244         tta_Flags : Byte;        { font preferences AND flags }
245         tta_Tags  : pTagItem;     { extended attributes }
246     end;
247 
248 {***** Text Tags **************************************************}
249 CONST
250   TA_DeviceDPI  =  (1+TAG_USER);    { Tag value is Point union: }
251                                         { Hi Longint XDPI, Lo Longint YDPI }
252 
253   MAXFONTMATCHWEIGHT  =    32767;   { perfect match from WeighTAMatch }
254 
255 
256 
257 {***** TextFonts node *********************************************}
258 Type
259 
260     pTextFont = ^tTextFont;
261     tTextFont = record
262         tf_Message      : tMessage;      { reply message for font removal }
263                                         { font name in LN \    used in this }
264         tf_YSize        : Word;        { font height     |    order to best }
265         tf_Style        : Byte;         { font style      |    match a font }
266         tf_Flags        : Byte;         { preferences and flags /    request. }
267         tf_XSize        : Word;        { nominal font width }
268         tf_Baseline     : Word; { distance from the top of char to baseline }
269         tf_BoldSmear    : Word;        { smear to affect a bold enhancement }
270 
271         tf_Accessors    : Word;        { access count }
272 
273         tf_LoChar       : Byte;         { the first character described here }
274         tf_HiChar       : Byte;         { the last character described here }
275         tf_CharData     : Pointer;      { the bit character data }
276 
277         tf_Modulo       : Word; { the row modulo for the strike font data }
278         tf_CharLoc      : Pointer; { ptr to location data for the strike font }
279                                         { 2 words: bit offset then size }
280         tf_CharSpace    : Pointer; { ptr to words of proportional spacing data }
281         tf_CharKern     : Pointer;      { ptr to words of kerning data }
282     end;
283 
284 
285 {----- tfe_Flags0 (partial definition) ----------------------------}
286 CONST
287  TE0B_NOREMFONT = 0;       { disallow RemFont for this font }
288  TE0F_NOREMFONT = $01;
289 
290 Type
291 
292    pTextFontExtension = ^tTextFontExtension;
293    tTextFontExtension = record              { this structure is read-only }
294     tfe_MatchWord  : Word;                { a magic cookie for the extension }
295     tfe_Flags0     : Byte;                 { (system private flags) }
296     tfe_Flags1     : Byte;                 { (system private flags) }
297     tfe_BackPtr    : pTextFont;          { validation of compilation }
298     tfe_OrigReplyPort : pMsgPort;        { original value in tf_Extension }
299     tfe_Tags       : pTagItem;              { Text Tags for the font }
300     tfe_OFontPatchS,                       { (system private use) }
301     tfe_OFontPatchK : Pointer;             { (system private use) }
302     { this space is reserved for future expansion }
303    END;
304 
305 {***** ColorTextFont node *****************************************}
306 {----- ctf_Flags --------------------------------------------------}
307 CONST
308  CT_COLORMASK  =  $000F;  { mask to get to following color styles }
309  CT_COLORFONT  =  $0001;  { color map contains designer's colors }
310  CT_GREYFONT   =  $0002;  { color map describes even-stepped }
311                                 { brightnesses from low to high }
312  CT_ANTIALIAS  =  $0004;  { zero background thru fully saturated char }
313 
314  CTB_MAPCOLOR  =  0;      { map ctf_FgColor to the rp_FgPen IF it's }
315  CTF_MAPCOLOR  =  $0001;  { is a valid color within ctf_Low..ctf_High }
316 
317 {----- ColorFontColors --------------------------------------------}
318 Type
319    pColorFontColors = ^tColorFontColors;
320    tColorFontColors = record
321     cfc_Reserved,                 { *must* be zero }
322     cfc_Count   : Word;          { number of entries in cfc_ColorTable }
323     cfc_ColorTable : Pointer;     { 4 bit per component color map packed xRGB }
324    END;
325 
326 {----- ColorTextFont ----------------------------------------------}
327 
328    pColorTextFont = ^tColorTextFont;
329    tColorTextFont = record
330     ctf_TF      : tTextFont;
331     ctf_Flags   : Word;          { extended flags }
332     ctf_Depth,          { number of bit planes }
333     ctf_FgColor,        { color that is remapped to FgPen }
334     ctf_Low,            { lowest color represented here }
335     ctf_High,           { highest color represented here }
336     ctf_PlanePick,      { PlanePick ala Images }
337     ctf_PlaneOnOff : Byte;     { PlaneOnOff ala Images }
338     ctf_ColorFontColors : pColorFontColors; { colors for font }
339     ctf_CharData : Array[0..7] of APTR;    {pointers to bit planes ala tf_CharData }
340    END;
341 
342 {***** TextExtent node ********************************************}
343 
344    pTextExtent = ^tTextExtent;
345    tTextExtent = record
346     te_Width,                   { same as TextLength }
347     te_Height : Word;          { same as tf_YSize }
348     te_Extent : tRectangle;      { relative to CP }
349    END;
350 
351 
352 const
353 
354     COPPER_MOVE = 0;    { pseude opcode for move #XXXX,dir }
355     COPPER_WAIT = 1;    { pseudo opcode for wait y,x }
356     CPRNXTBUF   = 2;    { continue processing with next buffer }
357     CPR_NT_LOF  = $8000; { copper instruction only for Longint frames }
358     CPR_NT_SHT  = $4000; { copper instruction only for long frames }
359     CPR_NT_SYS  = $2000; { copper user instruction only }
360 type
361 
362 { Note: The combination VWaitAddr and HWaitAddr replace a three way
363         union in C.  The three possibilities are:
364 
365         nxtList : CopListPtr;  or
366 
367         VWaitPos : Longint;
368         HWaitPos : Longint;  or
369 
370         DestAddr : Longint;
371         DestData : Longint;
372 }
373 
374   PCopList = ^TCopList;
375 
376   // Copper structures
377   PCopIns = ^TCopIns;
378   TCopIns = record
379     OpCode: smallint; // 0 = move, 1 = wait
380     case SmallInt of
381     0:(
382       NxtList: PCopList;
383       );
384     1:(
385       DestAddr: SmallInt; // destination Pointer
386       DestData: SmallInt; // data to send
387       );
388     2:(
389       VWaitPos: SmallInt; // vertical wait position
390       HWaitPos: SmallInt; // horizontal wait position
391       );
392   end;
393 
394 { structure of cprlist that points to list that hardware actually executes }
395 
396     pcprlist = ^tcprlist;
397     tcprlist = record
398         Next    : pcprlist;
399         start   : psmallint;       { start of copper list }
400         MaxCount : smallint;       { number of long instructions }
401     end;
402 
403 
404     tCopList = record
405         Next    : pCopList;     { next block for this copper list }
406         _CopList : pCopList;    { system use }
407         _ViewPort : Pointer;    { system use }
408         CopIns  : pCopIns;    { start of this block }
409         CopPtr  : pCopIns;    { intermediate ptr }
410         CopLStart : psmallint;     { mrgcop fills this in for Long Frame}
411         CopSStart : psmallint;     { mrgcop fills this in for Longint Frame}
412         Count   : smallint;        { intermediate counter }
413         MaxCount : smallint;       { max # of copins for this block }
414         DyOffset : smallint;       { offset this copper list vertical waits }
415         SLRepeat : Word;
416         Flags    : Word;
417     end;
418 
419     pUCopList = ^tUCopList;
420     tUCopList = record
421         Next    : pUCopList;
422         FirstCopList : pCopList;      { head node of this copper list }
423         CopList : pCopList;           { node in use }
424     end;
425 
426     pcopinit = ^tcopinit;
427     tcopinit = record
428         vsync_hblank : array [0..1] of word;
429         diagstrt : Array [0..11] of word;
430         fm0      : array [0..1] of word;
431         diwstart : array [0..9] of word;
432         bplcon2  : array [0..1] of word;
433         sprfix   : array [0..(2*8-1)] of word;
434         sprstrtup : Array [0..(2*8*2-1)] of Word;
435         wait14    : array [0..1] of word;
436         norm_hblank : array [0..1] of word;
437         jump        : array [0..1] of word;
438         wait_forever : array [0..5] of word;
439         sprstop : Array [0..7] of Word;
440     end;
441 
442 
443 
444     pAreaInfo = ^tAreaInfo;
445     tAreaInfo = record
446         VctrTbl : Pointer;      { ptr to start of vector table }
447         VctrPtr : Pointer;      { ptr to current vertex }
448         FlagTbl : Pointer;      { ptr to start of vector flag table }
449         FlagPtr : Pointer;      { ptrs to areafill flags }
450         Count   : smallint;        { number of vertices in list }
451         MaxCount : smallint;       { AreaMove/Draw will not allow Count>MaxCount}
452         FirstX,
453         FirstY  : smallint;        { first point for this polygon }
454     end;
455 
456     pTmpRas = ^tTmpRas;
457     tTmpRas = record
458         RasPtr  : Pointer;
459         Size    : Longint;
460     end;
461 
462 { unoptimized for 32bit alignment of pointers }
463 
464     pGelsInfo = ^tGelsInfo;
465     tGelsInfo = record
466         sprRsrvd        : Shortint; { flag of which sprites to reserve from
467                                   vsprite system }
468         Flags   : Byte;       { system use }
469         gelHead,
470         gelTail : Pointer; { (VSpritePtr) dummy vSprites for list management}
471 
472     { pointer to array of 8 WORDS for sprite available lines }
473 
474         nextLine : Pointer;
475 
476     { pointer to array of 8 pointers for color-last-assigned to vSprites }
477 
478         lastColor : Pointer;
479         collHandler : Pointer;  { (collTablePtr) Pointeres of collision routines }
480         leftmost,
481         rightmost,
482         topmost,
483         bottommost      : smallint;
484         firstBlissObj,
485         lastBlissObj    : Pointer;    { system use only }
486     end;
487 
488     pRastPort = ^tRastPort;
489     tRastPort = record
490         Layer           : pLayer;      { LayerPtr }
491         BitMap          : pBitMap;      { BitMapPtr }
492         AreaPtrn        : Pointer;      { ptr to areafill pattern }
493         TmpRas          : pTmpRas;
494         AreaInfo        : pAreaInfo;
495         GelsInfo        : pGelsInfo;
496         Mask            : Byte;         { write mask for this raster }
497         FgPen           : Shortint;         { foreground pen for this raster }
498         BgPen           : Shortint;         { background pen         }
499         AOlPen          : Shortint;         { areafill outline pen }
500         DrawMode        : Shortint; { drawing mode for fill, lines, and text }
501         AreaPtSz        : Shortint;         { 2^n words for areafill pattern }
502         linpatcnt       : Shortint; { current line drawing pattern preshift }
503         dummy           : Shortint;
504         Flags           : Word;        { miscellaneous control bits }
505         LinePtrn        : Word;        { 16 bits for textured lines }
506         cp_x,
507         cp_y            : smallint;        { current pen position }
508         minterms        : Array [0..7] of Byte;
509         PenWidth        : smallint;
510         PenHeight       : smallint;
511         Font            : pTextFont;      { (TextFontPtr) current font Pointer }
512         AlgoStyle       : Byte;         { the algorithmically generated style }
513         TxFlags         : Byte;         { text specific flags }
514         TxHeight        : Word;        { text height }
515         TxWidth         : Word;        { text nominal width }
516         TxBaseline      : Word;        { text baseline }
517         TxSpacing       : smallint;        { text spacing (per character) }
518         RP_User         : Pointer;
519         longreserved    : Array [0..1] of ULONG;
520         wordreserved    : Array [0..6] of Word;        { used to be a node }
521         reserved        : Array [0..7] of Byte;         { for future use }
522     end;
523 
524 const
525 
526 { drawing modes }
527 
528     JAM1        = 0;    { jam 1 color into raster }
529     JAM2        = 1;    { jam 2 colors into raster }
530     COMPLEMENT  = 2;    { XOR bits into raster }
531     INVERSVID   = 4;    { inverse video for drawing modes }
532 
533 { these are the flag bits for RastPort flags }
534 
535     FRST_DOT    = $01;  { draw the first dot of this line ? }
536     ONE_DOT     = $02;  { use one dot mode for drawing lines }
537     DBUFFER     = $04;  { flag set when RastPorts are double-buffered }
538 
539              { only used for bobs }
540 
541     AREAOUTLINE = $08;  { used by areafiller }
542     NOCROSSFILL = $20;  { areafills have no crossovers }
543 
544 { there is only one style of clipping: raster clipping }
545 { this preserves the continuity of jaggies regardless of clip window }
546 { When drawing into a RastPort, if the ptr to ClipRect is nil then there }
547 { is no clipping done, this is dangerous but useful for speed }
548 
549 
550 Const
551     CleanUp     = $40;
552     CleanMe     = CleanUp;
553 
554     BltClearWait        = 1;    { Waits for blit to finish }
555     BltClearXY          = 2;    { Use Row/Bytes per row method }
556 
557         { Useful minterms }
558 
559     StraightCopy        = $C0;  { Vanilla copy }
560     InvertAndCopy       = $30;  { Invert the source before copy }
561     InvertDest          = $50;  { Forget source, invert dest }
562 
563 
564  {      mode coercion definitions }
565 
566 const
567 {  These flags are passed (in combination) to CoerceMode() to determine the
568  * type of coercion required.
569  }
570 
571 {  Ensure that the mode coerced to can display just as many colours as the
572  * ViewPort being coerced.
573  }
574     PRESERVE_COLORS = 1;
575 
576 {  Ensure that the mode coerced to is not interlaced. }
577     AVOID_FLICKER   = 2;
578 
579 {  Coercion should ignore monitor compatibility issues. }
580     IGNORE_MCOMPAT  = 4;
581 
582 
583     BIDTAG_COERCE   = 1; {  Private }
584 
585 const
586 
587 { VSprite flags }
588 { user-set VSprite flags: }
589 
590     SUSERFLAGS  = $00FF;        { mask of all user-settable VSprite-flags }
591     VSPRITE_f   = $0001;        { set if VSprite, clear if Bob }
592                                 { VSPRITE had to be changed for name conflict }
593     SAVEBACK    = $0002;        { set if background is to be saved/restored }
594     OVERLAY     = $0004;        { set to mask image of Bob onto background }
595     MUSTDRAW    = $0008;        { set if VSprite absolutely must be drawn }
596 
597 { system-set VSprite flags: }
598 
599     BACKSAVED   = $0100;        { this Bob's background has been saved }
600     BOBUPDATE   = $0200;        { temporary flag, useless to outside world }
601     GELGONE     = $0400;        { set if gel is completely clipped (offscreen) }
602     VSOVERFLOW  = $0800;        { VSprite overflow (if MUSTDRAW set we draw!) }
603 
604 { Bob flags }
605 { these are the user flag bits }
606 
607     BUSERFLAGS  = $00FF;        { mask of all user-settable Bob-flags }
608     SAVEBOB     = $0001;        { set to not erase Bob }
609     BOBISCOMP   = $0002;        { set to identify Bob as AnimComp }
610 
611 { these are the system flag bits }
612 
613     BWAITING    = $0100;        { set while Bob is waiting on 'after' }
614     BDRAWN      = $0200;        { set when Bob is drawn this DrawG pass}
615     BOBSAWAY    = $0400;        { set to initiate removal of Bob }
616     BOBNIX      = $0800;        { set when Bob is completely removed }
617     SAVEPRESERVE = $1000;       { for back-restore during double-buffer}
618     OUTSTEP     = $2000;        { for double-clearing if double-buffer }
619 
620 { defines for the animation procedures }
621 
622     ANFRACSIZE  = 6;
623     ANIMHALF    = $0020;
624     RINGTRIGGER = $0001;
625 
626 
627 { UserStuff definitions
628  *  the user can define these to be a single variable or a sub-structure
629  *  if undefined by the user, the system turns these into innocuous variables
630  *  see the manual for a thorough definition of the UserStuff definitions
631  *
632  }
633 
634 type
635 
636     VUserStuff  = smallint;        { Sprite user stuff }
637     BUserStuff  = smallint;        { Bob user stuff }
638     AUserStuff  = smallint;        { AnimOb user stuff }
639 
640 {********************** GEL STRUCTURES **********************************}
641 
642     pVSprite = ^tVSprite;
643     tVSprite = record
644 
645 { --------------------- SYSTEM VARIABLES ------------------------------- }
646 { GEL linked list forward/backward pointers sorted by y,x value }
647 
648         NextVSprite     : pVSprite;
649         PrevVSprite     : pVSprite;
650 
651 { GEL draw list constructed in the order the Bobs are actually drawn, then
652  *  list is copied to clear list
653  *  must be here in VSprite for system boundary detection
654  }
655 
656         DrawPath        : pVSprite;     { pointer of overlay drawing }
657         ClearPath       : pVSprite;     { pointer for overlay clearing }
658 
659 { the VSprite positions are defined in (y,x) order to make sorting
660  *  sorting easier, since (y,x) as a long Longint
661  }
662 
663         OldY, OldX      : smallint;        { previous position }
664 
665 { --------------------- COMMON VARIABLES --------------------------------- }
666 
667         Flags           : smallint;        { VSprite flags }
668 
669 
670 { --------------------- USER VARIABLES ----------------------------------- }
671 { the VSprite positions are defined in (y,x) order to make sorting
672  *  sorting easier, since (y,x) as a long Longint
673  }
674 
675         Y, X            : smallint;        { screen position }
676 
677         Height  : smallint;
678         Width   : smallint;        { number of words per row of image data }
679         Depth   : smallint;        { number of planes of data }
680 
681         MeMask  : smallint;        { which types can collide with this VSprite}
682         HitMask : smallint;        { which types this VSprite can collide with}
683 
684         ImageData       : Pointer;      { pointer to VSprite image }
685 
686 { borderLine is the one-dimensional logical OR of all
687  *  the VSprite bits, used for fast collision detection of edge
688  }
689 
690         BorderLine      : Pointer; { logical OR of all VSprite bits }
691         CollMask        : Pointer; { similar to above except this is a matrix }
692 
693 { pointer to this VSprite's color definitions (not used by Bobs) }
694 
695         SprColors       : Pointer;
696 
697         VSBob   : Pointer;      { (BobPtr) points home if this VSprite
698                                    is part of a Bob }
699 
700 { planePick flag:  set bit selects a plane from image, clear bit selects
701  *  use of shadow mask for that plane
702  * OnOff flag: if using shadow mask to fill plane, this bit (corresponding
703  *  to bit in planePick) describes whether to fill with 0's or 1's
704  * There are two uses for these flags:
705  *      - if this is the VSprite of a Bob, these flags describe how the Bob
706  *        is to be drawn into memory
707  *      - if this is a simple VSprite and the user intends on setting the
708  *        MUSTDRAW flag of the VSprite, these flags must be set too to describe
709  *        which color registers the user wants for the image
710  }
711 
712         PlanePick       : Shortint;
713         PlaneOnOff      : Shortint;
714 
715         VUserExt        : VUserStuff;   { user definable:  see note above }
716     end;
717 
718 
719 
720 
721 { dBufPacket defines the values needed to be saved across buffer to buffer
722  *  when in double-buffer mode
723  }
724 
725     pDBufPacket = ^tDBufPacket;
726     tDBufPacket = record
727         BufY,
728         BufX    : Word;        { save other buffers screen coordinates }
729         BufPath : pVSprite;   { carry the draw path over the gap }
730 
731 { these pointers must be filled in by the user }
732 { pointer to other buffer's background save buffer }
733 
734         BufBuffer : Pointer;
735     end;
736 
737 
738 
739 
740 
741     pBob = ^tBob;
742     tBob = record
743 { blitter-objects }
744 
745 { --------------------- SYSTEM VARIABLES --------------------------------- }
746 
747 { --------------------- COMMON VARIABLES --------------------------------- }
748 
749         Flags   : smallint; { general purpose flags (see definitions below) }
750 
751 { --------------------- USER VARIABLES ----------------------------------- }
752 
753         SaveBuffer : Pointer;   { pointer to the buffer for background save }
754 
755 { used by Bobs for "cookie-cutting" and multi-plane masking }
756 
757         ImageShadow : Pointer;
758 
759 { pointer to BOBs for sequenced drawing of Bobs
760  *  for correct overlaying of multiple component animations
761  }
762         Before  : pBob; { draw this Bob before Bob pointed to by before }
763         After   : pBob; { draw this Bob after Bob pointed to by after }
764 
765         BobVSprite : pVSprite;        { this Bob's VSprite definition }
766 
767         BobComp : Pointer; { (AnimCompPtr) pointer to this Bob's AnimComp def }
768 
769         DBuffer : Pointer;        { pointer to this Bob's dBuf packet }
770 
771         BUserExt : BUserStuff;  { Bob user extension }
772     end;
773 
774     pAnimComp = ^tAnimComp;
775     tAnimComp = record
776 
777 { --------------------- SYSTEM VARIABLES --------------------------------- }
778 
779 { --------------------- COMMON VARIABLES --------------------------------- }
780 
781         Flags   : smallint;        { AnimComp flags for system & user }
782 
783 { timer defines how long to keep this component active:
784  *  if set non-zero, timer decrements to zero then switches to nextSeq
785  *  if set to zero, AnimComp never switches
786  }
787 
788         Timer   : smallint;
789 
790 { --------------------- USER VARIABLES ----------------------------------- }
791 { initial value for timer when the AnimComp is activated by the system }
792 
793         TimeSet : smallint;
794 
795 { pointer to next and previous components of animation object }
796 
797         NextComp        : pAnimComp;
798         PrevComp        : pAnimComp;
799 
800 { pointer to component component definition of next image in sequence }
801 
802         NextSeq : pAnimComp;
803         PrevSeq : pAnimComp;
804 
805         AnimCRoutine : Pointer; { Pointer of special animation procedure }
806 
807         YTrans  : smallint; { initial y translation (if this is a component) }
808         XTrans  : smallint; { initial x translation (if this is a component) }
809 
810         HeadOb  : Pointer; { AnimObPtr }
811 
812         AnimBob : pBob;
813     end;
814 
815     pAnimOb = ^tAnimOb;
816     tAnimOb = record
817 
818 { --------------------- SYSTEM VARIABLES --------------------------------- }
819 
820         NextOb,
821         PrevOb  : pAnimOb;
822 
823 { number of calls to Animate this AnimOb has endured }
824 
825         Clock   : Longint;
826 
827         AnOldY,
828         AnOldX  : smallint;        { old y,x coordinates }
829 
830 { --------------------- COMMON VARIABLES --------------------------------- }
831 
832         AnY,
833         AnX     : smallint;        { y,x coordinates of the AnimOb }
834 
835 { --------------------- USER VARIABLES ----------------------------------- }
836 
837         YVel,
838         XVel    : smallint;        { velocities of this object }
839         YAccel,
840         XAccel  : smallint;        { accelerations of this object }
841 
842         RingYTrans,
843         RingXTrans      : smallint;        { ring translation values }
844 
845         AnimORoutine    : Pointer;      { Pointer of special animation
846                                           procedure }
847 
848         HeadComp        : pAnimComp;  { pointer to first component }
849 
850         AUserExt        : AUserStuff;       { AnimOb user extension }
851     end;
852 
853     ppAnimOb = ^pAnimOb;
854 
855 
856 { ************************************************************************ }
857 
858 const
859 
860     B2NORM      = 0;
861     B2SWAP      = 1;
862     B2BOBBER    = 2;
863 
864 { ************************************************************************ }
865 
866 type
867 
868 { a structure to contain the 16 collision procedure addresses }
869 
870     collTable = Array [0..15] of Pointer;
871     pcollTable = ^collTable;
872 
873 const
874 
875 {   These bit descriptors are used by the GEL collide routines.
876  *  These bits are set in the hitMask and meMask variables of
877  *  a GEL to describe whether or not these types of collisions
878  *  can affect the GEL.  BNDRY_HIT is described further below;
879  *  this bit is permanently assigned as the boundary-hit flag.
880  *  The other bit GEL_HIT is meant only as a default to cover
881  *  any GEL hitting any other; the user may redefine this bit.
882  }
883 
884     BORDERHIT   = 0;
885 
886 {   These bit descriptors are used by the GEL boundry hit routines.
887  *  When the user's boundry-hit routine is called (via the argument
888  *  set by a call to SetCollision) the first argument passed to
889  *  the user's routine is the Pointer of the GEL involved in the
890  *  boundry-hit, and the second argument has the appropriate bit(s)
891  *  set to describe which boundry was surpassed
892  }
893 
894     TOPHIT      = 1;
895     BOTTOMHIT   = 2;
896     LEFTHIT     = 4;
897     RIGHTHIT    = 8;
898 
899 Type
900  pExtendedNode = ^tExtendedNode;
901  tExtendedNode = record
902   xln_Succ,
903   xln_Pred  : pNode;
904   xln_Type  : Byte;
905   xln_Pri   : Shortint;
906   xln_Name  : STRPTR;
907   xln_Subsystem : Byte;
908   xln_Subtype   : Byte;
909   xln_Library : Longint;
910   xln_Init : Pointer;
911  END;
912 
913 CONST
914  SS_GRAPHICS   =  $02;
915 
916  VIEW_EXTRA_TYPE       =  1;
917  VIEWPORT_EXTRA_TYPE   =  2;
918  SPECIAL_MONITOR_TYPE  =  3;
919  MONITOR_SPEC_TYPE     =  4;
920 
921 type
922 
923 { structure used by AddTOFTask }
924 
925     pIsrvstr = ^tIsrvstr;
926     tIsrvstr = record
927         is_Node : tNode;
928         Iptr    : pIsrvstr;     { passed to srvr by os }
929         code    : Pointer;
930         ccode   : Pointer;
931         Carg    : Pointer;
932     end;
933 
934 Type
935  pAnalogSignalInterval = ^tAnalogSignalInterval;
936  tAnalogSignalInterval = record
937   asi_Start,
938   asi_Stop  : Word;
939  END;
940 
941  pSpecialMonitor = ^tSpecialMonitor;
942  tSpecialMonitor = record
943   spm_Node      : tExtendedNode;
944   spm_Flags     : Word;
945   do_monitor,
946   reserved1,
947   reserved2,
948   reserved3     : Pointer;
949   hblank,
950   vblank,
951   hsync,
952   vsync : tAnalogSignalInterval;
953  END;
954 
955 
956  pMonitorSpec = ^tMonitorSpec;
957  tMonitorSpec = record
958     ms_Node     : tExtendedNode;
959     ms_Flags    : Word;
960     ratioh,
961     ratiov      : Longint;
962     total_rows,
963     total_colorclocks,
964     DeniseMaxDisplayColumn,
965     BeamCon0,
966     min_row     : Word;
967     ms_Special  : pSpecialMonitor;
968     ms_OpenCount : Word;
969     ms_transform,
970     ms_translate,
971     ms_scale    : Pointer;
972     ms_xoffset,
973     ms_yoffset  : Word;
974     ms_LegalView : tRectangle;
975     ms_maxoscan,       { maximum legal overscan }
976     ms_videoscan  : Pointer;      { video display overscan }
977     DeniseMinDisplayColumn : Word;
978     DisplayCompatible      : ULONG;
979     DisplayInfoDataBase    : tList;
980     DisplayInfoDataBaseSemaphore : tSignalSemaphore;
981     ms_MrgCop,
982     ms_LoadView,
983     ms_KillView  : Longint;
984  END;
985 
986 const
987   TO_MONITOR            =  0;
988   FROM_MONITOR          =  1;
989   STANDARD_XOFFSET      =  9;
990   STANDARD_YOFFSET      =  0;
991 
992   MSB_REQUEST_NTSC      =  0;
993   MSB_REQUEST_PAL       =  1;
994   MSB_REQUEST_SPECIAL   =  2;
995   MSB_REQUEST_A2024     =  3;
996   MSB_DOUBLE_SPRITES    =  4;
997   MSF_REQUEST_NTSC      =  1;
998   MSF_REQUEST_PAL       =  2;
999   MSF_REQUEST_SPECIAL   =  4;
1000   MSF_REQUEST_A2024     =  8;
1001   MSF_DOUBLE_SPRITES    =  16;
1002 
1003 
1004 { obsolete, v37 compatible definitions follow }
1005   REQUEST_NTSC          =  1;
1006   REQUEST_PAL           =  2;
1007   REQUEST_SPECIAL       =  4;
1008   REQUEST_A2024         =  8;
1009 
1010   DEFAULT_MONITOR_NAME  : PChar =  'default.monitor';
1011   NTSC_MONITOR_NAME     : PChar =  'ntsc.monitor';
1012   PAL_MONITOR_NAME      : PChar =  'pal.monitor';
1013   STANDARD_MONITOR_MASK =  ( REQUEST_NTSC OR REQUEST_PAL ) ;
1014 
1015   STANDARD_NTSC_ROWS    =  262;
1016   STANDARD_PAL_ROWS     =  312;
1017   STANDARD_COLORCLOCKS  =  226;
1018   STANDARD_DENISE_MAX   =  455;
1019   STANDARD_DENISE_MIN   =  93 ;
1020   STANDARD_NTSC_BEAMCON =  $0000;
1021   STANDARD_PAL_BEAMCON  =  DISPLAYPAL ;
1022 
1023   SPECIAL_BEAMCON       = ( VARVBLANK OR LOLDIS OR VARVSYNC OR VARHSYNC OR VARBEAM OR CSBLANK OR VSYNCTRUE);
1024 
1025   MIN_NTSC_ROW    = 21   ;
1026   MIN_PAL_ROW     = 29   ;
1027   STANDARD_VIEW_X = $81  ;
1028   STANDARD_VIEW_Y = $2C  ;
1029   STANDARD_HBSTRT = $06  ;
1030   STANDARD_HSSTRT = $0B  ;
1031   STANDARD_HSSTOP = $1C  ;
1032   STANDARD_HBSTOP = $2C  ;
1033   STANDARD_VBSTRT = $0122;
1034   STANDARD_VSSTRT = $02A6;
1035   STANDARD_VSSTOP = $03AA;
1036   STANDARD_VBSTOP = $1066;
1037 
1038   VGA_COLORCLOCKS = (STANDARD_COLORCLOCKS/2);
1039   VGA_TOTAL_ROWS  = (STANDARD_NTSC_ROWS*2);
1040   VGA_DENISE_MIN  = 59   ;
1041   MIN_VGA_ROW     = 29   ;
1042   VGA_HBSTRT      = $08  ;
1043   VGA_HSSTRT      = $0E  ;
1044   VGA_HSSTOP      = $1C  ;
1045   VGA_HBSTOP      = $1E  ;
1046   VGA_VBSTRT      = $0000;
1047   VGA_VSSTRT      = $0153;
1048   VGA_VSSTOP      = $0235;
1049   VGA_VBSTOP      = $0CCD;
1050 
1051   VGA_MONITOR_NAME  : PChar    =  'vga.monitor';
1052 
1053 { NOTE: VGA70 definitions are obsolete - a VGA70 monitor has never been
1054  * implemented.
1055  }
1056   VGA70_COLORCLOCKS = (STANDARD_COLORCLOCKS/2) ;
1057   VGA70_TOTAL_ROWS  = 449;
1058   VGA70_DENISE_MIN  = 59;
1059   MIN_VGA70_ROW     = 35   ;
1060   VGA70_HBSTRT      = $08  ;
1061   VGA70_HSSTRT      = $0E  ;
1062   VGA70_HSSTOP      = $1C  ;
1063   VGA70_HBSTOP      = $1E  ;
1064   VGA70_VBSTRT      = $0000;
1065   VGA70_VSSTRT      = $02A6;
1066   VGA70_VSSTOP      = $0388;
1067   VGA70_VBSTOP      = $0F73;
1068 
1069   VGA70_BEAMCON     = (SPECIAL_BEAMCON XOR VSYNCTRUE);
1070   VGA70_MONITOR_NAME  : PChar  =      'vga70.monitor';
1071 
1072   BROADCAST_HBSTRT  =      $01  ;
1073   BROADCAST_HSSTRT  =      $06  ;
1074   BROADCAST_HSSTOP  =      $17  ;
1075   BROADCAST_HBSTOP  =      $27  ;
1076   BROADCAST_VBSTRT  =      $0000;
1077   BROADCAST_VSSTRT  =      $02A6;
1078   BROADCAST_VSSTOP  =      $054C;
1079   BROADCAST_VBSTOP  =      $1C40;
1080   BROADCAST_BEAMCON =      ( LOLDIS OR CSBLANK );
1081   RATIO_FIXEDPART   =      4;
1082   RATIO_UNITY       =      16;
1083 
1084 
1085 
1086 Type
1087     pRasInfo = ^tRasInfo;
1088     tRasInfo = record    { used by callers to and InitDspC() }
1089         Next    : pRasInfo;     { used for dualpf }
1090         BitMap  : pBitMap;
1091         RxOffset,
1092         RyOffset : smallint;       { scroll offsets in this BitMap }
1093     end;
1094 
1095 
1096     pView = ^tView;
1097     tView = record
1098         ViewPort        : Pointer;      { ViewPortPtr }
1099         LOFCprList      : pcprlist;   { used for interlaced and noninterlaced }
1100         SHFCprList      : pcprlist;   { only used during interlace }
1101         DyOffset,
1102         DxOffset        : smallint;        { for complete View positioning }
1103                                 { offsets are +- adjustments to standard #s }
1104         Modes           : WORD;        { such as INTERLACE, GENLOC }
1105     end;
1106 
1107 { these structures are obtained via GfxNew }
1108 { and disposed by GfxFree }
1109 Type
1110        pViewExtra = ^tViewExtra;
1111        tViewExtra = record
1112         n : tExtendedNode;
1113         View     : pView;       { backwards link }   { view in C-Includes }
1114         Monitor : pMonitorSpec; { monitors for this view }
1115         TopLine : Word;
1116        END;
1117 
1118 
1119     pViewPort = ^tViewPort;
1120     tViewPort = record
1121         Next    : pViewPort;
1122         ColorMap : Pointer; { table of colors for this viewport }        { ColorMapPtr }
1123                           { if this is nil, MakeVPort assumes default values }
1124         DspIns  : pCopList;   { user by MakeView() }
1125         SprIns  : pCopList;   { used by sprite stuff }
1126         ClrIns  : pCopList;   { used by sprite stuff }
1127         UCopIns : pUCopList;  { User copper list }
1128         DWidth,
1129         DHeight : smallint;
1130         DxOffset,
1131         DyOffset : smallint;
1132         Modes   : Word;
1133         SpritePriorities : Byte;        { used by makevp }
1134         reserved : Byte;
1135         RasInfo : pRasInfo;
1136     end;
1137 
1138 
1139 { this structure is obtained via GfxNew }
1140 { and disposed by GfxFree }
1141 
1142  pViewPortExtra = ^tViewPortExtra;
1143  tViewPortExtra = record
1144   n : tExtendedNode;
1145   ViewPort     : pViewPort;      { backwards link }   { ViewPort in C-Includes }
1146   DisplayClip  : tRectangle;  { makevp display clipping information }
1147         { These are added for V39 }
1148   VecTable     : Pointer;                { Private }
1149   DriverData   : Array[0..1] of Pointer;
1150   Flags        : WORD;
1151   Origin       : Array[0..1] of tPoint;  { First visible point relative to the DClip.
1152                                          * One for each possible playfield.
1153                                          }
1154   cop1ptr,                  { private }
1155   cop2ptr      : ULONG;   { private }
1156  END;
1157 
1158 
1159     pColorMap = ^tColorMap;
1160     tColorMap = record
1161         Flags   : Byte;
1162         Type_   : Byte;         { This is "Type" in C includes }
1163         Count   : Word;
1164         ColorTable      : Pointer;
1165         cm_vpe  : pViewPortExtra;
1166         LowColorBits : Pointer;
1167         TransparencyPlane,
1168         SpriteResolution,
1169         SpriteResDefault,
1170         AuxFlags         : Byte;
1171         cm_vp            : pViewPort;   { ViewPortPtr }
1172         NormalDisplayInfo,
1173         CoerceDisplayInfo : Pointer;
1174         cm_batch_items   : pTagItem;
1175         VPModeID         : ULONG;
1176         PalExtra         : Pointer;
1177         SpriteBase_Even,
1178         SpriteBase_Odd,
1179         Bp_0_base,
1180         Bp_1_base        : Word;
1181     end;
1182 
1183 { if Type == 0 then ColorMap is V1.2/V1.3 compatible }
1184 { if Type != 0 then ColorMap is V36       compatible }
1185 { the system will never create other than V39 type colormaps when running V39 }
1186 
1187 CONST
1188  COLORMAP_TYPE_V1_2     = $00;
1189  COLORMAP_TYPE_V1_4     = $01;
1190  COLORMAP_TYPE_V36      = COLORMAP_TYPE_V1_4;    { use this definition }
1191  COLORMAP_TYPE_V39      = $02;
1192 
1193 
1194 { Flags variable }
1195  COLORMAP_TRANSPARENCY   = $01;
1196  COLORPLANE_TRANSPARENCY = $02;
1197  BORDER_BLANKING         = $04;
1198  BORDER_NOTRANSPARENCY   = $08;
1199  VIDEOCONTROL_BATCH      = $10;
1200  USER_COPPER_CLIP        = $20;
1201 
1202 
1203 CONST
1204  EXTEND_VSTRUCT = $1000;  { unused bit in Modes field of View }
1205 
1206 
1207 { defines used for Modes in IVPargs }
1208 
1209 CONST
1210  GENLOCK_VIDEO  =  $0002;
1211  LACE           =  $0004;
1212  SUPERHIRES     =  $0020;
1213  PFBA           =  $0040;
1214  EXTRA_HALFBRITE=  $0080;
1215  GENLOCK_AUDIO  =  $0100;
1216  DUALPF         =  $0400;
1217  HAM            =  $0800;
1218  EXTENDED_MODE  =  $1000;
1219  VP_HIDE        =  $2000;
1220  SPRITES        =  $4000;
1221  HIRES          =  $8000;
1222 
1223  VPF_A2024      =  $40;
1224  VPF_AGNUS      =  $20;
1225  VPF_TENHZ      =  $20;
1226 
1227  BORDERSPRITES   = $40;
1228 
1229  CMF_CMTRANS   =  0;
1230  CMF_CPTRANS   =  1;
1231  CMF_BRDRBLNK  =  2;
1232  CMF_BRDNTRAN  =  3;
1233  CMF_BRDRSPRT  =  6;
1234 
1235  SPRITERESN_ECS       =   0;
1236 { ^140ns, except in 35ns viewport, where it is 70ns. }
1237  SPRITERESN_140NS     =   1;
1238  SPRITERESN_70NS      =   2;
1239  SPRITERESN_35NS      =   3;
1240  SPRITERESN_DEFAULT   =   -1;
1241 
1242 { AuxFlags : }
1243  CMAB_FULLPALETTE = 0;
1244  CMAF_FULLPALETTE = 1;
1245  CMAB_NO_INTERMED_UPDATE = 1;
1246  CMAF_NO_INTERMED_UPDATE = 2;
1247  CMAB_NO_COLOR_LOAD = 2;
1248  CMAF_NO_COLOR_LOAD = 4;
1249  CMAB_DUALPF_DISABLE = 3;
1250  CMAF_DUALPF_DISABLE = 8;
1251 
1252 Type
1253     pPaletteExtra = ^tPaletteExtra;
1254     tPaletteExtra = record                            { structure may be extended so watch out! }
1255         pe_Semaphore  : tSignalSemaphore;                { shared semaphore for arbitration     }
1256         pe_FirstFree,                                   { *private*                            }
1257         pe_NFree,                                       { number of free colors                }
1258         pe_FirstShared,                                 { *private*                            }
1259         pe_NShared    : WORD;                           { *private*                            }
1260         pe_RefCnt     : Pointer;                        { *private*                            }
1261         pe_AllocList  : Pointer;                        { *private*                            }
1262         pe_ViewPort   : pViewPort;                    { back pointer to viewport             }
1263         pe_SharableColors : WORD;                       { the number of sharable colors.       }
1264     end;
1265 { flags values for ObtainPen }
1266 Const
1267  PENB_EXCLUSIVE = 0;
1268  PENB_NO_SETCOLOR = 1;
1269 
1270  PENF_EXCLUSIVE = 1;
1271  PENF_NO_SETCOLOR = 2;
1272 
1273 { obsolete names for PENF_xxx flags: }
1274 
1275  PEN_EXCLUSIVE = PENF_EXCLUSIVE;
1276  PEN_NO_SETCOLOR = PENF_NO_SETCOLOR;
1277 
1278 { precision values for ObtainBestPen : }
1279 
1280  PRECISION_EXACT = -1;
1281  PRECISION_IMAGE = 0;
1282  PRECISION_ICON  = 16;
1283  PRECISION_GUI   = 32;
1284 
1285 
1286 { tags for ObtainBestPen: }
1287  OBP_Precision = $84000000;
1288  OBP_FailIfBad = $84000001;
1289 
1290 { From V39, MakeVPort() will return an error if there is not enough memory,
1291  * or the requested mode cannot be opened with the requested depth with the
1292  * given bitmap (for higher bandwidth alignments).
1293  }
1294 
1295  MVP_OK        =  0;       { you want to see this one }
1296  MVP_NO_MEM    =  1;       { insufficient memory for intermediate workspace }
1297  MVP_NO_VPE    =  2;       { ViewPort does not have a ViewPortExtra, and
1298                                  * insufficient memory to allocate a temporary one.
1299                                  }
1300  MVP_NO_DSPINS =  3;       { insufficient memory for intermidiate copper
1301                                  * instructions.
1302                                  }
1303  MVP_NO_DISPLAY = 4;       { BitMap data is misaligned for this viewport's
1304                                  * mode and depth - see AllocBitMap().
1305                                  }
1306  MVP_OFF_BOTTOM = 5;       { PRIVATE - you will never see this. }
1307 
1308 { From V39, MrgCop() will return an error if there is not enough memory,
1309  * or for some reason MrgCop() did not need to make any copper lists.
1310  }
1311 
1312  MCOP_OK       =  0;       { you want to see this one }
1313  MCOP_NO_MEM   =  1;       { insufficient memory to allocate the system
1314                                  * copper lists.
1315                                  }
1316  MCOP_NOP      =  2;       { MrgCop() did not merge any copper lists
1317                                  * (eg, no ViewPorts in the list, or all marked as
1318                                  * hidden).
1319                                  }
1320 Type
1321     pDBufInfo = ^tDBufInfo;
1322     tDBufInfo = record
1323         dbi_Link1   : Pointer;
1324         dbi_Count1  : ULONG;
1325         dbi_SafeMessage : tMessage;         { replied to when safe to write to old bitmap }
1326         dbi_UserData1   : Pointer;                     { first user data }
1327 
1328         dbi_Link2   : Pointer;
1329         dbi_Count2  : ULONG;
1330         dbi_DispMessage : tMessage; { replied to when new bitmap has been displayed at least
1331                                                         once }
1332         dbi_UserData2 : Pointer;                  { second user data }
1333         dbi_MatchLong : ULONG;
1334         dbi_CopPtr1,
1335         dbi_CopPtr2,
1336         dbi_CopPtr3   : Pointer;
1337         dbi_BeamPos1,
1338         dbi_BeamPos2  : WORD;
1339     end;
1340 
1341 
1342 
1343    {   include define file for graphics display mode IDs.   }
1344 
1345 
1346 const
1347 
1348    INVALID_ID                   =   NOT 0;
1349 
1350 { With all the new modes that are available under V38 and V39, it is highly
1351  * recommended that you use either the asl.library screenmode requester,
1352  * and/or the V39 graphics.library function BestModeIDA().
1353  *
1354  * DO NOT interpret the any of the bits in the ModeID for its meaning. For
1355  * example, do not interpret bit 3 ($4) as meaning the ModeID is interlaced.
1356  * Instead, use GetDisplayInfoData() with DTAG_DISP, and examine the DIPF_...
1357  * flags to determine a ModeID's characteristics. The only exception to
1358  * this rule is that bit 7 ($80) will always mean the ModeID is
1359  * ExtraHalfBright, and bit 11 ($800) will always mean the ModeID is HAM.
1360  }
1361 
1362 { normal identifiers }
1363 
1364    MONITOR_ID_MASK              =   $FFFF1000;
1365 
1366    DEFAULT_MONITOR_ID           =   $00000000;
1367    NTSC_MONITOR_ID              =   $00011000;
1368    PAL_MONITOR_ID               =   $00021000;
1369 
1370 { the following 22 composite keys are for Modes on the default Monitor.
1371  * NTSC & PAL "flavors" of these particular keys may be made by or'ing
1372  * the NTSC or PAL MONITOR_ID with the desired MODE_KEY...
1373  *
1374  * For example, to specifically open a PAL HAM interlaced ViewPort
1375  * (or intuition screen), you would use the modeid of
1376  * (PAL_MONITOR_ID OR HAMLACE_KEY)
1377  }
1378 
1379    LORES_KEY                     =  $00000000;
1380    HIRES_KEY                     =  $00008000;
1381    SUPER_KEY                     =  $00008020;
1382    HAM_KEY                       =  $00000800;
1383    LORESLACE_KEY                 =  $00000004;
1384    HIRESLACE_KEY                 =  $00008004;
1385    SUPERLACE_KEY                 =  $00008024;
1386    HAMLACE_KEY                   =  $00000804;
1387    LORESDPF_KEY                  =  $00000400;
1388    HIRESDPF_KEY                  =  $00008400;
1389    SUPERDPF_KEY                  =  $00008420;
1390    LORESLACEDPF_KEY              =  $00000404;
1391    HIRESLACEDPF_KEY              =  $00008404;
1392    SUPERLACEDPF_KEY              =  $00008424;
1393    LORESDPF2_KEY                 =  $00000440;
1394    HIRESDPF2_KEY                 =  $00008440;
1395    SUPERDPF2_KEY                 =  $00008460;
1396    LORESLACEDPF2_KEY             =  $00000444;
1397    HIRESLACEDPF2_KEY             =  $00008444;
1398    SUPERLACEDPF2_KEY             =  $00008464;
1399    EXTRAHALFBRITE_KEY            =  $00000080;
1400    EXTRAHALFBRITELACE_KEY        =  $00000084;
1401 { New for AA ChipSet (V39) }
1402    HIRESHAM_KEY                  =  $00008800;
1403    SUPERHAM_KEY                  =  $00008820;
1404    HIRESEHB_KEY                  =  $00008080;
1405    SUPEREHB_KEY                  =  $000080a0;
1406    HIRESHAMLACE_KEY              =  $00008804;
1407    SUPERHAMLACE_KEY              =  $00008824;
1408    HIRESEHBLACE_KEY              =  $00008084;
1409    SUPEREHBLACE_KEY              =  $000080a4;
1410 { Added for V40 - may be useful modes for some games or animations. }
1411    LORESSDBL_KEY                 =  $00000008;
1412    LORESHAMSDBL_KEY              =  $00000808;
1413    LORESEHBSDBL_KEY              =  $00000088;
1414    HIRESHAMSDBL_KEY              =  $00008808;
1415 
1416 
1417 { VGA identifiers }
1418 
1419    VGA_MONITOR_ID                =  $00031000;
1420 
1421    VGAEXTRALORES_KEY             =  $00031004;
1422    VGALORES_KEY                  =  $00039004;
1423    VGAPRODUCT_KEY                =  $00039024;
1424    VGAHAM_KEY                    =  $00031804;
1425    VGAEXTRALORESLACE_KEY         =  $00031005;
1426    VGALORESLACE_KEY              =  $00039005;
1427    VGAPRODUCTLACE_KEY            =  $00039025;
1428    VGAHAMLACE_KEY                =  $00031805;
1429    VGAEXTRALORESDPF_KEY          =  $00031404;
1430    VGALORESDPF_KEY               =  $00039404;
1431    VGAPRODUCTDPF_KEY             =  $00039424;
1432    VGAEXTRALORESLACEDPF_KEY      =  $00031405;
1433    VGALORESLACEDPF_KEY           =  $00039405;
1434    VGAPRODUCTLACEDPF_KEY         =  $00039425;
1435    VGAEXTRALORESDPF2_KEY         =  $00031444;
1436    VGALORESDPF2_KEY              =  $00039444;
1437    VGAPRODUCTDPF2_KEY            =  $00039464;
1438    VGAEXTRALORESLACEDPF2_KEY     =  $00031445;
1439    VGALORESLACEDPF2_KEY          =  $00039445;
1440    VGAPRODUCTLACEDPF2_KEY        =  $00039465;
1441    VGAEXTRAHALFBRITE_KEY         =  $00031084;
1442    VGAEXTRAHALFBRITELACE_KEY     =  $00031085;
1443 { New for AA ChipSet (V39) }
1444    VGAPRODUCTHAM_KEY             =  $00039824;
1445    VGALORESHAM_KEY               =  $00039804;
1446    VGAEXTRALORESHAM_KEY          =  VGAHAM_KEY;
1447    VGAPRODUCTHAMLACE_KEY         =  $00039825;
1448    VGALORESHAMLACE_KEY           =  $00039805;
1449    VGAEXTRALORESHAMLACE_KEY      =  VGAHAMLACE_KEY;
1450    VGAEXTRALORESEHB_KEY          =  VGAEXTRAHALFBRITE_KEY;
1451    VGAEXTRALORESEHBLACE_KEY      =  VGAEXTRAHALFBRITELACE_KEY;
1452    VGALORESEHB_KEY               =  $00039084;
1453    VGALORESEHBLACE_KEY           =  $00039085;
1454    VGAEHB_KEY                    =  $000390a4;
1455    VGAEHBLACE_KEY                =  $000390a5;
1456 { These ModeIDs are the scandoubled equivalents of the above, with the
1457  * exception of the DualPlayfield modes, as AA does not allow for scandoubling
1458  * dualplayfield.
1459  }
1460    VGAEXTRALORESDBL_KEY          =  $00031000;
1461    VGALORESDBL_KEY               =  $00039000;
1462    VGAPRODUCTDBL_KEY             =  $00039020;
1463    VGAEXTRALORESHAMDBL_KEY       =  $00031800;
1464    VGALORESHAMDBL_KEY            =  $00039800;
1465    VGAPRODUCTHAMDBL_KEY          =  $00039820;
1466    VGAEXTRALORESEHBDBL_KEY       =  $00031080;
1467    VGALORESEHBDBL_KEY            =  $00039080;
1468    VGAPRODUCTEHBDBL_KEY          =  $000390a0;
1469 
1470 { a2024 identifiers }
1471 
1472    A2024_MONITOR_ID              =  $00041000;
1473 
1474    A2024TENHERTZ_KEY             =  $00041000;
1475    A2024FIFTEENHERTZ_KEY         =  $00049000;
1476 
1477 { prototype identifiers (private) }
1478 
1479    PROTO_MONITOR_ID              =  $00051000;
1480 
1481 
1482 { These monitors and modes were added for the V38 release. }
1483 
1484    EURO72_MONITOR_ID             =  $00061000;
1485 
1486    EURO72EXTRALORES_KEY          =  $00061004;
1487    EURO72LORES_KEY               =  $00069004;
1488    EURO72PRODUCT_KEY             =  $00069024;
1489    EURO72HAM_KEY                 =  $00061804;
1490    EURO72EXTRALORESLACE_KEY      =  $00061005;
1491    EURO72LORESLACE_KEY           =  $00069005;
1492    EURO72PRODUCTLACE_KEY         =  $00069025;
1493    EURO72HAMLACE_KEY             =  $00061805;
1494    EURO72EXTRALORESDPF_KEY       =  $00061404;
1495    EURO72LORESDPF_KEY            =  $00069404;
1496    EURO72PRODUCTDPF_KEY          =  $00069424;
1497    EURO72EXTRALORESLACEDPF_KEY   =  $00061405;
1498    EURO72LORESLACEDPF_KEY        =  $00069405;
1499    EURO72PRODUCTLACEDPF_KEY      =  $00069425;
1500    EURO72EXTRALORESDPF2_KEY      =  $00061444;
1501    EURO72LORESDPF2_KEY           =  $00069444;
1502    EURO72PRODUCTDPF2_KEY         =  $00069464;
1503    EURO72EXTRALORESLACEDPF2_KEY  =  $00061445;
1504    EURO72LORESLACEDPF2_KEY       =  $00069445;
1505    EURO72PRODUCTLACEDPF2_KEY     =  $00069465;
1506    EURO72EXTRAHALFBRITE_KEY      =  $00061084;
1507    EURO72EXTRAHALFBRITELACE_KEY  =  $00061085;
1508 { New AA modes (V39) }
1509    EURO72PRODUCTHAM_KEY          =  $00069824;
1510    EURO72PRODUCTHAMLACE_KEY      =  $00069825;
1511    EURO72LORESHAM_KEY            =  $00069804;
1512    EURO72LORESHAMLACE_KEY        =  $00069805;
1513    EURO72EXTRALORESHAM_KEY       =  EURO72HAM_KEY;
1514    EURO72EXTRALORESHAMLACE_KEY   =  EURO72HAMLACE_KEY ;
1515    EURO72EXTRALORESEHB_KEY       =  EURO72EXTRAHALFBRITE_KEY;
1516    EURO72EXTRALORESEHBLACE_KEY   =  EURO72EXTRAHALFBRITELACE_KEY;
1517    EURO72LORESEHB_KEY            =  $00069084;
1518    EURO72LORESEHBLACE_KEY        =  $00069085;
1519    EURO72EHB_KEY                 =  $000690a4;
1520    EURO72EHBLACE_KEY             =  $000690a5;
1521 { These ModeIDs are the scandoubled equivalents of the above, with the
1522  * exception of the DualPlayfield modes, as AA does not allow for scandoubling
1523  * dualplayfield.
1524  }
1525    EURO72EXTRALORESDBL_KEY       =  $00061000;
1526    EURO72LORESDBL_KEY            =  $00069000;
1527    EURO72PRODUCTDBL_KEY          =  $00069020;
1528    EURO72EXTRALORESHAMDBL_KEY    =  $00061800;
1529    EURO72LORESHAMDBL_KEY         =  $00069800;
1530    EURO72PRODUCTHAMDBL_KEY       =  $00069820;
1531    EURO72EXTRALORESEHBDBL_KEY    =  $00061080;
1532    EURO72LORESEHBDBL_KEY         =  $00069080;
1533    EURO72PRODUCTEHBDBL_KEY       =  $000690a0;
1534 
1535 
1536    EURO36_MONITOR_ID             =  $00071000;
1537 
1538 { Euro36 modeids can be ORed with the default modeids a la NTSC and PAL.
1539  * For example, Euro36 SuperHires is
1540  * (EURO36_MONITOR_ID OR SUPER_KEY)
1541  }
1542 
1543    SUPER72_MONITOR_ID            =  $00081000;
1544 
1545 { Super72 modeids can be ORed with the default modeids a la NTSC and PAL.
1546  * For example, Super72 SuperHiresLace (80$600) is
1547  * (SUPER72_MONITOR_ID OR SUPERLACE_KEY).
1548  * The following scandoubled Modes are the exception:
1549  }
1550    SUPER72LORESDBL_KEY           =  $00081008;
1551    SUPER72HIRESDBL_KEY           =  $00089008;
1552    SUPER72SUPERDBL_KEY           =  $00089028;
1553    SUPER72LORESHAMDBL_KEY        =  $00081808;
1554    SUPER72HIRESHAMDBL_KEY        =  $00089808;
1555    SUPER72SUPERHAMDBL_KEY        =  $00089828;
1556    SUPER72LORESEHBDBL_KEY        =  $00081088;
1557    SUPER72HIRESEHBDBL_KEY        =  $00089088;
1558    SUPER72SUPEREHBDBL_KEY        =  $000890a8;
1559 
1560 
1561 { These monitors and modes were added for the V39 release. }
1562 
1563    DBLNTSC_MONITOR_ID            =  $00091000;
1564 
1565    DBLNTSCLORES_KEY              =  $00091000;
1566    DBLNTSCLORESFF_KEY            =  $00091004;
1567    DBLNTSCLORESHAM_KEY           =  $00091800;
1568    DBLNTSCLORESHAMFF_KEY         =  $00091804;
1569    DBLNTSCLORESEHB_KEY           =  $00091080;
1570    DBLNTSCLORESEHBFF_KEY         =  $00091084;
1571    DBLNTSCLORESLACE_KEY          =  $00091005;
1572    DBLNTSCLORESHAMLACE_KEY       =  $00091805;
1573    DBLNTSCLORESEHBLACE_KEY       =  $00091085;
1574    DBLNTSCLORESDPF_KEY           =  $00091400;
1575    DBLNTSCLORESDPFFF_KEY         =  $00091404;
1576    DBLNTSCLORESDPFLACE_KEY       =  $00091405;
1577    DBLNTSCLORESDPF2_KEY          =  $00091440;
1578    DBLNTSCLORESDPF2FF_KEY        =  $00091444;
1579    DBLNTSCLORESDPF2LACE_KEY      =  $00091445;
1580    DBLNTSCHIRES_KEY              =  $00099000;
1581    DBLNTSCHIRESFF_KEY            =  $00099004;
1582    DBLNTSCHIRESHAM_KEY           =  $00099800;
1583    DBLNTSCHIRESHAMFF_KEY         =  $00099804;
1584    DBLNTSCHIRESLACE_KEY          =  $00099005;
1585    DBLNTSCHIRESHAMLACE_KEY       =  $00099805;
1586    DBLNTSCHIRESEHB_KEY           =  $00099080;
1587    DBLNTSCHIRESEHBFF_KEY         =  $00099084;
1588    DBLNTSCHIRESEHBLACE_KEY       =  $00099085;
1589    DBLNTSCHIRESDPF_KEY           =  $00099400;
1590    DBLNTSCHIRESDPFFF_KEY         =  $00099404;
1591    DBLNTSCHIRESDPFLACE_KEY       =  $00099405;
1592    DBLNTSCHIRESDPF2_KEY          =  $00099440;
1593    DBLNTSCHIRESDPF2FF_KEY        =  $00099444;
1594    DBLNTSCHIRESDPF2LACE_KEY      =  $00099445;
1595    DBLNTSCEXTRALORES_KEY         =  $00091200;
1596    DBLNTSCEXTRALORESHAM_KEY      =  $00091a00;
1597    DBLNTSCEXTRALORESEHB_KEY      =  $00091280;
1598    DBLNTSCEXTRALORESDPF_KEY      =  $00091600;
1599    DBLNTSCEXTRALORESDPF2_KEY     =  $00091640;
1600    DBLNTSCEXTRALORESFF_KEY       =  $00091204;
1601    DBLNTSCEXTRALORESHAMFF_KEY    =  $00091a04;
1602    DBLNTSCEXTRALORESEHBFF_KEY    =  $00091284;
1603    DBLNTSCEXTRALORESDPFFF_KEY    =  $00091604;
1604    DBLNTSCEXTRALORESDPF2FF_KEY   =  $00091644;
1605    DBLNTSCEXTRALORESLACE_KEY     =  $00091205;
1606    DBLNTSCEXTRALORESHAMLACE_KEY  =  $00091a05;
1607    DBLNTSCEXTRALORESEHBLACE_KEY  =  $00091285;
1608    DBLNTSCEXTRALORESDPFLACE_KEY  =  $00091605;
1609    DBLNTSCEXTRALORESDPF2LACE_KEY =  $00091645;
1610 
1611    DBLPAL_MONITOR_ID             =  $000a1000;
1612 
1613    DBLPALLORES_KEY               =  $000a1000;
1614    DBLPALLORESFF_KEY             =  $000a1004;
1615    DBLPALLORESHAM_KEY            =  $000a1800;
1616    DBLPALLORESHAMFF_KEY          =  $000a1804;
1617    DBLPALLORESEHB_KEY            =  $000a1080;
1618    DBLPALLORESEHBFF_KEY          =  $000a1084;
1619    DBLPALLORESLACE_KEY           =  $000a1005;
1620    DBLPALLORESHAMLACE_KEY        =  $000a1805;
1621    DBLPALLORESEHBLACE_KEY        =  $000a1085;
1622    DBLPALLORESDPF_KEY            =  $000a1400;
1623    DBLPALLORESDPFFF_KEY          =  $000a1404;
1624    DBLPALLORESDPFLACE_KEY        =  $000a1405;
1625    DBLPALLORESDPF2_KEY           =  $000a1440;
1626    DBLPALLORESDPF2FF_KEY         =  $000a1444;
1627    DBLPALLORESDPF2LACE_KEY       =  $000a1445;
1628    DBLPALHIRES_KEY               =  $000a9000;
1629    DBLPALHIRESFF_KEY             =  $000a9004;
1630    DBLPALHIRESHAM_KEY            =  $000a9800;
1631    DBLPALHIRESHAMFF_KEY          =  $000a9804;
1632    DBLPALHIRESLACE_KEY           =  $000a9005;
1633    DBLPALHIRESHAMLACE_KEY        =  $000a9805;
1634    DBLPALHIRESEHB_KEY            =  $000a9080;
1635    DBLPALHIRESEHBFF_KEY          =  $000a9084;
1636    DBLPALHIRESEHBLACE_KEY        =  $000a9085;
1637    DBLPALHIRESDPF_KEY            =  $000a9400;
1638    DBLPALHIRESDPFFF_KEY          =  $000a9404;
1639    DBLPALHIRESDPFLACE_KEY        =  $000a9405;
1640    DBLPALHIRESDPF2_KEY           =  $000a9440;
1641    DBLPALHIRESDPF2FF_KEY         =  $000a9444;
1642    DBLPALHIRESDPF2LACE_KEY       =  $000a9445;
1643    DBLPALEXTRALORES_KEY          =  $000a1200;
1644    DBLPALEXTRALORESHAM_KEY       =  $000a1a00;
1645    DBLPALEXTRALORESEHB_KEY       =  $000a1280;
1646    DBLPALEXTRALORESDPF_KEY       =  $000a1600;
1647    DBLPALEXTRALORESDPF2_KEY      =  $000a1640;
1648    DBLPALEXTRALORESFF_KEY        =  $000a1204;
1649    DBLPALEXTRALORESHAMFF_KEY     =  $000a1a04;
1650    DBLPALEXTRALORESEHBFF_KEY     =  $000a1284;
1651    DBLPALEXTRALORESDPFFF_KEY     =  $000a1604;
1652    DBLPALEXTRALORESDPF2FF_KEY    =  $000a1644;
1653    DBLPALEXTRALORESLACE_KEY      =  $000a1205;
1654    DBLPALEXTRALORESHAMLACE_KEY   =  $000a1a05;
1655    DBLPALEXTRALORESEHBLACE_KEY   =  $000a1285;
1656    DBLPALEXTRALORESDPFLACE_KEY   =  $000a1605;
1657    DBLPALEXTRALORESDPF2LACE_KEY  =  $000a1645;
1658 
1659 
1660 { Use these tags for passing to BestModeID() (V39) }
1661 
1662    SPECIAL_FLAGS = $100E;
1663    { Original:
1664      SPECIAL_FLAGS = DIPF_IS_DUALPF OR DIPF_IS_PF2PRI OR DIPF_IS_HAM OR DIPF_IS_EXTRAHALFBRITE;
1665      ( Mu?te aufgrund eines Fehler in PCQ ge?ndert werden )
1666    }
1667 
1668 
1669    BIDTAG_DIPFMustHave     = $80000001;      { mask of the DIPF_ flags the ModeID must have }
1670                                 { Default - NULL }
1671    BIDTAG_DIPFMustNotHave  = $80000002;      { mask of the DIPF_ flags the ModeID must not have }
1672                                 { Default - SPECIAL_FLAGS }
1673    BIDTAG_ViewPort         = $80000003;      { ViewPort for which a ModeID is sought. }
1674                                 { Default - NULL }
1675    BIDTAG_NominalWidth     = $80000004;      { \ together make the aspect ratio and }
1676    BIDTAG_NominalHeight    = $80000005;      { / override the vp->Width/Height. }
1677                                 { Default - SourceID NominalDimensionInfo,
1678                                  * or vp->DWidth/Height, or (640 * 200),
1679                                  * in that preferred order.
1680                                  }
1681    BIDTAG_DesiredWidth     = $80000006;      { \ Nominal Width and Height of the }
1682    BIDTAG_DesiredHeight    = $80000007;      { / returned ModeID. }
1683                                 { Default - same as Nominal }
1684    BIDTAG_Depth            = $80000008;      { ModeID must support this depth. }
1685                                 { Default - vp->RasInfo->BitMap->Depth or 1 }
1686    BIDTAG_MonitorID        = $80000009;      { ModeID must use this monitor. }
1687                                 { Default - use best monitor available }
1688    BIDTAG_SourceID         = $8000000a;      { instead of a ViewPort. }
1689                                 { Default - VPModeID(vp) if BIDTAG_ViewPort is
1690                                  * specified, else leave the DIPFMustHave and
1691                                  * DIPFMustNotHave values untouched.
1692                                  }
1693    BIDTAG_RedBits        =  $8000000b;      { \                            }
1694    BIDTAG_BlueBits       =  $8000000c;      {  > Match up from the database }
1695    BIDTAG_GreenBits      =  $8000000d;      { /                            }
1696                                             { Default - 4 }
1697    BIDTAG_GfxPrivate     =  $8000000e;      { Private }
1698 
1699 
1700 const
1701 
1702 { bplcon0 defines }
1703 
1704     MODE_640    = $8000;
1705     PLNCNTMSK   = $7;           { how many bit planes? }
1706                                 { 0 = none, 1->6 = 1->6, 7 = reserved }
1707     PLNCNTSHFT  = 12;           { bits to shift for bplcon0 }
1708     PF2PRI      = $40;          { bplcon2 bit }
1709     COLORON     = $0200;        { disable color burst }
1710     DBLPF       = $400;
1711     HOLDNMODIFY = $800;
1712     INTERLACE   = 4;            { interlace mode for 400 }
1713 
1714 { bplcon1 defines }
1715 
1716     PFA_FINE_SCROLL             = $F;
1717     PFB_FINE_SCROLL_SHIFT       = 4;
1718     PF_FINE_SCROLL_MASK         = $F;
1719 
1720 { display window start and stop defines }
1721 
1722     DIW_HORIZ_POS       = $7F;  { horizontal start/stop }
1723     DIW_VRTCL_POS       = $1FF; { vertical start/stop }
1724     DIW_VRTCL_POS_SHIFT = $7;
1725 
1726 { Data fetch start/stop horizontal position }
1727 
1728     DFTCH_MASK  = $FF;
1729 
1730 { vposr bits }
1731 
1732     VPOSRLOF    = $8000;
1733 
1734   {   include define file for displayinfo database }
1735 
1736 { the "public" handle to a DisplayInfoRecord }
1737 Type
1738 
1739  DisplayInfoHandle = APTR;
1740 
1741 { datachunk type identifiers }
1742 
1743 CONST
1744  DTAG_DISP            =   $80000000;
1745  DTAG_DIMS            =   $80001000;
1746  DTAG_MNTR            =   $80002000;
1747  DTAG_NAME            =   $80003000;
1748  DTAG_VEC             =   $80004000;      { internal use only }
1749 
1750 Type
1751 
1752   pQueryHeader = ^tQueryHeader;
1753   tQueryHeader = record
1754    StructID,                    { datachunk type identifier }
1755    DisplayID,                  { copy of display record key   }
1756    SkipID,                     { TAG_SKIP -- see tagitems.h }
1757    Length  :  ULONG;         { length of local data in double-longwords }
1758   END;
1759 
1760   pDisplayInfo = ^tDisplayInfo;
1761   tDisplayInfo = record
1762    Header : tQueryHeader;
1763    NotAvailable : Word;    { IF NULL available, else see defines }
1764    PropertyFlags : ULONG;  { Properties of this mode see defines }
1765    Resolution : tPoint;     { ticks-per-pixel X/Y                 }
1766    PixelSpeed : Word;     { aproximation in nanoseconds         }
1767    NumStdSprites : Word;  { number of standard amiga sprites    }
1768    PaletteRange : Word;   { distinguishable shades available    }
1769    SpriteResolution : tPoint; { std sprite ticks-per-pixel X/Y    }
1770    pad : Array[0..3] of Byte;
1771    RedBits     : Byte;
1772    GreenBits   : Byte;
1773    BlueBits    : Byte;
1774    pad2        : array [0..4] of Byte;
1775    reserved : Array[0..1] of ULONG;    { terminator }
1776   END;
1777 
1778 { availability }
1779 
1780 CONST
1781  DI_AVAIL_NOCHIPS        =$0001;
1782  DI_AVAIL_NOMONITOR      =$0002;
1783  DI_AVAIL_NOTWITHGENLOCK =$0004;
1784 
1785 { mode properties }
1786 
1787  DIPF_IS_LACE          =  $00000001;
1788  DIPF_IS_DUALPF        =  $00000002;
1789  DIPF_IS_PF2PRI        =  $00000004;
1790  DIPF_IS_HAM           =  $00000008;
1791 
1792  DIPF_IS_ECS           =  $00000010;      {      note: ECS modes (SHIRES, VGA, AND **
1793                                                  PRODUCTIVITY) do not support      **
1794                                                  attached sprites.                 **
1795                                                                                         }
1796  DIPF_IS_AA            =  $00010000;      { AA modes - may only be available
1797                                                 ** if machine has correct memory
1798                                                 ** type to support required
1799                                                 ** bandwidth - check availability.
1800                                                 ** (V39)
1801                                                 }
1802  DIPF_IS_PAL           =  $00000020;
1803  DIPF_IS_SPRITES       =  $00000040;
1804  DIPF_IS_GENLOCK       =  $00000080;
1805 
1806  DIPF_IS_WB            =  $00000100;
1807  DIPF_IS_DRAGGABLE     =  $00000200;
1808  DIPF_IS_PANELLED      =  $00000400;
1809  DIPF_IS_BEAMSYNC      =  $00000800;
1810 
1811  DIPF_IS_EXTRAHALFBRITE = $00001000;
1812 
1813 { The following DIPF_IS_... flags are new for V39 }
1814   DIPF_IS_SPRITES_ATT           =  $00002000;      { supports attached sprites }
1815   DIPF_IS_SPRITES_CHNG_RES      =  $00004000;      { supports variable sprite resolution }
1816   DIPF_IS_SPRITES_BORDER        =  $00008000;      { sprite can be displayed in the border }
1817   DIPF_IS_SCANDBL               =  $00020000;      { scan doubled }
1818   DIPF_IS_SPRITES_CHNG_BASE     =  $00040000;
1819                                                    { can change the sprite base colour }
1820   DIPF_IS_SPRITES_CHNG_PRI      =  $00080000;
1821                                                                                         { can change the sprite priority
1822                                                                                         ** with respect to the playfield(s).
1823                                                                                         }
1824   DIPF_IS_DBUFFER       =  $00100000;      { can support double buffering }
1825   DIPF_IS_PROGBEAM      =  $00200000;      { is a programmed beam-sync mode }
1826   DIPF_IS_FOREIGN       =  $80000000;      { this mode is not native to the Amiga }
1827 
1828 Type
1829  pDimensionInfo =^tDimensionInfo;
1830  tDimensionInfo = record
1831   Header : tQueryHeader;
1832   MaxDepth,             { log2( max number of colors ) }
1833   MinRasterWidth,       { minimum width in pixels      }
1834   MinRasterHeight,      { minimum height in pixels     }
1835   MaxRasterWidth,       { maximum width in pixels      }
1836   MaxRasterHeight : Word;      { maximum height in pixels     }
1837   Nominal,              { "standard" dimensions        }
1838   MaxOScan,             { fixed, hardware dependant    }
1839   VideoOScan,           { fixed, hardware dependant    }
1840   TxtOScan,             { editable via preferences     }
1841   StdOScan  : tRectangle; { editable via preferences     }
1842   pad  : Array[0..13] of Byte;
1843   reserved : Array[0..1] of Longint;          { terminator }
1844  END;
1845 
1846  pMonitorInfo = ^tMonitorInfo;
1847  tMonitorInfo = record
1848   Header : tQueryHeader;
1849   Mspc   : pMonitorSpec;         { pointer to monitor specification  }
1850   ViewPosition,                    { editable via preferences          }
1851   ViewResolution : tPoint;          { standard monitor ticks-per-pixel  }
1852   ViewPositionRange : tRectangle;   { fixed, hardware dependant }
1853   TotalRows,                       { display height in scanlines       }
1854   TotalColorClocks,                { scanline width in 280 ns units    }
1855   MinRow        : Word;            { absolute minimum active scanline  }
1856   Compatibility : smallint;           { how this coexists with others     }
1857   pad : Array[0..31] of Byte;
1858   MouseTicks    : tPoint;
1859   DefaultViewPosition : tPoint;
1860   PreferredModeID : ULONG;
1861   reserved : Array[0..1] of ULONG;          { terminator }
1862  END;
1863 
1864 { monitor compatibility }
1865 
1866 CONST
1867  MCOMPAT_MIXED =  0;       { can share display with other MCOMPAT_MIXED }
1868  MCOMPAT_SELF  =  1;       { can share only within same monitor }
1869  MCOMPAT_NOBODY= -1;       { only one viewport at a time }
1870 
1871  DISPLAYNAMELEN = 32;
1872 
1873 Type
1874  pNameInfo = ^tNameInfo;
1875  tNameInfo = record
1876   Header : tQueryHeader;
1877   Name   : Array[0..DISPLAYNAMELEN-1] of Char;
1878   reserved : Array[0..1] of ULONG;          { terminator }
1879  END;
1880 
1881 
1882 {****************************************************************************}
1883 
1884 { The following VecInfo structure is PRIVATE, for our use only
1885  * Touch these, and burn! (V39)
1886  }
1887 Type
1888  pVecInfo = ^tVecInfo;
1889  tVecInfo = record
1890         Header  : tQueryHeader;
1891         Vec     : Pointer;
1892         Data    : Pointer;
1893         Type_ : WORD;               { Type in C Includes }
1894         pad     : Array[0..2] of WORD;
1895         reserved : Array[0..1] of ULONG;
1896  end;
1897 
1898 
1899 CONST
1900  VTAG_END_CM            = $00000000;
1901  VTAG_CHROMAKEY_CLR     = $80000000;
1902  VTAG_CHROMAKEY_SET     = $80000001;
1903  VTAG_BITPLANEKEY_CLR   = $80000002;
1904  VTAG_BITPLANEKEY_SET   = $80000003;
1905  VTAG_BORDERBLANK_CLR   = $80000004;
1906  VTAG_BORDERBLANK_SET   = $80000005;
1907  VTAG_BORDERNOTRANS_CLR = $80000006;
1908  VTAG_BORDERNOTRANS_SET = $80000007;
1909  VTAG_CHROMA_PEN_CLR    = $80000008;
1910  VTAG_CHROMA_PEN_SET    = $80000009;
1911  VTAG_CHROMA_PLANE_SET  = $8000000A;
1912  VTAG_ATTACH_CM_SET     = $8000000B;
1913  VTAG_NEXTBUF_CM        = $8000000C;
1914  VTAG_BATCH_CM_CLR      = $8000000D;
1915  VTAG_BATCH_CM_SET      = $8000000E;
1916  VTAG_NORMAL_DISP_GET   = $8000000F;
1917  VTAG_NORMAL_DISP_SET   = $80000010;
1918  VTAG_COERCE_DISP_GET   = $80000011;
1919  VTAG_COERCE_DISP_SET   = $80000012;
1920  VTAG_VIEWPORTEXTRA_GET = $80000013;
1921  VTAG_VIEWPORTEXTRA_SET = $80000014;
1922  VTAG_CHROMAKEY_GET     = $80000015;
1923  VTAG_BITPLANEKEY_GET   = $80000016;
1924  VTAG_BORDERBLANK_GET   = $80000017;
1925  VTAG_BORDERNOTRANS_GET = $80000018;
1926  VTAG_CHROMA_PEN_GET    = $80000019;
1927  VTAG_CHROMA_PLANE_GET  = $8000001A;
1928  VTAG_ATTACH_CM_GET     = $8000001B;
1929  VTAG_BATCH_CM_GET      = $8000001C;
1930  VTAG_BATCH_ITEMS_GET   = $8000001D;
1931  VTAG_BATCH_ITEMS_SET   = $8000001E;
1932  VTAG_BATCH_ITEMS_ADD   = $8000001F;
1933  VTAG_VPMODEID_GET      = $80000020;
1934  VTAG_VPMODEID_SET      = $80000021;
1935  VTAG_VPMODEID_CLR      = $80000022;
1936  VTAG_USERCLIP_GET      = $80000023;
1937  VTAG_USERCLIP_SET      = $80000024;
1938  VTAG_USERCLIP_CLR      = $80000025;
1939 { The following tags are V39 specific. They will be ignored (returing error -3) by
1940         earlier versions }
1941  VTAG_PF1_BASE_GET             =  $80000026;
1942  VTAG_PF2_BASE_GET             =  $80000027;
1943  VTAG_SPEVEN_BASE_GET          =  $80000028;
1944  VTAG_SPODD_BASE_GET           =  $80000029;
1945  VTAG_PF1_BASE_SET             =  $8000002a;
1946  VTAG_PF2_BASE_SET             =  $8000002b;
1947  VTAG_SPEVEN_BASE_SET          =  $8000002c;
1948  VTAG_SPODD_BASE_SET           =  $8000002d;
1949  VTAG_BORDERSPRITE_GET         =  $8000002e;
1950  VTAG_BORDERSPRITE_SET         =  $8000002f;
1951  VTAG_BORDERSPRITE_CLR         =  $80000030;
1952  VTAG_SPRITERESN_SET           =  $80000031;
1953  VTAG_SPRITERESN_GET           =  $80000032;
1954  VTAG_PF1_TO_SPRITEPRI_SET     =  $80000033;
1955  VTAG_PF1_TO_SPRITEPRI_GET     =  $80000034;
1956  VTAG_PF2_TO_SPRITEPRI_SET     =  $80000035;
1957  VTAG_PF2_TO_SPRITEPRI_GET     =  $80000036;
1958  VTAG_IMMEDIATE                =  $80000037;
1959  VTAG_FULLPALETTE_SET          =  $80000038;
1960  VTAG_FULLPALETTE_GET          =  $80000039;
1961  VTAG_FULLPALETTE_CLR          =  $8000003A;
1962  VTAG_DEFSPRITERESN_SET        =  $8000003B;
1963  VTAG_DEFSPRITERESN_GET        =  $8000003C;
1964 
1965 { all the following tags follow the new, rational standard for videocontrol tags:
1966  * VC_xxx,state         set the state of attribute 'xxx' to value 'state'
1967  * VC_xxx_QUERY,&var    get the state of attribute 'xxx' and store it into the longword
1968  *                      pointed to by &var.
1969  *
1970  * The following are new for V40:
1971  }
1972 
1973  VC_IntermediateCLUpdate       =  $80000080;
1974         { default=true. When set graphics will update the intermediate copper
1975          * lists on color changes, etc. When false, it won't, and will be faster.
1976          }
1977  VC_IntermediateCLUpdate_Query =  $80000081;
1978 
1979  VC_NoColorPaletteLoad         =  $80000082;
1980         { default = false. When set, graphics will only load color 0
1981          * for this ViewPort, and so the ViewPort's colors will come
1982          * from the previous ViewPort's.
1983          *
1984          * NB - Using this tag and VTAG_FULLPALETTE_SET together is undefined.
1985          }
1986  VC_NoColorPaletteLoad_Query   =  $80000083;
1987 
1988  VC_DUALPF_Disable             =  $80000084;
1989         { default = false. When this flag is set, the dual-pf bit
1990            in Dual-Playfield screens will be turned off. Even bitplanes
1991            will still come from the first BitMap and odd bitplanes
1992            from the second BitMap, and both R[xy]Offsets will be
1993            considered. This can be used (with appropriate palette
1994            selection) for cross-fades between differently scrolling
1995            images.
1996            When this flag is turned on, colors will be loaded for
1997            the viewport as if it were a single viewport of depth
1998            depth1+depth2 }
1999  VC_DUALPF_Disable_Query       =  $80000085;
2000 
2001 
2002 const
2003 
2004     SPRITE_ATTACHED     = $80;
2005 
2006 type
2007 
2008     pSimpleSprite = ^tSimpleSprite;
2009     tSimpleSprite = record
2010         posctldata      : Pointer;
2011         height          : Word;
2012         x,y             : Word;        { current position }
2013         num             : Word;
2014     end;
2015 
2016     pExtSprite = ^tExtSprite;
2017     tExtSprite = record
2018         es_SimpleSprite : tSimpleSprite;         { conventional simple sprite structure }
2019         es_wordwidth    : WORD;                 { graphics use only, subject to change }
2020         es_flags        : WORD;                 { graphics use only, subject to change }
2021     end;
2022 
2023 const
2024 { tags for AllocSpriteData() }
2025  SPRITEA_Width          = $81000000;
2026  SPRITEA_XReplication   = $81000002;
2027  SPRITEA_YReplication   = $81000004;
2028  SPRITEA_OutputHeight   = $81000006;
2029  SPRITEA_Attached       = $81000008;
2030  SPRITEA_OldDataFormat  = $8100000a;      { MUST pass in outputheight if using this tag }
2031 
2032 { tags for GetExtSprite() }
2033  GSTAG_SPRITE_NUM = $82000020;
2034  GSTAG_ATTACHED   = $82000022;
2035  GSTAG_SOFTSPRITE = $82000024;
2036 
2037 { tags valid for either GetExtSprite or ChangeExtSprite }
2038  GSTAG_SCANDOUBLED     =  $83000000;      { request "NTSC-Like" height if possible. }
2039 
2040 
2041 Type
2042     pBitScaleArgs = ^tBitScaleArgs;
2043     tBitScaleArgs = record
2044     bsa_SrcX, bsa_SrcY,                 { source origin }
2045     bsa_SrcWidth, bsa_SrcHeight,        { source size }
2046     bsa_XSrcFactor, bsa_YSrcFactor,     { scale factor denominators }
2047     bsa_DestX, bsa_DestY,               { destination origin }
2048     bsa_DestWidth, bsa_DestHeight,      { destination size result }
2049     bsa_XDestFactor, bsa_YDestFactor : Word;   { scale factor numerators }
2050     bsa_SrcBitMap,                           { source BitMap }
2051     bsa_DestBitMap : pBitMap;              { destination BitMap }
2052     bsa_Flags   : ULONG;              { reserved.  Must be zero! }
2053     bsa_XDDA, bsa_YDDA : Word;         { reserved }
2054     bsa_Reserved1,
2055     bsa_Reserved2 : Longint;
2056    END;
2057 
2058   {    tag definitions for GetRPAttr, SetRPAttr     }
2059 
2060 const
2061  RPTAG_Font            =  $80000000;      { get/set font }
2062  RPTAG_APen            =  $80000002;      { get/set apen }
2063  RPTAG_BPen            =  $80000003;      { get/set bpen }
2064  RPTAG_DrMd            =  $80000004;      { get/set draw mode }
2065  RPTAG_OutlinePen      =  $80000005;      { get/set outline pen. corrected case. }
2066  RPTAG_WriteMask       =  $80000006;      { get/set WriteMask }
2067  RPTAG_MaxPen          =  $80000007;      { get/set maxpen }
2068 
2069  RPTAG_DrawBounds      =  $80000008;      { get only rastport draw bounds. pass &rect }
2070 
2071 
2072 
2073 
2074 TYPE
2075 
2076  pRegionRectangle = ^tRegionRectangle;
2077  tRegionRectangle = record
2078     Next, Prev  : pRegionRectangle;
2079     bounds      : tRectangle;
2080  END;
2081 
2082  pRegion = ^tRegion;
2083  tRegion = record
2084     bounds      : tRectangle;
2085     RegionRectangle  : pRegionRectangle;
2086  END;
2087 
2088 type
2089 
2090     pGfxBase = ^tGfxBase;
2091     tGfxBase = record
2092         LibNode         : tLibrary;
2093         ActiView        : pView;      { ViewPtr }
2094         copinit         : pcopinit; { (copinitptr) ptr to copper start up list }
2095         cia             : Pointer;      { for 8520 resource use }
2096         blitter         : Pointer;      { for future blitter resource use }
2097         LOFlist         : Pointer;
2098         SHFlist         : Pointer;
2099         blthd,
2100         blttl           : pbltnode;
2101         bsblthd,
2102         bsblttl         : pbltnode;      { Previous four are (bltnodeptr) }
2103         vbsrv,
2104         timsrv,
2105         bltsrv          : tInterrupt;
2106         TextFonts       : tList;
2107         DefaultFont     : pTextFont;      { TextFontPtr }
2108         Modes           : Word;        { copy of current first bplcon0 }
2109         VBlank          : Shortint;
2110         Debug           : Shortint;
2111         BeamSync        : smallint;
2112         system_bplcon0  : smallint; { it is ored into each bplcon0 for display }
2113         SpriteReserved  : Byte;
2114         bytereserved    : Byte;
2115         Flags           : Word;
2116         BlitLock        : smallint;
2117         BlitNest        : smallint;
2118 
2119         BlitWaitQ       : tList;
2120         BlitOwner       : pTask;      { TaskPtr }
2121         TOF_WaitQ       : tList;
2122         DisplayFlags    : Word;        { NTSC PAL GENLOC etc}
2123 
2124                 { Display flags are determined at power on }
2125 
2126         SimpleSprites   : Pointer;      { SimpleSpritePtr ptr }
2127         MaxDisplayRow   : Word;        { hardware stuff, do not use }
2128         MaxDisplayColumn : Word;       { hardware stuff, do not use }
2129         NormalDisplayRows : Word;
2130         NormalDisplayColumns : Word;
2131 
2132         { the following are for standard non interlace, 1/2 wb width }
2133 
2134         NormalDPMX      : Word;        { Dots per meter on display }
2135         NormalDPMY      : Word;        { Dots per meter on display }
2136         LastChanceMemory : pSignalSemaphore;     { SignalSemaphorePtr }
2137         LCMptr          : Pointer;
2138         MicrosPerLine   : Word;        { 256 time usec/line }
2139         MinDisplayColumn : Word;
2140         ChipRevBits0    : Byte;
2141         MemType         : Byte;
2142         crb_reserved  :  Array[0..3] of Byte;
2143         monitor_id  : Word;             { normally null }
2144         hedley  : Array[0..7] of ULONG;
2145         hedley_sprites  : Array[0..7] of ULONG;     { sprite ptrs for intuition mouse }
2146         hedley_sprites1 : Array[0..7] of ULONG;            { sprite ptrs for intuition mouse }
2147         hedley_count    : smallint;
2148         hedley_flags    : Word;
2149         hedley_tmp      : smallint;
2150         hash_table      : Pointer;
2151         current_tot_rows : Word;
2152         current_tot_cclks : Word;
2153         hedley_hint     : Byte;
2154         hedley_hint2    : Byte;
2155         nreserved       : Array[0..3] of ULONG;
2156         a2024_sync_raster : Pointer;
2157         control_delta_pal : Word;
2158         control_delta_ntsc : Word;
2159         current_monitor : pMonitorSpec;
2160         MonitorList     : tList;
2161         default_monitor : pMonitorSpec;
2162         MonitorListSemaphore : pSignalSemaphore;
2163         DisplayInfoDataBase : Pointer;
2164         TopLine      : Word;
2165         ActiViewCprSemaphore : pSignalSemaphore;
2166         UtilityBase  : Pointer;           { for hook AND tag utilities   }
2167         ExecBase     : Pointer;              { to link with rom.lib }
2168         bwshifts     : Pointer;
2169         StrtFetchMasks,
2170         StopFetchMasks,
2171         Overrun,
2172         RealStops    : Pointer;
2173         SpriteWidth,                    { current width (in words) of sprites }
2174         SpriteFMode  : WORD;            { current sprite fmode bits    }
2175         SoftSprites,                    { bit mask of size change knowledgeable sprites }
2176         arraywidth   : Shortint;
2177         DefaultSpriteWidth : WORD;      { what width intuition wants }
2178         SprMoveDisable : Shortint;
2179         WantChips,
2180         BoardMemType,
2181         Bugs         : Byte;
2182         gb_LayersBase : Pointer;
2183         ColorMask    : ULONG;
2184         IVector,
2185         IData        : Pointer;
2186         SpecialCounter : ULONG;         { special for double buffering }
2187         DBList       : Pointer;
2188         MonitorFlags : WORD;
2189         ScanDoubledSprites,
2190         BP3Bits      : Byte;
2191         MonitorVBlank  : tAnalogSignalInterval;
2192         natural_monitor  : pMonitorSpec;
2193         ProgData     : Pointer;
2194         ExtSprites   : Byte;
2195         pad3         : Byte;
2196         GfxFlags     : WORD;
2197         VBCounter    : ULONG;
2198         HashTableSemaphore  : pSignalSemaphore;
2199         case boolean of
2200           true: ( ChunkyToPlanarPtr: PLongWord;);  // HWEmul[0];
2201           false: (HWEmul: array[0..8] of PLongWord;);
2202     end;
2203 
2204 const
2205 
2206     NTSC        = 1;
2207     GENLOC      = 2;
2208     PAL         = 4;
2209     TODA_SAFE   = 8;
2210 
2211     BLITMSG_FAULT = 4;
2212 
2213 { bits defs for ChipRevBits }
2214    GFXB_BIG_BLITS = 0 ;
2215    GFXB_HR_AGNUS  = 0 ;
2216    GFXB_HR_DENISE = 1 ;
2217    GFXB_AA_ALICE  = 2 ;
2218    GFXB_AA_LISA   = 3 ;
2219    GFXB_AA_MLISA  = 4 ;      { internal use only. }
2220 
2221    GFXF_BIG_BLITS = 1 ;
2222    GFXF_HR_AGNUS  = 1 ;
2223    GFXF_HR_DENISE = 2 ;
2224    GFXF_AA_ALICE  = 4 ;
2225    GFXF_AA_LISA   = 8 ;
2226    GFXF_AA_MLISA  = 16;      { internal use only }
2227 
2228 { Pass ONE of these to SetChipRev() }
2229    SETCHIPREV_A   = GFXF_HR_AGNUS;
2230    SETCHIPREV_ECS = (GFXF_HR_AGNUS OR GFXF_HR_DENISE);
2231    SETCHIPREV_AA  = (GFXF_AA_ALICE OR GFXF_AA_LISA OR SETCHIPREV_ECS);
2232    SETCHIPREV_BEST= $ffffffff;
2233 
2234 { memory type }
2235    BUS_16         = 0;
2236    NML_CAS        = 0;
2237    BUS_32         = 1;
2238    DBL_CAS        = 2;
2239    BANDWIDTH_1X   = (BUS_16 OR NML_CAS);
2240    BANDWIDTH_2XNML= BUS_32;
2241    BANDWIDTH_2XDBL= DBL_CAS;
2242    BANDWIDTH_4X   = (BUS_32 OR DBL_CAS);
2243 
2244 { GfxFlags (private) }
2245    NEW_DATABASE   = 1;
2246 
2247    GRAPHICSNAME   : PChar  = 'graphics.library';
2248 
2249 
2250 var
2251     GfxBase : pLibrary = nil;
2252 
2253 PROCEDURE AddAnimOb(anOb : pAnimOb location 'a0'; anKey : ppAnimOb location 'a1'; rp : pRastPort location 'a2'); syscall GfxBase 156;
2254 PROCEDURE AddBob(bob : pBob location 'a0'; rp : pRastPort location 'a1'); syscall GfxBase 096;
2255 PROCEDURE AddFont(textFont : pTextFont location 'a1'); syscall GfxBase 480;
2256 PROCEDURE AddVSprite(vSprite : pVSprite location 'a0'; rp : pRastPort location 'a1'); syscall GfxBase 102;
AllocBitMapnull2257 FUNCTION AllocBitMap(sizex : ULONG location 'd0'; sizey : ULONG location 'd1'; depth : ULONG location 'd2'; flags : ULONG location 'd3'; const friend_bitmap : pBitMap location 'a0') : pBitMap; syscall GfxBase 918;
AllocDBufInfonull2258 FUNCTION AllocDBufInfo(vp : pViewPort location 'a0') : pDBufInfo; syscall GfxBase 966;
AllocRasternull2259 FUNCTION AllocRaster(width : ULONG location 'd0'; height : ULONG location 'd1') : TPlanePtr; syscall GfxBase 492;
AllocSpriteDataAnull2260 FUNCTION AllocSpriteDataA(const bm : pBitMap location 'a2';const tags : pTagItem location 'a1') : pExtSprite; syscall GfxBase 1020;
2261 PROCEDURE AndRectRegion(region : pRegion location 'a0';const rectangle : pRectangle location 'a1'); syscall GfxBase 504;
AndRegionRegionnull2262 FUNCTION AndRegionRegion(const srcRegion : pRegion location 'a0'; destRegion : pRegion location 'a1') : LongBool; syscall GfxBase 624;
2263 PROCEDURE Animate(anKey : ppAnimOb location 'a0'; rp : pRastPort location 'a1'); syscall GfxBase 162;
AreaDrawnull2264 FUNCTION AreaDraw(rp : pRastPort location 'a1'; x : LONGINT location 'd0'; y : LONGINT location 'd1') : LONGINT; syscall GfxBase 258;
AreaEllipsenull2265 FUNCTION AreaEllipse(rp : pRastPort location 'a1'; xCenter : LONGINT location 'd0'; yCenter : LONGINT location 'd1'; a : LONGINT location 'd2'; b : LONGINT location 'd3') : LONGINT; syscall GfxBase 186;
AreaEndnull2266 FUNCTION AreaEnd(rp : pRastPort location 'a1') : LONGINT; syscall GfxBase 264;
AreaMovenull2267 FUNCTION AreaMove(rp : pRastPort location 'a1'; x : LONGINT location 'd0'; y : LONGINT location 'd1') : LONGINT; syscall GfxBase 252;
2268 PROCEDURE AskFont(rp : pRastPort location 'a1'; textAttr : pTextAttr location 'a0'); syscall GfxBase 474;
AskSoftStylenull2269 FUNCTION AskSoftStyle(rp : pRastPort location 'a1') : ULONG; syscall GfxBase 084;
AttachPalExtranull2270 FUNCTION AttachPalExtra(cm : pColorMap location 'a0'; vp : pViewPort location 'a1') : LONGINT; syscall GfxBase 834;
AttemptLockLayerRomnull2271 FUNCTION AttemptLockLayerRom(layer : pLayer location 'a5') : LongBool; syscall GfxBase 654;
BestModeIDAnull2272 FUNCTION BestModeIDA(const tags : pTagItem location 'a0') : ULONG; syscall GfxBase 1050;
2273 PROCEDURE BitMapScale(bitScaleArgs : pBitScaleArgs location 'a0'); syscall GfxBase 678;
BltBitMapnull2274 FUNCTION BltBitMap(const srcBitMap : pBitMap location 'a0'; xSrc : LONGINT location 'd0'; ySrc : LONGINT location 'd1'; destBitMap : pBitMap location 'a1'; xDest : LONGINT location 'd2'; yDest : LONGINT location 'd3'; xSize : LONGINT location 'd4'; ySize : LONGINT location 'd5'; minterm : ULONG location 'd6'; mask : ULONG location 'd7'; tempA : pCHAR location 'a2') : LONGINT; syscall GfxBase 030;
2275 PROCEDURE BltBitMapRastPort(const srcBitMap : pBitMap location 'a0'; xSrc : LONGINT location 'd0'; ySrc : LONGINT location 'd1'; destRP : pRastPort location 'a1'; xDest : LONGINT location 'd2'; yDest : LONGINT location 'd3'; xSize : LONGINT location 'd4'; ySize : LONGINT location 'd5'; minterm : ULONG location 'd6'); syscall GfxBase 606;
2276 PROCEDURE BltClear(memBlock : pointer location 'a1'; byteCount : ULONG location 'd0'; flags : ULONG location 'd1'); syscall GfxBase 300;
2277 PROCEDURE BltMaskBitMapRastPort(const srcBitMap : pBitMap location 'a0'; xSrc : LONGINT location 'd0'; ySrc : LONGINT location 'd1'; destRP : pRastPort location 'a1'; xDest : LONGINT location 'd2'; yDest : LONGINT location 'd3'; xSize : LONGINT location 'd4'; ySize : LONGINT location 'd5'; minterm : ULONG location 'd6';const bltMask : pCHAR location 'a2'); syscall GfxBase 636;
2278 PROCEDURE BltPattern(rp : pRastPort location 'a1';const mask : pCHAR location 'a0'; xMin : LONGINT location 'd0'; yMin : LONGINT location 'd1'; xMax : LONGINT location 'd2'; yMax : LONGINT location 'd3'; maskBPR : ULONG location 'd4'); syscall GfxBase 312;
2279 PROCEDURE BltTemplate(const source : pWORD location 'a0'; xSrc : LONGINT location 'd0'; srcMod : LONGINT location 'd1'; destRP : pRastPort location 'a1'; xDest : LONGINT location 'd2'; yDest : LONGINT location 'd3'; xSize : LONGINT location 'd4'; ySize : LONGINT location 'd5'); syscall GfxBase 036;
CalcIVGnull2280 FUNCTION CalcIVG(v : pView location 'a0'; vp : pViewPort location 'a1') : WORD; syscall GfxBase 828;
2281 PROCEDURE CBump(copList : pUCopList location 'a1'); syscall GfxBase 366;
ChangeExtSpriteAnull2282 FUNCTION ChangeExtSpriteA(vp : pViewPort location 'a0'; oldsprite : pExtSprite location 'a1'; newsprite : pExtSprite location 'a2';const tags : pTagItem location 'a3') : LONGINT; syscall GfxBase 1026;
2283 PROCEDURE ChangeSprite(vp : pViewPort location 'a0'; sprite : pSimpleSprite location 'a1'; newData : pWORD location 'a2'); syscall GfxBase 420;
2284 PROCEDURE ChangeVPBitMap(vp : pViewPort location 'a0'; bm : pBitMap location 'a1'; db : pDBufInfo location 'a2'); syscall GfxBase 942;
2285 PROCEDURE ClearEOL(rp : pRastPort location 'a1'); syscall GfxBase 042;
ClearRectRegionnull2286 FUNCTION ClearRectRegion(region : pRegion location 'a0';const rectangle : pRectangle location 'a1') : LongBool; syscall GfxBase 522;
2287 PROCEDURE ClearRegion(region : pRegion location 'a0'); syscall GfxBase 528;
2288 PROCEDURE ClearScreen(rp : pRastPort location 'a1'); syscall GfxBase 048;
2289 PROCEDURE ClipBlit(srcRP : pRastPort location 'a0'; xSrc : LONGINT location 'd0'; ySrc : LONGINT location 'd1'; destRP : pRastPort location 'a1'; xDest : LONGINT location 'd2'; yDest : LONGINT location 'd3'; xSize : LONGINT location 'd4'; ySize : LONGINT location 'd5'; minterm : ULONG location 'd6'); syscall GfxBase 552;
2290 PROCEDURE CloseFont(textFont : pTextFont location 'a1'); syscall GfxBase 078;
CloseMonitornull2291 FUNCTION CloseMonitor(monitorSpec : pMonitorSpec location 'a0') : LongBool; syscall GfxBase 720;
2292 PROCEDURE CMove(copList : pUCopList location 'a1'; destination : POINTER location 'a0'; data : LONGINT location 'd1'); syscall GfxBase 372;
CoerceModenull2293 FUNCTION CoerceMode(vp : pViewPort location 'a0'; monitorid : ULONG location 'd0'; flags : ULONG location 'd1') : ULONG; syscall GfxBase 936;
2294 PROCEDURE CopySBitMap(layer : pLayer location 'a0'); syscall GfxBase 450;
2295 PROCEDURE CWait(copList : pUCopList location 'a1'; v : LONGINT location 'd0'; h : LONGINT location 'd1'); syscall GfxBase 378;
2296 PROCEDURE DisownBlitter; syscall GfxBase 462;
2297 PROCEDURE DisposeRegion(region : pRegion location 'a0'); syscall GfxBase 534;
2298 PROCEDURE DoCollision(rp : pRastPort location 'a1'); syscall GfxBase 108;
2299 PROCEDURE Draw(rp : pRastPort location 'a1'; x : LONGINT location 'd0'; y : LONGINT location 'd1'); syscall GfxBase 246;
2300 PROCEDURE DrawEllipse(rp : pRastPort location 'a1'; xCenter : LONGINT location 'd0'; yCenter : LONGINT location 'd1'; a : LONGINT location 'd2'; b : LONGINT location 'd3'); syscall GfxBase 180;
2301 PROCEDURE DrawGList(rp : pRastPort location 'a1'; vp : pViewPort location 'a0'); syscall GfxBase 114;
2302 PROCEDURE EraseRect(rp : pRastPort location 'a1'; xMin : LONGINT location 'd0'; yMin : LONGINT location 'd1'; xMax : LONGINT location 'd2'; yMax : LONGINT location 'd3'); syscall GfxBase 810;
ExtendFontnull2303 FUNCTION ExtendFont(font : pTextFont location 'a0';const fontTags : pTagItem location 'a1') : ULONG; syscall GfxBase 816;
FindColornull2304 FUNCTION FindColor(cm : pColorMap location 'a3'; r : ULONG location 'd1'; g : ULONG location 'd2'; b : ULONG location 'd3'; maxcolor : LONGINT location 'd4') : LONGINT; syscall GfxBase 1008;
FindDisplayInfonull2305 FUNCTION FindDisplayInfo(displayID : ULONG location 'd0') : POINTER; syscall GfxBase 726;
Floodnull2306 FUNCTION Flood(rp : pRastPort location 'a1'; mode : ULONG location 'd2'; x : LONGINT location 'd0'; y : LONGINT location 'd1') : LongBool; syscall GfxBase 330;
2307 PROCEDURE FontExtent(const font : pTextFont location 'a0'; fontExtent : pTextExtent location 'a1'); syscall GfxBase 762;
2308 PROCEDURE FreeBitMap(bm : pBitMap location 'a0'); syscall GfxBase 924;
2309 PROCEDURE FreeColorMap(colorMap : pColorMap location 'a0'); syscall GfxBase 576;
2310 PROCEDURE FreeCopList(copList : pCopList location 'a0'); syscall GfxBase 546;
2311 PROCEDURE FreeCprList(cprList : pcprlist location 'a0'); syscall GfxBase 564;
2312 PROCEDURE FreeDBufInfo(dbi : pDBufInfo location 'a1'); syscall GfxBase 972;
2313 PROCEDURE FreeGBuffers(anOb : pAnimOb location 'a0'; rp : pRastPort location 'a1'; flag : LONGINT location 'd0'); syscall GfxBase 600;
2314 PROCEDURE FreeRaster(p : TPlanePtr location 'a0'; width : ULONG location 'd0'; height : ULONG location 'd1'); syscall GfxBase 498;
2315 PROCEDURE FreeSprite(num : LONGINT location 'd0'); syscall GfxBase 414;
2316 PROCEDURE FreeSpriteData(sp : pExtSprite location 'a2'); syscall GfxBase 1032;
2317 PROCEDURE FreeVPortCopLists(vp : pViewPort location 'a0'); syscall GfxBase 540;
GetAPennull2318 FUNCTION GetAPen(rp : pRastPort location 'a0') : ULONG; syscall GfxBase 858;
GetBitMapAttrnull2319 FUNCTION GetBitMapAttr(const bm : pBitMap location 'a0'; attrnum : ULONG location 'd1') : ULONG; syscall GfxBase 960;
GetBPennull2320 FUNCTION GetBPen(rp : pRastPort location 'a0') : ULONG; syscall GfxBase 864;
GetColorMapnull2321 FUNCTION GetColorMap(entries : LONGINT location 'd0') : pColorMap; syscall GfxBase 570;
GetDisplayInfoDatanull2322 FUNCTION GetDisplayInfoData(const handle : POINTER location 'a0'; buf : pCHAR location 'a1'; size : ULONG location 'd0'; tagID : ULONG location 'd1'; displayID : ULONG location 'd2') : ULONG; syscall GfxBase 756;
GetDrMdnull2323 FUNCTION GetDrMd(rp : pRastPort location 'a0') : ULONG; syscall GfxBase 870;
GetExtSpriteAnull2324 FUNCTION GetExtSpriteA(ss : pExtSprite location 'a2';const tags : pTagItem location 'a1') : LONGINT; syscall GfxBase 930;
GetGBuffersnull2325 FUNCTION GetGBuffers(anOb : pAnimOb location 'a0'; rp : pRastPort location 'a1'; flag : LONGINT location 'd0') : LongBool; syscall GfxBase 168;
GetOutlinePennull2326 FUNCTION GetOutlinePen(rp : pRastPort location 'a0') : ULONG; syscall GfxBase 876;
2327 PROCEDURE GetRGB32(const cm : pColorMap location 'a0'; firstcolor : ULONG location 'd0'; ncolors : ULONG location 'd1'; table : pulong location 'a1'); syscall GfxBase 900;
GetRGB4null2328 FUNCTION GetRGB4(colorMap : pColorMap location 'a0'; entry : LONGINT location 'd0') : ULONG; syscall GfxBase 582;
2329 PROCEDURE GetRPAttrsA(const rp : pRastPort location 'a0';const tags : pTagItem location 'a1'); syscall GfxBase 1044;
GetSpritenull2330 FUNCTION GetSprite(sprite : pSimpleSprite location 'a0'; num : LONGINT location 'd0') : smallint; syscall GfxBase 408;
GetVPModeIDnull2331 FUNCTION GetVPModeID(const vp : pViewPort location 'a0') : LONGINT; syscall GfxBase 792;
2332 PROCEDURE GfxAssociate(const associateNode : POINTER location 'a0'; gfxNodePtr : POINTER location 'a1'); syscall GfxBase 672;
2333 PROCEDURE GfxFree(gfxNodePtr : POINTER location 'a0'); syscall GfxBase 666;
GfxLookUpnull2334 FUNCTION GfxLookUp(const associateNode : POINTER location 'a0') : POINTER; syscall GfxBase 702;
GfxNewnull2335 FUNCTION GfxNew(gfxNodeType : ULONG location 'd0') : POINTER; syscall GfxBase 660;
2336 PROCEDURE InitArea(areaInfo : pAreaInfo location 'a0'; vectorBuffer : POINTER location 'a1'; maxVectors : LONGINT location 'd0'); syscall GfxBase 282;
2337 PROCEDURE InitBitMap(bitMap : pBitMap location 'a0'; depth : LONGINT location 'd0'; width : LONGINT location 'd1'; height : LONGINT location 'd2'); syscall GfxBase 390;
2338 PROCEDURE InitGels(head : pVSprite location 'a0'; tail : pVSprite location 'a1'; gelsInfo : pGelsInfo location 'a2'); syscall GfxBase 120;
2339 PROCEDURE InitGMasks(anOb : pAnimOb location 'a0'); syscall GfxBase 174;
2340 PROCEDURE InitMasks(vSprite : pVSprite location 'a0'); syscall GfxBase 126;
2341 PROCEDURE InitRastPort(rp : pRastPort location 'a1'); syscall GfxBase 198;
InitTmpRasnull2342 FUNCTION InitTmpRas(tmpRas : pTmpRas location 'a0'; buffer : Pointer location 'a1'; size : LONGINT location 'd0') : pTmpRas; syscall GfxBase 468;
2343 PROCEDURE InitView(view : pView location 'a1'); syscall GfxBase 360;
2344 PROCEDURE InitVPort(vp : pViewPort location 'a0'); syscall GfxBase 204;
2345 PROCEDURE LoadRGB32(vp : pViewPort location 'a0';const table : pULONG location 'a1'); syscall GfxBase 882;
2346 PROCEDURE LoadRGB4(vp : pViewPort location 'a0';const colors : pWord location 'a1'; count : LONGINT location 'd0'); syscall GfxBase 192;
2347 PROCEDURE LoadView(view : pView location 'a1'); syscall GfxBase 222;
2348 PROCEDURE LockLayerRom(layer : pLayer location 'a5'); syscall GfxBase 432;
MakeVPortnull2349 FUNCTION MakeVPort(view : pView location 'a0'; vp : pViewPort location 'a1') : ULONG; syscall GfxBase 216;
ModeNotAvailablenull2350 FUNCTION ModeNotAvailable(modeID : ULONG location 'd0') : LONGINT; syscall GfxBase 798;
2351 PROCEDURE gfxMove(rp : pRastPort location 'a1'; x : LONGINT location 'd0'; y : LONGINT location 'd1'); syscall GfxBase 240;
2352 PROCEDURE MoveSprite(vp : pViewPort location 'a0'; sprite : pSimpleSprite location 'a1'; x : LONGINT location 'd0'; y : LONGINT location 'd1'); syscall GfxBase 426;
MrgCopnull2353 FUNCTION MrgCop(view : pView location 'a1') : ULONG; syscall GfxBase 210;
NewRegionnull2354 FUNCTION NewRegion : pRegion; syscall GfxBase 516;
NextDisplayInfonull2355 FUNCTION NextDisplayInfo(displayID : ULONG location 'd0') : ULONG; syscall GfxBase 732;
ObtainBestPenAnull2356 FUNCTION ObtainBestPenA(cm : pColorMap location 'a0'; r : ULONG location 'd1'; g : ULONG location 'd2'; b : ULONG location 'd3';const tags : pTagItem location 'a1') : LONGINT; syscall GfxBase 840;
ObtainPennull2357 FUNCTION ObtainPen(cm : pColorMap location 'a0'; n : ULONG location 'd0'; r : ULONG location 'd1'; g : ULONG location 'd2'; b : ULONG location 'd3'; f : LONGINT location 'd4') : ULONG; syscall GfxBase 954;
OpenFontnull2358 FUNCTION OpenFont(textAttr : pTextAttr location 'a0') : pTextFont; syscall GfxBase 072;
OpenMonitornull2359 FUNCTION OpenMonitor(const monitorName : pCHAR location 'a1'; displayID : ULONG location 'd0') : pMonitorSpec; syscall GfxBase 714;
OrRectRegionnull2360 FUNCTION OrRectRegion(region : pRegion location 'a0';const rectangle : pRectangle location 'a1') : LongBool; syscall GfxBase 510;
OrRegionRegionnull2361 FUNCTION OrRegionRegion(const srcRegion : pRegion location 'a0'; destRegion : pRegion location 'a1') : LongBool; syscall GfxBase 612;
2362 PROCEDURE OwnBlitter; syscall GfxBase 456;
2363 PROCEDURE PolyDraw(rp : pRastPort location 'a1'; count : LONGINT location 'd0';const polyTable : PSmallInt location 'a0'); syscall GfxBase 336;
2364 PROCEDURE QBlit(blit : pbltnode location 'a1'); syscall GfxBase 276;
2365 PROCEDURE QBSBlit(blit : pbltnode location 'a1'); syscall GfxBase 294;
ReadPixelnull2366 FUNCTION ReadPixel(rp : pRastPort location 'a1'; x : LONGINT location 'd0'; y : LONGINT location 'd1') : ULONG; syscall GfxBase 318;
ReadPixelArray8null2367 FUNCTION ReadPixelArray8(rp : pRastPort location 'a0'; xstart : ULONG location 'd0'; ystart : ULONG location 'd1'; xstop : ULONG location 'd2'; ystop : ULONG location 'd3'; array_ : PByte location 'a2'; temprp : pRastPort location 'a1') : LONGINT; syscall GfxBase 780;
ReadPixelLine8null2368 FUNCTION ReadPixelLine8(rp : pRastPort location 'a0'; xstart : ULONG location 'd0'; ystart : ULONG location 'd1'; width : ULONG location 'd2'; array_ : PByte location 'a2'; tempRP : pRastPort location 'a1') : LONGINT; syscall GfxBase 768;
2369 PROCEDURE RectFill(rp : pRastPort location 'a1'; xMin : LONGINT location 'd0'; yMin : LONGINT location 'd1'; xMax : LONGINT location 'd2'; yMax : LONGINT location 'd3'); syscall GfxBase 306;
2370 PROCEDURE ReleasePen(cm : pColorMap location 'a0'; n : ULONG location 'd0'); syscall GfxBase 948;
2371 PROCEDURE RemFont(textFont : pTextFont location 'a1'); syscall GfxBase 486;
2372 PROCEDURE RemIBob(bob : pBob location 'a0'; rp : pRastPort location 'a1'; vp : pViewPort location 'a2'); syscall GfxBase 132;
2373 PROCEDURE RemVSprite(vSprite : pVSprite location 'a0'); syscall GfxBase 138;
ScalerDivnull2374 FUNCTION ScalerDiv(factor : ULONG location 'd0'; numerator : ULONG location 'd1'; denominator : ULONG location 'd2') : WORD; syscall GfxBase 684;
2375 PROCEDURE ScrollRaster(rp : pRastPort location 'a1'; dx : LONGINT location 'd0'; dy : LONGINT location 'd1'; xMin : LONGINT location 'd2'; yMin : LONGINT location 'd3'; xMax : LONGINT location 'd4'; yMax : LONGINT location 'd5'); syscall GfxBase 396;
2376 PROCEDURE ScrollRasterBF(rp : pRastPort location 'a1'; dx : LONGINT location 'd0'; dy : LONGINT location 'd1'; xMin : LONGINT location 'd2'; yMin : LONGINT location 'd3'; xMax : LONGINT location 'd4'; yMax : LONGINT location 'd5'); syscall GfxBase 1002;
2377 PROCEDURE ScrollVPort(vp : pViewPort location 'a0'); syscall GfxBase 588;
2378 PROCEDURE SetABPenDrMd(rp : pRastPort location 'a1'; apen : ULONG location 'd0'; bpen : ULONG location 'd1'; drawmode : ULONG location 'd2'); syscall GfxBase 894;
2379 PROCEDURE SetAPen(rp : pRastPort location 'a1'; pen : ULONG location 'd0'); syscall GfxBase 342;
2380 PROCEDURE SetBPen(rp : pRastPort location 'a1'; pen : ULONG location 'd0'); syscall GfxBase 348;
SetChipRevnull2381 FUNCTION SetChipRev(want : ULONG location 'd0') : ULONG; syscall GfxBase 888;
2382 PROCEDURE SetCollision(num : ULONG location 'd0'; routine : tPROCEDURE location 'a0'; gelsInfo : pGelsInfo location 'a1'); syscall GfxBase 144;
2383 PROCEDURE SetDrMd(rp : pRastPort location 'a1'; drawMode : ULONG location 'd0'); syscall GfxBase 354;
SetFontnull2384 FUNCTION SetFont(rp : pRastPort location 'a1';const textFont : pTextFont location 'a0') : LONGINT; syscall GfxBase 066;
2385 PROCEDURE SetMaxPen(rp : pRastPort location 'a0'; maxpen : ULONG location 'd0'); syscall GfxBase 990;
SetOutlinePennull2386 FUNCTION SetOutlinePen(rp : pRastPort location 'a0'; pen : ULONG location 'd0') : ULONG; syscall GfxBase 978;
2387 PROCEDURE SetRast(rp : pRastPort location 'a1'; pen : ULONG location 'd0'); syscall GfxBase 234;
2388 PROCEDURE SetRGB32(vp : pViewPort location 'a0'; n : ULONG location 'd0'; r : ULONG location 'd1'; g : ULONG location 'd2'; b : ULONG location 'd3'); syscall GfxBase 852;
2389 PROCEDURE SetRGB32CM(cm : pColorMap location 'a0'; n : ULONG location 'd0'; r : ULONG location 'd1'; g : ULONG location 'd2'; b : ULONG location 'd3'); syscall GfxBase 996;
2390 PROCEDURE SetRGB4(vp : pViewPort location 'a0'; index : LONGINT location 'd0'; red : ULONG location 'd1'; green : ULONG location 'd2'; blue : ULONG location 'd3'); syscall GfxBase 288;
2391 PROCEDURE SetRGB4CM(colorMap : pColorMap location 'a0'; index : LONGINT location 'd0'; red : ULONG location 'd1'; green : ULONG location 'd2'; blue : ULONG location 'd3'); syscall GfxBase 630;
2392 PROCEDURE SetRPAttrsA(rp : pRastPort location 'a0';const tags : pTagItem location 'a1'); syscall GfxBase 1038;
SetSoftStylenull2393 FUNCTION SetSoftStyle(rp : pRastPort location 'a1'; style : ULONG location 'd0'; enable : ULONG location 'd1') : ULONG; syscall GfxBase 090;
SetWriteMasknull2394 FUNCTION SetWriteMask(rp : pRastPort location 'a0'; msk : ULONG location 'd0') : ULONG; syscall GfxBase 984;
2395 PROCEDURE SortGList(rp : pRastPort location 'a1'); syscall GfxBase 150;
2396 PROCEDURE StripFont(font : pTextFont location 'a0'); syscall GfxBase 822;
2397 PROCEDURE SyncSBitMap(layer : pLayer location 'a0'); syscall GfxBase 444;
GfxTextnull2398 FUNCTION GfxText(rp : pRastPort location 'a1';const string_ : pCHAR location 'a0'; count : ULONG location 'd0') : LONGINT; syscall GfxBase 060;
TextExtentnull2399 FUNCTION TextExtent(rp : pRastPort location 'a1';const string_ : pCHAR location 'a0'; count : LONGINT location 'd0'; _textExtent : pTextExtent location 'a2') : smallint; syscall GfxBase 690;
TextFitnull2400 FUNCTION TextFit(rp : pRastPort location 'a1';const string_ : pCHAR location 'a0'; strLen : ULONG location 'd0'; textExtent : pTextExtent location 'a2'; constrainingExtent : pTextExtent location 'a3'; strDirection : LONGINT location 'd1'; constrainingBitWidth : ULONG location 'd2'; constrainingBitHeight : ULONG location 'd3') : ULONG; syscall GfxBase 696;
TextLengthnull2401 FUNCTION TextLength(rp : pRastPort location 'a1';const string_ : pCHAR location 'a0'; count : ULONG location 'd0') : smallint; syscall GfxBase 054;
UCopperListInitnull2402 FUNCTION UCopperListInit(uCopList : pUCopList location 'a0'; n : LONGINT location 'd0') : pCopList; syscall GfxBase 594;
2403 PROCEDURE UnlockLayerRom(layer : pLayer location 'a5'); syscall GfxBase 438;
VBeamPosnull2404 FUNCTION VBeamPos : LONGINT; syscall GfxBase 384;
VideoControlnull2405 FUNCTION VideoControl(colorMap : pColorMap location 'a0'; tagarray : pTagItem location 'a1') : LongWord; syscall GfxBase 708;
2406 PROCEDURE WaitBlit; syscall GfxBase 228;
2407 PROCEDURE WaitBOVP(vp : pViewPort location 'a0'); syscall GfxBase 402;
2408 PROCEDURE WaitTOF; syscall GfxBase 270;
WeighTAMatchnull2409 FUNCTION WeighTAMatch(reqTextAttr : pTextAttr location 'a0'; targetTextAttr : pTextAttr location 'a1'; targetTags : pTagItem location 'a2') : smallint; syscall GfxBase 804;
2410 PROCEDURE WriteChunkyPixels(rp : pRastPort location 'a0'; xstart : ULONG location 'd0'; ystart : ULONG location 'd1'; xstop : ULONG location 'd2'; ystop : ULONG location 'd3'; array_ : PByte location 'a2'; bytesperrow : LONGINT location 'd4'); syscall GfxBase 1056;
WritePixelnull2411 FUNCTION WritePixel(rp : pRastPort location 'a1'; x : LONGINT location 'd0'; y : LONGINT location 'd1') : LONGINT; syscall GfxBase 324;
WritePixelArray8null2412 FUNCTION WritePixelArray8(rp : pRastPort location 'a0'; xstart : ULONG location 'd0'; ystart : ULONG location 'd1'; xstop : ULONG location 'd2'; ystop : ULONG location 'd3'; array_ : PByte location 'a2'; temprp : pRastPort location 'a1') : LONGINT; syscall GfxBase 786;
WritePixelLine8null2413 FUNCTION WritePixelLine8(rp : pRastPort location 'a0'; xstart : ULONG location 'd0'; ystart : ULONG location 'd1'; width : ULONG location 'd2'; array_ : PByte location 'a2'; tempRP : pRastPort location 'a1') : LONGINT; syscall GfxBase 774;
XorRectRegionnull2414 FUNCTION XorRectRegion(region : pRegion location 'a0';const rectangle : pRectangle location 'a1') : LongBool; syscall GfxBase 558;
XorRegionRegionnull2415 FUNCTION XorRegionRegion(const srcRegion : pRegion location 'a0'; destRegion : pRegion location 'a1') : LongBool; syscall GfxBase 618;
2416 
AllocSpriteDatanull2417 function AllocSpriteData(bm : pBitMap; Const argv : array of PtrUInt) : pExtSprite;
BestModeIDnull2418 function BestModeID(Const argv : array of PtrUInt) : ULONG;
ChangeExtSpritenull2419 function ChangeExtSprite(vp : pViewPort; oldsprite : pExtSprite; newsprite : pExtSprite; Const argv : array of PtrUInt) : LONGINT;
ExtendFontTagsnull2420 function ExtendFontTags(font : pTextFont; Const argv : array of PtrUInt) : ULONG;
GetExtSpritenull2421 function GetExtSprite(ss : pExtSprite; Const argv : array of PtrUInt) : LONGINT;
2422 procedure GetRPAttrs(rp : pRastPort; Const argv : array of PtrUInt);
ObtainBestPennull2423 function ObtainBestPen(cm : pColorMap; r : ULONG; g : ULONG; b : ULONG; Const argv : array of PtrUInt) : LONGINT;
2424 procedure SetRPAttrs(rp : pRastPort; Const argv : array of PtrUInt);
VideoControlTagsnull2425 function VideoControlTags(colorMap : pColorMap; Const argv : array of PtrUInt) : LongWord;
WeighTAMatchTagsnull2426 function WeighTAMatchTags(reqTextAttr : pTextAttr; targetTextAttr : pTextAttr; Const argv : array of PtrUInt) : smallint;
2427 
2428 { gfxmacros }
2429 
2430 PROCEDURE BNDRYOFF (w: pRastPort);
2431 PROCEDURE InitAnimate (animkey: ppAnimOb);
2432 PROCEDURE SetAfPt(w: pRastPort;p: Pointer; n: Byte);
2433 PROCEDURE SetDrPt(w: pRastPort;p: Word);
2434 PROCEDURE SetOPen(w: pRastPort;c: Byte);
2435 PROCEDURE SetWrMsk(w: pRastPort; m: Byte);
2436 
2437 PROCEDURE SafeSetOutlinePen(w : pRastPort; c : byte);
2438 PROCEDURE SafeSetWriteMask( w : pRastPort ; m : smallint ) ;
2439 
2440 PROCEDURE OFF_DISPLAY (cust: pCustom);
2441 PROCEDURE ON_DISPLAY (cust: pCustom);
2442 PROCEDURE OFF_SPRITE (cust: pCustom);
2443 PROCEDURE ON_SPRITE (cust: pCustom);
2444 PROCEDURE OFF_VBLANK (cust: pCustom);
2445 PROCEDURE ON_VBLANK (cust: pCustom);
2446 
2447 procedure DrawCircle(Rp: PRastPort; xCenter, yCenter, r: LongInt); inline;
AreaCirclenull2448 function AreaCircle(Rp: PRastPort; xCenter, yCenter, r: SmallInt): LongWord; inline;
2449 
RasSizenull2450 function RasSize(w, h: Word): Integer;
2451 
2452 IMPLEMENTATION
2453 
AllocSpriteDatanull2454 function AllocSpriteData(bm : pBitMap; Const argv : array of PtrUInt) : pExtSprite;
2455 begin
2456     AllocSpriteData := AllocSpriteDataA(bm,@argv);
2457 end;
2458 
BestModeIDnull2459 function BestModeID(Const argv : array of PtrUInt) : ULONG;
2460 begin
2461     BestModeID := BestModeIDA(@argv);
2462 end;
2463 
ChangeExtSpritenull2464 function ChangeExtSprite(vp : pViewPort; oldsprite : pExtSprite; newsprite : pExtSprite; Const argv : array of PtrUInt) : LONGINT;
2465 begin
2466     ChangeExtSprite := ChangeExtSpriteA(vp,oldsprite,newsprite,@argv);
2467 end;
2468 
ExtendFontTagsnull2469 function ExtendFontTags(font : pTextFont; Const argv : array of PtrUInt) : ULONG;
2470 begin
2471     ExtendFontTags := ExtendFont(font,@argv);
2472 end;
2473 
GetExtSpritenull2474 function GetExtSprite(ss : pExtSprite; Const argv : array of PtrUInt) : LONGINT;
2475 begin
2476     GetExtSprite := GetExtSpriteA(ss,@argv);
2477 end;
2478 
2479 procedure GetRPAttrs(rp : pRastPort; Const argv : array of PtrUInt);
2480 begin
2481     GetRPAttrsA(rp,@argv);
2482 end;
2483 
ObtainBestPennull2484 function ObtainBestPen(cm : pColorMap; r : ULONG; g : ULONG; b : ULONG; Const argv : array of PtrUInt) : LONGINT;
2485 begin
2486     ObtainBestPen := ObtainBestPenA(cm,r,g,b,@argv);
2487 end;
2488 
2489 procedure SetRPAttrs(rp : pRastPort; Const argv : array of PtrUInt);
2490 begin
2491     SetRPAttrsA(rp,@argv);
2492 end;
2493 
VideoControlTagsnull2494 function VideoControlTags(colorMap : pColorMap; Const argv : array of PtrUInt) : LongWord;
2495 begin
2496     VideoControlTags := VideoControl(colorMap,@argv);
2497 end;
2498 
WeighTAMatchTagsnull2499 function WeighTAMatchTags(reqTextAttr : pTextAttr; targetTextAttr : pTextAttr; Const argv : array of PtrUInt) : smallint;
2500 begin
2501     WeighTAMatchTags := WeighTAMatch(reqTextAttr,targetTextAttr,@argv);
2502 end;
2503 
2504 PROCEDURE BNDRYOFF (w: pRastPort);
2505 BEGIN
2506     WITH w^ DO BEGIN
2507         Flags := Flags AND (NOT AREAOUTLINE);
2508     END;
2509 END;
2510 
2511 PROCEDURE InitAnimate (animkey: ppAnimOb);
2512 BEGIN
2513     animkey^ := NIL;
2514 END;
2515 
2516 PROCEDURE SetAfPt(w: pRastPort;p: Pointer; n: Byte);
2517 BEGIN
2518     WITH w^ DO
2519     BEGIN
2520         AreaPtrn := p;
2521         AreaPtSz := n;
2522     END;
2523 END;
2524 
2525 PROCEDURE SetDrPt(w: pRastPort;p: Word);
2526 BEGIN
2527     WITH w^ DO
2528     BEGIN
2529         LinePtrn    := p;
2530         Flags       := Flags OR FRST_DOT;
2531         linpatcnt   := 15;
2532     END;
2533 END;
2534 
2535 PROCEDURE SetOPen(w: pRastPort;c: Byte);
2536 BEGIN
2537     WITH w^ DO
2538     BEGIN
2539         AOlPen  := c;
2540         Flags   := Flags OR AREAOUTLINE;
2541     END;
2542 END;
2543 
2544 { This FUNCTION is fine, but FOR OS39 the SetWriteMask() gfx FUNCTION
2545   should be prefered because it SHOULD operate WITH gfx boards as well.
2546   At least I hope it does.... }
2547 PROCEDURE SetWrMsk(w: pRastPort; m: Byte);
2548 BEGIN
2549     w^.Mask := m;
2550 END;
2551 
2552 PROCEDURE SafeSetOutlinePen(w : pRastPort; c : byte);
2553 begin
2554     IF pGfxBase(GfxBase)^.LibNode.Lib_Version < 39 THEN begin
2555         w^.AOlPen := c;
2556         w^.Flags := w^.Flags OR AREAOUTLINE;
2557     END ELSE begin
2558         c := SetOutlinePen(w,c);
2559     END;
2560 END;
2561 
2562 PROCEDURE SafeSetWriteMask( w : pRastPort ; m : smallint ) ;
2563   VAR x : smallint ;
2564 BEGIN
2565   IF pGfxBase(GfxBase)^.LibNode.Lib_Version < 39 THEN w^.Mask := BYTE(m)
2566   ELSE x := SetWriteMask( w, m );
2567 END;
2568 
2569 PROCEDURE OFF_DISPLAY (cust: pCustom);
2570 BEGIN
2571     cust^.dmacon := BITCLR OR DMAF_RASTER;
2572 END;
2573 
2574 PROCEDURE ON_DISPLAY (cust: pCustom);
2575 BEGIN
2576     cust^.dmacon := BITSET OR DMAF_RASTER;
2577 END;
2578 
2579 PROCEDURE OFF_SPRITE (cust: pCustom);
2580 BEGIN
2581     cust^.dmacon := BITCLR OR DMAF_SPRITE;
2582 END;
2583 
2584 PROCEDURE ON_SPRITE (cust: pCustom);
2585 BEGIN
2586     cust^.dmacon := BITSET OR DMAF_SPRITE;
2587 END;
2588 
2589 PROCEDURE OFF_VBLANK (cust: pCustom);
2590 BEGIN
2591     cust^.intena := BITCLR OR INTF_VERTB;
2592 END;
2593 
2594 PROCEDURE ON_VBLANK (cust: pCustom);
2595 BEGIN
2596     cust^.intena := BITSET OR INTF_VERTB;
2597 END;
2598 
RasSizenull2599 function RasSize(w, h: Word): Integer; inline;
2600 begin
2601   RasSize := h * (((w + 15) shr 3) and $FFFE);
2602 end;
2603 
2604 procedure DrawCircle(Rp: PRastPort; xCenter, yCenter, r: LongInt); inline;
2605 begin
2606   DrawEllipse(Rp, xCenter, yCenter, r, r);
2607 end;
2608 
AreaCirclenull2609 function AreaCircle(Rp: PRastPort; xCenter, yCenter, r: SmallInt): LongWord; inline;
2610 begin
2611   AreaCircle := AreaEllipse(Rp, xCenter, yCenter, r, r);
2612 end;
2613 
2614 const
2615     { Change VERSION and LIBVERSION to proper values }
2616     VERSION : string[2] = '0';
2617     LIBVERSION : longword = 0;
2618 
2619 initialization
2620   GfxBase := OpenLibrary(GRAPHICSNAME,LIBVERSION);
2621 finalization
2622   if Assigned(GfxBase) then
2623     CloseLibrary(GfxBase);
2624 END. (* UNIT GRAPHICS *)
2625 
2626 
2627 
2628 
2629 
2630 
2631