|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
Data Structures | |
| struct | fns |
| struct | fnshead |
Macros | |
| #define | TOK_bload ((LIB_riamosfunclib << 7) + 15) /* form 1: d0 name, d1 bank */ |
| #define | TOK_start ((LIB_riamosfunclib << 7) + 17) /* d0 bank -> d0 address */ |
| #define | TOK_length ((LIB_riamosfunclib << 7) + 18) /* d0 bank -> d0 its length */ |
| #define | TOK_erase ((LIB_riamosfunclib << 7) + 19) /* d0 bank */ |
| #define | TOK_banklimit ((LIB_riamosfunclib << 7) + 36) /* form 1: -> d0 the number of banks */ |
| #define | FNSID 0x464e532eUL /* "FNS." */ |
| #define | FONTSIZE 1712 |
| #define | BMAP0 LIB_bitmaplib, BL_IA0|BL_PD0 /* !bmap {0,0} */ |
| #define | OFF_TCOLOUR 44 |
| #define | OFF_TCOLOUR2 45 |
| #define | OFF_TEXTPREFS 46 |
| #define | OFF_TEXTPREFS2 47 |
| #define | OFF_BITADDRESS 78 |
| #define | FNS_FONT "../../../archive/amiblitz3-github/Sourcecodes/Data/fns/fonts/PERSONAL.FNS" |
| #define | FH(font) |
| #define | LONGAT(p) |
| #define | DEFLAST (122 - 32) |
| #define | BITSTACK ((ULONG *)((UBYTE *)&fns + offsetof(struct fns, bitstack))) |
| #define | S_(x) |
Functions | |
| void | _fnsprint (void) |
| void | _fnsprint2 (void) |
| void | _installfns (void) |
| void | _installfns3 (void) |
| void | _fnsoutput2 (void) |
| void | _fnsoutput (void) |
| void | _fnsink (void) |
| void | _fnsprefs2 (void) |
| void | _fnsprefs (void) |
| void | _fnsheight (void) |
| void | _fnsclipset (void) |
| void | _fnsclipoutputset (void) |
| void | _removefns (void) |
| void | _fnsunderline (void) |
| void | _fnslength2 (void) |
| void | _fnslength (void) |
| void | _fnsversion (void) |
| FNSVersion: the version of the library, 1.1 as a Quick. | |
| void | _fnsorigin2 (void) |
| void | _fnsorigin (void) |
| void | _fnswidth (void) |
| void | _fnsload (void) |
| void | _fnsslot (void) |
| void | _fnsunload (void) |
| void | _fnssettab (void) |
| void | _fnsshadowprint (void) |
| void | _fnsshadowprint2 (void) |
| void | _fnsshadowprint3 (void) |
| void | rifnslib_libinit (void) |
| void | clipchk (void) |
| void | tabchk (void) |
| static void | _libfinit (void) |
| finit: nothing. | |
| static int | isfont (const UBYTE *font) |
| static void | underline (UWORD x) |
| static UWORD | countwidth (const UBYTE *font, const UBYTE *p, UBYTE bold, UBYTE lastg) |
| static void | drawchar (const UWORD *g, ULONG rowoff, UWORD s) |
| static UBYTE * | print (UWORD fontnum, UWORD x0, UWORD y0, const UBYTE *str, UBYTE prefs, UBYTE colour, UBYTE *result) |
| static UBYTE * | print_c (UWORD fontnum, UWORD x, UWORD y, const UBYTE *str, UWORD prefs, UWORD colour, UBYTE *result) |
| FNSPrint fontnum,x,y,a$,prefs,colour: prints a text into the FNSOutput bitmap. | |
| static UBYTE * | shadow_c (UWORD fontnum, UWORD x, UWORD y, const UBYTE *str, UWORD prefs, UWORD colour, UWORD shadow, UBYTE *result) |
| FNSShadowPrint fontnum,x,y,a$,prefs,colour,shadow: prints a text with a shadow. | |
| static void | libinit_c (void) |
| init: the variables as the library is loaded, slot 0 = the built-in font. | |
| static ULONG | installfns3_c (ULONG n, const UBYTE *font, UWORD count) |
| InstallFNS(fontnum,address,characters): puts a font of characters glyphs into a slot. | |
| static ULONG | installfns_c (ULONG n, const UBYTE *font) |
| InstallFNS(fontnum,address): puts a font in memory into a slot. | |
| static void | removefns_c (ULONG n) |
| RemoveFNS fontnum: empties a font slot. | |
| static void | clipoutput_c (void) |
| FNSClipOutput: the clipping zone = the whole output bitmap. | |
| static void | output_c (UWORD clip, struct BitMap *bm) |
| FNSOutput bitmap,clip_update: the bitmap to print into. | |
| static void | output2_c (struct BitMap *bm) |
| FNSOutput bitmap: as FNSOutput bitmap,Off (the clipping zone stays). | |
| static void | ink_c (UWORD c) |
| FNSInk colour: the colour of FNSPrint without prefs,colour. | |
| static void | prefs2_c (UWORD p) |
| FNSPrefs prefs: the prefs of FNSPrint without prefs,colour. | |
| static void | prefs_c (UWORD p, UWORD c) |
| FNSPrefs prefs,colour: the prefs and the colour of FNSPrint without them. | |
| static ULONG | fontword (ULONG n, int off) |
| static ULONG | height_c (ULONG n) |
| FNSHeight(fontnum): the height of a font. | |
| static ULONG | underline_c (ULONG n) |
| FNSUnderline(fontnum): the underline offset of a font. | |
| static ULONG | width_c (ULONG n) |
| FNSWidth(fontnum): the width of a font in pixels (16, 32, 48, 64). | |
| static void | clipset_c (UWORD x0, UWORD y0, UWORD x1, UWORD y1) |
| FNSClip xmin,ymin,xmax,ymax: the clipping zone; x rounded down to 16. | |
| static ULONG | length_c (UWORD n, const UBYTE *str, UWORD prefs) |
| FNSLength(fontnum,a$,prefs): the width of a text in pixels. | |
| static ULONG | length2_c (UWORD n, const UBYTE *str) |
| FNSLength(fontnum,a$): as FNSLength with FNSPrefs' prefs. | |
| static void | origin2_c (void) |
| FNSOrigin: the origin of FNSPrint back to 0,0. | |
| static void | origin_c (UWORD x, UWORD y) |
| FNSOrigin x,y: the origin added to FNSPrint's x,y. | |
| static UBYTE | filelast (const UBYTE *font, ULONG size) |
| static ULONG | load_c (ULONG name, ULONG slot) |
| FNSLoad(fontname$,fontslot): loads a font file into a slot. | |
| static void | unload_c (ULONG slot) |
| FNSUnload fontslot: empties the slot and erases its bank. | |
| static ULONG | slot_c (void) |
| FNSSlot: the address of the 16 font slots (longs). | |
| static void | settab_c (UWORD t) |
| FNSSetTab tab_size: the tab size in pixels (32 at first). | |
| static void | clipchk_c (UWORD x0, UWORD y0) |
| The error check of FNSClip (debugger only). | |
| static void | tabchk_c (UWORD t) |
| The error check of FNSSetTab (debugger only). | |
Variables | |
| struct fns | fns |
| static UBYTE | lastglyph [16] = { [0 ... 15] = DEFLAST } |
| static UWORD | loadedslots |
| static LONG | slotbank [16] = { [0 ... 15] = -1 } |
| static UWORD | gly |
| static UWORD | glrows |
| #define DEFLAST (122 - 32) |
| #define FNS_FONT "../../../archive/amiblitz3-github/Sourcecodes/Data/fns/fonts/PERSONAL.FNS" |
| #define FNSID 0x464e532eUL /* "FNS." */ |
| #define FONTSIZE 1712 |
| #define LONGAT | ( | p | ) |
| #define OFF_BITADDRESS 78 |
| #define OFF_TCOLOUR 44 |
| #define OFF_TCOLOUR2 45 |
| #define OFF_TEXTPREFS 46 |
| #define OFF_TEXTPREFS2 47 |
| #define S_ | ( | x | ) |
| #define TOK_erase ((LIB_riamosfunclib << 7) + 19) /* d0 bank */ |
| #define TOK_start ((LIB_riamosfunclib << 7) + 17) /* d0 bank -> d0 address */ |
| void _fnsclipoutputset | ( | void | ) |
| void _fnsclipset | ( | void | ) |
| void _fnsheight | ( | void | ) |
| void _fnsink | ( | void | ) |
| void _fnslength | ( | void | ) |
| void _fnslength2 | ( | void | ) |
| void _fnsload | ( | void | ) |
| void _fnsorigin | ( | void | ) |
| void _fnsorigin2 | ( | void | ) |
| void _fnsoutput | ( | void | ) |
| void _fnsoutput2 | ( | void | ) |
| void _fnsprefs | ( | void | ) |
| void _fnsprefs2 | ( | void | ) |
| void _fnsprint | ( | void | ) |
| void _fnsprint2 | ( | void | ) |
| void _fnssettab | ( | void | ) |
| void _fnsshadowprint | ( | void | ) |
| void _fnsshadowprint2 | ( | void | ) |
| void _fnsshadowprint3 | ( | void | ) |
| void _fnsslot | ( | void | ) |
| void _fnsunderline | ( | void | ) |
| void _fnsunload | ( | void | ) |
| void _fnsversion | ( | void | ) |
FNSVersion: the version of the library, 1.1 as a Quick.
Inline: MOVE.l #65536+6553,d0.
| void _fnswidth | ( | void | ) |
| void _installfns | ( | void | ) |
| void _installfns3 | ( | void | ) |
|
static |
finit: nothing.
| void _removefns | ( | void | ) |
| void clipchk | ( | void | ) |
|
static |
The error check of FNSClip (debugger only).
Fixed (#664), not in the original (rifnslib had no error check area): FNSPrint tests the rows signed at ymin and unsigned at ymax and takes the byte offset of x as ASR.w of the long x & $FFF0; with a negative xmin or ymin a text at negative x or y was written about 64K bytes or rows away. The release code is unchanged (an invalid argument, D-005).
Errors: "FNSClip zone must not start below 0" (xmin or ymin below 0).
| x0 | d0: xmin |
| y0 | d1: ymin |
|
static |
FNSClipOutput: the clipping zone = the whole output bitmap.
xmin, ymin 0, xmax = the bytes per row * 8, ymax = the rows (fixed, #1128: the first row outside, as xmax; the original set the rows - 1).
|
static |
FNSClip xmin,ymin,xmax,ymax: the clipping zone; x rounded down to 16.
xmax and ymax are the first column and row outside the zone (fixed, #1128: the manual's "FNSClip 0,0,320,256" for a 320x256 bitmap; the original drew rows up to ymax itself, one behind such a bitmap). A negative xmin or ymin is the programmer's: with runtime error checking clipchk refuses it (fixed #664).
| x0 | d0: xmin |
| y0 | d1: ymin |
| x1 | d2: xmax |
| y1 | d3: ymax |
|
inlinestatic |
|
static |
|
static |
|
static |
|
static |
FNSHeight(fontnum): the height of a font.
| n | d0: the slot (& 15) |
|
static |
FNSInk colour: the colour of FNSPrint without prefs,colour.
| c | d0: the colour (its low byte) |
|
static |
InstallFNS(fontnum,address,characters): puts a font of characters glyphs into a slot.
Fixed (#657), a form the original does not have: the font has the glyphs of the codes 32 to 31 + characters (1 to 224: 0 is taken as 1, the space; above 224 as 224, up to code 255); a code behind them is printed and counted as a space. Only an "FNS." font with a height of at least 1 (fixed, #663).
| n | d0: the slot (& 15) |
| font | d1: the address of the font |
| count | d2: the number of glyphs (a word) |
|
static |
InstallFNS(fontnum,address): puts a font in memory into a slot.
Only an "FNS." font with a height of at least 1 (fixed, #663: the original took a height of 0, which drew 65536 rows per character). The font is taken to have the glyphs of the codes 32 to 122 (fixed, #657: the 91 of every known font; a code behind them is a space).
| n | d0: the slot (& 15) |
| font | d1: the address of the font |
|
static |
|
static |
|
static |
FNSLength(fontnum,a$,prefs): the width of a text in pixels.
The widths of the characters (+ 1 for bold, prefs bit 1) up to the first code that ends the text: the width FNSPrint uses (fixed, #662: the original returned the width - 2, 0 at least). Fixed (#660): the font number & 15 (the original shifted the whole word: 16 on read the font data, negative numbers the variables before font_add).
|
static |
init: the variables as the library is loaded, slot 0 = the built-in font.
Fixed (#1124): every variable in front of the built-in font back to its start value (0, the tab size 32: no output bitmap, the slots 1-15 empty, FNSPrefs, FNSInk, the clip zone and the origin 0), the slots' glyph counts 91 and no FNSLoad bank; the original set slot 0 and the origin only, so a second run of a program from the editor (the library stays loaded) printed with the first run's settings, and FNSPrint before FNSOutput drew into the first run's freed bitmap.
|
static |
FNSLoad(fontname$,fontslot): loads a font file into a slot.
RIAmosFuncLib BLoad into a bank, then its Start into the slot. Fixed (#984): bank 55 + slot when it exists (below BankLimit); else the bank the slot's font is in, or the highest free bank below the limit (-1 when every bank is in use), remembered for FNSUnload. The original always used 55 + slot: with RIAmosFuncLib's default of 50 banks BLoad took the number as an address and read the file to the address 55 + slot, Start returned 0 and FNSLoad -1. Fixed (#657): the font has the glyphs of the codes 32 to 31 + (the bank's length - 256) / bytes per character (Length of the bank, the file's size). Fixed (#663): a file that is no "FNS." font or has a height of 0 is refused: -1, the bank erased, and the slot emptied if its font was the one FNSLoad had put in that bank (BLoad overwrote it); the original stored whatever Start returned (FNSPrint then drew nothing, a font of height 0 65536 rows per character). Amiga mode only.
|
static |
FNSOrigin: the origin of FNSPrint back to 0,0.
|
static |
|
static |
FNSOutput bitmap: as FNSOutput bitmap,Off (the clipping zone stays).
| bm | a0: the bitmap object |
|
static |
FNSOutput bitmap,clip_update: the bitmap to print into.
Keeps the bitmap, its bytes per row and depth. BUG(orig) (#658): the 16 pixel loop draws (Flags<<8 | Depth) - 1 + 1 planes - with Flags set or depth 0 hundreds or 65536.
| clip | d1: On: also FNSClipOutput (a byte) |
| bm | a0: the bitmap object (!bmap) |
|
static |
FNSPrefs prefs: the prefs of FNSPrint without prefs,colour.
| p | d0: the prefs (its low byte) |
|
static |
FNSPrefs prefs,colour: the prefs and the colour of FNSPrint without them.
| p | d0: the prefs (its low byte) |
| c | d1: the colour (its low byte) |
|
static |
|
static |
FNSPrint fontnum,x,y,a$,prefs,colour: prints a text into the FNSOutput bitmap.
Behind the entries _fnsprint/_fnsprint2 (below), which check the bitmap. At x,y + the origin, in the font of slot fontnum & 15 (nothing if it is no "FNS." font); prefs bit 0 centred, 1 bold, 2 underlined, 3 right aligned; chr$(1) + c changes the colour, chr$(9) a tab (FNSSetTab), chr$(10) a new line, chr$(0) and other codes below 32 end the text, a code behind the font's last is printed as a space (fixed #657); clipped by FNSClip; an empty line is neither centred, aligned nor underlined (fixed #659). BUG(orig): depth 0 or above 8 overruns the plane stack (#658). With a negative xmin or ymin (refused by FNSClip's error check, fixed #664) text at negative x or y is written about 64K bytes or rows away; with a tab size of 0 (refused by FNSSetTab's error check, fixed #666) a chr$(9) divides by 0.
| fontnum | d0: the font slot |
| x | d1: x |
| y | d2: y |
| str | d3: the text (a string or an address) |
| prefs | d4: the prefs (a byte) |
| colour | d5: the colour (a byte) |
| result | a0: the caller's a0 (the result without a font) |
|
static |
RemoveFNS fontnum: empties a font slot.
| n | d0: the slot (& 15) |
| void rifnslib_libinit | ( | void | ) |
|
static |
FNSSetTab tab_size: the tab size in pixels (32 at first).
A size of 0 makes chr$(9) divide by 0: with runtime error checking tabchk refuses a size below 1 (fixed #666).
| t | d0: the tab size |
|
static |
FNSShadowPrint fontnum,x,y,a$,prefs,colour,shadow: prints a text with a shadow.
Behind the entries _fnsshadowprint..3 (below). First the text at x+1,y+1 in the shadow colour, then normally, as FNSPrint.
| fontnum | d0: the font slot |
| x | d1: x |
| y | d2: y |
| str | d3: the text |
| prefs | d4: the prefs (a byte) |
| colour | d5: the colour (a byte) |
| shadow | d6: the shadow colour (a byte) |
| result | a0: the caller's a0 |
|
static |
FNSSlot: the address of the 16 font slots (longs).
| void tabchk | ( | void | ) |
|
static |
The error check of FNSSetTab (debugger only).
Fixed (#666), not in the original: a chr$(9) in a printed text moves x to the next tab stop with DIVU tabsize; a size of 0 divided by 0. The release code is unchanged (an invalid argument, D-005).
Errors: "FNSSetTab size must be at least 1" (the size, a signed word, below 1).
| t | d0: the tab size |
|
static |
|
static |
FNSUnderline(fontnum): the underline offset of a font.
| n | d0: the slot (& 15) |
|
static |
FNSUnload fontslot: empties the slot and erases its bank.
The bank FNSLoad last loaded the slot's font into (fixed, #984), bank 55 + slot if there is none (the original's always).
| slot | d0: the slot (& 15) |
|
static |
FNSWidth(fontnum): the width of a font in pixels (16, 32, 48, 64).
| n | d0: the slot (& 15) |
| struct fns fns |
|
static |
|
static |
|
static |
|
static |
|
static |