bb_blitlib
This library holds the custom blitter code of Reflective Images’ game Blitz Bombers. Most of its commands draw shapes, bitmaps and images in chip memory into the current bitmap. They program the blitter registers directly, without asking the system for the blitter, so they are meant for Blitz mode. They check almost nothing: shapes and bitmaps must exist and be of the sizes a command expects. With runtime error checking, the commands that blit a shape refuse one that was never defined with the error “Uninitialized Shape”; without it, such a shape makes them blit 65536 planes over memory.
Several commands are written for the 16 by 16 blocks of a map and
assume that the bitmap has the line width set with SetupMapTwo, 40
bytes (320 pixels) unless changed. They draw without shifting, at a
byte position: their x position is used in steps of 8 pixels and
should be a multiple of 16.
BPredatorBlit, BColourBlit and BTBlockImage save the background they draw over in
a buffer of the buffered blit commands (Buffer, BBlit), so that
UnBuffer restores it, and shift the shape to any x position.
The fixed bugs of the library are listed in Fixes in bb_blitlib.
Library number 19.
Commands
BColourBlit
Draws the area of a shape’s cookie in one colour, colour, into the current bitmap at x,y, placed by the shape’s handle, after saving the background into the buffer buffer for UnBuffer.
Statement. Help text: buffer,shape,x,y,colour
Arguments: .w, .w, .w, .w, .w
BlockToShape
Copies the data of a shape into the shape destshape of the same size.
Statement. Help text: shape,destshape
Arguments: .w, .w
The copy is one blit, so the shape’s height times its depth may be at most 1024 and its width at most 1024 pixels. With runtime error checking, a destination shape without data is the error “Destination shape MUST be pre-reserved!”, one of another size “Shapes must be the same size!”, and a larger shape “Shape too large for BlockToShape!”.
BPredatorBlit
Like PredatorBlit, but saves the background into the buffer buffer first, so that UnBuffer restores it, and places the shape by its handle.
Statement. Help text: buffer,shape,x,y
Arguments: .w, .w, .w, .w
The saved background and the effect cover one line less than the
shape’s height. The next line is found with the line width of the
current bitmap, not with that of SetupMapTwo.
BTBlockImage
Like TBlockImage, but at any x position, after saving the background into the buffer buffer for UnBuffer.
Statement. Help text: buffer,image_addr,x,y,image
Arguments: .w, .l, .w, .w, .w
CreateShape
Makes count shapes from start_shape on with the size of like_shape, whose data lie one after another in the chip memory at chipmemblock.
Statement. Help text: start_shape,count,chipmemblock,like_shape
Arguments: .w, .w, .l, .w
The shapes get no cookie, and their data is marked as not their own,
so freeing them does not free the memory. With runtime error
checking, a count of 0 is the error “CreateShape count must be at
least 1!”, and shapes beyond the shape maximum of the compiler
options the error “CreateShape start+count above Maximum Shapes!”.
PredatorBlit
The “predator” effect of Blitz Bombers - inside the outline of a 16 by 16 shape’s cookie at x,y, the bitmap is replaced by its next line, shifted by one pixel. As a function it returns the address of the shape’s cookie.
Statement or function, result .l. Help text: shape,x,y
Arguments: .w, .w, .w
The bitmap must have the line width of SetupMapTwo.
SetupMapTwo
Sets the line width in bytes, 40 at the start, that SpecialBlock, TBlock and the predator commands assume for the current bitmap.
Statement. Help text: ebwidth
Arguments: .w
SpecialBlock
Draws a 16 by 16 block made of two shapes into the current bitmap, the top shape through its cookie over the bottom shape, at x,y or at the byte offset in the bitmap.
Statement. Help text: topshape,bottomshape,(x,y)|offset
2 forms:
.w, .w, .w, .w.w, .w, .w
Both shapes must be 16 by 16 pixels, and the bitmap must have the
line width of SetupMapTwo. x is used in steps of 8 pixels.
SpecialBlockBitmap
Draws a shape of any size through its cookie over the same area of another bitmap into the current bitmap, at x,y or at the byte offset, which counts in both bitmaps.
Statement. Help text: topshape,bitmap,(x,y)|offset
2 forms:
.w, .w, .w, .w.w, .w, .w
x is used in steps of 8 pixels. Here the line width is that of the
current bitmap, not the one of SetupMapTwo.
SpecialBlockToShape
Like SpecialBlock, but draws the block into the data of the shape destshape instead of a bitmap.
Statement. Help text: topshape,bottomshape,destshape
Arguments: .w, .w, .w
With runtime error checking, these are errors:
| Situation | Error |
|---|---|
| the destination shape has no data | “Destination shape MUST be pre-reserved!” |
| the destination shape has another size than the top shape | “Shapes must be the same size!” |
| the top shape was never defined | “Uninitialized Shape” |
TBlock
Draws a 16 by 16 shape through its cookie into the current bitmap at x,y, so that the bitmap shows where the shape has colour 0.
Statement. Help text: shape,x,y
Arguments: .w, .w, .w
The bitmap must have the line width of SetupMapTwo. x is used in
steps of 8 pixels.
TBlockImage
Draws image number image of a block of 16 by 16 images at image_addr through its mask onto the first 6 bitplanes of the current bitmap at x,y.
Statement. Help text: image_addr,image,x,y
Arguments: .l, .w, .w, .w
An image is 224 bytes: a mask of 32 bytes, then 6 bitplanes of 32
bytes each. x is used in steps of 8 pixels.