|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
Macros | |
| #define | BLITZONLY ((void *)1) |
| #define | TOK_setcoplist 0xc205 /* switchlib: a0 = copper list */ |
| #define | TOK_c104 0xc104 /* intlib (Blitz mode), d0 = 0 */ |
| #define | CUSTOM 0xdff000 |
| #define | SHOWARGS const struct bb_bitmap *bitmap BL_REG(a0), struct bb_slice *slice BL_REG(a1) |
Functions | |
| void | doqslice (void) |
| void | doslice (void) |
| void | docoploc (void) |
| void | docustomcop (void) |
| void | doshow2 (void) |
| void | doshow (void) |
| void | doshowf2 (void) |
| void | doshowf3 (void) |
| void | doshowf (void) |
| void | doshowb2 (void) |
| void | doshowb3 (void) |
| void | doshowb (void) |
| void | docoplen (void) |
| void | blitzcoplib_docolsplit (void) |
| void | doshowblitz (void) |
| void | dokillslices (void) |
| void | dodisplayoff (void) |
| void | dodisplayon (void) |
| void | dosetbplcon0 (void) |
| void | dosetblwait (void) |
| void | blitzcoplib_doinit (void) |
| void | freeslice (void) |
| The slice object's free routine: does nothing (RTS). | |
| void | slicechk (void) |
| void | slicechk2 (void) |
| void | nshowchk (void) |
| void | showfchk (void) |
| void | showbchk (void) |
| void | cspltst (void) |
| void | blitzcoplib_sbchk (void) |
| static void | custom_w (ULONG reg, UWORD v) |
| static void | custom_l (ULONG reg, ULONG v) |
| static LONG | muls16 (WORD a, WORD b) |
| static ULONG | alloc (ULONG size, ULONG flags) |
| static void | dealloc (ULONG mem, ULONG size) |
| static ULONG | setcoplist (ULONG list) |
| static void | dosetbplcon0_c (ULONG v) |
| SetBPLCON0 BPLCON0 Default: the bits every later Slice ORs into BPLCON0. | |
| static void | dosetblwait_c (ULONG v) |
| SetBLWait: the wait the copper list uses for line 256. | |
| BLITZ_ALIAS (dosetbplcon0, dosetbplcon0_c) | |
| BLITZ_ALIAS (dosetblwait, dosetblwait_c) | |
| static void | display (UWORD dmacon) |
| void | dodisplayoff_c (void) |
| DisplayOff: switch off bitplane and copper DMA (Blitz mode only). | |
| void | dodisplayon_c (void) |
| DisplayOn: switch bitplane and copper DMA on (Blitz mode only). | |
| BLITZ_ALIAS (dodisplayoff, dodisplayoff_c) | |
| BLITZ_ALIAS (dodisplayon, dodisplayon_c) | |
| static void | makedumcop (void) |
| static void | dokillslices_c (struct bb_slice *slice, UWORD n, struct GfxBase *gfx) |
| FreeSlices: free all slices and the copper list. | |
| BLITZ_ALIAS (dokillslices, dokillslices_c) | |
| static void | doshowblitz_c (void) |
| ShowBlitz: put the slices' copper list on the hardware (Blitz mode only). | |
| BLITZ_ALIAS (doshowblitz, doshowblitz_c) | |
| static void | doinit_c (struct bb_slice *base, UWORD max) |
| The init routine: remember the slice objects, start the dummy copper list. | |
| static ULONG | docoploc_c (void) |
| CopLoc: the address of the slices' copper list (chip memory). | |
| static ULONG | docoplen_c (void) |
| CopLen: the length of the slices' copper list in bytes. | |
| BLITZ_ALIAS (docoploc, docoploc_c) | |
| BLITZ_ALIAS (docoplen, docoplen_c) | |
| static ULONG | inscop2 (ULONG *list, ULONG len, UWORD y) |
| static ULONG | inscop3 (ULONG *list, ULONG len, UWORD y) |
| static ULONG | inscop (ULONG *list, ULONG len, UWORD y) |
| static void | doslice2 (const UWORD *args, UWORD flags, UWORD planes, UWORD sprites, UWORD colours, WORD used) |
| static void | doslice2_c (const UWORD *args, ULONG flags, ULONG planes, ULONG sprites, ULONG colours, ULONG used) |
| Slice Slice#,Y,Width,Hite,Flgs,Bitplns,Sprts,Colrs,Fscrnw,Bscrnw (Amiga mode). | |
| static void | bdoslice_c (const UWORD *args, ULONG flags, ULONG planes, ULONG sprites, ULONG colours, ULONG used) |
| Slice Slice#,Y,Width,... in Blitz mode: as in Amiga mode, then ShowBlitz. | |
| static void | doqslice2 (UWORD y, UWORD fl, WORD used, const struct GfxBase *gfx) |
| static void | doqslice2_c (UWORD y, UWORD fl, ULONG used, const struct GfxBase *gfx) |
| Slice Slice#,Y,Flags: a full screen slice (Amiga mode). | |
| static void | b_doqslice_c (UWORD y, UWORD fl, ULONG used, const struct GfxBase *gfx) |
| Slice Slice#,Y,Flags in Blitz mode: as in Amiga mode, then ShowBlitz. | |
| BLITZ_ALIAS (b_doqslice, b_doqslice_c) | |
| BLITZ_ALIAS (bdoslice, bdoslice_c) | |
| static ULONG | customcop_c (ULONG str, UWORD y, const ULONG *lens) |
| CustomCop Copins$,Y: insert copper instructions at line Y (Amiga mode). | |
| static ULONG | bdocustomcop_c (ULONG str, UWORD y, const ULONG *lens) |
| CustomCop Copins$,Y in Blitz mode: as in Amiga mode, then the new list on COP1LC and switchlib $C205. | |
| static ULONG | a_colsplit (UWORD reg, UWORD r, UWORD g, UWORD b, UWORD y, const struct bb_slice *slice) |
| static ULONG | a_colsplit_c (UWORD reg, UWORD r, UWORD g, UWORD b, UWORD y, const struct bb_slice *slice) |
| ColSplit Colour Register,Red,Green,Blue,Y: a colour change at line Y of the used slice (Amiga mode). | |
| static ULONG | b_colsplit_c (UWORD reg, UWORD r, UWORD g, UWORD b, UWORD y, const struct bb_slice *slice) |
| ColSplit ... in Blitz mode: as in Amiga mode, then the new list on COP1LC and switchlib $C205. | |
| void | customcop_a (void) |
| void | bdocustomcop (void) |
| void | a_colsplit_t (void) |
| void | b_colsplit (void) |
| BL_ALWAYS_INLINE LONG | calcoff (UWORD *x, WORD y, const struct bb_bitmap *bitmap, const struct bb_slice *slice) |
| BL_ALWAYS_INLINE void | setplanes (const struct bb_bitmap *bitmap, UWORD *moves, LONG offset, WORD step) |
| BL_ALWAYS_INLINE void | show (const struct bb_bitmap *bitmap, struct bb_slice *slice, UWORD x, WORD y) |
| BL_ALWAYS_INLINE void | showf (const struct bb_bitmap *bitmap, struct bb_slice *slice, UWORD x, WORD y, UWORD x2) |
| BL_ALWAYS_INLINE void | showb (const struct bb_bitmap *bitmap, struct bb_slice *slice, UWORD x, WORD y, UWORD x2) |
| static BLITZ_ENTRYPOINT void | doshow2_c (const struct bb_bitmap *bitmap, struct bb_slice *slice) |
| Show Bitmap#: show a bitmap in the used slice at 0,0. | |
| static BLITZ_ENTRYPOINT void | doshow_c (const struct bb_bitmap *bitmap, struct bb_slice *slice, UWORD x, UWORD y) |
| Show Bitmap#,X,Y: show a bitmap in the used slice from X,Y. | |
| static BLITZ_ENTRYPOINT void | doshowf2_c (const struct bb_bitmap *bitmap, struct bb_slice *slice) |
| ShowF Bitmap#: show a bitmap as the front playfield at 0,0. | |
| static BLITZ_ENTRYPOINT void | doshowf3_c (const struct bb_bitmap *bitmap, struct bb_slice *slice, UWORD x, UWORD y) |
| ShowF Bitmap#,X,Y: show a bitmap as the front playfield from X,Y. | |
| static BLITZ_ENTRYPOINT void | doshowf_c (const struct bb_bitmap *bitmap, struct bb_slice *slice, UWORD x, UWORD y, UWORD x2) |
| ShowF Bitmap#,X,Y,ShowB X: show a bitmap as the front playfield. | |
| static BLITZ_ENTRYPOINT void | doshowb2_c (const struct bb_bitmap *bitmap, struct bb_slice *slice) |
| ShowB Bitmap#: show a bitmap as the back playfield at 0,0. | |
| static BLITZ_ENTRYPOINT void | doshowb3_c (const struct bb_bitmap *bitmap, struct bb_slice *slice, UWORD x, UWORD y) |
| ShowB Bitmap#,X,Y: show a bitmap as the back playfield from X,Y. | |
| static BLITZ_ENTRYPOINT void | doshowb_c (const struct bb_bitmap *bitmap, struct bb_slice *slice, UWORD x, UWORD y, UWORD x2) |
| ShowB Bitmap#,X,Y,ShowF X: show a bitmap as the back playfield. | |
| BLITZ_ALIAS_EP (doshow2, doshow2_c) | |
| BLITZ_ALIAS_EP (doshow, doshow_c) | |
| BLITZ_ALIAS_EP (doshowf2, doshowf2_c) | |
| BLITZ_ALIAS_EP (doshowf3, doshowf3_c) | |
| BLITZ_ALIAS_EP (doshowf, doshowf_c) | |
| BLITZ_ALIAS_EP (doshowb2, doshowb2_c) | |
| BLITZ_ALIAS_EP (doshowb3, doshowb3_c) | |
| BLITZ_ALIAS_EP (doshowb, doshowb_c) | |
| static void | cspltst_c (UWORD reg, UWORD r, UWORD g, UWORD b, const struct bb_slice *slice) |
| static void | slicechk_c (void) |
| static void | slicechk2_c (const UWORD *args, UWORD flags) |
| static void | showchk (const struct bb_bitmap *bitmap, const struct bb_slice *slice) |
| static void | nshowchk_c (const struct bb_bitmap *bitmap, const struct bb_slice *slice) |
| static void | showfchk_c (const struct bb_bitmap *bitmap, const struct bb_slice *slice) |
| static void | showbchk_c (const struct bb_bitmap *bitmap, const struct bb_slice *slice) |
| static void | sbchk_c (void) |
Variables | |
| ULONG | mycop |
| static ULONG | mycoplen |
| static struct bb_slice * | slicebase |
| static UWORD | maxslice |
| static UBYTE | hwait [2] |
| static UWORD | hstart = 0x81 |
| static UWORD | bplcon0 = 0x300 |
| static ULONG | blwait = 0xffe1fffe |
| static UWORD | maxcop [202] |
| static const ULONG | dumcop [2] = { 0x00960020, 0xfffffffe } |
| static ULONG | colstuff |
| static UWORD | aqslice [5] |
| #define BLITZONLY ((void *)1) |
| #define CUSTOM 0xdff000 |
| #define TOK_c104 0xc104 /* intlib (Blitz mode), d0 = 0 */ |
| #define TOK_setcoplist 0xc205 /* switchlib: a0 = copper list */ |
|
static |
|
static |
ColSplit Colour Register,Red,Green,Blue,Y: a colour change at line Y of the used slice (Amiga mode).
One colour move inserted with inscop at the slice's line + Y (+ 2 with flag bit 4, DMA off/on). Errors (debugger only, cspltst): "Unintialized Slice", "Colour Register out of range" (> 31), "RGB Components out of range" (> 15).
| reg | d0.w: the colour register |
| r | d1.w: red |
| g | d2.w: green |
| b | d3.w: blue |
| y | d4.w: the line in the slice |
| slice | a1: the used slice (!libs{blitzcoplib,$1102}) |
| void a_colsplit_t | ( | void | ) |
|
static |
| void b_colsplit | ( | void | ) |
|
static |
ColSplit ... in Blitz mode: as in Amiga mode, then the new list on COP1LC and switchlib $C205.
The $A001 entry for Blitz mode; the parameters are those of a_colsplit_c. Returns what $C205 leaves.
|
static |
Slice Slice#,Y,Flags in Blitz mode: as in Amiga mode, then ShowBlitz.
The $A001 entry for Blitz mode; the parameters are those of doqslice2_c.
| void bdocustomcop | ( | void | ) |
|
static |
CustomCop Copins$,Y in Blitz mode: as in Amiga mode, then the new list on COP1LC and switchlib $C205.
The $A001 entry for Blitz mode; the parameters are those of customcop_c. Returns what $C205 leaves.
|
static |
Slice Slice#,Y,Width,... in Blitz mode: as in Amiga mode, then ShowBlitz.
The $A001 entry for Blitz mode; the parameters are those of doslice2_c.
| BLITZ_ALIAS | ( | b_doqslice | , |
| b_doqslice_c | ) |
| BLITZ_ALIAS | ( | bdoslice | , |
| bdoslice_c | ) |
| BLITZ_ALIAS | ( | docoplen | , |
| docoplen_c | ) |
| BLITZ_ALIAS | ( | docoploc | , |
| docoploc_c | ) |
| BLITZ_ALIAS | ( | dodisplayoff | , |
| dodisplayoff_c | ) |
| BLITZ_ALIAS | ( | dodisplayon | , |
| dodisplayon_c | ) |
| BLITZ_ALIAS | ( | dokillslices | , |
| dokillslices_c | ) |
| BLITZ_ALIAS | ( | dosetblwait | , |
| dosetblwait_c | ) |
| BLITZ_ALIAS | ( | dosetbplcon0 | , |
| dosetbplcon0_c | ) |
| BLITZ_ALIAS | ( | doshowblitz | , |
| doshowblitz_c | ) |
| BLITZ_ALIAS_EP | ( | doshowb2 | , |
| doshowb2_c | ) |
| BLITZ_ALIAS_EP | ( | doshowb3 | , |
| doshowb3_c | ) |
| BLITZ_ALIAS_EP | ( | doshowf2 | , |
| doshowf2_c | ) |
| BLITZ_ALIAS_EP | ( | doshowf3 | , |
| doshowf3_c | ) |
| void blitzcoplib_docolsplit | ( | void | ) |
| void blitzcoplib_doinit | ( | void | ) |
| void blitzcoplib_sbchk | ( | void | ) |
| BL_ALWAYS_INLINE LONG calcoff | ( | UWORD * | x, |
| WORD | y, | ||
| const struct bb_bitmap * | bitmap, | ||
| const struct bb_slice * | slice ) |
| void cspltst | ( | void | ) |
|
static |
|
inlinestatic |
|
inlinestatic |
| void customcop_a | ( | void | ) |
|
static |
CustomCop Copins$,Y: insert copper instructions at line Y (Amiga mode).
Inserted with inscop (the wait's horizontal position 7). The original returns d0 = position, d1 = mycop and keeps d2-d7/a1-a3 (inscop3's MOVEM). DIFF: a2 stays unchanged (the original leaves it decremented by 4). Fixed (#404): a string of 0-3 bytes inserts no instruction (the original copied 2^32 longs). Fixed (#406): with a Slice maximum of 0 the pointer loop makes no pass (the original: 65536). Fixed (#405): the string is copied as given (the original took a long $01FE1234 for Slice's marker).
| str | d0: the copper instructions |
| y | d1.w: the line |
| lens | a2: the argument stack, -4(a2) = the string's length |
|
static |
|
static |
| void docoplen | ( | void | ) |
|
static |
CopLen: the length of the slices' copper list in bytes.
| void docoploc | ( | void | ) |
|
static |
CopLoc: the address of the slices' copper list (chip memory).
| void docustomcop | ( | void | ) |
| void dodisplayoff | ( | void | ) |
| void dodisplayoff_c | ( | void | ) |
DisplayOff: switch off bitplane and copper DMA (Blitz mode only).
intlib $C104 with d0 = 0, then DMACON = $0180. Errors: Blitz mode only (err1 = 1).
| void dodisplayon | ( | void | ) |
| void dodisplayon_c | ( | void | ) |
DisplayOn: switch bitplane and copper DMA on (Blitz mode only).
intlib $C104 with d0 = 0, then DMACON = $8180. Errors: Blitz mode only (err1 = 1).
|
static |
The init routine: remember the slice objects, start the dummy copper list.
The list starts as {DMACON $0020, end}; SetBLWait's value is reset to $FFE1FFFE.
| base | a0: slice 0 (!libs{blitzcoplib,$1001}) |
| max | d0: the maximum number of slices (!libs{blitzcoplib,$0003}) |
| void dokillslices | ( | void | ) |
|
static |
FreeSlices: free all slices and the copper list.
Marks every slice unused, puts GfxBase->copinit back on COP1LC (through switchlib $C205) and strobes COPJMP1 (also in Amiga mode), frees the copper list and starts a new dummy list.
| slice | a0: slice 0 (!libs{blitzcoplib,$1001}) |
| n | d0: the maximum number of slices (!libs{blitzcoplib,$0003}) |
| gfx | a1: GfxBase |
| void doqslice | ( | void | ) |
|
static |
|
static |
Slice Slice#,Y,Flags: a full screen slice (Amiga mode).
The long form with flags $FFF0 + hires/dual playfield/HAM from Flags, 8 sprites, 32 colours, width 320/640, height 256 (200 on NTSC: GfxBase DisplayFlags bit 0); its arguments go into aqslice. Errors (debugger only, slicechk): "Slice already in use".
Reads a3: the slice (!libs{blitzcoplib,$1380} from Slice# in d0).
| y | d1.w: Y |
| fl | d2.w: Flags - bits 0-2 bitplanes, 3 hires, 4 dual playfield, 5 HAM |
| used | d6: the offset of the used slice variable (!libs{blitzcoplib,$0604}) |
| gfx | a0: GfxBase |
| void dosetblwait | ( | void | ) |
|
static |
SetBLWait: the wait the copper list uses for line 256.
Initially (and after every init) $FFE1FFFE.
| v | d0: the copper wait instruction |
| void dosetbplcon0 | ( | void | ) |
|
static |
SetBPLCON0 BPLCON0 Default: the bits every later Slice ORs into BPLCON0.
| v | d0: the default (the low word is used; initially $300) |
| void doshow | ( | void | ) |
| void doshow2 | ( | void | ) |
|
static |
Show Bitmap#: show a bitmap in the used slice at 0,0.
Writes the bitplane pointers and BPLCON1 of the slice (see doshow_c).
| bitmap | a0: the bitmap (!libs{bitmaplib,$1080} from Bitmap#) |
| slice | a1: the used slice (!libs{blitzcoplib,$1102}) |
|
static |
Show Bitmap#,X,Y: show a bitmap in the used slice from X,Y.
Writes the bitplane pointers (+ the offset of x,y) and BPLCON1 (the scroll value for both playfields) of the slice. The originals change d0-d7/a0/a2. Errors (debugger only, nshowchk): "Unintialized Slice", "Can't Show in Slice" (a dual playfield slice), "Uninitialized BitMap", "Too many Bit planes to Show". Fixed (#407): a slice without BPLCON1 gets the value written into its own +30 (the BPLCON1 copy); the original wrote it at a relocated 0 pointer.
| void doshowb | ( | void | ) |
| void doshowb2 | ( | void | ) |
|
static |
ShowB Bitmap#: show a bitmap as the back playfield at 0,0.
See doshowb_c.
| bitmap | a0: the bitmap (!libs{bitmaplib,$1080} from Bitmap#) |
| slice | a1: the used slice (!libs{blitzcoplib,$1102}) |
| void doshowb3 | ( | void | ) |
|
static |
|
static |
ShowB Bitmap#,X,Y,ShowF X: show a bitmap as the back playfield.
Writes the bitplane pointers of the back playfield and BPLCON1 with the scroll values of both playfields. Errors (debugger only, showbchk): "Unintialized Slice", "Uninitialized BitMap", "Too many Bit planes to Show", "Can't Show in Slice" (a dual playfield slice without bit 14 in its bitplanes). Fixed (#407): see Show.
| void doshowblitz | ( | void | ) |
|
static |
ShowBlitz: put the slices' copper list on the hardware (Blitz mode only).
COP1LC = the list (switchlib $C205 is told), strobe COPJMP1, FMODE = 0 and BPLCON3 = $C00 ("hires sprite kludge"). Errors (debugger only): "No Blitz Display Set up"; Blitz mode only.
| void doshowf | ( | void | ) |
| void doshowf2 | ( | void | ) |
|
static |
ShowF Bitmap#: show a bitmap as the front playfield at 0,0.
See doshowf_c.
| bitmap | a0: the bitmap (!libs{bitmaplib,$1080} from Bitmap#) |
| slice | a1: the used slice (!libs{blitzcoplib,$1102}) |
| void doshowf3 | ( | void | ) |
|
static |
|
static |
ShowF Bitmap#,X,Y,ShowB X: show a bitmap as the front playfield.
Writes the bitplane pointers of the front playfield (every second move of a dual playfield slice) and BPLCON1 with the scroll values of both playfields. Errors (debugger only, showfchk): "Unintialized Slice", "Uninitialized BitMap", "Too many Bit planes to Show", "Can't Show in Slice" (a dual playfield slice without bit 15 in its bitplanes). Fixed (#407): see Show.
| void doslice | ( | void | ) |
|
static |
|
static |
Slice Slice#,Y,Width,Hite,Flgs,Bitplns,Sprts,Colrs,Fscrnw,Bscrnw (Amiga mode).
Builds the slice's copper instructions in maxcop from the flags (bit 0 hires, 1 dual playfield, 2 HAM, 3 smooth scrolling, 4 DMA off/on + end wait, 7 BPL2MOD, 8 BPL1MOD, 10 DDFSTRT/STOP, 12 DIWSTRT/STOP, 13 BPLCON2, 14 BPLCON1, 15 BPLCON0) and inserts them into the copper list at line Y (inscop3); the slice becomes the used one. The width checks (Lores/Hires multiple) are in the check routine only. Errors (debugger only, slicechk2): "Lores slice width MUST be multiple of 16", "Hires slice width MUST be multiple of 32", "Slice already in use". Fixed (#407): only pointers into maxcop are relocated; unused ones stay 0, and the BPLCON1 pointer of a slice without BPLCON1 points at its own +30, which Show writes anyway (the original relocated them all). The $01FE1234 marker is rewritten in maxcop itself (the library's buffer, built anew by every Slice); fixed (#405): only there.
Reads a3: the slice (!libs{blitzcoplib,$1380} from Slice# in d0).
| void freeslice | ( | void | ) |
The slice object's free routine: does nothing (RTS).
|
static |
|
static |
|
static |
|
static |
|
inlinestatic |
| void nshowchk | ( | void | ) |
|
static |
|
static |
| BL_ALWAYS_INLINE void setplanes | ( | const struct bb_bitmap * | bitmap, |
| UWORD * | moves, | ||
| LONG | offset, | ||
| WORD | step ) |
| BL_ALWAYS_INLINE void show | ( | const struct bb_bitmap * | bitmap, |
| struct bb_slice * | slice, | ||
| UWORD | x, | ||
| WORD | y ) |
| BL_ALWAYS_INLINE void showb | ( | const struct bb_bitmap * | bitmap, |
| struct bb_slice * | slice, | ||
| UWORD | x, | ||
| WORD | y, | ||
| UWORD | x2 ) |
| void showbchk | ( | void | ) |
| BL_ALWAYS_INLINE void showf | ( | const struct bb_bitmap * | bitmap, |
| struct bb_slice * | slice, | ||
| UWORD | x, | ||
| WORD | y, | ||
| UWORD | x2 ) |
| void showfchk | ( | void | ) |
| void slicechk | ( | void | ) |
| void slicechk2 | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| ULONG mycop |
|
static |
|
static |