|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
Macros | |
| #define | BUFLIBS |
| #define | CUSTOM ((UBYTE *)0xdff000) |
| #define | CW(o) |
| #define | CL(o) |
| #define | HIDE_A(p) |
| #define | PLANELOOP_START |
| #define | PLANELOOP_END " dbf %[n],0b" |
| #define | MYBLITSIZE (1 + (16 << 6)) /* 16 lines of one word */ |
| #define | MYBLITSIZESCROLL (2 + (16 << 6)) /* 16 lines of two words */ |
| #define | DEPTH 6 /* TBlockImage */ |
| #define | IMAGEPLANESIZE 32 |
| #define | IMAGESIZE (IMAGEPLANESIZE * (DEPTH + 1)) |
| #define | SHAPE_DEPTH 6 /* BTBlockImage */ |
| #define | SHAPE_EBWIDTH 2 |
| #define | SHAPE_BLITSIZE ((16 * 64) + SHAPE_EBWIDTH) |
| #define | SHAPE_PLANEBYTESIZE (SHAPE_EBWIDTH * 16) |
| #define | SHAPE_ONEBPMEMX ((SHAPE_EBWIDTH + 2) * 16) |
| #define | SHAPE_BYTESIZE (SHAPE_PLANEBYTESIZE * (SHAPE_DEPTH + 1)) |
| #define | PUT(v) |
| #define | BSAVE(ebw, size, save) |
| #define | BWAIT |
| #define | BMODS |
| #define | PUT(type, v) |
Enumerations | |
| enum | { BLTCON0 = 0x40 , BLTCON1 = 0x42 , BLTAFWM = 0x44 , BLTALWM = 0x46 , BLTCPT = 0x48 , BLTBPT = 0x4c , BLTAPT = 0x50 , BLTDPT = 0x54 , BLTSIZE = 0x58 , BLTCMOD = 0x60 , BLTBMOD = 0x62 , BLTAMOD = 0x64 , BLTDMOD = 0x66 } |
Functions | |
| void | _specialblock (void) |
| void | _specialblock2 (void) |
| void | _specialblockbitmap (void) |
| void | _specialblockbitmap2 (void) |
| void | _tblock (void) |
| void | _predatorblit (void) |
| void | _bpredatorblit (void) |
| BPredatorBlit buffer,shape,x,y: PredatorBlit, buffered. | |
| void | _MapInfo (void) |
| void | _createshape (void) |
| void | _specialblocktoshape (void) |
| void | _blocktoshape (void) |
| void | docolblit (void) |
| BColourBlit buffer,shape,x,y,colour: a shape's cookie in one colour, buffered. | |
| void | _tblockimage (void) |
| void | _btblockimage (void) |
| BTBlockImage buffer,image_addr,x,y,image: TBlockImage, buffered and shifted. | |
| void | _errSBlockToShape (void) |
| void | _errBlockToShape (void) |
| void | _errCreateShape (void) |
| void | _errShapeA1 (void) |
| void | _errShapeA3 (void) |
| static void | _libinit (void) |
| init: does nothing (RTS). | |
| static void | _libfinit (void) |
| finit: does nothing (RTS). | |
| static BLITZ_ENTRYPOINT void | mapinfo_c (UWORD w) |
| SetupMapTwo ebwidth: the bytes per line of the bitmaps. | |
| BL_ALWAYS_INLINE UWORD | xyoff (UWORD x, UWORD y, UWORD width) |
| BL_ALWAYS_INLINE void | specialblock (UWORD off, struct bb_bitmap *bm, struct bb_shape *top, struct bb_shape *bot) |
| SpecialBlock topshape,bottomshape,offset: a 16x16 block of two shapes into the used bitmap. | |
| static BLITZ_ENTRYPOINT void | specialblock_c (UWORD x, UWORD y, struct bb_bitmap *bm, struct bb_shape *top, struct bb_shape *bot) |
| SpecialBlock topshape,bottomshape,x,y: as the offset form, at y * SetupMapTwo's width + x/8. | |
| static BLITZ_ENTRYPOINT void | specialblock2_c (UWORD off, struct bb_bitmap *bm, struct bb_shape *top, struct bb_shape *bot) |
| SpecialBlock topshape,bottomshape,offset: the entry of the offset form (specialblock() above; d2 the offset, a0-a2 as there). | |
| BL_ALWAYS_INLINE void | specialblockbitmap (UWORD off, struct bb_bitmap *bm, struct bb_shape *shape, struct bb_bitmap *src) |
| SpecialBlockBitmap topshape,bitmap,offset: a shape over another bitmap into the used bitmap. | |
| static BLITZ_ENTRYPOINT void | specialblockbitmap_c (UWORD x, UWORD y, struct bb_bitmap *bm, struct bb_shape *shape, struct bb_bitmap *src) |
| SpecialBlockBitmap topshape,bitmap,x,y: as the offset form, at y * the used bitmap's width + x/8. | |
| static BLITZ_ENTRYPOINT void | specialblockbitmap2_c (UWORD off, struct bb_bitmap *bm, struct bb_shape *shape, struct bb_bitmap *src) |
| SpecialBlockBitmap topshape,bitmap,offset: the entry of the offset form (specialblockbitmap() above; d2 the offset, a0-a2 as there). | |
| static BLITZ_ENTRYPOINT void | tblock_c (UWORD x, UWORD y, struct bb_bitmap *bm, struct bb_shape *shape) |
| TBlock shape,x,y: a 16x16 shape through its cookie onto the used bitmap. | |
| static BLITZ_ENTRYPOINT ULONG | predatorblit_c (UWORD x, UWORD y, struct bb_bitmap *bm, struct bb_shape *shape) |
| PredatorBlit(shape,x,y): the "predator" effect inside a shape's cookie. | |
| static BLITZ_ENTRYPOINT void | tblockimage_c (ULONG addr, UWORD image, UWORD x, UWORD y, struct bb_bitmap *bm) |
| TBlockImage image_addr,image,x,y: a 16x16 image of 6 planes through its mask. | |
| static BLITZ_ENTRYPOINT void | createshape_c (UWORD count, ULONG mem, struct bb_shape *shape, struct bb_shape *like) |
| CreateShape start_shape,count,chipmemblock,like_shape: shape objects whose data lie in a given block. | |
| static BLITZ_ENTRYPOINT void | specialblocktoshape_c (struct bb_shape *dest, struct bb_shape *top, struct bb_shape *bot) |
| SpecialBlockToShape topshape,bottomshape,destshape: SpecialBlock into a shape. | |
| static BLITZ_ENTRYPOINT void | blocktoshape_c (struct bb_shape *shape, struct bb_shape *dest) |
| BlockToShape shape,destshape: copies a shape's data into another. | |
| BLITZ_ALIAS_EP (_specialblock, specialblock_c) | |
| BLITZ_ALIAS_EP (_specialblock2, specialblock2_c) | |
| BLITZ_ALIAS_EP (_specialblockbitmap, specialblockbitmap_c) | |
| BLITZ_ALIAS_EP (_specialblockbitmap2, specialblockbitmap2_c) | |
| BLITZ_ALIAS_EP (_tblock, tblock_c) | |
| BLITZ_ALIAS_EP (_predatorblit, predatorblit_c) | |
| BLITZ_ALIAS_EP (_MapInfo, mapinfo_c) | |
| BLITZ_ALIAS_EP (_createshape, createshape_c) | |
| BLITZ_ALIAS_EP (_specialblocktoshape, specialblocktoshape_c) | |
| BLITZ_ALIAS_EP (_blocktoshape, blocktoshape_c) | |
| BLITZ_ALIAS_EP (_tblockimage, tblockimage_c) | |
| static void | errblocktoshape_c (struct bb_shape *shape, struct bb_shape *dest) |
| BlockToShape's error check: dest has data, both shapes the same size (size, +26), and the shape fits one blit. | |
| static void | errsblocktoshape_c (struct bb_shape *dest, struct bb_shape *top) |
| SpecialBlockToShape's error check: the same for dest and the top shape, then the top shape's depth. | |
| static void | errshapea1_c (struct bb_shape *shape) |
| The error check of SpecialBlock, SpecialBlockBitmap, TBlock and PredatorBlit (not in the original): the shape in a1 has planes. | |
| static void | errshapea3_c (struct bb_shape *shape) |
| The error check of BPredatorBlit and BColourBlit (not in the original): the shape in a3 has planes. | |
| static void | errcreateshape_c (UWORD count, UWORD max, struct bb_shape *table, struct bb_shape *shape) |
| CreateShape's error check (not in the original): a count of at least 1 that stays inside the shape table. | |
Variables | |
| struct { | |
| UWORD ebwidth | |
| UWORD modwidth | |
| UWORD modwidth2 | |
| } | map = { 40, 38, 36 } |
| static UWORD | coltoblit |
| #define BMODS |
| #define BSAVE | ( | ebw, | |
| size, | |||
| save ) |
| #define BUFLIBS |
| #define BWAIT |
| #define CL | ( | o | ) |
| #define CUSTOM ((UBYTE *)0xdff000) |
| #define CW | ( | o | ) |
| #define DEPTH 6 /* TBlockImage */ |
| #define HIDE_A | ( | p | ) |
| #define IMAGEPLANESIZE 32 |
| #define IMAGESIZE (IMAGEPLANESIZE * (DEPTH + 1)) |
| #define MYBLITSIZESCROLL (2 + (16 << 6)) /* 16 lines of two words */ |
| #define PLANELOOP_END " dbf %[n],0b" |
| #define PLANELOOP_START |
| #define SHAPE_BLITSIZE ((16 * 64) + SHAPE_EBWIDTH) |
| #define SHAPE_BYTESIZE (SHAPE_PLANEBYTESIZE * (SHAPE_DEPTH + 1)) |
| #define SHAPE_DEPTH 6 /* BTBlockImage */ |
| #define SHAPE_EBWIDTH 2 |
| #define SHAPE_ONEBPMEMX ((SHAPE_EBWIDTH + 2) * 16) |
| #define SHAPE_PLANEBYTESIZE (SHAPE_EBWIDTH * 16) |
| anonymous enum |
| void _blocktoshape | ( | void | ) |
| void _bpredatorblit | ( | void | ) |
BPredatorBlit buffer,shape,x,y: PredatorBlit, buffered.
The shape's area (at x,y minus the handle) is saved into a record of the buffer as bblitlib's BBlit does, with a blit size one line less (deliberate: ";!!! BB Cludge!"), then PredatorBlit's blit through the shifted cookie (B: the line below, one pixel more). Fixed (#426): B reads the line the bitmap's bytes per row below; the original added SetupMapTwo's width. Depth 0 loops 65536 times: Fixed (#429), errshapea3_c refuses it. In: d2 x, d3 y, a0 the buffer object (bblitlib), a1 the chip base (chipbaselib), a2 the used bitmap object, a3 the shape object.
| void _btblockimage | ( | void | ) |
BTBlockImage buffer,image_addr,x,y,image: TBlockImage, buffered and shifted.
The area is saved as BBlit does, then the image shifted through its mask. Fixed (#427): image*224 is added as a long; the original added it as a word (ADD.w: from image 147 on before image_addr). Assembler like the other buffered blits. In: d1 image_addr, d2 x, d3 y, d4 the image number, a0 the buffer object, a1 the chip base, a2 the used bitmap object.
| void _createshape | ( | void | ) |
| void _errBlockToShape | ( | void | ) |
| void _errCreateShape | ( | void | ) |
| void _errSBlockToShape | ( | void | ) |
| void _errShapeA1 | ( | void | ) |
| void _errShapeA3 | ( | void | ) |
|
static |
finit: does nothing (RTS).
|
static |
init: does nothing (RTS).
| void _MapInfo | ( | void | ) |
| void _predatorblit | ( | void | ) |
| void _specialblock | ( | void | ) |
| void _specialblock2 | ( | void | ) |
| void _specialblockbitmap | ( | void | ) |
| void _specialblockbitmap2 | ( | void | ) |
| void _specialblocktoshape | ( | void | ) |
| void _tblock | ( | void | ) |
| void _tblockimage | ( | void | ) |
| BLITZ_ALIAS_EP | ( | _blocktoshape | , |
| blocktoshape_c | ) |
| BLITZ_ALIAS_EP | ( | _createshape | , |
| createshape_c | ) |
| BLITZ_ALIAS_EP | ( | _predatorblit | , |
| predatorblit_c | ) |
| BLITZ_ALIAS_EP | ( | _specialblock | , |
| specialblock_c | ) |
| BLITZ_ALIAS_EP | ( | _specialblock2 | , |
| specialblock2_c | ) |
| BLITZ_ALIAS_EP | ( | _specialblockbitmap | , |
| specialblockbitmap_c | ) |
| BLITZ_ALIAS_EP | ( | _specialblockbitmap2 | , |
| specialblockbitmap2_c | ) |
| BLITZ_ALIAS_EP | ( | _specialblocktoshape | , |
| specialblocktoshape_c | ) |
| BLITZ_ALIAS_EP | ( | _tblockimage | , |
| tblockimage_c | ) |
|
static |
BlockToShape shape,destshape: copies a shape's data into another.
One blit of height*depth lines of ebwidth/2 words, modulos 0: the whole data, straight through. Fixed (#425): the original blitted one word per line (ADDQ.w #1), so of a shape wider than 16 pixels only the first 2/ebwidth of the data. The width field is 6 bits (0 = 64 words), the height field 10 bits (0 = 1024 lines); larger shapes are refused by errblocktoshape_c.
| shape | a1: the source shape object |
| dest | a2: the destination shape object |
|
static |
CreateShape start_shape,count,chipmemblock,like_shape: shape objects whose data lie in a given block.
count shape objects from start_shape on like like_shape, their data at chipmemblock one after another (size, +26, of the like shape each), no cookie, "cL" (the data is not the shapes'). count 0 creates 65536 shapes (DBRA), a count past Maximum Shapes writes behind the shape table; Fixed (#428, #1077): the error check errcreateshape_c refuses both.
| count | d1: the number of shapes |
| mem | d2: the chip memory block |
| shape | a2: the first shape object |
| like | a3: the shape to copy the sizes from |
| void docolblit | ( | void | ) |
BColourBlit buffer,shape,x,y,colour: a shape's cookie in one colour, buffered.
The area is saved as BBlit does, then the shifted cookie is blitted in colour: per plane D = A | C (bit set) or ~A & C. Sets the B modulos it does not use and shifts the colour as a byte (at most 8 planes): original behaviour. Depth 0 loops 65536 times: Fixed (#429), errshapea3_c refuses it. The colour waits in coltoblit while the save uses every data register, as in the original. In: d2 x, d3 y, d4 the colour, a0 the buffer object, a1 the chip base, a2 the used bitmap object, a3 the shape object.
BlockToShape's error check: dest has data, both shapes the same size (size, +26), and the shape fits one blit.
Runtime errors "Destination shape MUST be pre-reserved!", "Shapes must be the same size!" and, Fixed (#425), "Shape too large for BlockToShape!" for more than 1024 lines (height*depth) or a width above 64 words (1024 pixels): the blitter's limits for the one blit.
| shape | a1: the source shape object |
| dest | a2: the destination shape object |
|
static |
CreateShape's error check (not in the original): a count of at least 1 that stays inside the shape table.
Fixed (#428): count 0 makes the routine's DBRA loop create 65536 shapes over the memory behind the shape table; runtime error "CreateShape count must be at least 1!". Fixed (#1077): start_shape + count above Maximum Shapes writes the shapes from Maximum Shapes on behind the table; runtime error "CreateShape start+count above Maximum Shapes!". start_shape itself is checked by the compiler's item check ("Value out of Maximum Range"), so shape - table is below the maximum. The release code is unchanged (an invalid argument); the declaration loads a0 and d4 for this check.
SpecialBlockToShape's error check: the same for dest and the top shape, then the top shape's depth.
Fixed (#429): a top shape of depth 0 (a shape never defined, whose size is that of dest) is the runtime error "Uninitialized Shape"; the original does not test it, and the blit loop runs 65536 times.
| dest | a0: the destination shape object |
| top | a1: the top shape object |
|
static |
The error check of SpecialBlock, SpecialBlockBitmap, TBlock and PredatorBlit (not in the original): the shape in a1 has planes.
Fixed (#429): a shape of depth 0 (a shape never defined) makes the blit loop (DBRA on depth-1) run 65536 times over the "plane pointers" behind the bitmap object; runtime error "Uninitialized Shape". The release code is unchanged (an invalid argument).
| shape | a1: the shape object |
|
static |
The error check of BPredatorBlit and BColourBlit (not in the original): the shape in a3 has planes.
Fixed (#429): as errshapea1_c (the save of the background loops over the bitmap's planes, the blit over the shape's).
| shape | a3: the shape object |
|
static |
SetupMapTwo ebwidth: the bytes per line of the bitmaps.
SpecialBlock, TBlock and the predator blits assume bitmaps of this width (default 40); also sets the modulos ebwidth-2 and ebwidth-4. The three words through an address register (MOVE.w (a0)+, 8 cycles against the original's 16 for an absolute address).
| w | d0: the bytes per line |
|
static |
PredatorBlit(shape,x,y): the "predator" effect inside a shape's cookie.
B = the bitmap one line (SetupMapTwo's width) further, shifted by x and one pixel more, C = D = the bitmap, 2 words wide at the even word, through the cookie (A, shifted, last word masked). Assumes 16x16 shapes. Depth 0 loops 65536 times: Fixed (#429), errshapea1_c refuses it.
| BL_ALWAYS_INLINE void specialblock | ( | UWORD | off, |
| struct bb_bitmap * | bm, | ||
| struct bb_shape * | top, | ||
| struct bb_shape * | bot ) |
SpecialBlock topshape,bottomshape,offset: a 16x16 block of two shapes into the used bitmap.
The top shape (B) over the bottom shape (C) through top's cookie (A) into each plane of the used bitmap at off (D = A ? B : C); B and C go on from plane to plane. Assumes 16x16 shapes and bitmaps of SetupMapTwo's width. Depth 0 loops 65536 times: Fixed (#429), errshapea1_c refuses it.
|
static |
SpecialBlock topshape,bottomshape,offset: the entry of the offset form (specialblock() above; d2 the offset, a0-a2 as there).
|
static |
| BL_ALWAYS_INLINE void specialblockbitmap | ( | UWORD | off, |
| struct bb_bitmap * | bm, | ||
| struct bb_shape * | shape, | ||
| struct bb_bitmap * | src ) |
SpecialBlockBitmap topshape,bitmap,offset: a shape over another bitmap into the used bitmap.
The shape (B, any size) over the same area of the source bitmap (C) through its cookie (A) into the used bitmap, both at off; B goes on from plane to plane. Depth 0 loops 65536 times: Fixed (#429), errshapea1_c refuses it.
| off | d2: the byte offset in both bitmaps |
| bm | a0: the used bitmap object |
| shape | a1: the shape object (parameter 0) |
| src | a2: the source bitmap object (parameter 1) |
|
static |
SpecialBlockBitmap topshape,bitmap,offset: the entry of the offset form (specialblockbitmap() above; d2 the offset, a0-a2 as there).
|
static |
|
static |
SpecialBlockToShape topshape,bottomshape,destshape: SpecialBlock into a shape.
The 16x16 block (top over bottom through top's cookie) into the data of dest. Error check: errsblocktoshape_c. Depth 0 loops 65536 times: Fixed (#429), errsblocktoshape_c refuses it.
| dest | a0: the destination shape object |
| top | a1: the top shape object |
| bot | a2: the bottom shape object |
|
static |
TBlock shape,x,y: a 16x16 shape through its cookie onto the used bitmap.
B = the shape, A = its cookie, C = D = the bitmap at y * SetupMapTwo's width + x/8; B goes on from plane to plane. Depth 0 loops 65536 times: Fixed (#429), errshapea1_c refuses it.
|
static |
TBlockImage image_addr,image,x,y: a 16x16 image of 6 planes through its mask.
Image image of image_addr (224 bytes: the mask, then 6 planes of 16x16) through its mask onto 6 planes of the used bitmap.
| BL_ALWAYS_INLINE UWORD xyoff | ( | UWORD | x, |
| UWORD | y, | ||
| UWORD | width ) |
|
static |
| UWORD ebwidth |
| struct { ... } map |
| UWORD modwidth |
| UWORD modwidth2 |