displaylib
The display library builds the picture of a Blitz mode program from
copper lists, the programs of the Amiga’s copper chip. A copper list
is a Blitz object, numbered from 0, called a CopList. InitCopList
sets one up for a part of the screen: its position and height, the
number of bitplanes, the resolution and the sprites and colours it
can show. CreateDisplay shows one or more of them, from top to
bottom. DisplayBitMap, DisplaySprite and DisplayPalette then
put bitmaps, sprites and colours into the lists; they take effect at
once, also while the display is shown.
BitMap 0,320,256,5
LoadBitMap 0,"picture.iff",0
InitCopList 0,44,256,5,8,32,0
BLITZ
CreateDisplay 0
DisplayPalette 0,0
DisplayBitMap 0,0The type of InitCopList is the number of bitplanes plus these
values:
| Value | Meaning |
|---|---|
| $10 | smooth scrolling: DisplayBitMap with a position |
| $20 | dual playfield, two bitmaps |
| $40 | extra half brite, 32 colour registers |
| $80 | hold and modify (HAM) |
| $000, $100, $200 | low, high or super high resolution |
| $400, $800, $C00 | low, high or super high resolution sprites |
| $0000, $1000, $2000, $3000 | fetch mode 0 to 3 |
| $10000 | 24 bit (AGA) palette |
Without the AGA chip set, only fetch mode 0 and low resolution sprites work.
A copper list can also have room for custom copper instructions,
given by numcustoms in InitCopList. A positive number reserves that
many instructions in one block, which CustomColors, CustomString,
CustomSprites and CustomChunky fill at a line of their choice,
CCOffset instructions into the block. A negative number reserves that
many instructions on every line, for the line by line effects
DisplayDblScan, DisplayRainbow, DisplayRGB, DisplayUser and
DisplayScroll. The comment after a command’s form tells how many
instructions it needs, as ecs and aga counts where they differ.
With runtime error checking, a CopList that is not initialised is the error “Uninitialised CopList”. A command that needs more custom instructions than there are is the error “Not Enough Custom Cops” or “Not Enough Custom Copper Space”, also without runtime error checking.
Based on the displaylib guide by Acid Software.
Library number 143. It manages CopList objects, by default at most 10 (the compiler options set the maximum).
Commands
CopList
The object of a copper list for a part of the display, as the introduction describes.
Object name. No help text.
CreateDisplay
Shows one or more copper lists, linked one after the other. Give them in the order of their position on the screen; they must not overlap. Blitz mode only.
Statement. Help text: CopList#[,CopList#..]
Arguments: { .w }...
The bitmaps, colours and sprites already in the lists stay as they are.
CustomChunky
Makes a chunky area of width by height blocks from line YPos on, each block a colour register changed by the copper, res lines high; with splitpos, the area is split into two parts. AGA only.
Statement. Help text: CopList#,CCOffset,YPos,width,height,res[,splitpos] ;4n+2
2 forms:
.w, .w, .w, .w, .w, .w.w, .w, .w, .w, .w, .w, .w
CustomChunkySize gives the number of custom instructions it needs.
YPos must not be lower than res, else this is the error
“CustomChunky must start at ypos greater than res”.
CustomChunkySize
The number of custom copper instructions CustomChunky needs for an area of width by height.
Function, result .l. Help text: width,height
Arguments: .w, .w
CustomColors
Changes numcols colours from startcol on to those of a palette at line YPos, through the custom copper instructions from CCOffset on. An ECS list needs 2+n instructions, an AGA list 2+n+n+n/16.
Statement. Help text: CopList#,CCOffset,YPos,Palette,startcol,numcols[,thru256flag] ;ecs=2+n aga=2+n+n+n/16
2 forms:
.w, .w, .w, .w, .w, .w, .w.w, .w, .w, .w, .w, .w
Give thru256flag when the copper instructions of the change run on
past line 255 (a large AGA palette change can take several lines of
the display): the custom commands after it then add no second wait
for line 255. A thru256flag of 0 is the same as leaving it out.
CustomSprites
Sets up NumSprites further sprites from line YPos on, through the custom copper instructions; DisplaySprite shows them on the channels after the list’s own sprites, 8 to 15 for a list with 8. It needs 4n+2 instructions.
Statement. Help text: CopList#,CCOffset,YPos,NumSprites ;4n+2
Arguments: .w, .w, .w, .w
CCOffset counts copper instructions, as for CustomColors and
CustomString. Channels that show no sprite show an empty one.
CustomString
Puts the copper instructions in Copper$, four bytes each, at line YPos, through the custom copper instructions from CCOffset on.
Statement. Help text: CopList#,CCOffset,YPos,Copper$ ;2+n {n=len(a$)/4}
Arguments: .w, .w, .w, $
A string that is empty or whose length is not a multiple of 4 is the error “Custom Copper String Must Be Multiple Of 4 Bytes Silly!”.
DisplayAdjust
Adds the values given to the fetch width and to the data fetch (DDFSTRT, DDFSTOP) and display window (DIWSTRT, DIWSTOP) registers of a copper list, for displays wider or narrower than the standard.
Statement. Help text: CopList#,fetchwid,ddfstrt,ddfstop,diwstrt,diwstop
Arguments: .w, .w, .w, .w, .w, .w
DisplayBitMap
Shows a bitmap, or two bitmaps for a dual playfield list, in a copper list, at the position x,y of the bitmap if it is given.
Statement. Help text: CopList#,bmap[,x,y] [,bmap[,x,y]]
4 forms:
.w, .w.w, .w, .q, .w.w, .w, .w.w, .w, .q, .w, .w, .q, .w
The position needs a list with smooth scrolling in its type. With
the AGA chip set, the fractional part of x scrolls low and high
resolution lists in finer steps than a pixel.
DisplayControls
Changes the control registers BPLCON2, BPLCON3 and BPLCON4 of a copper list. The values are combined by exclusive or with the values the list has.
Statement. Help text: CopList#,BPLCON2,BPLCON3,BPLCON4
Arguments: .w, .w, .w, .w
The lists start with BPLCON2 = $224 (without bit 9 for extra half brite), BPLCON3 = $C00 (plus the sprite resolution bits of the type) and BPLCON4 = $11. BPLCON2 sets the priority of playfields and sprites, BPLCON3 the colour bank and the colour offset of the second playfield, and BPLCON4 the colour offsets of the sprites and of the bitplanes. For example, this fetches the sprite colours from registers 240 to 255 instead of 16 to 31:
DisplayControls 0,0,0,$EEThe bits are those of the AGA chip set; the Amiga hardware documentation describes them.
DisplayDblScan
Repeats the lines of the bitmap shown, to zoom the display vertically; mode 0 switches it off, mode 1 shows every line twice, and the higher modes repeat lines more often. It needs 2 line by line instructions.
Statement. Help text: CopList#,Mode[,copoffset] ;2
2 forms:
.w, .w.w, .w, .w
Set up the list with a negative numcustoms in InitCopList, for
example -2. copoffset is the place of the instructions in each
line’s block.
DisplayGenlock
Bits that copper lists set up after it add to their BPLCON0 register; 2 uses an external sync signal, 4 makes the display interlaced.
Statement. Help text: BPLCON0 ;2=use external sync 4=interlace
Arguments: .w
DisplayPalette
Copies the colours of a palette into a copper list, from colour coloroffset of the palette on and, with the AGA chip set, into colour bank bankoffset.
Statement. Help text: CopList#,Palette# [,coloroffset] [,coloroffset,bankoffset]
3 forms:
.w, .w.w, .w, .w.w, .w, .w, .w
More than 32 colours need the 24 bit palette in the list’s type; otherwise this is the error “Need AGA palette mode ($10000) for this many colors”.
DisplayRainbow
Gives colour register Register a new colour on every line, colour n of a palette on line n. It needs 1 (ECS) or 4 (AGA) line by line instructions.
Statement. Help text: CopList#,Register,Palette[,copoffset] ;ecs=1 aga=4
2 forms:
.w, .w, .w.w, .w, .w, .w
DisplayRGB
Gives colour register Register the colour r,g,b from line line on. It needs 1 (ECS) or 4 (AGA) line by line instructions.
Statement. Help text: CopList#,Register,line,r,g,b[,copoffset] ;ecs=1 aga=4
2 forms:
.w, .w, .w, .w, .w, .w.w, .w, .w, .w, .w, .w, .w
DisplayScroll
Scrolls every line of the display by its own amount. The two arrays hold, for each line, the difference of the horizontal position to the line above, for the two playfields. It needs 3 line by line instructions.
Statement. Help text: CopList#,&xpos.q(n),&xpos.q(n)[,Offset] ;3
2 forms:
.w, .l, .l.w, .l, .l, .w
Use it after DisplayBitMap, from whose position it starts. With
the AGA chip set, the fractional parts of the values position in
steps finer than a pixel.
DisplaySprite
Shows a sprite in a copper list at X,Y, on the sprite channel given and, for a wide sprite, the channels after it. Super high resolution positions and wide sprites are supported.
Statement. Help text: CopList#,Sprite#,X,Y,Sprite Channel
Arguments: .w, .w, .q, .w, .w
A sprite that has not been made is the error “Uninitialised Sprite”,
one that needs more channels than the list has “Not Enough Sprite
Channels”. The channels after the list’s own sprites are those of
CustomSprites.
The sprite channels form two banks: the list’s own channels, and
those of CustomSprites. The banks show their sprites in different
parts of the display, so the channels of a sprite must all lie in one
bank; a sprite that runs from one into the other is the error “Not
Enough Sprite Channels” too. A sprite moved completely above or
below the display is switched off, on the list’s own channels and on
those of CustomSprites alike.
DisplayUser
Puts the copper instructions in String, four bytes each, into the line by line instructions of line Line, at Offset in them.
Statement. Help text: CopList#,Line,String[,Offset]
2 forms:
.w, .w, $.w, .w, $, .w
InitCopList
Sets up a copper list for height lines from line ypos, with the type the introduction describes, room for sprites sprites (normally 8), colors colours (up to 256) and numcustoms custom copper instructions. The list becomes the used one.
Statement. Help text: CopList#[,type]|[,ypos,height,type,sprites,colors,numcustoms]
2 forms:
.w, .l.w, .w, .w, .l, .w, .w, .w
The short form InitCopList CopList#,type makes a list for 256 lines
from line 44, with 8 sprites, as many colours as the bitplanes give
and no custom instructions. An old list of the object is freed
first. More than 8 bitplanes are the error “Illegal Number of
BitPlanes for Resolution”.