AMCAF Extension V1.40 Manual  Index

Blitter Commands

AMCAF makes it possible to control the Blitter by hand and to clear, fill, copy or modify Bitplanes directly.


Commands

BLITTER COPY
instruction: copy and modify a bitplane
Blitter Copy sourcescreen,sourceplane To targetscreen,targetplane
Blitter Copy sourcescreen,sourceplane To targetscreen,targetplane,miniterm
Blitter Copy s1,p1,s2,p2 To targetscreen,targetplane
Blitter Copy s1,p1,s2,p2 To targetscreen,targetplane,miniterm
Blitter Copy s1,p1,s2,p2,s3,p3 To targetscreen,targetplane
Blitter Copy s1,p1,s2,p2,s3,p3 To targetscreen,targetplane,miniterm

With the help of Blitter Copy you can copy a Bitplane of a screen to another or the same bitplane on another or the same screen.
The Amiga Blitter chip is used to fulfill this action.
If two or three source screens and bitplanes parameters are given, the graphics can be combined by so called miniterms and the result is then written into the target screen.

Important

1. Before you can call Blitter Copy, you must set the limits of the operation using Blitter Copy Limit.

2. Take care that all specified screens have these dimensions and all screens are big enough.

The optional parameter miniterm contains a bitmask which defines the way the source planes should be combined.

If these values are omitted, these default values are used:

One source   : the bitplane is copies normally             (=%11110000).
Two sources  : the bitplanes are combined using logical OR (=%11111100).
Three sources: the bitplanes are combined using logical OR (=%11111110).

Frequently used miniterm values:

Sourceplanes one, two and three represent A, B and C.

1: %11110000: copy bitplane                 : A
1: %00001111: invert bitplane               : NOT A
2: %11111100: use logical OR on the planes  : A OR B
2: %00000011: OR planes and invert them     : NOT (A OR B)
2: %11000000: the two planes are ANDed      : A AND B
2: %00111111: planes are ANDed and inverted : NOT (A AND B)
2: %00111100: the planes will be XORed      : A XOR B
2: %11000011: planes are XORed and inverted : NOT (A XOR B)
3: %11111110: OR all planes (create mask)   : A OR B OR C
3: %00000001: OR all planes and invert them : NOT (A OR B OR C)
3: %10000000: Do a logical AND on all planes: A AND B AND C
3: %01111111: AND all planes and invert them: NOT (A AND B AND C)

If you want to create other combinations, simply try out the values you like (nothing can happen except of bad looking screens).
If you have some knowledge on boolean algebra, read Blitter miniterms.


BLITTER COPY LIMIT
instruction: set the blitter copy area
Blitter Copy Limit screen
Blitter Copy Limit x1,y1 To x2,y2

Using this command you define the rectangular area which will be used for the Blitter Copy command.
If you only specify the 'screen' parameter, the full screen dimensions of the screen numbered 'screen' will be taken.

Otherwise x1,y1 represents the upper left corner and x2,y2 the lower right corner of the region which will be affected by the copying and combining process.
This area will be used for all screens, therefore you must ensure that every screen is at least as big as the lower right corner of the specified limits.


BLITTER FILL
instruction: fill polygons using the blitter
Blitter Fill screen,bitplane
Blitter Fill screen,bitplane,x1,y1,x2,y2
Blitter Fill sourcescreen,sourceplane To targetscreen,targetplane
Blitter Fill sourcescreen,sourceplane,x1,y1,x2,y2 To targetscreen,targetplane

With Blitter Fill you can fill polygons. However, there are some limitations: the filling algorithm of the Blitter chip is very simple.
It only fills the gap between two dots of a horizontal line. Therefore the limiting lines may only be one pixel thick.
These lines can be either created using Turbo Draw or Bcircle.

The 'screen' and 'bitplane' parameter specify the screen which contains the area to be filled.
Additionally you can give a rectangular region which is defined by the coordinate pairs x1,y1 and x2,y2.

You can also give a second screen 'targetscreen' and a second bitplane number 'targetplane' into which the filled figures are written.
In this mode, the source screen is not altered in any way.

If more than one filled figure is to be drawn and these don't overlap, you can draw all limiting lines first and then fill all figures in one cycle.

The Blitter processes the screen from the lower right to the upper left.
Due to this feature you should draw on Double Buffered or hidden screens to avoid flickering.


BLITTER CLEAR
instruction: clear a bitplane using the blitter
Blitter Clear screen,bitplane
Blitter Clear screen,bitplane,x1,y1 To x2,y2

The Blitter chip can be used to clear Bitplanes as well.
In comparison to the AMOS command Cls, Blitter Clear allows you to wipe single bitplane instead of all.

Optionally you may include the coordinates of a rectangular region where the command should have an effect on.


BLITTER WAIT
instruction: wait for blitter to finish a task
Blitter Wait

This command waits until the Blitter has finished his work.
You are advised to use this command before calling e.g Print or any other command that does not require the blitter, that will draw onto a screen, which is currently altered by the blitter.
You should use Blitter Wait in front of Wait Vbl, too.


TURBO DRAW
instruction: draw from one coordinate to another
Turbo Draw x1,y1 To x2,y2,colour
Turbo Draw x1,y1 To x2,y2,colour,bitplane

This instruction replaces the AMOS Draw command. The x1,y1 coordinates represent the starting point of the line and x2,y2 the ending point.
The coordinates needn't to be on the screen, the line is clipped automatically.

The colour of the line must be given, whereas the 'bitplane' parameter is optional.
It determines into which Bitplanes the line should be drawn. So Bit 0 represents bitplane 0, bit 1 represents bitplane 1 etc.
If the corresponding bit is set, a line will be drawn in the bitplane, otherwise not. If 'bitplanes' is omitted, every bitplane is drawn into.
Turbo Draw supports a line pattern, which can be changed using the AMOS Set Line command.

With Turbo Draw, you can draw even more and special lines, so-called Blitter Lines.
These lines are only drawn with one dot in each horizontal line and are used to create polygons which can then be filled with the blitter chip.
To switch to this mode, the 'bitplane' parameter must be given as negative number, everything else can remain as it is.
Please note that an extra line is drawn automatically if the blitter line leaves the right boundary of the screen.


BCIRCLE
instruction: draw a circle for the blitter to fill
Bcircle x,y,radius,bitplane

Draws an empty circle around x,y with a radius into the bitplane.
This line is really only one pixel thick to ensure the circle can be filled by the Blitter chip.


BLITTER BUSY
function: return the current blitter state
flag=Blitter Busy

This function returns -1 (True), if the Blitter chip is currently busy and working on a job, e.g is currently clearing a bitplane or drawing a line etc.
This can be used to wait for the end of the blitter activity, although Blitter Wait is preferred in this case.
You could use Blitter Busy to decide, if you want to do some more calculations using the processor or better start the next blitter activity.