R-11: DISPLAY LIBRARY COMMANDS 

The new display library is an alternative to the slice library. Instead of extending
the slice library for AGA support a completely new display library has been
developed.

Besides support for extended sprites, super hires scrolling and 8 bitplane displays
a more modular method of creating displays has been implemented with the use of
CopLists. CopLists need only be initialised once at the start of the program.
Displays can then be created using any combination of CopLists. Most importantly the
CreateDisplay command does not allocate any memory avoiding any memory fragmenting
problems. The new display library is for non-AGA displays also.

To create displays the InitCopList command is used to allocate memory for what were
up till now known as Slices. A display is then created by LINKing one or more of
these coplists together into a single display.

With many of the new AGA modes sprite DMA has been screwed up something severe.
Those wanting to use 8 bitplanes and 8 sprites in lores will be disapointed to hear
that their displays must be modified to some 256 pixels across.

The way the Amiga fetches data for each scanline is also a little different with the
AGA machines. The effect is that displays have to be created more to the right than
usual so the system has time to fetch sprites.


InitCopList CopList#,ypos,height,type,sprites,colors,customs 

InitCopList is used to create a CopList for use with the CreateDisplay command.

The ypos and height parameters define the vertical section of the screen the display
will take up.

Sprites, Colors and Customs will allocate instructions for that many sprites
(always=8!) colors (yes, as many as 256!) and custom copper instructions (which need
to be allocated to take advantage of the custom commands listed at the end of this
section).

A shortened version of the InitCopList command is available that simply requires the
CopList# and the Type. From the Type it fills in the missing parameters.

As with slices several lines must be left between coplists when displaying more than
one.

The following constants make up the type patameter, add the number of bitplanes to
the total to make up the type parameter:

Type            Value 

#smoothscroll   $10     #dualplayfield   $20     #extrahalibrite   $40
#ham            $80     #lores           $000    #hires            $100
#super          $200    #loressprites    $400    #hiressprites     $800
#supersprites   $c00
#fmode0         $0000   #fmode1          $1000   #fmode2          $2000
#fmode3         $3000   #agapalette      $10000

For displays on non-AGA machines only #fmode0 and #loressprites are allowed.

More documentation, examples and fixes will be published soon for creating displays


CreateDisplay CopList#[,CopList#..] 

CreateDisplay is used to setup a new screen display with the new display library.
Any number of CopLists can be passed to CreateDisplay although at present they must
be in order of vertical position and not overlap. CreateDisplay then LINKs the
Coplists together using internal pointers. bitmaps, colours and sprites attached to
coplists are not affected


DisplayBitMap CopList#,bmap[,x,y] [,bmap[,x,y]] 

The DisplayBitMap command is similar in usage to the slice libraries' show commands.
Instead of different commands for front and back playfields and smooth scroll
options there is only the one DisplayBitMap command with various parameter options.
With AGA machines, the x positioning of lores and hires coplists uses the fractional
part of the x parameter for super smooth scrolling. The CopList must be initialised
with the smooth scrolling flag set if the x,y parameters are used, same goes tor
dualplayfield.


DisplaySprite CopList#,Sprite#,X,Y,Sprite Channel 

DisplaySprite is similar to the slice libraries ShowSprite cotnmand with the added
advantage of super hires positioning and extra wide sprite handling. See also
SpriteMode and the Usage discussion above.


DisplayPalette CopList#,Palette# [,coloroffset] 

DisplayPalette copies colour information from a Palette to the CopList specified.


DisplayControls CopList#,BPLCON2,BPLCON3,BPLCON4 

DisplayControls allows access to the more remote options available in the Amiga's
display system. The following are the most important bits from these registers
(still unpublished by Commodore!)

The default values are given at the top of the table, the parameters are exclusive
or'd with these values.

To set all the sprite color offsets to 1 so that sprite colours are fetched from
color registers 240..255 instead of 16..31 we would use the parameters:

DisplayControls 0,0,0,$ee

Bit#    BPLCON2       BPLCON3                      BPLCON4
        ($224)        ($c00)                       ($11)

15          *         BANK2 *activecolorbank       BPLAM7 ;xorithbitplane
14      ZDBPSEL2      BANK1 *                      BPLAM6 ;DMA altering
13      ZDBPSEL1      BANK0 *                      BPLAM5 ;effectivecolour
12      ZDBPSEL0      PF20F2 coloffset pfield 2    BPLAM4 ;look up
11      ZDBPEN        PF20F1                       BPLAM3
10      ZDCTEN        PF20F0                       BPLAM2
09      KILLEHB *     LOCT *palette hi/lo nibble   BPLAM1
08      RDRAM=0 *                                  BPLAM0
07      SOGEN         SPRESI *sprite res           ESPRM7 high order color
06      PF2PRI H      SPRES0 *                     ESPRM6 offset for even
05      PF2P2         BRDRBLANK border             ESPRM5 sprites
04      PF2P1         BRDNTRAN zd=border           ESPRM4
03      PFIP0                                      OSPRM7 hiorder color
02      PFIP2         ZDCLCKEN zd= 14mhz           OSPRM6 offset for odd
01      PFIP1         BRDSPRT spritesinborders!    OSPRM5 sprites
00      PFIP0         EXTBLKEN blank output?       OSPRM4


! = Don't touch
H - See standard hardware reference manual
* - controlled by display.library
ZD- any reference to ZD is only a guess (just sold my genlock)


DisplayAdjust CopList#,fetchwid,ddfstrt,ddfstop,diwstrt,diwstop 

Temporary control of display registers until I get the widthadjust parameter working
with InitCopList. Currently only standard width displays are available but you can
modify the width manually (just stick a screwdriver in the back of your 1084) or
with some knowledge of Commodores AGA circuitry. Ha ha ha. No to be quite serious I
really do not have a clue how they cludeged up the Amiga chip set. When ECS was
introduced suddenly all display fetching moved to the right. Now they seem to have
done the same to sprites so it is near impossible to have them all going without
limiting yourself to a seriously thin display.

If you hack around with the system copperlists you'll find they actually change
fetch modes as you scroll a viewport across the display and

Commodore say you should not use sprites anyway so as to be compatible with their
new hardware which is rumoured to run WindowsNT, yipeee. By then we will be
hopefully shipping the Jaguarlib for Blitz. (close than you think)...


CustomColors CopList#,CCOffset,YPos,Palette,startcol,numcols 

Using the custom copper space in a display, CustomColors will alter the displays
palette at the given YPos. The number of customcops required is either 2+numcols for
ECS displays and 2+n+n+n/16 for AGA displays. In AGA, numcols must be a multiple of
32.

Note that large AGA palette changes may take several lines of the display to be complete.


CustomString CopList#,CCOffset,YPos,Copper$ 

CustomString allows the user to insert their own copper commands (contained in a
string) into the display's copper list at a given vertical position. The amount of
space required is equal to the number of copper instructions in the Copper$ (length
of string divide by 4) plus 2 which of course have to be allocated with InitCopList
before CustomString is used.


CustomSprites Coplist#,CCOffset,YPos,NumSprites 

CustomSprites inserts a copper list that reinitialises the sprites hardware at a
certain vertical position in the display. These lower sprites are assigned sprite
numbers of 8..15. CustomCops required = 4 x numsprites + 2


DisplayDblScan mode 

DisplayDblScan is used to divide the vertical resolution of the display by 2,4,8 or
16 using Modes 1,2,3 and 4. This is most useful for fast bitmap based zooms. A Mode
of 0 will return the display to 100% magnification.

As with the DisplayRainbow, DisplayRGB, DisplayUser and DisplayScroll commands
DisplayDblScan uses the new line by line copper control of the display library. To
initialise this mode a negative parameter is used in the CustomCops parameter of the
InitCopList command. DisplayDblScan requires 2 copper instructions per line (make
CustomCops=-2).


DisplayRainbow CopList#,Register,Palette[,copoffset] 

DisplayRainbow is used to alter a certain colour register vertically down a display.
It simple maps each colour in a palette to the coresponding vertical position of the
display. ECS displays require one copper instruction per line while AGA displays
require 4.


DisplayRGB CopList#,Register,line,r,g,b[,copoffset] 

DisplayRGB is a single line version of DisplayRainbow allowing the programmer to
alter any register of any particular line. As with DisplayRainbow ECS displays
require 1 copper instruction while AGA requires 4.


DisplayUser CopList#,Line,String[,Offset] 

DisplayUser allows the programmer to use their own Copper$ at any line of the
display. Of course copper instructions have to be allocated with the number of
copper instructions in the InitCoplist multiplied by - 1.


DisplayScroll CopList#,&xpos.q(n),&xpos.q(n)[,Offset] 

DisplayScroll allows the program to dynamically display any part of a bitmap on any
line of the display. DisplayScroll should always follow the DisplayBitMap command.
The parameters are two arrays holding a list of xoffsets that represent the
difference in horizontal position from the line above. AGA machines are able to use
the fractional part of each entry for super hiresolution positioning of the bitmap.
Three instructions per line are required for the DisplayScroll command.