BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
qblitlib.c File Reference
#include "blitzlib.h"
#include "blitzobj.h"
#include <proto/graphics.h>

Data Structures

struct  qitem
struct  queue
struct  blitstate

Macros

#define __NOLIBBASE__
#define GRAPHICS_BASE_NAME   gfx
#define QBLIT_LIBS
#define QBLIT_REGS

Functions

void doqueue (void)
void qblitlib_doblit (void)
void qblitlib_doblitex (void)
void dounqueue (void)
void dounqueue2 (void)
void doqblitmode (void)
void doflushqueue (void)
 FlushQueue Queue# - empty the queue without touching the bitmaps.
void qblitlib_codeinit (void)
void freequeue (void)
void qblitchk (void)
void unqueuechk (void)
void unqueuechk2 (void)
static void doqblitmode_c (UWORD m)
 QBlitMode BLTCON0 - set the BLTCON0 value of the following QBlits.
 BLITZ_ALIAS (doqblitmode, doqblitmode_c)
static ULONG codeinit_c (ULONG hiword)
 Library init: BLTCON0 back to $FCA.
static void freeq (struct queue *q)
static void freequeue_c (void)
 Object free routine (_free) of a Queue: free its memory.
static void doqueue_c (UWORD items)
 Queue Queue#,Max Items - set up a queue for that many QBlits.
 BLITZ_ALIAS (doqueue, doqueue_c)
BL_ALWAYS_INLINE void qblit (struct queue *q, const struct bb_shape *shape, const struct bb_bitmap *bm, UBYTE *cb, WORD x, WORD y, struct blitstate *st)
BL_ALWAYS_INLINE void qblitex (struct queue *q, const struct bb_shape *shape, const struct bb_bitmap *bm, UBYTE *cb, WORD x, WORD y, UWORD bits)
BL_ALWAYS_INLINE void unqueue (struct queue *q, UBYTE *cb)
BL_ALWAYS_INLINE void unqueue2 (struct queue *q, UBYTE *cb, const struct bb_bitmap *src)
static BLITZ_ENTRYPOINT void b_doblit_c (WORD x, WORD y, struct queue *q, UBYTE *cb, const struct bb_bitmap *bm)
 QBlit Queue#,Shape#,X,Y - blit a shape and remember the area (Blitz mode).
 BLITZ_EP_MARK (b_doblit_c)
static void a_doblit_c (WORD x, WORD y, struct queue *q, UBYTE *cb, const struct bb_bitmap *bm, struct Library *gfx)
 QBlit Queue#,Shape#,X,Y in Amiga mode: b_doblit_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end.
static BLITZ_ENTRYPOINT void b_doblitex_c (WORD x, WORD y, struct queue *q, UBYTE *cb, const struct bb_bitmap *bm, UWORD bits)
 QBlit Queue#,Shape#,X,Y,Excessonoff - QBlit and fill the bitmap's planes beyond the shape's depth (Blitz mode).
 BLITZ_EP_MARK (b_doblitex_c)
static void a_doblitex_c (WORD x, WORD y, struct queue *q, UBYTE *cb, const struct bb_bitmap *bm, UWORD bits, struct Library *gfx)
 QBlit Queue#,Shape#,X,Y,Excessonoff in Amiga mode: b_doblitex_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end.
static BLITZ_ENTRYPOINT void b_dounqueue_c (UBYTE *cb)
 UnQueue Queue# - clear all queued areas and empty the queue (Blitz mode).
 BLITZ_EP_MARK (b_dounqueue_c)
void a_dounqueue_c (UBYTE *cb, struct Library *gfx)
 UnQueue Queue# in Amiga mode: b_dounqueue_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end.
static BLITZ_ENTRYPOINT void b_dounqueue2_c (UBYTE *cb, const struct bb_bitmap *bm)
 UnQueue Queue#,BitMap# - restore all queued areas from a bitmap and empty the queue (Blitz mode).
 BLITZ_EP_MARK (b_dounqueue2_c)
void a_dounqueue2_c (UBYTE *cb, const struct bb_bitmap *bm, struct Library *gfx)
 UnQueue Queue#,BitMap# in Amiga mode: b_dounqueue2_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end.
static int maxchk (const struct bb_shape *shape, const struct bb_bitmap *bm)
static int poschk (const struct bb_shape *shape, const struct bb_bitmap *bm, WORD x, WORD y)
static void qblitchk_c (WORD x, WORD y, const struct queue *q, const struct bb_bitmap *bm)
static void unqueuechk_c (void)
static void unqueuechk2_c (const struct bb_bitmap *bm)

Variables

 QBLIT_LIBS
static UWORD bcon0 = 0xfca

Macro Definition Documentation

◆ __NOLIBBASE__

#define __NOLIBBASE__

◆ GRAPHICS_BASE_NAME

#define GRAPHICS_BASE_NAME   gfx

◆ QBLIT_LIBS

#define QBLIT_LIBS
Value:
BLITZ_LIBS(LIB_shapeslib, BL_IA3|BL_PD1, LIB_qblitlib, BL_IA0|BL_PD0, \
LIB_bitmaplib, BL_UA2, LIB_chipbaselib, BL_LA1, \
LIB_graphicslib, BL_IFAMIGA|BL_LA6)
#define BL_IA0
Definition blitzlib.h:239
#define BL_LA1
Definition blitzlib.h:198
#define BL_PD0
Definition blitzlib.h:231
#define BL_IA3
Definition blitzlib.h:242
#define BL_LA6
Definition blitzlib.h:201
#define BL_PD1
Definition blitzlib.h:232
#define BL_UA2
Definition blitzlib.h:213
#define BL_IFAMIGA
Definition blitzlib.h:187
#define BLITZ_LIBS(...)
Definition blitzlib.h:361

◆ QBLIT_REGS

#define QBLIT_REGS
Value:
WORD x BL_REG(d2), WORD y BL_REG(d3), struct queue *q BL_REG(a0), \
UBYTE *cb BL_REG(a1), const struct bb_bitmap *bm BL_REG(a2)
ULONG x
Definition 2dlib.c:2491
WORD y
Definition 2dlib.c:285
#define BL_REG(r)
Definition blitzlib.h:280
struct BitMap bm
Definition iffmakelib.c:162
A BitMap object, 64 bytes: a struct BitMap (+0 .. +39) and the Blitz fields behind it.
Definition blitzobj.h:87
Definition qblitlib.c:124

Function Documentation

◆ a_doblit_c()

void a_doblit_c ( WORD x,
WORD y,
struct queue * q,
UBYTE * cb,
const struct bb_bitmap * bm,
struct Library * gfx )
static

QBlit Queue#,Shape#,X,Y in Amiga mode: b_doblit_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end.

Parameters
gfxa6: graphics.library

◆ a_doblitex_c()

void a_doblitex_c ( WORD x,
WORD y,
struct queue * q,
UBYTE * cb,
const struct bb_bitmap * bm,
UWORD bits,
struct Library * gfx )
static

QBlit Queue#,Shape#,X,Y,Excessonoff in Amiga mode: b_doblitex_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end.

Parameters
bitsd4.w: one bit per excess plane
gfxa6: graphics.library

◆ a_dounqueue2_c()

void a_dounqueue2_c ( UBYTE * cb,
const struct bb_bitmap * bm,
struct Library * gfx )

UnQueue Queue#,BitMap# in Amiga mode: b_dounqueue2_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end.

Parameters
cba1: the chip base ($DFF000)
bma2: the bitmap to copy from
gfxa6: graphics.library

◆ a_dounqueue_c()

void a_dounqueue_c ( UBYTE * cb,
struct Library * gfx )

UnQueue Queue# in Amiga mode: b_dounqueue_c between OwnBlitter and DisownBlitter, waiting for the blitter at the end.

Parameters
cba1: the chip base ($DFF000)
gfxa6: graphics.library

◆ b_doblit_c()

BLITZ_ENTRYPOINT void b_doblit_c ( WORD x,
WORD y,
struct queue * q,
UBYTE * cb,
const struct bb_bitmap * bm )
static

QBlit Queue#,Shape#,X,Y - blit a shape and remember the area (Blitz mode).

The shape (a3) is blitted through its cookie into all its planes of the used bitmap at x/y minus the shape's handle (BLTCON0 = shift | the QBlitMode value); an item {modulo, bltsize, bitmap depth - 1, bitmap, offset} is appended to the queue for UnQueue. Blitz mode version: the blitter is used directly, no OwnBlitter.

Errors (qblitchk, debugger only): "Uninitialized Queue", the blitlib checks (cookie, bitmap, shape, depth, coordinates) and "Queue Overflow". By design (#423): only the runtime error checking tests for an overflow. Fixed (#243): a shape of depth 0 loops 65536 times (DBF), refused at its creation in the error check area.

Parameters
xd2.w: the x position
yd3.w: the y position
qa0: the queue object
cba1: the chip base ($DFF000, chipbaselib)
bma2: the used bitmap

◆ b_doblitex_c()

BLITZ_ENTRYPOINT void b_doblitex_c ( WORD x,
WORD y,
struct queue * q,
UBYTE * cb,
const struct bb_bitmap * bm,
UWORD bits )
static

QBlit Queue#,Shape#,X,Y,Excessonoff - QBlit and fill the bitmap's planes beyond the shape's depth (Blitz mode).

As b_doblit_c, then for every plane from the shape's depth up to the bitmap's depth one bit of bits (bit 0 first): set = the cookie area is set (minterm $BFA), clear = it is cleared ($B0A). The queue item is the one of b_doblit_c (UnQueue clears all planes of the bitmap anyway).

Errors: as b_doblit_c (qblitchk).

Parameters
bitsd4.w: one bit per excess plane

◆ b_dounqueue2_c()

BLITZ_ENTRYPOINT void b_dounqueue2_c ( UBYTE * cb,
const struct bb_bitmap * bm )
static

UnQueue Queue#,BitMap# - restore all queued areas from a bitmap and empty the queue (Blitz mode).

As b_dounqueue_c, but every area is copied from the same place of bm (A -> D, minterm $9F0), plane by plane, instead of cleared.

Errors (unqueuechk2, debugger only): "Uninitialized Queue", "Uninitialized BitMap".

Parameters
cba1: the chip base ($DFF000)
bma2: the bitmap to copy from

◆ b_dounqueue_c()

BLITZ_ENTRYPOINT void b_dounqueue_c ( UBYTE * cb)
static

UnQueue Queue# - clear all queued areas and empty the queue (Blitz mode).

a3 = the queue object. Every item's area is cleared in all planes of its bitmap (D only, minterm 0), not only in those of the shape: QBlit with Excessonoff changes them too, and UnQueue is meant to clear the area to colour 0 (not a bug). The write position goes back to the start.

Errors: "Uninitialized Queue" (unqueuechk, debugger only).

Parameters
cba1: the chip base ($DFF000)

◆ BLITZ_ALIAS() [1/2]

BLITZ_ALIAS ( doqblitmode ,
doqblitmode_c  )

◆ BLITZ_ALIAS() [2/2]

BLITZ_ALIAS ( doqueue ,
doqueue_c  )

◆ BLITZ_EP_MARK() [1/4]

BLITZ_EP_MARK ( b_doblit_c )

◆ BLITZ_EP_MARK() [2/4]

BLITZ_EP_MARK ( b_doblitex_c )

◆ BLITZ_EP_MARK() [3/4]

BLITZ_EP_MARK ( b_dounqueue2_c )

◆ BLITZ_EP_MARK() [4/4]

BLITZ_EP_MARK ( b_dounqueue_c )

◆ codeinit_c()

ULONG codeinit_c ( ULONG hiword)
static

Library init: BLTCON0 back to $FCA.

The original is MOVE #$fca,d0 falling into doqblitmode, so d0.w is $FCA afterwards (its upper word stays).

Parameters
hiwordd0: the caller's d0 (only its upper word is kept)
Returns
d0: the upper word of hiword, $FCA in the low word

◆ doflushqueue()

void doflushqueue ( void )

FlushQueue Queue# - empty the queue without touching the bitmaps.

Inline code MOVE.l 4(a3),(a3): the write position goes back to the start of the queue memory. a3 = the queue object.

Errors: "Uninitialized Queue" (unqueuechk, debugger only).

◆ doqblitmode()

void doqblitmode ( void )

◆ doqblitmode_c()

void doqblitmode_c ( UWORD m)
static

QBlitMode BLTCON0 - set the BLTCON0 value of the following QBlits.

Only the minterm and channel bits are used: QBlit ORs the shift of the x position into it. The default (init) is $FCA (A, B, C, D: cookie cut).

Parameters
md0.w: BLTCON0 without the shift

◆ doqueue()

void doqueue ( void )

◆ doqueue_c()

void doqueue_c ( UWORD items)
static

Queue Queue#,Max Items - set up a queue for that many QBlits.

a3 = the queue object. The old memory is freed first (freequeue), then items * 14 bytes are allocated (memlib globalloc, MEMF_PUBLIC); the write position is set to their start. The allocation is not checked.

Parameters
itemsd1.w: the maximum number of items

◆ dounqueue()

void dounqueue ( void )

◆ dounqueue2()

void dounqueue2 ( void )

◆ freeq()

void freeq ( struct queue * q)
static

◆ freequeue()

void freequeue ( void )

◆ freequeue_c()

void freequeue_c ( void )
static

Object free routine (_free) of a Queue: free its memory.

a3 = the queue object; memlib globfree of the items, the memory pointer is cleared. BUG(orig) (#244): the write position stays stale.

◆ maxchk()

int maxchk ( const struct bb_shape * shape,
const struct bb_bitmap * bm )
static

◆ poschk()

int poschk ( const struct bb_shape * shape,
const struct bb_bitmap * bm,
WORD x,
WORD y )
static

◆ qblit()

BL_ALWAYS_INLINE void qblit ( struct queue * q,
const struct bb_shape * shape,
const struct bb_bitmap * bm,
UBYTE * cb,
WORD x,
WORD y,
struct blitstate * st )

◆ qblitchk()

void qblitchk ( void )

◆ qblitchk_c()

void qblitchk_c ( WORD x,
WORD y,
const struct queue * q,
const struct bb_bitmap * bm )
static

◆ qblitex()

BL_ALWAYS_INLINE void qblitex ( struct queue * q,
const struct bb_shape * shape,
const struct bb_bitmap * bm,
UBYTE * cb,
WORD x,
WORD y,
UWORD bits )

◆ qblitlib_codeinit()

void qblitlib_codeinit ( void )

◆ qblitlib_doblit()

void qblitlib_doblit ( void )

◆ qblitlib_doblitex()

void qblitlib_doblitex ( void )

◆ unqueue()

BL_ALWAYS_INLINE void unqueue ( struct queue * q,
UBYTE * cb )

◆ unqueue2()

BL_ALWAYS_INLINE void unqueue2 ( struct queue * q,
UBYTE * cb,
const struct bb_bitmap * src )

◆ unqueuechk()

void unqueuechk ( void )

◆ unqueuechk2()

void unqueuechk2 ( void )

◆ unqueuechk2_c()

void unqueuechk2_c ( const struct bb_bitmap * bm)
static

◆ unqueuechk_c()

void unqueuechk_c ( void )
static

Variable Documentation

◆ bcon0

UWORD bcon0 = 0xfca
static

◆ QBLIT_LIBS

QBLIT_LIBS