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

Data Structures

struct  bregs
struct  box
struct  page

Macros

#define PAGE   LIB_blitzoslib, BL_IA3|BL_PD0 /* a3 = page of param d0 */
#define UPAGE   LIB_blitzoslib, BL_UA3 /* a3 = used page */
#define BCALL_(tok, form, r, regs)
#define BCALL(tok, form, r)
#define BCALL_A3(tok, form, r)
#define T_RAWSTATUS   0x3102 /* blitzkeyslib: d0 = raw key -> Z = up */
#define T_BLITZKEY   0x3106 /* blitzkeyslib: -> d0 = key (<0 none) */
#define T_SCROLL   0x3202 /* scrolllib */
#define T_MOUSEX   0x3604 /* mouselib: -> d0 (Quick) */
#define T_MOUSEY   0x3605
#define T_MOUSEXSPEED   0x3606
#define T_POSITIONMOUSE   0x3608
#define T_BOXF   0x3b84 /* 2dlib: d0-d3, d4 = colour */
#define T_LINE   0x3b85
#define T_COLOUR   0x4703 /* fontlib, form 1: d0 = fg, d1 = bg */
#define T_LOCATE   0x4704 /* fontlib: d0 = column, d1 = row (y<<13) */
#define T_PRINTN   0x470e /* fontlib: a0 = text, d0 = length */
#define T_PRINT0   0x470f /* fontlib: a0 = null terminated text */
#define T_BLIT   0x4b01 /* d0 = shape, d1 = x, d2 = y */
#define T_JOYX   0x5f01
#define T_JOYY   0x5f02
#define T_JOYB   0x5f04
#define BCALL0(tok, value)
#define BOXAT(p, n)
#define PG   ((struct page *)blitz_string)

Functions

void _initpage (void)
void _freepage (void)
void _addbox (void)
void _addbox1 (void)
void _addbox2 (void)
void _redrawpage (void)
void _redrawbox (void)
void _selectbox (void)
void _selectbox2 (void)
void _selectbox3 (void)
void _deselectbox (void)
void _activateselected (void)
void _setbox (void)
void _setbox2 (void)
void _boxvalue (void)
void _boxvalue2 (void)
void _setboxstring (void)
void _boxstring (void)
void _boxstring2 (void)
void _boxshow (void)
void _boxshow2 (void)
void _boxselected (void)
void _boxprint (void)
void _boxprint2 (void)
void _setboxcolor (void)
void _blitzevent (void)
void _setboxtitle (void)
void _disablebox (void)
void _enablebox (void)
void _mouseenabled (void)
void _setpagepens (void)
void _boxpropx (void)
void _boxpropy (void)
void _changebox (void)
void _togglebox (void)
void _spotbox (void)
void spotboxchk (void)
void selectboxchk (void)
void initpagechk (void)
static void boxf (WORD x1, WORD y1, WORD x2, WORD y2, ULONG c)
static void line (WORD x1, WORD y1, WORD x2, WORD y2, ULONG c)
static void locate (ULONG x, ULONG y)
static void colour (ULONG fg, ULONG bg)
static void printn (const UBYTE *s, ULONG len)
static void scroll (ULONG sx, ULONG sy, ULONG dx, ULONG dy, UWORD w, UWORD h, void *src, void *dst)
static int rawstatus (UWORD key)
static WORD divs_sat (ULONG dividend, WORD divisor)
static void waitblit (void)
static void * globalloc (ULONG size, ULONG flags)
static void globfree (void *mem, ULONG size)
static struct box * getbox (struct page *p, ULONG n)
static void chkpage (struct page *p)
static ULONG locrow (WORD y)
static void drawbox (struct page *p, struct box *box)
static void freepage_ (struct page *p)
static void initpage_c (ULONG n, UWORD *bm, ULONG used)
 InitPage Page#,BitMap#,NumBoxes: a page of boxes drawn into a bitmap.
 BLITZ_ALIAS (_initpage, initpage_c)
static void freepage_c (void)
 FreePage Page#: free the boxes of a page.
 BLITZ_ALIAS (_freepage, freepage_c)
static void setpagepens_c (ULONG dark, ULONG light, ULONG mid, ULONG txt)
 SetPagePens Page#,c0,c1,c2,c3: the pens of a page.
 BLITZ_ALIAS (_setpagepens, setpagepens_c)
static void togglebox_c (ULONG n)
 ToggleBox Box#: invert the bevel of a box (NOT of its colour).
 BLITZ_ALIAS (_togglebox, togglebox_c)
static void enablebox_c (ULONG n)
 EnableBox Box#: enable a disabled box (a positive type).
 BLITZ_ALIAS (_enablebox, enablebox_c)
static void disablebox_c (ULONG n)
 DisableBox Box#: disable a box (a negative type).
 BLITZ_ALIAS (_disablebox, disablebox_c)
static ULONG boxpropx_c (ULONG n)
 BoxPropX Box#: the horizontal knob position of a prop box.
 BLITZ_ALIAS (_boxpropx, boxpropx_c)
static ULONG boxpropy_c (ULONG n)
 BoxPropY Box#: the vertical knob position of a prop box.
 BLITZ_ALIAS (_boxpropy, boxpropy_c)
static struct box * addbox (struct page *p, ULONG n, ULONG x, ULONG y, ULONG w, ULONG h, WORD type)
static void addbox_c (ULONG n, ULONG x, ULONG y, ULONG w, ULONG h, const UWORD *args)
 AddBox Page#,Box#,x,y,w,h,type: define a box.
 BLITZ_ALIAS (_addbox, addbox_c)
static void addbox2_c (ULONG n, ULONG x, ULONG y, ULONG w, ULONG h, const UWORD *args)
 AddBox Page#,Box#,x,y,w,h,type,shape,shape: a shape button.
 BLITZ_ALIAS (_addbox2, addbox2_c)
static void boxtext (struct box *b, ULONG len, const UBYTE *s)
static void addbox1_c (ULONG n, ULONG x, ULONG y, ULONG w, ULONG h, const UBYTE *args)
 AddBox Page#,Box#,x,y,w,h,type,text$: a box with a text.
 BLITZ_ALIAS (_addbox1, addbox1_c)
static void setboxtitle_c (ULONG n, const UBYTE *s, const ULONG *lens)
 SetBoxTitle Box#,String$: the text of a box.
 BLITZ_ALIAS (_setboxtitle, setboxtitle_c)
static void setbox (ULONG n, ULONG v)
static void setbox_c (ULONG n, ULONG v)
 SetBox Box#,Value: the value of a box (the selected string).
 BLITZ_ALIAS (_setbox, setbox_c)
static void changebox_c (ULONG n, ULONG v)
 ChangeBox Page#,Box#,Value: SetBox for the box of a page.
 BLITZ_ALIAS (_changebox, changebox_c)
static void setbox2_c (ULONG n, ULONG qx, ULONG qy)
 SetBox Box#,xprop,yprop: the knob position of a prop box.
 BLITZ_ALIAS (_setbox2, setbox2_c)
static void setboxcolor_c (ULONG n, ULONG c)
 SetBoxColor Box#,color: the background colour of a box.
 BLITZ_ALIAS (_setboxcolor, setboxcolor_c)
static void setboxstring_c (ULONG n, const UBYTE *s, const ULONG *lens)
 SetBoxString Box#,String$: the answer of a string box.
 BLITZ_ALIAS (_setboxstring, setboxstring_c)
static ULONG boxvalue_c (ULONG n)
 BoxValue(Box#): the value of a box of the used page.
 BLITZ_ALIAS (_boxvalue, boxvalue_c)
static ULONG boxvalue2_c (ULONG callerd0, ULONG n)
 BoxValue(Page#,Box#): the value of a box of a page.
 BLITZ_ALIAS (_boxvalue2, boxvalue2_c)
static ULONG boxstring (struct page *p, ULONG n)
static ULONG boxstring_c (ULONG n, struct page *p)
 BoxString(Box#): the answer of a string box, without trailing spaces.
 BLITZ_ALIAS (_boxstring, boxstring_c)
static ULONG boxstring2_c (ULONG callerd0, ULONG n, struct page *p)
 BoxString(Page#,Box#): BoxString of a box of a page.
 BLITZ_ALIAS (_boxstring2, boxstring2_c)
static ULONG boxselected_c (void)
 BoxSelected: the selected box of the used page.
 BLITZ_ALIAS (_boxselected, boxselected_c)
static void redrawpage_c (void)
 RedrawPage: draw all boxes of the used page.
 BLITZ_ALIAS (_redrawpage, redrawpage_c)
static void redrawbox_c (ULONG n)
 RedrawBox Box#: draw a box of the used page.
 BLITZ_ALIAS (_redrawbox, redrawbox_c)
static void dobs (struct page *p, struct box *b)
static void boxshow_c (ULONG n, UBYTE *bm, ULONG x, ULONG y)
 BoxShow Box#,Bitmap#,x,y: show part of a bitmap in a view box.
 BLITZ_ALIAS (_boxshow, boxshow_c)
static void boxshow2_c (ULONG n, ULONG dx, ULONG dy)
 BoxShow Box#,dx,dy: move the view of a view box.
 BLITZ_ALIAS (_boxshow2, boxshow2_c)
static void boxprint (struct page *p, ULONG n, const UBYTE *s, ULONG *lens)
static void boxprint_c (ULONG n, const UBYTE *s, ULONG *lens)
 BoxPrint Box#,String$: print a line into a view box.
 BLITZ_ALIAS (_boxprint, boxprint_c)
static void boxprint2_c (ULONG n, UBYTE **bank, ULONG ln)
 BoxPrint Box#,Bank#,Line: print a line of a bank into a view box.
 BLITZ_ALIAS (_boxprint2, boxprint2_c)
static void selectbox_c (ULONG n)
 SelectBox Box#: select a box (and draw it and the old one).
 BLITZ_ALIAS (_selectbox, selectbox_c)
static int inbox (struct box *b, WORD px, WORD py)
static LONG selectbox3 (struct page *p, WORD x, WORD y)
static ULONG selectbox3_c (ULONG x, ULONG y)
 SelectBox 0,x,y: select the enabled box at x,y.
 BLITZ_ALIAS (_selectbox3, selectbox3_c)
static void selectbox2 (struct page *p, WORD dx, WORD dy)
static void selectbox2_c (ULONG dx, ULONG dy)
 SelectBox x+,y+: select the nearest box in a direction.
 BLITZ_ALIAS (_selectbox2, selectbox2_c)
static void deselectbox_c (void)
 DeSelectBox: deselect the selected box and draw it as not pressed.
 BLITZ_ALIAS (_deselectbox, deselectbox_c)
static void docursor (struct page *p)
static void edstring (struct page *p, struct box *b)
static void activateselected (struct page *p)
static void activateselected_c (void)
 ActivateSelectedBox: activate the selected box.
 BLITZ_ALIAS (_activateselected, activateselected_c)
static ULONG spotbox_c (void)
 SpotBox: the box that the mouse is over.
 BLITZ_ALIAS (_spotbox, spotbox_c)
static ULONG mouseenabled_c (ULONG callerd0)
 MouseEnabled: whether BlitzEvent follows the mouse.
 BLITZ_ALIAS (_mouseenabled, mouseenabled_c)
static LONG blitzevent (struct page *p)
static ULONG blitzevent_c (void)
 BlitzEvent: handle the user input of the used page.
 BLITZ_ALIAS (_blitzevent, blitzevent_c)
static void spotboxchk_c (void)
 The error check of SpotBox (debugger only).
static void selectboxchk_c (ULONG n)
 The error check of SelectBox Box# (debugger only).
static void initpagechk_c (ULONG n)
 The error check of InitPage (debugger only).

Variables

static const char mess1 [] = "UnInitialised Page"
static const char mess2 [] = "Illegal Box# For Page"
static const char mess3 [] = "Value Out of Range"
static const char mess4 [] = "No Room For String"
static const char mess5 [] = "Illegal Box Type"
static const char mess6 [] = "Unitialised Bank"
static const char mess7 [] = "Not a Prop Box"
static const char mess8 [] = "Unitialised BitMap"
static WORD xyxy [4]
static WORD xyxy2 [4]
static ULONG text [2]
static WORD btype
static WORD c0
static WORD c1
static WORD c2
static WORD c3
static WORD sel
static WORD nable
static ULONG xx
static ULONG yy
static WORD lines
static WORD count
static UWORD cx
static UWORD cy
static ULONG linelen [2]
static WORD inprop
static WORD inedit
static WORD indrag
static WORD edxyc [3]
static WORD status
static WORD delay
static WORD button
static WORD mo
static WORD jx
static WORD jy
static WORD jb
static WORD mx
static WORD my
static WORD mb
static WORD ox
static WORD oy
static constexpr WORD dcon = 6
static constexpr WORD pspd = 1024
static const WORD delt [] = { 0, 0, 0, -1, -1, 0, 0, 1, 1, 0 }

Macro Definition Documentation

◆ BCALL

#define BCALL ( tok,
form,
r )
Value:
BCALL_(tok, form, r, "d0-d4/a0-a2")
#define BCALL_(tok, form, r, regs)
Definition blitzoslib.c:347
Definition ribbmaplib.c:191

◆ BCALL0

#define BCALL0 ( tok,
value )
Value:
({ struct bregs r_ = { .d0 = (value) }; BCALL(tok, 0, r_); r_.d0; })
#define BCALL(tok, form, r)
Definition blitzoslib.c:363
static ULONG value
Definition gtlib.c:442
Definition blitzoslib.c:338
ULONG d0
Definition blitzoslib.c:339

◆ BCALL_

#define BCALL_ ( tok,
form,
r,
regs )
Value:
do { \
register struct bregs *_r __asm("a6") = &(r); \
__asm volatile("movem.l a3-a4/a6,-(sp)\n\t" \
"movem.l (a6)," regs "\n\t" \
"jsr _blitz_tok+%c1\n\t" \
"move.l 8(sp),a6\n\t" \
"seq 36(a6)\n\t" \
"move.l d0,(a6)\n\t" \
"movem.l (sp)+,a3-a4/a6" \
: : "a"(_r), "i"(BL_BTOKVAL(tok, form)) \
: "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "a0", "a1", "a2", \
"cc", "memory"); \
} while (0)
#define BL_BTOKVAL(tok, form)
Definition blitzlib.h:527
The register frame of the stubs in start.c (movem d0-d7/a0-a6).
Definition edstub.h:34

◆ BCALL_A3

#define BCALL_A3 ( tok,
form,
r )
Value:
BCALL_(tok, form, r, "d0-d4/a0-a3")

◆ BOXAT

#define BOXAT ( p,
n )
Value:
((struct box *)((UBYTE *)(p)->memloc + ((ULONG)(UWORD)(n) << 5)))
ULONG WORD UWORD UWORD border ULONG ULONG struct bb_bitmap *dst void UWORD n
Definition 2dlib.c:2498
Definition blitzoslib.c:479

◆ PAGE

#define PAGE   LIB_blitzoslib, BL_IA3|BL_PD0 /* a3 = page of param d0 */

◆ PG

#define PG   ((struct page *)blitz_string)

◆ T_BLIT

#define T_BLIT   0x4b01 /* d0 = shape, d1 = x, d2 = y */

◆ T_BLITZKEY

#define T_BLITZKEY   0x3106 /* blitzkeyslib: -> d0 = key (<0 none) */

◆ T_BOXF

#define T_BOXF   0x3b84 /* 2dlib: d0-d3, d4 = colour */

◆ T_COLOUR

#define T_COLOUR   0x4703 /* fontlib, form 1: d0 = fg, d1 = bg */

◆ T_JOYB

#define T_JOYB   0x5f04

◆ T_JOYX

#define T_JOYX   0x5f01

◆ T_JOYY

#define T_JOYY   0x5f02

◆ T_LINE

#define T_LINE   0x3b85

◆ T_LOCATE

#define T_LOCATE   0x4704 /* fontlib: d0 = column, d1 = row (y<<13) */

◆ T_MOUSEX

#define T_MOUSEX   0x3604 /* mouselib: -> d0 (Quick) */

◆ T_MOUSEXSPEED

#define T_MOUSEXSPEED   0x3606

◆ T_MOUSEY

#define T_MOUSEY   0x3605

◆ T_POSITIONMOUSE

#define T_POSITIONMOUSE   0x3608

◆ T_PRINT0

#define T_PRINT0   0x470f /* fontlib: a0 = null terminated text */

◆ T_PRINTN

#define T_PRINTN   0x470e /* fontlib: a0 = text, d0 = length */

◆ T_RAWSTATUS

#define T_RAWSTATUS   0x3102 /* blitzkeyslib: d0 = raw key -> Z = up */

◆ T_SCROLL

#define T_SCROLL   0x3202 /* scrolllib */

◆ UPAGE

#define UPAGE   LIB_blitzoslib, BL_UA3 /* a3 = used page */

Function Documentation

◆ _activateselected()

void _activateselected ( void )

◆ _addbox()

void _addbox ( void )

◆ _addbox1()

void _addbox1 ( void )

◆ _addbox2()

void _addbox2 ( void )

◆ _blitzevent()

void _blitzevent ( void )

◆ _boxprint()

void _boxprint ( void )

◆ _boxprint2()

void _boxprint2 ( void )

◆ _boxpropx()

void _boxpropx ( void )

◆ _boxpropy()

void _boxpropy ( void )

◆ _boxselected()

void _boxselected ( void )

◆ _boxshow()

void _boxshow ( void )

◆ _boxshow2()

void _boxshow2 ( void )

◆ _boxstring()

void _boxstring ( void )

◆ _boxstring2()

void _boxstring2 ( void )

◆ _boxvalue()

void _boxvalue ( void )

◆ _boxvalue2()

void _boxvalue2 ( void )

◆ _changebox()

void _changebox ( void )

◆ _deselectbox()

void _deselectbox ( void )

◆ _disablebox()

void _disablebox ( void )

◆ _enablebox()

void _enablebox ( void )

◆ _freepage()

void _freepage ( void )

◆ _initpage()

void _initpage ( void )

◆ _mouseenabled()

void _mouseenabled ( void )

◆ _redrawbox()

void _redrawbox ( void )

◆ _redrawpage()

void _redrawpage ( void )

◆ _selectbox()

void _selectbox ( void )

◆ _selectbox2()

void _selectbox2 ( void )

◆ _selectbox3()

void _selectbox3 ( void )

◆ _setbox()

void _setbox ( void )

◆ _setbox2()

void _setbox2 ( void )

◆ _setboxcolor()

void _setboxcolor ( void )

◆ _setboxstring()

void _setboxstring ( void )

◆ _setboxtitle()

void _setboxtitle ( void )

◆ _setpagepens()

void _setpagepens ( void )

◆ _spotbox()

void _spotbox ( void )

◆ _togglebox()

void _togglebox ( void )

◆ activateselected()

void activateselected ( struct page * p)
static

◆ activateselected_c()

void activateselected_c ( void )
static

ActivateSelectedBox: activate the selected box.

Button and list: redraw; string box: start editing (cursor after the prompt); prop: start moving the knob; drag: start dragging. Errors (always checked): "UnInitialised Page".

Reads a3: the used page.

◆ addbox()

struct box * addbox ( struct page * p,
ULONG n,
ULONG x,
ULONG y,
ULONG w,
ULONG h,
WORD type )
static

◆ addbox1_c()

void addbox1_c ( ULONG n,
ULONG x,
ULONG y,
ULONG w,
ULONG h,
const UBYTE * args )
static

AddBox Page#,Box#,x,y,w,h,type,text$: a box with a text.

As AddBox, then the text: for a string box the prompt (copied into the spaces; error "No Room For String" if it does not fit); otherwise a copy (memlib globalloc) with "|" as separator of several strings (a text starting with "|" is taken verbatim), view, button and list boxes get value 0 and range = the number of strings (list boxes: fixed, #989).

Reads a3: the page (!libs{blitzoslib,$1380} from Page# in d0).

Parameters
nd1.w: Box#
xd2.w: x
yd3.w: y
wd4.w: the width
hd5.w: the height
argsa2: the argument stack: the string pointer and its length are below the type word

◆ addbox2_c()

void addbox2_c ( ULONG n,
ULONG x,
ULONG y,
ULONG w,
ULONG h,
const UWORD * args )
static

AddBox Page#,Box#,x,y,w,h,type,shape,shape: a shape button.

As AddBox, then the box shows shapes (isshape -1): the first shape and the number of shapes (range = second - first + 1); the button's value selects the shape.

Reads a3: the page (!libs{blitzoslib,$1380} from Page# in d0).

Parameters
nd1.w: Box#
xd2.w: x
yd3.w: y
wd4.w: the width
hd5.w: the height
argsa2: the argument stack, -2(a2) = type, -4 the first shape, -6 the last shape

◆ addbox_c()

void addbox_c ( ULONG n,
ULONG x,
ULONG y,
ULONG w,
ULONG h,
const UWORD * args )
static

AddBox Page#,Box#,x,y,w,h,type: define a box.

Frees the box's old text; type bit 0 = inverted bevel (NOT of the colour c2), type >> 1 = the box type (0 view, 1 button, 2 string, 3 prop, 4 shape/display, 5 list, 6 drag). A string box gets w/8 spaces, a prop box its knob (fixed axis -1 if the track is too short). Not drawn. Errors (always checked): "UnInitialised Page", "Illegal Box# For Page", "No Room For String" (a string box narrower than 8 pixels). Fixed (#84): a string box 8..15 pixels wide gets the empty text (the original wrote 65536 spaces behind its 1 byte).

Reads a3: the page (!libs{blitzoslib,$1380} from Page# in d0).

Parameters
nd1.w: Box#
xd2.w: x
yd3.w: y
wd4.w: the width
hd5.w: the height
argsa2: the argument stack, -2(a2) = type

◆ BLITZ_ALIAS() [1/36]

◆ BLITZ_ALIAS() [2/36]

BLITZ_ALIAS ( _addbox ,
addbox_c  )

◆ BLITZ_ALIAS() [3/36]

BLITZ_ALIAS ( _addbox1 ,
addbox1_c  )

◆ BLITZ_ALIAS() [4/36]

BLITZ_ALIAS ( _addbox2 ,
addbox2_c  )

◆ BLITZ_ALIAS() [5/36]

BLITZ_ALIAS ( _blitzevent ,
blitzevent_c  )

◆ BLITZ_ALIAS() [6/36]

BLITZ_ALIAS ( _boxprint ,
boxprint_c  )

◆ BLITZ_ALIAS() [7/36]

BLITZ_ALIAS ( _boxprint2 ,
boxprint2_c  )

◆ BLITZ_ALIAS() [8/36]

BLITZ_ALIAS ( _boxpropx ,
boxpropx_c  )

◆ BLITZ_ALIAS() [9/36]

BLITZ_ALIAS ( _boxpropy ,
boxpropy_c  )

◆ BLITZ_ALIAS() [10/36]

BLITZ_ALIAS ( _boxselected ,
boxselected_c  )

◆ BLITZ_ALIAS() [11/36]

BLITZ_ALIAS ( _boxshow ,
boxshow_c  )

◆ BLITZ_ALIAS() [12/36]

BLITZ_ALIAS ( _boxshow2 ,
boxshow2_c  )

◆ BLITZ_ALIAS() [13/36]

BLITZ_ALIAS ( _boxstring ,
boxstring_c  )

◆ BLITZ_ALIAS() [14/36]

BLITZ_ALIAS ( _boxstring2 ,
boxstring2_c  )

◆ BLITZ_ALIAS() [15/36]

BLITZ_ALIAS ( _boxvalue ,
boxvalue_c  )

◆ BLITZ_ALIAS() [16/36]

BLITZ_ALIAS ( _boxvalue2 ,
boxvalue2_c  )

◆ BLITZ_ALIAS() [17/36]

BLITZ_ALIAS ( _changebox ,
changebox_c  )

◆ BLITZ_ALIAS() [18/36]

BLITZ_ALIAS ( _deselectbox ,
deselectbox_c  )

◆ BLITZ_ALIAS() [19/36]

BLITZ_ALIAS ( _disablebox ,
disablebox_c  )

◆ BLITZ_ALIAS() [20/36]

BLITZ_ALIAS ( _enablebox ,
enablebox_c  )

◆ BLITZ_ALIAS() [21/36]

BLITZ_ALIAS ( _freepage ,
freepage_c  )

◆ BLITZ_ALIAS() [22/36]

BLITZ_ALIAS ( _initpage ,
initpage_c  )

◆ BLITZ_ALIAS() [23/36]

BLITZ_ALIAS ( _mouseenabled ,
mouseenabled_c  )

◆ BLITZ_ALIAS() [24/36]

BLITZ_ALIAS ( _redrawbox ,
redrawbox_c  )

◆ BLITZ_ALIAS() [25/36]

BLITZ_ALIAS ( _redrawpage ,
redrawpage_c  )

◆ BLITZ_ALIAS() [26/36]

BLITZ_ALIAS ( _selectbox ,
selectbox_c  )

◆ BLITZ_ALIAS() [27/36]

BLITZ_ALIAS ( _selectbox2 ,
selectbox2_c  )

◆ BLITZ_ALIAS() [28/36]

BLITZ_ALIAS ( _selectbox3 ,
selectbox3_c  )

◆ BLITZ_ALIAS() [29/36]

BLITZ_ALIAS ( _setbox ,
setbox_c  )

◆ BLITZ_ALIAS() [30/36]

BLITZ_ALIAS ( _setbox2 ,
setbox2_c  )

◆ BLITZ_ALIAS() [31/36]

BLITZ_ALIAS ( _setboxcolor ,
setboxcolor_c  )

◆ BLITZ_ALIAS() [32/36]

BLITZ_ALIAS ( _setboxstring ,
setboxstring_c  )

◆ BLITZ_ALIAS() [33/36]

BLITZ_ALIAS ( _setboxtitle ,
setboxtitle_c  )

◆ BLITZ_ALIAS() [34/36]

BLITZ_ALIAS ( _setpagepens ,
setpagepens_c  )

◆ BLITZ_ALIAS() [35/36]

BLITZ_ALIAS ( _spotbox ,
spotbox_c  )

◆ BLITZ_ALIAS() [36/36]

BLITZ_ALIAS ( _togglebox ,
togglebox_c  )

◆ blitzevent()

LONG blitzevent ( struct page * p)
static

◆ blitzevent_c()

ULONG blitzevent_c ( void )
static

BlitzEvent: handle the user input of the used page.

Reads joystick, mouse, cursor keys (Return as button, left Alt + left Amiga and right Amiga + right Alt as the mouse buttons) and the keyboard (BlitzKey): moves the selection, edits string boxes, moves list entries, prop knobs and drag boxes, presses and releases buttons. Fixed (#90): cursor up/down with nothing selected moves no list (the original read btype of selected = 0, at address 8). Fixed (#91): after Backspace at position 0 and the other control characters (Return, Esc, Tab, codes above 127) the cursor is on again (the original left it off). Not a bug (#92): the character cycle of the cursor keys uses BMI after CMP.b.

Reads a3: the used page.

Returns
d0: -1 = a button was released (clicked), 1 = a box was activated, 2 = a prop or drag box moved, 0 = nothing

◆ boxf()

void boxf ( WORD x1,
WORD y1,
WORD x2,
WORD y2,
ULONG c )
static

◆ boxprint()

void boxprint ( struct page * p,
ULONG n,
const UBYTE * s,
ULONG * lens )
static

◆ boxprint2_c()

void boxprint2_c ( ULONG n,
UBYTE ** bank,
ULONG ln )
static

BoxPrint Box#,Bank#,Line: print a line of a bank into a view box.

The line (ended by LF or 0) is printed as BoxPrint Box#,String$. Errors (always checked): "Unitialised Bank", then those of BoxPrint. A line ends at LF or 0 (both count when the lines before it are skipped). Fixed (#87): the bank is not changed (the original replaced the line's LF in the bank by 0).

Reads a3: the used page.

Parameters
nd0.w: Box#
banka2: the bank object (!libs{banklib,$1281} from Bank#)
lnd2.w: Line (from 0)

◆ boxprint_c()

void boxprint_c ( ULONG n,
const UBYTE * s,
ULONG * lens )
static

BoxPrint Box#,String$: print a line into a view box.

A box lower than 16 pixels scrolls its line left and prints at the right; otherwise the box scrolls up 8 pixels and the string goes into the last line. Errors (always checked): "UnInitialised Page", "Illegal Box# For Page", "Illegal Box Type" (not a view box). Not a bug (#88): overwrites the string length at -4(a2) with Scroll's size.

Reads a3: the used page.

Parameters
nd0.w: Box#
sd1: the string
lensa2: the argument stack, -4(a2) = the string's length

◆ boxpropx_c()

ULONG boxpropx_c ( ULONG n)
static

BoxPropX Box#: the horizontal knob position of a prop box.

Errors (always checked): "UnInitialised Page", "Illegal Box# For Page".

Reads a3: the used page.

Parameters
nd0.w: Box#
Returns
d0: the knob position as Quick (the word * 2; -1 * 2 for a fixed axis)

◆ boxpropy_c()

ULONG boxpropy_c ( ULONG n)
static

BoxPropY Box#: the vertical knob position of a prop box.

As BoxPropX.

Reads a3: the used page.

Parameters
nd0.w: Box#
Returns
d0: the knob position as Quick (the word * 2)

◆ boxselected_c()

ULONG boxselected_c ( void )
static

BoxSelected: the selected box of the used page.

(selected - memloc) >> 5. Errors (always checked): "UnInitialised Page". Fixed (#81): shifted as a long (the original's LSR.w gave the wrong number from box 2048 on).

Reads a3: the used page.

Returns
d0.w: the Box#, -1 for none

◆ boxshow2_c()

void boxshow2_c ( ULONG n,
ULONG dx,
ULONG dy )
static

BoxShow Box#,dx,dy: move the view of a view box.

As BoxShow Box#,Bitmap#,x,y with the position moved by dx,dy. Errors as BoxShow.

Reads a3: the used page.

Parameters
nd0.w: Box#
dxd1.w: the x offset
dyd2.w: the y offset

◆ boxshow_c()

void boxshow_c ( ULONG n,
UBYTE * bm,
ULONG x,
ULONG y )
static

BoxShow Box#,Bitmap#,x,y: show part of a bitmap in a view box.

Scrolls the bitmap from x,y (clipped to the bitmap) into the box. Errors (always checked): "UnInitialised Page", "Illegal Box# For Page", "Illegal Box Type" (not a view box).

Reads a3: the used page.

Parameters
nd0.w: Box#
bma2: the bitmap object (!libs{bitmaplib,$1281} from Bitmap#)
xd2.w: x in the bitmap
yd3.w: y in the bitmap

◆ boxstring()

ULONG boxstring ( struct page * p,
ULONG n )
static

◆ boxstring2_c()

ULONG boxstring2_c ( ULONG callerd0,
ULONG n,
struct page * p )
static

BoxString(Page#,Box#): BoxString of a box of a page.

Parameters
callerd0d0: Page# (its upper word stays)
nd1.w: Box#
pa1: the page (!libs{blitzoslib,$1180} from Page#)
Returns
d0: the length of the string at a3

◆ boxstring_c()

ULONG boxstring_c ( ULONG n,
struct page * p )
static

BoxString(Box#): the answer of a string box, without trailing spaces.

The answer after the prompt goes to a3; no 0 is written, a3 = the end (not a bug, #86: the compiler appends the 0 itself). Errors (always checked): "UnInitialised Page", "Illegal Box# For Page". Fixed (#85): the trailing spaces are stripped back to the start of the answer, an all-space answer is the empty string (the original ran on into the prompt and the memory before the text: a negative length copied up to 65535 bytes).

Parameters
nd0.w: Box#
pa1: the used page (!libs{blitzoslib,$1102})
Returns
d0: the length of the string at a3

◆ boxtext()

void boxtext ( struct box * b,
ULONG len,
const UBYTE * s )
static

◆ boxvalue2_c()

ULONG boxvalue2_c ( ULONG callerd0,
ULONG n )
static

BoxValue(Page#,Box#): the value of a box of a page.

As BoxValue(Box#) (MOVE d1,d0 first).

Reads a3: the page (!libs{blitzoslib,$1380} from Page# in d0).

Parameters
callerd0d0: Page# (its upper word stays)
nd1.w: Box#
Returns
d0.w: the value

◆ boxvalue_c()

ULONG boxvalue_c ( ULONG n)
static

BoxValue(Box#): the value of a box of the used page.

MOVE value,d0: a word function, the upper word of d0 is the caller's. Errors (always checked): "UnInitialised Page", "Illegal Box# For Page".

Reads a3: the used page.

Parameters
nd0.w: Box#
Returns
d0.w: the value

◆ changebox_c()

void changebox_c ( ULONG n,
ULONG v )
static

ChangeBox Page#,Box#,Value: SetBox for the box of a page.

Reads a3: the page (!libs{blitzoslib,$1380} from Page# in d0).

Parameters
nd1.w: Box#
vd2.w: Value

◆ chkpage()

void chkpage ( struct page * p)
static

◆ colour()

void colour ( ULONG fg,
ULONG bg )
static

◆ deselectbox_c()

void deselectbox_c ( void )
static

DeSelectBox: deselect the selected box and draw it as not pressed.

Restores an inverted bevel and ends editing, prop and drag. Errors (always checked): "UnInitialised Page". Fixed (#94): clears the selection (the original kept selected: BoxSelected still returned the box, BlitzEvent still acted on it).

Reads a3: the used page.

◆ disablebox_c()

void disablebox_c ( ULONG n)
static

DisableBox Box#: disable a box (a negative type).

Not redrawn; a disabled box is drawn as a plain c2 box and cannot be selected with the mouse. Errors (always checked): "UnInitialised Page", "Illegal Box# For Page".

Reads a3: the used page.

Parameters
nd0.w: Box#

◆ divs_sat()

WORD divs_sat ( ULONG dividend,
WORD divisor )
static

◆ dobs()

void dobs ( struct page * p,
struct box * b )
static

◆ docursor()

void docursor ( struct page * p)
static

◆ drawbox()

void drawbox ( struct page * p,
struct box * box )
static

◆ edstring()

void edstring ( struct page * p,
struct box * b )
static

◆ enablebox_c()

void enablebox_c ( ULONG n)
static

EnableBox Box#: enable a disabled box (a positive type).

Not redrawn. Errors (always checked): "UnInitialised Page", "Illegal Box# For Page".

Reads a3: the used page.

Parameters
nd0.w: Box#

◆ freepage_()

void freepage_ ( struct page * p)
static

◆ freepage_c()

void freepage_c ( void )
static

FreePage Page#: free the boxes of a page.

Nothing for an unused page. The texts of the boxes are not freed (memlib's global memory, freed with the program).

Reads a3: the page (!libs{blitzoslib,$1380} from Page# in d0).

◆ getbox()

struct box * getbox ( struct page * p,
ULONG n )
static

◆ globalloc()

void * globalloc ( ULONG size,
ULONG flags )
static

◆ globfree()

void globfree ( void * mem,
ULONG size )
static

◆ inbox()

int inbox ( struct box * b,
WORD px,
WORD py )
static

◆ initpage_c()

void initpage_c ( ULONG n,
UWORD * bm,
ULONG used )
static

InitPage Page#,BitMap#,NumBoxes: a page of boxes drawn into a bitmap.

Frees the page's old boxes, allocates NumBoxes cleared boxes (32 bytes each, MEMF_PUBLIC|MEMF_CLEAR), sets the pens 1,3,2,1 (the help text of SetPagePens says 3,1,2,3) and makes the page the used one. Errors (always checked): "Unitialised BitMap". Debugger only (initpagechk): "Illegal Number of Boxes" for NumBoxes of 32768 or more (fixed, #1043: the original has no check, the table size NumBoxes x 32 of the sign-extended word became negative).

Reads a3: the page (!libs{blitzoslib,$1380} from Page# in d0).

Parameters
nd2: NumBoxes
bma2: the bitmap object (!libs{bitmaplib,$1281} from BitMap#)
usedd6: the offset of the used page variable (auto use)

◆ initpagechk()

void initpagechk ( void )

◆ initpagechk_c()

void initpagechk_c ( ULONG n)
static

The error check of InitPage (debugger only).

Fixed (#1043), not in the original (InitPage had no check): the size of the box table is NumBoxes x 32 of the word sign-extended, so NumBoxes of 32768 or more gives a negative size. 0 boxes stay valid (a page without boxes, #83).

Errors: "Illegal Number of Boxes".

Parameters
nd2.w: NumBoxes

◆ line()

void line ( WORD x1,
WORD y1,
WORD x2,
WORD y2,
ULONG c )
static

◆ locate()

void locate ( ULONG x,
ULONG y )
static

◆ locrow()

ULONG locrow ( WORD y)
static

◆ mouseenabled_c()

ULONG mouseenabled_c ( ULONG callerd0)
static

MouseEnabled: whether BlitzEvent follows the mouse.

MOVE mo,d0 (low word): set when the mouse moved fast enough, cleared by a direction of the joystick or the cursor keys; 0 while dragging.

Parameters
callerd0d0: the caller's register (its upper word stays)
Returns
d0.w: -1 = mouse, 0 = joystick/keys

◆ printn()

void printn ( const UBYTE * s,
ULONG len )
static

◆ rawstatus()

int rawstatus ( UWORD key)
static

◆ redrawbox_c()

void redrawbox_c ( ULONG n)
static

RedrawBox Box#: draw a box of the used page.

Errors (always checked): "UnInitialised Page", "Illegal Box# For Page". Fixed (#89): a box without a text prints nothing (the original printed from address 0 with an old text pointer as the length, in drawbox).

Reads a3: the used page.

Parameters
nd0.w: Box#

◆ redrawpage_c()

void redrawpage_c ( void )
static

RedrawPage: draw all boxes of the used page.

Draws every box with a width. Errors (always checked): "UnInitialised Page".

Reads a3: the used page.

◆ scroll()

void scroll ( ULONG sx,
ULONG sy,
ULONG dx,
ULONG dy,
UWORD w,
UWORD h,
void * src,
void * dst )
static

◆ selectbox2()

void selectbox2 ( struct page * p,
WORD dx,
WORD dy )
static

◆ selectbox2_c()

void selectbox2_c ( ULONG dx,
ULONG dy )
static

SelectBox x+,y+: select the nearest box in a direction.

From the selected box, the nearest enabled box in direction dx,dy (signs); nothing without a selected box. Errors (always checked): "UnInitialised Page".

Reads a3: the used page.

Parameters
dxd0.w: the x direction (<0, 0, >0)
dyd1.w: the y direction (<0, 0, >0)

◆ selectbox3()

LONG selectbox3 ( struct page * p,
WORD x,
WORD y )
static

◆ selectbox3_c()

ULONG selectbox3_c ( ULONG x,
ULONG y )
static

SelectBox 0,x,y: select the enabled box at x,y.

Draws the new box and the old one. Errors (always checked): "UnInitialised Page". Not a bug (#93): redraws the old box also when it is the new one.

Reads a3: the used page.

Parameters
xd1.w: x
yd2.w: y
Returns
d0: -1 = a box was found and selected, 0 = none (a statement: the value is used only by BlitzEvent)

◆ selectbox_c()

void selectbox_c ( ULONG n)
static

SelectBox Box#: select a box (and draw it and the old one).

A negative Box# only deselects. Errors (always checked): "UnInitialised Page". Fixed (#81): the offset is computed as a long (the original's ASL #5 as a word made the boxes 1024..2047 deselect only and wrapped from 2048 on). Errors (debugger only, selectboxchk): "Illegal Box# For Page" (fixed, #82: the original did not check Box#; without the debugger a number behind the table still selects what lies there, an invalid argument).

Reads a3: the used page.

Parameters
nd0.w: Box#

◆ selectboxchk()

void selectboxchk ( void )

◆ selectboxchk_c()

void selectboxchk_c ( ULONG n)
static

The error check of SelectBox Box# (debugger only).

Fixed (#82), not in the original (SelectBox Box# did not check the number): a Box# from 0 on must be a box of the used page (a negative one deselects). The page is checked first, as SelectBox does.

Errors: "UnInitialised Page", "Illegal Box# For Page".

Reads a3: the used page.

Parameters
nd0.w: Box#

◆ setbox()

void setbox ( ULONG n,
ULONG v )
static

◆ setbox2_c()

void setbox2_c ( ULONG n,
ULONG qx,
ULONG qy )
static

SetBox Box#,xprop,yprop: the knob position of a prop box.

Quick values: (q-1 if q<>0).w >> 1; a fixed axis (-1) stays. Not redrawn. Errors (always checked): "UnInitialised Page", "Illegal Box# For Page", "Not a Prop Box".

Reads a3: the used page.

Parameters
nd0.w: Box#
qxd1: xprop (Quick)
qyd2: yprop (Quick)

◆ setbox_c()

void setbox_c ( ULONG n,
ULONG v )
static

SetBox Box#,Value: the value of a box (the selected string).

A negative value counts from the end (+ range). Not redrawn. Errors (always checked): "UnInitialised Page", "Illegal Box# For Page", "Value Out of Range" (not 0 <= value < range).

Reads a3: the used page.

Parameters
nd0.w: Box#
vd1.w: Value

◆ setboxcolor_c()

void setboxcolor_c ( ULONG n,
ULONG c )
static

SetBoxColor Box#,color: the background colour of a box.

Keeps an inverted bevel (NOT), then draws the box. Errors (always checked): "UnInitialised Page", "Illegal Box# For Page".

Reads a3: the used page.

Parameters
nd0.w: Box#
cd1.w: the colour

◆ setboxstring_c()

void setboxstring_c ( ULONG n,
const UBYTE * s,
const ULONG * lens )
static

SetBoxString Box#,String$: the answer of a string box.

Written after the prompt, padded with spaces. Not redrawn. Errors (always checked): "UnInitialised Page", "Illegal Box# For Page", "No Room For String".

Reads a3: the used page.

Parameters
nd0.w: Box#
sd1: the string
lensa2: the argument stack, -4(a2) = the string's length

◆ setboxtitle_c()

void setboxtitle_c ( ULONG n,
const UBYTE * s,
const ULONG * lens )
static

SetBoxTitle Box#,String$: the text of a box.

Frees the old text (not of a string box) and sets the new one as AddBox ...,text$. Not redrawn. Errors (always checked): "UnInitialised Page", "Illegal Box# For Page", "No Room For String".

Reads a3: the used page.

Parameters
nd0.w: Box#
sd1: the string
lensa2: the argument stack, -4(a2) = the string's length

◆ setpagepens_c()

void setpagepens_c ( ULONG dark,
ULONG light,
ULONG mid,
ULONG txt )
static

SetPagePens Page#,c0,c1,c2,c3: the pens of a page.

Reads a3: the page (!libs{blitzoslib,$1380} from Page# in d0).

Parameters
darkd1.w: c0, the dark bevel pen
lightd2.w: c1, the light bevel pen
midd3.w: c2, the background pen
txtd4.w: c3, the text pen

◆ spotbox_c()

ULONG spotbox_c ( void )
static

SpotBox: the box that the mouse is over.

The first enabled box under (mx,my) of the last BlitzEvent. Errors (debugger only, spotboxchk): "UnInitialised Page" (fixed, #83: the original had no page check; without the debugger a page without boxes is still scanned 65536 entries far, an invalid argument).

Reads a3: the used page.

Returns
d0.w: the Box#, -1 for none (the upper word is mx's sign)

◆ spotboxchk()

void spotboxchk ( void )

◆ spotboxchk_c()

void spotboxchk_c ( void )
static

The error check of SpotBox (debugger only).

Fixed (#83), not in the original (SpotBox had no page check): the used page must be initialised (a memory size, i.e. InitPage with at least one box), as the other commands check always.

Errors: "UnInitialised Page".

Reads a3: the used page.

◆ togglebox_c()

void togglebox_c ( ULONG n)
static

ToggleBox Box#: invert the bevel of a box (NOT of its colour).

Not redrawn. Errors (always checked): "UnInitialised Page", "Illegal Box# For Page".

Reads a3: the used page.

Parameters
nd0.w: Box#

◆ waitblit()

void waitblit ( void )
static

Variable Documentation

◆ btype

WORD btype
static

◆ button

WORD button
static

◆ c0

WORD c0
static

◆ c1

WORD c1
static

◆ c2

WORD c2
static

◆ c3

WORD c3
static

◆ count

WORD count
static

◆ cx

UWORD cx
static

◆ cy

UWORD cy
static

◆ dcon

WORD dcon = 6
staticconstexpr

◆ delay

WORD delay
static

◆ delt

const WORD delt[] = { 0, 0, 0, -1, -1, 0, 0, 1, 1, 0 }
static

◆ edxyc

WORD edxyc[3]
static

◆ indrag

WORD indrag
static

◆ inedit

WORD inedit
static

◆ inprop

WORD inprop
static

◆ jb

WORD jb
static

◆ jx

WORD jx
static

◆ jy

WORD jy
static

◆ linelen

ULONG linelen[2]
static

◆ lines

WORD lines ( void )
static

◆ mb

WORD mb
static

◆ mess1

const char mess1[] = "UnInitialised Page"
static

◆ mess2

const char mess2[] = "Illegal Box# For Page"
static

◆ mess3

const char mess3[] = "Value Out of Range"
static

◆ mess4

const char mess4[] = "No Room For String"
static

◆ mess5

const char mess5[] = "Illegal Box Type"
static

◆ mess6

const char mess6[] = "Unitialised Bank"
static

◆ mess7

const char mess7[] = "Not a Prop Box"
static

◆ mess8

const char mess8[] = "Unitialised BitMap"
static

◆ mo

WORD mo
static

◆ mx

WORD mx
static

◆ my

WORD my
static

◆ nable

WORD nable
static

◆ ox

WORD ox
static

◆ oy

WORD oy
static

◆ pspd

WORD pspd = 1024
staticconstexpr

◆ sel

WORD sel
static

◆ status

WORD status ( void )
static

◆ text

ULONG text[2]
static

◆ xx

ULONG xx
static

◆ xyxy

WORD xyxy[4]
static

◆ xyxy2

WORD xyxy2[4]
static

◆ yy

ULONG yy
static