BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
ridisplaylib.c File Reference
#include "blitzlib.h"
#include "blitzexec.h"

Data Structures

struct  viewlist

Functions

void _initview (void)
void _viewbitmap (void)
void ridisplaylib_codeinit (void)
void ridisplaylib_codefinit (void)
static void codeinit_c (void)
 init: open graphics.library 39.
static void codefinit_c (void)
 finit: close graphics.library and free every copper list.
static ULONG initview_c (UWORD height, UWORD depth, UWORD sprites, UWORD colours)
 InitView height,depth,numsprites,numcolours: allocate a copper list in chip memory and write its first four moves.
static void nothing_c (void)
 ViewBitmap bitmap: no code (RTS).

Variables

struct { 
   ULONG   viewsize 
   UWORD *   cop 
   struct viewlist *   lists 
} vd = { 0, 0, 0 }
static struct Library * gfxbase

Function Documentation

◆ _initview()

void _initview ( void )

◆ _viewbitmap()

void _viewbitmap ( void )

◆ codefinit_c()

void codefinit_c ( void )
static

finit: close graphics.library and free every copper list.

Closes the library if init opened it, and frees the lists of all InitViews, also without graphics.library (fixed (#891): the original frees only the last list, and nothing when init could not open the library; fixed (#888): it calls FreeMem(0, size) after a failed AllocMem).

◆ codeinit_c()

void codeinit_c ( void )
static

init: open graphics.library 39.

The base is only used by finit (to know that the library is open). Returns nothing (BL_NORET).

◆ initview_c()

ULONG initview_c ( UWORD height,
UWORD depth,
UWORD sprites,
UWORD colours )
static

InitView height,depth,numsprites,numcolours: allocate a copper list in chip memory and write its first four moves.

The size is 16*numsprites + 16*depth + 8*numcolours + 38, as a long (fixed (#890): the original's MOVE.w d0,d3 overwrites the colour count with the height before it is read, so its size is 8*height instead of 8*numcolours, computed as a word and sign-extended). The height is not part of the size. The four moves are DIWSTRT $2C81, DIWSTOP $2CC1, DDFSTRT $0038, DDFSTOP $00D0 (fixed (#889): the original's !cmoves read register and value from those absolute addresses, an address error on a 68000 at the odd ones). Without chip memory InitView returns 0, writes nothing and keeps the list before (fixed (#888): the original does not test AllocMem, the words go to address 0 and finit calls FreeMem(0, size)). Every call allocates a new list, behind a header of 8 bytes that chains it to the lists before; finit frees them all (fixed (#891): the original forgets the list before). The list is never installed.

Parameters
heightd0.w: the height (not used)
depthd1.w: the depth (16 bytes per plane)
spritesd2.w: the number of sprites (16 bytes each)
coloursd3.w: the number of colours (8 bytes each)
Returns
d0: the address of the copper list (0 without chip memory)

◆ nothing_c()

void nothing_c ( void )
static

ViewBitmap bitmap: no code (RTS).

a0 = the bitmap object (!libs bitmaplib) is not used; d0 stays unchanged.

◆ ridisplaylib_codefinit()

void ridisplaylib_codefinit ( void )

◆ ridisplaylib_codeinit()

void ridisplaylib_codeinit ( void )

Variable Documentation

◆ cop

UWORD* cop

◆ gfxbase

struct Library* gfxbase
static

◆ lists

struct viewlist* lists

◆ [struct]

struct { ... } vd

◆ viewsize

ULONG viewsize