home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / CBMDevKit1.dms / CBMDevKit1.adf / tutorials.lha / tutorials / V39_AA_Graphics < prev    next >
Encoding:
Text File  |  1993-11-04  |  29.4 KB  |  693 lines

  1.             Overview of V39 Graphics
  2.  
  3.   (c) Copyright 1992-93 Commodore-Amiga, Inc.  All Rights Reserved
  4.  
  5. The Advanced Amiga Chip set (AA) redefines graphics performance on the
  6. Amiga  by adding many new display modes, new features and more color to
  7. the Amiga  platform. This article presents an overview of how the new
  8. V39 graphics  library has implemented theses new features in the system
  9. software.
  10.  
  11. In V39, the graphics library has changed in the following areas:
  12.  
  13.    o  Support for new AA display modes
  14.    o  Double buffering
  15.    o  Retargettable sprite and screen (ViewPort) functions
  16.    o  Palette sharing
  17.    o  Bitmap functions
  18.    o  Interleaved BitMaps
  19.    o  Display mode promotion, coercion and selection
  20.    o  RTG compatible RastPort functions.
  21.  
  22. The original Amiga graphics library exposed many device-dependent
  23. details to the application programmer.  Because of this, introduction
  24. of new graphics devices has been slowed, and application support of new
  25. features has been delayed.  To reverse this trend, no features have
  26. been added to the new graphics system which cannot be kept for the
  27. future.  Thus, when newer graphics systems are introduced, system
  28. software will need fewer changes, and applications will be ready to
  29. automatically use new capabilities.  Thus, parameters such as number
  30. of bits per pixel, resolution, color palette size, etc., are either
  31. variable  or have been made very large.
  32.  
  33.  
  34. Compatibility
  35. =============
  36.  
  37. The AA chips are register level compatible with the old and ECS chips
  38. at boot  up time. However, when new AA modes are enabled and displayed,
  39. and a game then takes over the screen display without informing the OS
  40. of it, some registers may be in incompatible settings.
  41.  
  42. Two approaches will reduce this:
  43.  
  44.     1)  Old Programs which boot with their own custom boot block
  45. (games) will have AA features disabled unless they are specifically
  46. asked for.  This should ensure transparent compatibility for all
  47. bootable games.
  48.  
  49.     2)  It will be possible to disable AA features for non-compatible
  50. programs.  This will be  done via the "BootMenu" which is available at
  51. system boot time. New options in this menu will allow disabling of AA,
  52. disabling of ECS, and switching of PAL and NTSC.
  53.  
  54. For bootable games that want AA features, use the V39 graphics function
  55. SetChipRev().  This lets you upgrade the Amiga to be any chip revision
  56. you  need, and handles the extra house-keeping that graphics needs to
  57. operate the  selected chipset (such as updating the graphics database).
  58. The only  restriction is that it is not possible to downgrade the
  59. setting from AA  down to ECS or A.
  60.  
  61.  
  62. Get/Set Functions
  63. =================
  64.  
  65. This release of graphics.library will attempt to ease the (future)
  66. transition to Retargetable Graphics.  New functions are provided to do
  67. some operations in a more device-independent manner.  This will help
  68. when we have to support foreign graphics devices, more than 8 bits per
  69. pixel, chunky pixels, and true-color displays.
  70.  
  71. These new "Get/Set" functions will allow device independent access to
  72. fields in the RastPort structure which were only previously manipulable
  73. by direct structure access.
  74.  
  75.  
  76. VOID  SetAPen(rp, pen)   Sets the current APen value
  77. ULONG GetAPen(rp)        Return current APen value
  78. VOID  SetBPen(rp, pen)   Sets the current BPen value
  79. ULONG GetBPen(rp)        Return current BPen value
  80. VOID  SetDrMd(rp, mode)  Sets the current DrawMode
  81. ULONG GetDrMd(rp)        Return current DrawMode
  82. VOID  SetOPen(rp,c)      Was a macro. Now use the SetOutlinePen()
  83.                          function, or the SafeSetOutlinePen() macro.
  84. ULONG GetOPen(rp)        Return current area outline pen
  85. VOID  SetWrMsk(rp,m)     Was a macro. Now use the SetWriteMask()
  86.                          function, or the SafeSetWriteMask() macro.
  87. ULONG GetWrMsk(rp)       Description of this function is left as an
  88.                          exercise for the reader.
  89.  
  90. VOID  SetABPenDrMd(rp,apen,bpen,drmd)
  91.          Sets the APen, BPen, and DrawMode for a RastPort. Faster than
  92. separate calls.
  93.  
  94. VOID  SetRPAttr(rp,taglist)
  95.          You asked for it so here it is. Lets you set many of the
  96. RastPort attributes with one tag-based call. Here are the attributes
  97. currently supported:
  98.  
  99.        RPTAG_Font        Font for Text() RPTAG_SoftStyle style for text
  100.                          (see graphics/text.h)
  101.        RPTAG_APen        Primary rendering pen
  102.        RPTAG_BPen        Secondary rendering pen
  103.        RPTAG_DrMd        Drawing mode (see graphics/rastport.h)
  104.        RPTAG_OutLinePen  Area Outline pen
  105.        RPTAG_WriteMask   Bit Mask for writing.
  106.        RPTAG_MaxPen      Maximum pen to render (see SetMaxPen())
  107.  
  108.  
  109. VOID GetRPAttr(rp, taglist)
  110.         No prizes for guessing what this does. It supports the extra
  111. tag RPTAG_DrawBounds. This tag is passed with a pointer to a rectangle
  112. structure. The returned rectangle structure will contain the bounds of
  113. the clipping regions inside the RastPort. This can be used to optimize
  114. drawing and refresh.
  115.  
  116.  
  117. Color Map Functions
  118. ===================
  119.  
  120. The color palette in AA is different in a lot of ways from the ECS one:
  121.  
  122.    o  It has 24 bits per entry, plus one bit to select transparency.
  123.    o  There are 256 entries which is enough for many programs running
  124. on the same screen to share the palette.
  125.  
  126. All colors are now specified as 32 bit left-justified fractions, and
  127. are truncated based upon the number of bits that the hardware is
  128. capable of displaying.
  129.  
  130. There are now ...RGB32() functions to replace the ...RGB4() functions.
  131. These all work in 32-bits per gun, irrespective of the device the
  132. colors are intended for. Devices that cannot handle the color
  133. resolutions will truncate the colors to the most significant n bits.
  134. That is why it is important to duplicate the most significant n bits
  135. throughout the 32-bit resolution. For example, pure white should be
  136. treated as:
  137.  
  138.          R = 0xffffffff, G = 0xffffffff, B = 0xffffffff
  139.  
  140. and not
  141.  
  142.          R = 0xf0000000, G = 0xf0000000, B = 0xf0000000
  143.  
  144. The new color palette functions allow for multiple applications to
  145. coordinate their access to the palette.  This allows applications to,
  146. for instance, dynamically remap pictures to match the color palette of
  147. the Workbench screen, display animations in windows, etc.
  148.  
  149. ObtainPen() will attempt to obtain a free palette entry for use by your
  150. program, and then set the pen number to the RGB value you specify. A
  151. pen can be either shared or exclusively for your own use. If shared,
  152. then you should not modify the RGB value of the pen once the pen is
  153. obtained, because other applications may use that same pen, and will be
  154. relying on its color.
  155.  
  156. ObtainBestPen() is a tag-based function that will attempt to find the
  157. pen in the ColorMap which is closest to the specified RGB value, and
  158. then return a shared pen to you. There are (currently) four levels of
  159. precision to which the RGB value must match. PRECISION_EXACT asks for
  160. an exact match of the RGB value. The other three are, in descending
  161. order of precision, PRECISION_IMAGE, PRECISION_ICON, and PRECISION_GUI.
  162. If there is no pen in the ColorMap with the required RGB value to the
  163. specified precision, and there are unallocated pens, then a new pen is
  164. reserved as shared, and its RGB value set to the value you requested.
  165.  
  166. Note, there is no way to physically stop you from changing the colors
  167. of shared pens, but it's just not done, so don't do it.  Pens obtained
  168. either with ObtainPen() or ObtainBestPen() should be released back to
  169. the system with ReleasePen() when no longer used.
  170.  
  171. All the palette-sharing functions require a struct PalExtra to be
  172. attached to the ColorMap. This is done automatically for all Intuition
  173. screens, but if you are not using Intuition, then you will need to call
  174. AttachPalExtra() yourself. This allocates and attaches a PalExtra
  175. structure to the ColorMap. The PalExtra is deallocated by the
  176. FreeColorMap() function.
  177.  
  178. FindColor(cm,r,g,b,maxcolor) lets an application find the "closest"
  179. color to a given RGB value, independently of palette sharing. In fact,
  180. using SetRGB32CM and FindColor, you can perform color matching which is
  181. not associated with a display at all.
  182.  
  183.  
  184. Bitmap Functions
  185. ================
  186.  
  187. These function exist because the new AA chips have alignment
  188. restrictions in high bandwidth modes.  Changing InitBitMap() and
  189. AllocRaster() to obey these restrictions would have been very
  190. incompatible.  Bitmaps created by AllocRaster with a multiple of 32 or
  191. 64 pixels per line will be compatible with high fetch modes (2x or 4x
  192. respectively). Incompatible ones will fall back to 1x mode, if 1x mode
  193. is capable of displaying the screen.
  194.  
  195. AllocBitMap() allocates an entire bitmap structure, and the display
  196. memory for it. AllocBitMap() allows you to use more than 8 planes, and
  197. also allows you to specify another bitmap pointer, thus telling the
  198. system to allocate the bitmap to be "like" another bitmap.  A bitmap
  199. allocated in such a matter may be able to blit to this bitmap faster.
  200. Such a bitmap may be stored in a foreign device's local memory.  Do not
  201. assume anything about the structure of a bitmap allocated in this
  202. manner.  The size of a bitmap structure is subject to change in future
  203. graphics releases.  Thus, you should use AllocBitMap()/FreeBitMap() for
  204. your raster allocation.
  205.  
  206.  
  207. Sprite Functions
  208. ================
  209.  
  210. Graphics sprite functions (MoveSprite()) have been extended to
  211. understand large sprites, selectable sprite pixel resolution, and
  212. movement of scan-doubled sprites. Sprite positioning is no longer
  213. rounded down to lo-res pixel resolution.  Applications will no longer
  214. have to "know" about the hardware-dependent format of sprite data.
  215.  
  216. The new sprite functions work with an ExtSprite structure, which is
  217. obtained with the tag-based AllocSpriteData() function. This function
  218. allows you to specify a BitMap for the image of the sprite, and tags to
  219. specify scaling factors to apply to the BitMap. The returned ExtSprite
  220. structure is then passed to GetExtSprite(), which is the V39 equivalent
  221. of the old GetSprite() function. There is no equivalent FreeExtSprite(0
  222. function; FreeSprite() does the trick. The ExtSprite allocated with
  223. AllocSpriteData() is freed with FreeSpriteData().
  224.  
  225. The AA chip set imposes some limitations on sprites:
  226.  
  227.    o  All sprites in a ViewPort will be of the same resolution and
  228. width. There is no individual sprite resolution/width control. If the
  229. sprite you allocate is of a different width than Intuition's pointer,
  230. then Intuition is notified, and takes the appropriate steps to maintain
  231. the pointer imagery.
  232.  
  233.    o  In the programmable beam modes (namely Multiscan, Euro72,
  234. DblNTSC, DblPAL, and Super72), only sprite 0 is likely to be available;
  235. the other sprites are lost to bitplane DMA. MakeVPort() has code that
  236. detects which sprites have been reserved (with GetSprite() or
  237. GetExtSprite()), and if possible, will drop the display bandwidth. This
  238. will make available more DMA to the lower numbered sprites, at the
  239. expense of more bitplane DMA access. MakeVPort() will not drop the
  240. bandwidth if doing so would cause the loss of bitplanes in the display,
  241. so this is not always guaranteed to work for you.
  242.  
  243. All the AA sprite features are available through new tags for
  244. VideoControl():
  245.  
  246. VTAG_SPEVEN_BASE_SET/GET
  247.       This sets the base color number of the even numbered sprites. The
  248. AA chip set allows  odd numbered and even numbered sprites to use the
  249. colors of different 16-color banks, as    opposed to the previous chip
  250. sets where all sprites used colours 16-31. Legal values to set the base
  251. are 0-255, but will be rounded down to the nearest multiple of  16.
  252.  
  253. VTAG_SPODD_BASE_SET/GET
  254.       As VTAG_SPEVEN_BASE_SET/GET, only for the odd numbered sprites.
  255. For example, if the following tag list is passed to VideoControl():
  256.  
  257.       struct TagItem[] = { {VTAG_SPEVEN_BASE_SET, 32},
  258.                            {VTAG_SPODD_BASE_SET, 144}, {TAG_DONE}, };
  259.  
  260. then the sprites use the following colors:
  261.  
  262.         Sprite          Colors
  263.            0               32 (transparent), 33,34,35
  264.            2               36 (transparent), 37,38,39
  265.            4               40 (transparent), 41,42,43
  266.            6               44 (transparent), 45,46,47
  267.  
  268.            1               144 (transparent), 145,146,147
  269.            3               148 (transparent), 149,150,151
  270.            5               152 (transparent), 153,154,155
  271.            7               156 (transparent), 157,158,159
  272.  
  273. [Attached sprites use the palette settings of the odd numbered sprites.]
  274.  
  275. Normally, there are only (2 << depth) colours in a ColorMap (with the
  276. exception that Intuition screens always have a minimum of 32 colours).
  277. If you wish to set the sprite's colors to use pens that are outside of
  278. this range, then you should use the VTAG_FULLPALETTE_SET tag, which
  279. specifies that the ColorMap should contain entries for all possible
  280. colors (256). Therefore, the colors of these entries can be set with
  281. the usual ...RGB32() functions. Not setting VTAG_FULLPALETTE_SET in
  282. this case may cause unpredictable colors and enforcer hits.
  283.  
  284. VTAG_SPRITERESN_SET/GET
  285.       This allows you to set all the sprites in the ViewPort to one of
  286. 5 resolutions.
  287.  
  288.       SPRITERESN_140NS:    All sprites have 140ns pixels.
  289.       SPRITERESN_70NS:     All sprites have 70ns pixels.
  290.       SPRITERESN_35NS:     All sprites have 35ns pixels.
  291.       SPRITERESN_DEFAULT:  All sprites have the Intuition default
  292.                            resolution.
  293.       SPRITERESN_ECS:      Compatible with ECS resolutions; 140ns,
  294.                            except in 35ns display pixel modes
  295.                            (SuperHires), where the sprite pixels are
  296.                            70ns.
  297.  
  298. VTAG_DEFSPRITERESN_SET/GET
  299.       For setting the default sprite resolution, as used by
  300.       SPRITERESN_DEFAULT.
  301.  
  302. VTAG_BORDERSPRITE_SET/GET/CLR:
  303.       This sets the bordersprite option in the AA chipset for the
  304. ViewPort, which allows sprites to appear in the borders outside of the
  305. normal display window (DisplayClip), i.e., the area that is normally
  306. color 0. However, this does not apply to the horizontal blanking area.
  307.  
  308. VTAG_PF1_TO_SPRITEPRI_SET/GET:
  309.       All revisions of the Amiga chips have allowed the priorities of
  310. sprites to playfield to be set. Usually, the priority is such that the
  311. sprites always appear in front of the playfield.  There is an entry in
  312. the ViewPort structure for altering this priority, but V39 provides
  313. this tag in preference to writing to the ViewPort structure.
  314.  
  315. VTAG_PF2_TO_SPRITEPRI_SET/GET:
  316.       As VTAG_PF1_TO_SPRITEPRI_SET/GET, only for playfield 2.  On the
  317. Amiga, playfield 2 is the default playfield, and playfield 1 is only
  318. used in DualPlayfield modes!
  319.  
  320.  
  321. Display Mode IDs and the Graphics Database
  322. ==========================================
  323.  
  324. The graphics database has been extended where necessary for AA
  325. information, and these changes are limited to the DisplayInfo
  326. structure. The DisplayInfo->PaletteRange is only one WORD long, which
  327. is insufficient for the AA 24-bit colour resolution, and so has been
  328. superceded by three new entries called RedBits, BlueBits and GreenBits.
  329. These are one BYTE each, and show how many bits of precision is
  330. available for each colour gun. 255 bits each for red, green and blue
  331. should be enough for the foreseeable future (pun intended).
  332.  
  333. Some new DIPF_IS flags were added to the database, providing more
  334. information about each display mode ID.
  335.  
  336. DIPF_IS_SPRITES_ATT
  337.       shows the mode supports attached sprites. The 35ns display modes
  338. on ECS could not support them.
  339.  
  340. DIPF_IS_SPRITES_CHNG_RES
  341.       shows that the mode supports sprites that can change resolution,
  342. and so the VTAG_SPRITERESN_SET VideoControl() tag will work on
  343. ViewPorts in this mode.
  344.  
  345. DIPF_IS_SPRITES_BORDER
  346.       shows that this mode supports border sprites, so the
  347. VTAG_BORDERSPRITE_SET VideoControl() tag will work on ViewPorts in this
  348. mode.
  349.  
  350. DIPF_IS_SCANDBL
  351.       shows that this mode is scandoubled (each display line is
  352. repeated once), so that half as many lines take up the same physical
  353. area on the monitor. There should be no need for you to look at this
  354. bit.
  355.  
  356. DIPF_IS_SPRITES_CHNG_BASE
  357.       shows that this mode supports sprite base colour offset changing,
  358. so that the VTAG_SPODD/SPEVEN_BASE_SET VideoControl() tag will work on
  359. ViewPorts in this mode.
  360.  
  361. DIPF_IS_SPRITES_CHNG_PRI
  362.       shows that this mode supports changing the playfield to sprite
  363. priority, so that the VTAG_PF2/PF1_TO_SPRITEPRI_SET VideoControl() tag
  364. will work on ViewPorts in this mode.
  365.  
  366. DIPF_IS_DBUFFER
  367.       shows that this mode will work with the double-buffering Chan
  368. geVPBitMap() function. You should check this flag before using the
  369. double-bufferi ng functions on the ViewPort.
  370.  
  371. DIPF_IS_PROGBEAM
  372.       shows that this mode is a programmed beam-sync mode.
  373.  
  374. DIPF_IS_FOREIGN
  375.       shows that this mode is not native to the Amiga chip set.
  376. Currently, no mode IDs will have this flag set, but under RTG many 3rd
  377. party display devices will. You may want to start checking for this
  378. flag now.
  379.  
  380. With the plethora of new display modes that are available under V38 and
  381. V39,  it is now becoming harder and harder for both the application
  382. writer and the  end user to know which display mode ID they need to
  383. use. This will be  especially true under RTG when the application
  384. writer will have no way of  knowing all the possible display mode IDs
  385. that are available on third party  display devices. A function was
  386. added for V39 to alleviate this problem, and  provide a means by which
  387. the system can calculate the best mode ID to use  given a number of
  388. requirements, called BestModeID(). It takes the following tags:
  389.  
  390. BIDTAG_DIPFMustHave
  391.        The DIPF_ flags that this display mode ID must have set. Default
  392. is NULL, so there is no preference.
  393.  
  394. BIDTAG_DIPFMustNotHave
  395.        The DIPF_ flags that this display mode ID must not have set. For
  396. example, you may wish to ensure that only native Amiga modes are
  397. considered, so use BIDTAG_DIPFMustNotHave with DIPF_IS_FOREIGN.  The
  398. default value is defined as SPECIAL_FLAGS, which is (DIPF_IS_DUALPF |
  399. DIPF_IS_PF2PRI | DIPF_IS_HAM | DIPF_IS_EXTRAHALFBRITE) so you may need
  400. to OR your particular requirements with SPECIAL_FLAGS.
  401.  
  402. BIDTAG_ViewPort
  403.        An initializes ViewPort for which a mode ID is sought. For
  404. example, to find an interlaced version of a ViewPort:
  405.  
  406.          ID = BestModeID( BIDTAG_ViewPort, ThisViewPort,
  407.                           BIDTAG_MustHave, DIPF_IS_LACE, TAG_END);
  408.  
  409. BIDTAG_NominalWidth BIDTAG_NominalHeight
  410.        Together make up the aspect ratio of the desired mode ID. If
  411. specified, will override the Width and Height of the ViewPort passed in
  412. BIDTAG_ViewPort, or the NominalDimensionInfo of the ID passed in
  413. BIDTAG_SourceID. Defaults to 640x200.
  414.  
  415. BIDTAG_DesiredWidth BIDTAG_DesiredHeight
  416.        Nominal width and height of the returned mode ID.
  417.  
  418. BIDTAG_Depth
  419.        Mode ID must support at least this many bitplanes. Defaults to
  420. vp->RasInfo-> BitMap->Depth of the ViewPort passed in BIDTAG_ViewPort,
  421. or 1.
  422.  
  423. BIDTAG_MonitorID
  424.        The returned mode ID must belong to this monitor family.
  425. BIDTAG_SourceID
  426.        BestModeID() will use characteristics of this mode ID, and
  427. override some of the characteristics with the other values in the
  428. taglist.
  429.  
  430. BIDTAG_RedBits BIDTAG_BlueBits BIDTAG_GreenBits
  431.        The mode ID must support at least these many bits for each color
  432. gun.  Defaults to 4 bits each, so A2024 modes will not be considered.
  433.  
  434. As an example of its use, here is a portion of the code for the V39
  435. CoerceMode() function (which is used by Intuition when coercing
  436. screens):
  437.  
  438. ULONG CoerceMode(struct ViewPort *vp, ULONG MonitorID, ULONG Flags) {
  439. ...
  440.         /* Coerce the ViewPort vp to the best fit ModeID in the monitor
  441.          * MonitorID.
  442.          */
  443.         must = NULL;
  444.         mustnot = SPECIAL_FLAGS;
  445.         tag[t].ti_Tag = BIDTAG_ViewPort;
  446.         tag[t++].ti_Data = vp;
  447.         tag[t].ti_Tag = BIDTAG_MonitorID;
  448.         tag[t++].ti_Data = MonitorID;
  449.  
  450.         if (GetDisplayInfoData(NULL, (APTR)&dinfo,
  451.                            sizeof(struct DisplayInfo), DTAG_DISP, ID))
  452.         {
  453.             must = (dinfo.PropertyFlags & SPECIAL_FLAGS);
  454.             mustnot = (SPECIAL_FLAGS & ~must);
  455.             if ((Flags & AVOID_FLICKER) && (!(dinfo.PropertyFlags &
  456.                         DIPF_IS_LACE)))
  457.                 {
  458.                  /* we don't want lace if AVOID_FLICKER is set,
  459.                   * and this ViewPort is not naturally laced.
  460.                   */
  461.                 mustnot |= DIPF_IS_LACE;
  462.                 }
  463.  
  464.                 tag[t].ti_Tag = BIDTAG_RedBits;
  465.                 tag[t++].ti_Data = dinfo.RedBits;
  466.                 tag[t].ti_Tag = BIDTAG_GreenBits;
  467.                 tag[t++].ti_Data = dinfo.GreenBits;
  468.                 tag[t].ti_Tag = BIDTAG_BlueBits;
  469.                 tag[t++].ti_Data = dinfo.BlueBits;
  470.         }
  471.  
  472.         tag[t].ti_Tag = BIDTAG_DIPFMustNotHave;
  473.         tag[t++].ti_Data = mustnot;
  474.         tag[t].ti_Tag = BIDTAG_DIPFMustHave;
  475.         tag[t++].ti_Data = must;
  476.         tag[t].ti_Tag = TAG_DONE;
  477.  
  478.         return(BestModeIDA(tag));
  479. }
  480.  
  481. As another example, consider an IFF display program with a HAM image,
  482. to be displayed in the same monitor type as the Workbench ViewPort.
  483.  
  484. ID = BestModeID(BIDTAG_NominalWidth, IFFImage->Width,
  485.                 BIDTAG_NominalHeight, IFFImage->Height,
  486.                 BIDTAG_Depth, IFFImage->Depth,
  487.                 BIDTAG_DIPFMustHave, DIPF_IS_AM,
  488.                 BIDTAG_MonitorID, (GetVPModeID(WbVP) & MONITOR_ID_MASK),
  489.                 TAG_END);
  490.  
  491. The definitions of the display mode ID keys have been moved from
  492. <graphics/displayinfo.h> to a new <graphics/modeid.h> file.
  493.  
  494. The include file <graphics/modeid.h> specifically says that the
  495. individual  bits of the mode IDs should not be checked for any meaning,
  496. but that the  database should be read to glean information about the
  497. mode ID. In order to  maintain compatibility with old software, and
  498. make the application writer's  job somewhat easier, I am willing to
  499. guarantee that any mode ID with the bit  0x00000800 set is a HAM mode,
  500. and any mode ID with the bit 0x00000080 set is  an ExtraHalfBrite mode.
  501. These are the only bits that are guaranteed to mean  anything in the
  502. mode ID itself. These bits correspond of course to the HIRES  and
  503. EXTRA_HALFBRITE definitions in <graphics/view.h>.
  504.  
  505.  
  506. Display Mode Promotion
  507. ======================
  508.  
  509. Promotion is a software solution for the lack of hardware deinterlacing
  510. circuitry on the AA machines. With the promotion feature enabled in
  511. Icontrol, the default monitor (NTSC on NTSC machines, PAL on PAL
  512. machines), becomes DblNTSC on NTSC machine and DblPAL on PAL machines.
  513. There are a number of advantages and gotchas with this approach.
  514.  
  515. One advantage is that the graphics database is always truthful. Any
  516. enquiries  about a default monitor mode ID will yield information
  517. relevant to whatever  the default monitor happens to be at the time.
  518. This should not be a problem  for any code written for V37 onwards, as
  519. the default monitor has always been  either NTSC or PAL; now, there are
  520. just more possibilities.
  521.  
  522. Another advantage is that V39-aware software that requires NTSC or PAL
  523. modes (e.g., video titling software), can now get such modes using
  524. specific NTSC or PAL mode IDs.
  525.  
  526. Here is a list of "gotchas" (that is, things to watch out for if you
  527. want display mode promotion to work correctly).
  528.  
  529.    1) The default monitor is dynamic, and can change at any time.
  530. Therefore, do not cache any information about the default mode IDs,
  531. but read them from the  database as you need them.
  532.    2) There is no equivalent in the Dbl... monitors to the SuperHires
  533. modes. The database LVOs sniff out SuperHires mode IDs for database
  534. enquiries, and map SuperHires mode IDs to the equivalent Dbl... Hires
  535. mode IDs if promotion is enabled.
  536.    3) Programs that rely on copper timings for UserCopperlists, such as
  537. SHAM displayers, may no longer work when promoted, because each line is
  538. shorter in time than the NTSC/PAL line. Therefore, there are less
  539. coppercycles per line.
  540.    4) Promoted ViewPorts have less sprites available than non-promoted
  541. ViewPorts.
  542.    5) For compatibility, we do not promote 1.3 style custom ViewPorts
  543. and Views (we check for the presence of a ViewExtra).
  544.  
  545.  
  546. Miscellaneous
  547. =============
  548.  
  549. Interleaved screens have been added.  These use a different layout of
  550. the graphics data in order to speed rendering operations and eliminate
  551. the annoying "color-flash" problem which is the hallmark of planar (as
  552. opposed to "chunky") display architectures. Set the BMF_INTERLEAVED
  553. flag when calling AllocBitMap().
  554.  
  555. Double buffering functions have been added.  These allow applications
  556. to display very smooth, synchronized animation in fully an efficient
  557. "Intuition-friendly" manner. Call AllocDBufInfo() to allocate and
  558. initialize the DBufInfo structure, which is then passed to
  559. ChangeVPBitMap(). The double-buffering functions return up to two
  560. different types of messages.  The first (dbi_SafeMessage) tells your
  561. program when it is safe to write to the old BitMap. The second
  562. (dbi_DispMessage) is sent when it is safe to call ChangeVPBitMap()
  563. again and be certain the new bitmap has been seen for at least 1 field.
  564. The autodocs for AllocDBufInfo() has example code showing how to safely
  565. double buffer with ChangeVPBitMap().
  566.  
  567. The DBufInfo structure should be freed with the FreeDBufInfo() function.
  568.  
  569. Due to the extra colours that need to be loaded in deeper AA screens,
  570. the gap between screens can now be greater than the three lines that
  571. Intuition traditionally kept.  In fact, the number of lines between
  572. screens is variable, depending on the screen type and depth.  A new
  573. function CalcIVG() (CalcInterViewPortGap) has been added to calculate
  574. the number of lines required by the copper to execute all the copper
  575. instructions before the display window is opened.  Note however that
  576. CalcIVG() returns the true number of lines (rounded up to the next
  577. whole line) needed in ViewPort resolution units, but Intuition still
  578. maintains a gap of at least three lines between Screens. Therefore,
  579. when calling CalcIVG() to position screens in an Intuition environment,
  580. use the result of MAX((laced ?  6 :  3), CalcIVG(v, vp)).
  581.  
  582. There is one other caveat with respect to CalcIVG().  This function
  583. works by counting the number of copper instructions in the
  584. ViewPort->DspIns list, which is set up by MakeVPort().  If an Intuition
  585. screen is opened behind, then MakeVPort() is not called on that
  586. screen's ViewPort until it first becomes visible, so calling CalcIVG()
  587. with that screen's ViewPort will yield a result of 0.
  588.  
  589. Some operations have been sped up:  RectFill() has been rewritten,
  590. WritePixel() uses the CPU (3x speedup) ScrollVPort is 10 times faster,
  591. and other optimizations.
  592.  
  593.  
  594. Bugs and Anomalies
  595. ==================
  596.  
  597. There is a big bug in the V37-V39 graphics hash-table code, which is
  598. used to associate a ViewExtra with a View; namely, only 8 Views can
  599. have ViewExtras attached to them. This has been fixed in the latest
  600. SetPatch and Kickstart.
  601.  
  602. ScrollVPort() and ChangeVPBitMap() have problems with 8-bit HAM mode.
  603. This has been SetPatch'ed.
  604.  
  605. Many other outstanding bugs have been fixed for V39.
  606.  
  607.  
  608.  
  609. Table:  New AA Modes (In Addition to Modes Supported by ECS)
  610.  
  611.  
  612. Mode            Planes    Colors            Bandwidth (See note 1)
  613. ----            ------    ------            ----------------------
  614. LORES (320x200)        6    64                1
  615.             7    128                1
  616.             8    256                1
  617.             8    HAM 256,000+ (see note 2)    1
  618.  
  619. HIRES (640x200)        5    32                2
  620.             6    EHB 64 (see note 3)        2
  621.             6    HAM 4096 (see note 4)        2
  622.             6    64                2
  623.             7    128                2
  624.             8    256                2
  625.             8    HAM 256,000+ (see note 2)    2
  626.  
  627. SUPERHIRES (1280x200)
  628.             1    2 (see note 5)            1
  629.             2    4 (see note 5)            1
  630.             3    8                2
  631.             4    16                2
  632.             5    32                4
  633.             6    EHB 64 (see note 3)        4
  634.             6    HAM 4096 (see note 4)        4
  635.             6    64                4
  636.             7    128                4
  637.             8    256                4
  638.             8     HAM    256,000+ (see note 2)    4
  639.  
  640. VGA  (160,320,640x480 non-int.)
  641.             1    2 (see note 5)            1
  642.             2    4 (see note 5)            1
  643.             3    8                2
  644.             4    16                2
  645.             5    32                4
  646.             6     EHB 64 (see note 3)        4
  647.             6     HAM 4096 (see note 4)        4
  648.             6    64                4
  649.             7    128                4
  650.             8    256                4
  651.             8     HAM 256,000+ (see note 2)    4
  652.  
  653. Notes:
  654. 1 - The "Bandwidth" number describes the amount of fetch bandwidth required
  655. by a particular screen mode.  For example, a 5 bit deep VGA screen requires
  656. the 4x bandwidth fetch mode while a 1 bit VGA screen requires only the 1x
  657. mode..  This translates to the hardware having to move data 4 times faster.
  658. To be able to move data at these higher rates, the higher bandwidth modes
  659. require data to be properly aligned in CHIP memory that is fast enough to
  660. support the bandwidth.  Specifically, bandwidth fetch mode factors of 1
  661. require data to be on 16 bit boundaries, factors of 2 require 32 bit
  662. boundaries, and factors of 4 require 64 bit boundaries.  Restrictions like
  663. these are the best reason to use the system allocation functions whenever
  664. data is being prepared for the custom hardware.  It is not guaranteed that
  665. all machines that have the new chipset will also have memory fast enough
  666. for the 4x modes.  Therefore, the ONLY way to know whether or not the
  667. machine will support the mode you want is to check the Display Database.
  668.  
  669. 2 - New 8 bit HAM mode uses the upper 6 bits for 64 24-bit base register
  670. colors or as a 6 bit modify value, plus the lower 2 bits for 18 bit hold or
  671. modify mode control.  This mode could conceivably allow simultaneous
  672. display of more than 256,000 colors (up to 16.8 million, presuming a
  673. monitor / screenmode with enough pixels.)  Please note that while the
  674. register planes and control planes are internally reversed in 8 bit HAM
  675. (the control bits are the two LSBs instead of the two MSBs),  programs
  676. using graphics.library and intuition.library (i.e. Screens, BitMaps)
  677. will not have to deal with this reversal, as it will be handled
  678. automatically for them.
  679.  
  680. 3 - This is like the original EHB mode, but in new resolutions.  It uses 5
  681. bits to yield 32 register colors, plus a sixth bit for 32 colors that are
  682. 1/2 as bright.
  683.  
  684. 4 - This is like the original 6 bit Ham mode, but in new resolutions.  It
  685. uses the lower 4 bits for 16 register colors, plus the upper 2 bits for
  686. modify mode control.  This mode allows  simultaneous display of 4096
  687. colors.
  688.  
  689. 5 - These modes are unlike the old VGA and SUPERHIRES modes in that they
  690. are not restricted to a nonstandard 64 color palette.
  691.  
  692.  
  693.