|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
Macros | |
| #define | __NOLIBBASE__ |
| #define | GRAPHICS_BASE_NAME gfx |
| #define | CWIDTH 144 |
| #define | CW(cb, o) |
| #define | CL(cb, o) |
| #define | BUSY(cb) |
| #define | BLITWAIT(cb) |
| #define | MW(p, o) |
| #define | ML(p, o) |
| #define | SCROLL_REGS |
Functions | |
| void | doscroll (void) |
| void | b_doscroll (void) |
| void | docls (void) |
| void | docls2 (void) |
| void | doblockscroll (void) |
| void | scrolllib_codeinit (void) |
| void | doplot (void) |
| Plot X,Y,Colour - set a pixel of the used bitmap. | |
| void | dopoint (void) |
| Point(X,Y) - the colour of a pixel of the used bitmap. | |
| void | scchk1 (void) |
| void | scchk2 (void) |
| void | bmchk (void) |
| static void | clsdepth (UBYTE *cb, const struct bb_bitmap *bm, UWORD col, UWORD size, UWORD mod, ULONG off) |
| static void | clswidth (UBYTE *cb, const struct bb_bitmap *bm, UWORD col, UWORD h, ULONG off) |
| static void | b_cls (UBYTE *cb, const struct bb_bitmap *bm, UWORD col) |
| static void | b_docls_c (UBYTE *cb, const struct bb_bitmap *bm) |
| Cls - clear the used bitmap to colour 0 (Blitz mode). | |
| static void | b_docls2_c (UWORD col, UBYTE *cb, const struct bb_bitmap *bm) |
| Cls Colour - fill the used bitmap with a colour (Blitz mode). | |
| static void | a_docls_c (UBYTE *cb, const struct bb_bitmap *bm, struct GfxBase *gfx) |
| Cls in Amiga mode: b_docls_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end. | |
| static void | a_docls2_c (UWORD col, UBYTE *cb, const struct bb_bitmap *bm, struct GfxBase *gfx) |
| Cls Colour in Amiga mode: b_docls2_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end. | |
| BLITZ_ALIAS (b_docls, b_docls_c) | |
| BLITZ_ALIAS (b_docls2, b_docls2_c) | |
| static void | codeinit_c (void) |
| Library init: allocate the 144 byte cookie buffer (memlib globalloc, CHIP, not checked) and fill it with $FFFFFFFF. | |
| static UWORD * | cookwait (UBYTE *cb) |
| static UBYTE * | doit (UBYTE *cb, const struct bb_bitmap *src, const struct bb_bitmap *dst, const UWORD *args, ULONG srcoff, ULONG dstoff, UWORD words) |
| static UBYTE * | doasc (UWORD x1, UWORD y1, UWORD x2, UWORD y2, const struct bb_bitmap *src, const struct bb_bitmap *dst, UBYTE *cb, const UWORD *args) |
| static UBYTE * | dodesc (UWORD x1, UWORD y1, UWORD x2, UWORD y2, const struct bb_bitmap *src, const struct bb_bitmap *dst, UBYTE *cb, const UWORD *args) |
| static UBYTE * | scroll (UWORD x1, UWORD y1, UWORD x2, UWORD y2, const struct bb_bitmap *src, UBYTE *cb, UWORD *args) |
| static void | b_doscroll_c (UWORD x1, UWORD y1, UWORD x2, UWORD y2, const struct bb_bitmap *src, UBYTE *cb, UWORD *args) |
| Scroll X1,Y1,Width,Height,X2,Y2[,BitMap#] - copy an area with the blitter (Blitz mode). | |
| void | b_doscroll_blitz (void) |
| static void | a_doscroll_c (UWORD x1, UWORD y1, UWORD x2, UWORD y2, const struct bb_bitmap *src, UBYTE *cb, UWORD *args, struct GfxBase *gfx) |
| Scroll in Amiga mode: b_doscroll_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end. | |
| static UBYTE * | blockscroll (UWORD x1, UWORD y1, UWORD x2, UWORD y2, const struct bb_bitmap *src, UBYTE *cb, const UWORD *args) |
| static void | b_doblockscroll_c (UWORD x1, UWORD y1, UWORD x2, UWORD y2, const struct bb_bitmap *src, UBYTE *cb, UWORD *args) |
| BlockScroll X1,Y1,Width,Height,X2,Y2[,BitMap#] - copy whole bytes with the blitter (Blitz mode). | |
| static void | a_doblockscroll_c (UWORD x1, UWORD y1, UWORD x2, UWORD y2, const struct bb_bitmap *src, UBYTE *cb, UWORD *args, struct GfxBase *gfx) |
| BlockScroll in Amiga mode: b_doblockscroll_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end. | |
| void | b_doblockscroll (void) |
| BLITZ_ALIAS (b_doblockscroll, b_doblockscroll_c) | |
| static void | scchk (UWORD x, UWORD y, const struct bb_bitmap *bm, const UWORD *args) |
| static void | scchk1_c (UWORD x1, UWORD y1, UWORD x2, UWORD y2, const struct bb_bitmap *src, UBYTE *cb, UWORD *args) |
| static void | scchk2_c (UWORD x1, UWORD y1, UWORD x2, UWORD y2, const struct bb_bitmap *src, UBYTE *cb, UWORD *args) |
| static void | bmchk_c (const struct bb_bitmap *bm) |
Variables | |
| static UWORD * | cookie |
| static UWORD | offset |
| static UWORD | scminiterm = 0xfe2 |
| static const UWORD | masks [17] |
| const char | mess1 [] |
| const char | mess2 [] |
| const char | mess3 [] |
| #define __NOLIBBASE__ |
| #define BLITWAIT | ( | cb | ) |
| #define BUSY | ( | cb | ) |
| #define CL | ( | cb, | |
| o ) |
| #define CW | ( | cb, | |
| o ) |
| #define CWIDTH 144 |
| #define GRAPHICS_BASE_NAME gfx |
| #define ML | ( | p, | |
| o ) |
| #define MW | ( | p, | |
| o ) |
| #define SCROLL_REGS |
|
static |
BlockScroll in Amiga mode: b_doblockscroll_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end.
| gfx | d6: graphics.library (!libs) |
|
static |
Cls Colour in Amiga mode: b_docls2_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end.
| col | d0.w: the colour |
| cb | a1: the chip base ($DFF000) |
| bm | a2: the used bitmap |
| gfx | a6: graphics.library |
|
static |
Cls in Amiga mode: b_docls_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end.
| cb | a1: the chip base ($DFF000) |
| bm | a2: the used bitmap |
| gfx | a6: graphics.library |
|
static |
Scroll in Amiga mode: b_doscroll_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end.
| gfx | d6: graphics.library (!libs) |
|
static |
| void b_doblockscroll | ( | void | ) |
|
static |
BlockScroll X1,Y1,Width,Height,X2,Y2[,BitMap#] - copy whole bytes with the blitter (Blitz mode).
As Scroll, but x / 8 and width / 8: no shift, no masks, ascending only. a3 is left behind the destination's plane pointers as in the original.
Errors: as Scroll (scchk1/scchk2, debugger only).
| x1 | d0.w: source x |
| y1 | d1.w: source y |
| x2 | d2.w: destination x |
| y2 | d3.w: destination y |
| src | a0: the source bitmap |
| cb | a1: the chip base ($DFF000) |
| args | a2: the argument stack: -2(a2) width, -4(a2) height |
|
static |
Cls Colour - fill the used bitmap with a colour (Blitz mode).
As b_docls_c with the colour's bits.
| col | d0.w: the colour |
| cb | a1: the chip base ($DFF000) |
| bm | a2: the used bitmap |
|
static |
Cls - clear the used bitmap to colour 0 (Blitz mode).
The blitter fills every plane (D only, BLTCDAT = the colour's bit); an interleaved bitmap in bands of up to 1024 rows and 64 words, a normal one plane by plane in blits of up to 128K (clsnotint, as in the CD binary).
Fixed (#393): a bitmap of depth 0 runs the plane loop 65536 times (an invalid argument, refused at its creation in the error check area). Errors: "Uninitialized BitMap" (bmchk, debugger only).
| cb | a1: the chip base ($DFF000, chipbaselib) |
| bm | a2: the used bitmap |
| void b_doscroll | ( | void | ) |
| void b_doscroll_blitz | ( | void | ) |
|
static |
Scroll X1,Y1,Width,Height,X2,Y2[,BitMap#] - copy an area with the blitter (Blitz mode).
From the source bitmap (the used one, or BitMap#) to the used bitmap; ascending or descending depending on the overlap, the edges masked through the cookie buffer, as many planes as the shallower bitmap has. Areas wider than 960 pixels are copied in two blits: the width word on the caller's argument stack is changed for that, as in the original (not a bug: it belongs to this call and is discarded by the compiler afterwards). a3 is left as the original leaves it (dest bitmap planes
Errors (scchk1/scchk2, debugger only): "Illegal Scroll Area" (an area outside a bitmap), "Uninitialized BitMap", "Scroll area to large" (height > 1024).
| x1 | d0.w: source x |
| y1 | d1.w: source y |
| x2 | d2.w: destination x |
| y2 | d3.w: destination y |
| src | a0: the source bitmap |
| cb | a1: the chip base ($DFF000) |
| args | a2: the argument stack: -2(a2) width, -4(a2) height |
| BLITZ_ALIAS | ( | b_doblockscroll | , |
| b_doblockscroll_c | ) |
| BLITZ_ALIAS | ( | b_docls | , |
| b_docls_c | ) |
| BLITZ_ALIAS | ( | b_docls2 | , |
| b_docls2_c | ) |
|
static |
| void bmchk | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
Library init: allocate the 144 byte cookie buffer (memlib globalloc, CHIP, not checked) and fill it with $FFFFFFFF.
|
static |
|
static |
| void doblockscroll | ( | void | ) |
| void docls | ( | void | ) |
| void docls2 | ( | void | ) |
|
static |
|
static |
| void doplot | ( | void | ) |
Plot X,Y,Colour - set a pixel of the used bitmap.
The bitmap's origin (+48/+50) is added; outside the clip size (+56/+58, unsigned compare) nothing happens. A negative colour complements the pixel in all planes (BCHG). The planes are counted with the word +4 (flags and depth, as the original).
The original's code (ADD 48(a2),d0 ... MULU (a2),d1 ... BCLR/BSET d0,(a1) per plane); it changes d0-d3, a0 and a1 like the original, so no caller can rely on d2 or d3 (MikesSpaceFXLib saves d0-d2 itself around its calls from the starfield loop, and nothing else of it is live). Assembler: the C function cost about 160 cycles more per call.
Fixed (#393): a bitmap of depth 0 runs the plane loop 65536 times (an invalid argument, refused at its creation in the error check area). Errors: "Uninitialized BitMap" (bmchk, debugger only).
In: d0.w x, d1.w y, d2.w the colour (< 0 = complement), a2 the used bitmap (struct bb_bitmap).
| void dopoint | ( | void | ) |
Point(X,Y) - the colour of a pixel of the used bitmap.
Origin and clipping as in Plot. The original's code; it changes d1-d3, a0 and a1 (the register rule keeps a3-a7 for a function). Assembler: the C function cost about 290 cycles more per call.
Errors: "Uninitialized BitMap" (bmchk, debugger only).
In: d0.w x, d1.w y, a2 the used bitmap (struct bb_bitmap). Out: d0.w the colour, 0 outside the bitmap (MOVEQ #0,d0); the upper word is the one of the x argument (MOVE d2,d0)
| void doscroll | ( | void | ) |
|
static |
| void scchk1 | ( | void | ) |
|
static |
| void scchk2 | ( | void | ) |
|
static |
|
static |
| void scrolllib_codeinit | ( | void | ) |
|
static |
|
static |
|
extern |
| const char mess2[] |
| const char mess3[] |
|
static |
|
static |