|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
Macros | |
| #define | RI_BMAP(r, p) |
| #define | RI_BMAPS() |
| #define | B_(a) |
| #define | W_(a) |
| #define | L_(a) |
| #define | BM(bm) |
| #define | BM_BPR(bm) |
| #define | BM_ROWS(bm) |
| #define | BM_DEPTH(bm) |
| #define | BM_PLANES(bm) |
| #define | bit_add (&pa.all[0]) |
| #define | dest_add (&pa.all[16]) |
| #define | source_address pa.v.source_address |
| #define | dest_address pa.v.dest_address |
| #define | add_source pa.v.add_source |
| #define | add_dest pa.v.add_dest |
| #define | TABLESIZE 1856 |
| #define | COPY40(s, d) |
Functions | |
| static void | clearbitmap2 (ULONG delay, ULONG bm) |
| ClearBitmap bitmap#,delay: clears the whole bitmap line by line with a dither fade (see clearbitmap_c). | |
| static void | clearbitmap (ULONG delay, ULONG h, ULONG off, ULONG bm) |
| ClearBitmap bitmap#,delay,height,offset: clears height lines from line offset on with a dither fade. | |
| static void | fadeinbitmap2 (ULONG delay, ULONG src, ULONG dst) |
| FadeInBitmap bitmapsource#,bitmapdest#,delay: fades the whole source into the destination line by line (see fadein_c). | |
| static void | fadeinbitmap (ULONG delay, ULONG h, ULONG off1, ULONG off2, ULONG src, ULONG dst) |
| FadeInBitmap bitmapsource#,bitmapdest#,delay,height,offset1,offset2: fades height source lines into the destination with a dither. | |
| void | zoomxy_no_xy (void) |
| void | zoomx4_xy (void) |
| void | asmderez (void) |
| void | AsmZoom (void) |
| void | InitZoomxy (void) |
| void | zoomtables (void) |
| void | ADDValue (void) |
| void | ReduceX2 (void) |
| void | dozoomy (void) |
| void | rifxlib_libinit (void) |
| void | rifxlib_libfinit (void) |
| void | clearchk (void) |
| void | fadechk (void) |
| void | bm2chk (void) |
| void | zoomxychk (void) |
| void | zoomychk (void) |
| static void | libfinit_c (void) |
| finit: frees the zoom tables (1856 bytes, memlib globfree). | |
| static void | libinit_c (void) |
| init: allocates the zoom tables (memlib globalloc, 1856 bytes MEMF_PUBLIC) and fills them. | |
| static ULONG | zoomtables_c (void) |
| GetZoomTables: the address of the four table pointers. | |
| static void | slow_down (void) |
| static void | clearbitmap_c (ULONG delay, UWORD h, UWORD off, ULONG bm) |
| static void | fadein_c (ULONG delay, UWORD h, UWORD off1, UWORD off2, ULONG src, ULONG dst) |
| static BOOL | zoomstart (UWORD width, UWORD h, WORD *wbytes) |
| static void | zoomx4_c (UBYTE sel, ULONG srcadd, ULONG dstadd, UWORD width, UWORD h, ULONG src, ULONG dst) |
| static void | zoomx4_6_c (ULONG srcadd, ULONG dstadd, ULONG width, ULONG h, ULONG src, ULONG dst) |
| ZoomX4 source#,dest#,sourceadd,destadd,width,height: every source pixel becomes 4x4 pixels (zoomx4 table, see zoomx4_c). | |
| static void | zoomx4_7_c (ULONG srcadd, ULONG dstadd, ULONG width, ULONG h, ULONG src, ULONG dst, const UBYTE *args) |
| ZoomX4 source#,dest#,sourceadd,destadd,width,height,xy_select: as ZoomX4 above, in one direction only if asked. | |
| static void | zoomx2_c (ULONG srcadd, ULONG dstadd, ULONG width, ULONG h, ULONG src, ULONG dst) |
| ZoomX2 source#,dest#,sourceadd,destadd,width,height: every source pixel becomes 2x2 pixels (zoomx2 table). | |
| static void | zoomx8_c (ULONG srcadd, ULONG dstadd, ULONG width, ULONG h, ULONG src, ULONG dst) |
| ZoomX8 source#,dest#,sourceadd,destadd,width,height: every source pixel becomes 8x8 pixels (zoomx8 table). | |
| static void | dozoomy_c (ULONG bm) |
| ZoomyZoom bitmap#: doubles the left half of the bitmap in x, in place (zoomx2 table). | |
| static void | reducex2_c (ULONG srcadd, ULONG dstadd, ULONG width, ULONG h, ULONG src, ULONG dst) |
| ReduceX2 source#,dest#,sourceadd,destadd,width,height: halves the size (reducex2 table). | |
| static void | store_bitplanes (ULONG src, ULONG dst, ULONG sadd, ULONG dadd) |
| static void | screencopy (void) |
| static void | unrezx2 (void) |
| static ULONG | asmderez_c (ULONG sadd, ULONG dadd, ULONG rez, ULONG h, ULONG src, ULONG dst) |
| Derez source#,dest#,sourceadd,destadd,derez_value,height: lowers the resolution of a lores bitmap (40 bytes per line). | |
| static void | initzoomxy_c (ULONG sadd, ULONG dadd, ULONG src, ULONG dst) |
| InitZoomXY source#,dest#,sourceadd,destadd: stores the bitmaps and offsets for ZoomXY. | |
| static void | asmzoom_c (ULONG xz, ULONG yz, ULONG h) |
| ZoomXY xzoom,yzoom,height: zooms the bitmaps of InitZoomXY (lores, 40 bytes per line) by whole factors. | |
| static ULONG | addvalue_c (ULONG x, ULONG y, ULONG bm) |
| ADDValue(bitmap#,x,y): the byte offset of pixel x,y in a plane. | |
| static void | depthchk (ULONG bm) |
| static void | clearchk_c (ULONG delay, ULONG bm) |
| The error check of ClearBitmap (both forms; debugger only). | |
| static void | fadechk_c (ULONG delay, ULONG src, ULONG dst) |
| The error check of FadeInBitmap (both forms; debugger only). | |
| static void | bm2chk_c (ULONG src, ULONG dst) |
| The error check of ZoomX2, ZoomX4 (both forms), ZoomX8, ReduceX2 and Derez (debugger only). | |
| static void | zoomxychk_c (void) |
| The error check of ZoomXY (debugger only): the bitmaps of InitZoomXY. | |
| static void | zoomychk_c (ULONG bm) |
| The error check of ZoomyZoom (debugger only). | |
Variables | |
| static UWORD | EWWidth |
| static UWORD | BHeight |
| static UWORD | BDepth |
| static ULONG | delay_timer |
| static UWORD | bytesperline |
| static UWORD | bytesperline2 |
| static UWORD | xzoom = 1 |
| static UWORD | yzoom = 1 |
| static ULONG | tableaddress |
| struct { | |
| ULONG reducex2 | |
| ULONG zoomx2 | |
| ULONG zoomx4 | |
| ULONG zoomx8 | |
| } | tables |
| static ULONG | add_value = 1 |
| static UWORD | res_value |
| static UWORD | res_value2 |
| static UWORD | res_value3 |
| static UWORD | myline [21] |
| static UWORD | yzoom_value = 1 |
| static UWORD | yzoom_value2 = 1 |
| static UWORD | xzoom_value = 1 |
| static UWORD | sbitdepth |
| static UWORD | yvalue |
| static UWORD | height |
| union { | |
| ULONG all [36] | |
| struct { | |
| ULONG bit_add [16] | |
| ULONG dest_add [16] | |
| ULONG source_address | |
| ULONG dest_address | |
| ULONG add_source | |
| ULONG add_dest | |
| } v | |
| } | pa |
| #define add_dest pa.v.add_dest |
| #define add_source pa.v.add_source |
| #define B_ | ( | a | ) |
| #define bit_add (&pa.all[0]) |
| #define BM_DEPTH | ( | bm | ) |
| #define COPY40 | ( | s, | |
| d ) |
| #define dest_add (&pa.all[16]) |
| #define dest_address pa.v.dest_address |
| #define L_ | ( | a | ) |
| #define RI_BMAP | ( | r, | |
| p ) |
| RI_BMAPS | ( | ) |
| #define source_address pa.v.source_address |
| #define TABLESIZE 1856 |
| #define W_ | ( | a | ) |
| void ADDValue | ( | void | ) |
|
static |
| void asmderez | ( | void | ) |
|
static |
Derez source#,dest#,sourceadd,destadd,derez_value,height: lowers the resolution of a lores bitmap (40 bytes per line).
Blocks of derez_value pixels and lines get the colour of their first pixel (1 = ScreenCopy, 2 = UnrezX2, up to 17 through the mask table myline, above that bit by bit); derez_value 0 does nothing. The result: -1, 0 for derez_value 0 (fixed #672: the original set none, d0 was what the routine left there - the input for 0, its upper word and $FFFF for 1, the last long for 2, else the last mask/source word). Values >= 3 write 20 (21) words of myline, which has room for 21 here (the original's 18 words were followed by ZoomXY's code: fixed #671, DIFF). A depth-0 source gives 65536 planes, more than 16 planes overrun the pointer arrays: refused by bm2chk (fixed #947, #674). sbitdepth is set as a whole word (fixed #675: the original set its low byte only).
| sadd | d2: byte offset added to every source plane |
| dadd | d3: byte offset added to every destination plane |
| rez | d4.w: derez_value, the block size |
| h | d5.w: the number of lines |
| src | a0: the source bitmap (d0) |
| dst | a1: the destination bitmap (d1) |
| void AsmZoom | ( | void | ) |
|
static |
ZoomXY xzoom,yzoom,height: zooms the bitmaps of InitZoomXY (lores, 40 bytes per line) by whole factors.
Every source pixel becomes xzoom pixels wide, every line yzoom lines high; 1,1 = ScreenCopy; a factor 0 does nothing. A depth-0 source gives 65536 planes, more than 16 planes overrun the pointer arrays: refused by zoomxychk (fixed #947, #674), as is a ZoomXY before any InitZoomXY (fixed #1131: the bitmaps at address 0). sbitdepth is set as a whole word (fixed #675: the original set its low byte only).
| xz | d0.w: xzoom |
| yz | d1.w: yzoom |
| h | d2.w: the number of lines Returns nothing (keeps d1-d7/a0-a6, and d0 if it does nothing). |
| void bm2chk | ( | void | ) |
|
static |
The error check of ZoomX2, ZoomX4 (both forms), ZoomX8, ReduceX2 and Derez (debugger only).
Fixed (#947, #674), not in the original: the source's depth was not checked - the zooms count it as a byte (depth 0 = 256 planes, through the plane pointers behind the bitmap object), Derez as a word (65536 planes over the 16-entry plane pointer arrays and the 256 KB behind them); more than 16 planes overran Derez's arrays. The release code is unchanged (D-005).
Errors: "Illegal BitMap Depth" (depth 0 or more than 8, either bitmap).
| src | a0: the source bitmap (source#) |
| dst | a1: the destination bitmap (dest#) |
|
static |
ClearBitmap bitmap#,delay,height,offset: clears height lines from line offset on with a dither fade.
Backwards from the end of the area: each line is first ANDed with the alternating mask $AAAA/$5555, 19 lines later cleared. Delay 0 (2^32 turns), depth 0 or more than 8: refused by clearchk (fixed #669, #947, #674). Fixed: the passes start at the last word of the area (end-2); the original started at end-4, one word too low: the last word of the area stayed and the word before the area was cleared (#668). Fixed (#670): the depth is the byte bm_Depth (the original read the word bm_Flags:bm_Depth).
|
static |
ClearBitmap bitmap#,delay: clears the whole bitmap line by line with a dither fade (see clearbitmap_c).
Height bm_Rows, offset 0. Delay 0 = 2^32 turns, more than 16 planes overrun the pointer arrays, depth 0 runs 65536 planes: refused by clearchk (fixed #669, #674, #947). Fixed: the depth is the byte bm_Depth (#670); the passes start at the last word of the area, not one word lower (#668).
|
static |
| void clearchk | ( | void | ) |
|
static |
The error check of ClearBitmap (both forms; debugger only).
Fixed (#947, #674), not in the original (rifxlib had no error check area): the depth of the bitmap was not checked - depth 0 ran the plane loops 65536 times (DBRA on depth - 1 as a word), over the 16-entry plane pointer arrays and what follows them, and so did more than 16 planes. The manual: "the maximum bitmap depth for these functions is 8". Fixed (#669): the delay was not checked - 0 ran the busy loop 2^32 times per line (SUBQ.l #1 before its test); the manual: "don't pass 0". The release code is unchanged (invalid arguments, D-005).
Errors: "Illegal BitMap Depth" (depth 0 or more than 8), "Delay must not be 0".
|
static |
| void dozoomy | ( | void | ) |
|
static |
ZoomyZoom bitmap#: doubles the left half of the bitmap in x, in place (zoomx2 table).
Fixed 32 lines of 80 bytes whatever the bitmap's size; the left 40 bytes of a line are doubled in place (from the right, so nothing is read after it is written). A bitmap smaller than 640 x 32 is refused by zoomychk (fixed #676; the original's size is kept in the release code). Nothing without the table. Fixed (#670): the depth is the byte bm_Depth (the original read the word bm_Flags:bm_Depth); depth 0 (65536 planes) and more than 8 are refused by zoomychk (fixed #947, #674).
| bm | a0: the bitmap of bitmap# (d0) Returns nothing (all registers kept). |
| void fadechk | ( | void | ) |
|
static |
The error check of FadeInBitmap (both forms; debugger only).
Fixed (#947, #674), not in the original: as clearchk_c for both bitmaps; FadeInBitmap stores two pointers per plane in each array, so the original overran them from 9 planes on; the delay as there (#669).
Errors: "Illegal BitMap Depth" (depth 0 or more than 8, either bitmap), "Delay must not be 0".
| delay | d2: the delay (a long) |
| src | a0: the source bitmap |
| dst | a1: the destination bitmap |
|
static |
|
static |
FadeInBitmap bitmapsource#,bitmapdest#,delay,height,offset1,offset2: fades height source lines into the destination with a dither.
Forwards: each line is first copied through the alternating mask $AAAA/$5555, 19 lines later copied whole. Width, depth and both line offsets come from the source bitmap (offsets times the SOURCE's bytes per row). Fixed (#670): the depth is the byte bm_Depth (the original read the word bm_Flags:bm_Depth). Delay 0 = 2^32 turns, from 9 planes on the two pointers per plane overrun bit_add/dest_add, depth 0 runs 65536 planes: refused by fadechk (fixed #669, #674, #947).
|
static |
FadeInBitmap bitmapsource#,bitmapdest#,delay: fades the whole source into the destination line by line (see fadein_c).
Height bm_Rows of the source, offsets 0. Delay 0 = 2^32 turns, more than 8 planes overrun the pointer arrays, depth 0 runs 65536 planes: refused by fadechk (fixed #669, #674, #947). Fixed (#670): the depth is the byte bm_Depth.
| delay | d2: turns of the busy loop per line |
| src | a0: the source bitmap (bitmapsource#, d0) |
| dst | a1: the destination bitmap (bitmapdest#, d1) Returns nothing (keeps a4-a6 only). |
| void InitZoomxy | ( | void | ) |
|
static |
InitZoomXY source#,dest#,sourceadd,destadd: stores the bitmaps and offsets for ZoomXY.
| sadd | d2: byte offset added to every source plane |
| dadd | d3: byte offset added to every destination plane |
| src | a0: the source bitmap (source#, d0) |
| dst | a1: the destination bitmap (dest#, d1) Returns nothing (all registers kept). |
|
static |
finit: frees the zoom tables (1856 bytes, memlib globfree).
Nothing without tables. The table pointers stay set after the free, as in the original: not a defect, the next init sets them anew (#673, see the head of the file).
|
static |
init: allocates the zoom tables (memlib globalloc, 1856 bytes MEMF_PUBLIC) and fills them.
reducex2: 256 bytes, bits 7,5,3,1 to bits 3-0; zoomx2: 256 words, every bit twice; zoomx4: 256 longs, every bit four times; zoomx8: 16 longs, four bits eight times each. The test of globalloc's result is the original's: globalloc does not return without memory (memlib ends the program with "Out of Memory!"), so init always sets the pointers; they are 0 only before the first init, when the zooms do nothing. Then it clears the InitZoomXY state, as at the first load: fixed (#1127), the original kept the bitmaps and offsets of the run before.
| void ReduceX2 | ( | void | ) |
|
static |
ReduceX2 source#,dest#,sourceadd,destadd,width,height: halves the size (reducex2 table).
Every second line, two source bytes -> one (bits 7,5,3,1). Nothing without the table, with a width below 16 or a height below 2. The number of planes is the source's bm_Depth (0 = 256; bm2chk refuses 0 and more than 8: fixed #947, #674).
| srcadd | d2: byte offset added to every source plane |
| dstadd | d3: byte offset added to every destination plane |
| width | d4.w: the source width in pixels |
| h | d5.w: the number of source lines |
| src | a0: the source bitmap (source#, d0) |
| dst | a1: the destination bitmap (dest#, d1) Returns nothing (all registers kept). |
| void rifxlib_libfinit | ( | void | ) |
| void rifxlib_libinit | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
| void zoomtables | ( | void | ) |
|
static |
GetZoomTables: the address of the four table pointers.
The longs reducex2, zoomx2, zoomx4, zoomx8 (0 before init or if init found no memory).
|
static |
ZoomX2 source#,dest#,sourceadd,destadd,width,height: every source pixel becomes 2x2 pixels (zoomx2 table).
Nothing without the table, with a width below 8 or a height below 1. The number of planes is the source's bm_Depth (0 = 256; bm2chk refuses 0 and more than 8: fixed #947, #674).
| srcadd | d2: byte offset added to every source plane |
| dstadd | d3: byte offset added to every destination plane |
| width | d4.w: the width in pixels (ASR.w #3: whole bytes) |
| h | d5.w: the number of source lines |
| src | a0: the source bitmap (source#, d0) |
| dst | a1: the destination bitmap (dest#, d1) Returns nothing (all registers kept). |
|
static |
ZoomX4 source#,dest#,sourceadd,destadd,width,height: every source pixel becomes 4x4 pixels (zoomx4 table, see zoomx4_c).
Nothing without the table (init found no memory), with a width below 8 or a height below 1. The number of planes is the source's bm_Depth (a byte: 0 = 256; bm2chk refuses 0 and more than 8: fixed #947, #674).
| srcadd | d2: byte offset added to every source plane |
| dstadd | d3: byte offset added to every destination plane |
| width | d4.w: the width in pixels (ASR.w #3: whole bytes) |
| h | d5.w: the number of source lines |
| src | a0: the source bitmap (source#, d0) |
| dst | a1: the destination bitmap (dest#, d1) Returns nothing (all registers kept). |
|
static |
ZoomX4 source#,dest#,sourceadd,destadd,width,height,xy_select: as ZoomX4 above, in one direction only if asked.
xy_select 1 = only x (4 times as wide), 2 = only y (4 times as high), anything else both.
| srcadd | d2: byte offset added to every source plane |
| dstadd | d3: byte offset added to every destination plane |
| width | d4.w: the width in pixels |
| h | d5.w: the number of source lines |
| src | a0: the source bitmap (d0) |
| dst | a1: the destination bitmap (d1) |
| args | a2: the argument stack, xy_select the byte at -1(a2) Returns nothing (all registers kept). |
|
static |
| void zoomx4_xy | ( | void | ) |
|
static |
ZoomX8 source#,dest#,sourceadd,destadd,width,height: every source pixel becomes 8x8 pixels (zoomx8 table).
Every source line becomes 8 lines of 8 times the width (two passes of 4 lines). Nothing without the table, with a width below 8 or a height below 1. The number of planes is the source's bm_Depth (0 = 256; bm2chk refuses 0 and more than 8: fixed #947, #674).
| srcadd | d2: byte offset added to every source plane |
| dstadd | d3: byte offset added to every destination plane |
| width | d4.w: the width in pixels (ASR.w #3: whole bytes) |
| h | d5.w: the number of source lines |
| src | a0: the source bitmap (source#, d0) |
| dst | a1: the destination bitmap (dest#, d1) Returns nothing (all registers kept). |
| void zoomxy_no_xy | ( | void | ) |
| void zoomxychk | ( | void | ) |
|
static |
The error check of ZoomXY (debugger only): the bitmaps of InitZoomXY.
Fixed (#1131), not in the original: ZoomXY did not look whether InitZoomXY stored any bitmaps; before it (also after init, #1127) both are 0, and ZoomXY read a struct BitMap at address 0 (its depth a byte of the ExecBase pointer, its planes the exception vectors) and wrote through it. Fixed (#947, #674): as bm2chk_c for the bitmaps InitZoomXY stored (ZoomXY takes no bitmap itself). The release code is unchanged (a command before its setup command, D-005).
Errors: "ZoomXY needs InitZoomXY" (no bitmap stored), "Illegal BitMap Depth" (depth 0 or more than 8, either bitmap).
| void zoomychk | ( | void | ) |
|
static |
The error check of ZoomyZoom (debugger only).
Fixed (#947, #674), not in the original: the depth was not checked (depth 0: 65536 planes through the plane pointers behind the bitmap object). Fixed (#676): nor was the size - ZoomyZoom works on 32 lines of 80 bytes per plane whatever the bitmap is; a narrower bitmap is garbled (the lines are not its rows), a smaller one overwritten behind the plane. The release code is unchanged (D-005; W6 decision Q5).
Errors: "Illegal BitMap Depth" (depth 0 or more than 8), "ZoomyZoom needs a bitmap of at least 640 x 32" (fewer than 80 bytes per row or fewer than 32 rows).
| bm | a0: the bitmap of bitmap# |
| ULONG add_dest |
| ULONG add_source |
|
static |
| ULONG all[36] |
|
static |
|
static |
| ULONG bit_add[16] |
|
static |
|
static |
|
static |
| ULONG dest_add[16] |
| ULONG dest_address |
|
static |
|
static |
|
static |
| union { ... } pa |
| ULONG reducex2 |
|
static |
|
static |
|
static |
|
static |
| ULONG source_address |
|
static |
| struct { ... } tables |
| struct { ... } v |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| void zoomx2 |
| ULONG zoomx4 |
| void zoomx8 |