|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
Data Structures | |
| struct | toke |
| struct | trapregs |
| struct | handlers |
Macros | |
| #define | sw_goblitz 0xc200 /* switchlib */ |
| #define | sw_goamiga 0xc201 |
| #define | sw_goqamiga 0xc202 |
| #define | sw_goblitzS 0xc206 |
| #define | sw_goqamigaS 0xc207 |
Functions | |
| void | donewmode (void) |
| $D500 donewmode: nothing. | |
| void | dostop (void) |
| void | dosethandler (void) |
| void | dodetoke (void) |
| void | doevaluate (void) |
| void | doexecute (void) |
| void | doquit (void) |
| void | dofindoff (void) |
| void | doskip (void) |
| void | debuglib_docall (void) |
| $D509 docall: calls handler 6 of the front end's table. | |
| void | debuglib_codeinit (void) |
| static void | codefinit (void) |
| Library finit: nothing. | |
| void | data (void) |
| void | tasktrap (void) |
| static void | douthandler_c (UBYTE c) |
| static void | dout2_c (UWORD len, const UBYTE *s) |
| void | dout2 (void) |
| static void | dout3_c (const UBYTE *s) |
| void | dout3 (void) |
| static void | amigamode_c (void) |
| void | amigamode (void) |
| static void | fixmode_c (void) |
| void | fixmode (void) |
| void | executestate (void) |
| static BOOL | flagclr (int bit) |
| static ULONG | callhandler (APTR fn, ULONG *arg) |
| void | handleflags (void) |
| static void | codeinit_c (ULONG autorun) |
| Library init: resets the debugger state and installs the trap handler. | |
| static void | dostop_c (void) |
| $D501 dostop: stops the program at the next new line. | |
| static void | doevaluate_c (const char *text) |
| $D504 doevaluate: evaluates an expression at the next new line. | |
| static void | doexecute_c (const char *text) |
| $D505 doexecute: executes a line of Blitz code at the next new line. | |
| static void | doquit_c (void) |
| $D506 doquit: ends the program at the next new line. | |
| static void | doskip_c (void) |
| $D508 doskip: skips the current statement at the next new line. | |
| static APTR | dosethandler_c (UWORD *pflag, const struct handlers *tab) |
| $D502 dosethandler: installs the debugger front end's handlers. | |
| static const char * | tokename (UWORD token) |
| static void | dodetoke_c (UBYTE **p) |
| $D503 dodetoke: detokenises a line (a0 -> a1). | |
| static UWORD | dofindoff_c (const UBYTE *s, UWORD pos) |
| $D507 dofindoff: converts a position in a tokenised line into the position in the detokenised text. | |
| void | printlib_ref (void) |
Variables | |
| UBYTE | intsoff [2] |
| UWORD | oldmode |
| volatile UBYTE | flags [4] |
| struct toke * | tokens |
| const char * | supertext |
| const char * | usertext |
| const char * | evaltext |
| const char * | exectext |
| APTR | handler |
| APTR | statehandler |
| APTR | superhandler |
| APTR | userhandler |
| APTR | waithandler |
| APTR | evalhandler |
| APTR | h6 |
| APTR | h7 |
| UBYTE * | procsp |
| UBYTE | procstack [] |
| UBYTE * | intsp |
| UBYTE | intstack [] |
| UWORD * | procflag |
| char | statehandler_ [] |
| char | superhandler_ [] |
| char | userhandler_ [] |
| char | waithandler_ [] |
| char | evalhandler_ [] |
| char | mytrap0 [] |
| char | mytrap1 [] |
| char | mytrap2 [] |
| char | mytrap3 [] |
| char | mytrap4 [] |
| char | mytrap5 [] |
| UWORD | dirmode |
| APTR | oldouth |
| UBYTE | astring [] |
| UWORD | doutx |
| APTR | oldtc |
| UWORD | waitres |
| struct trapregs | trapregs |
| UBYTE * | trappc |
| char | evaluate_ [] |
| char | execute_ [] |
| static const char | starttext [] = "Interrupted - program start" |
| #define sw_goamiga 0xc201 |
| #define sw_goblitz 0xc200 /* switchlib */ |
| #define sw_goblitzS 0xc206 |
| #define sw_goqamiga 0xc202 |
| #define sw_goqamigaS 0xc207 |
| void amigamode | ( | void | ) |
|
static |
|
inlinestatic |
|
static |
Library finit: nothing.
The trap handler stays the task's: a SetInt routine can still run until intlib's finit, which comes later (finits go from the low library numbers up), and runerrlib's gosuper hands its traps to the task's handler. runerrlib's finit, the last of them, puts back the handler the program started with. (The original left its handlers in the CPU's vector table for good, #1069.)
|
static |
Library init: resets the debugger state and installs the trap handler.
Clears the flags, direct mode and the output redirection, resets the procedure and interrupt stacks and the default handlers, and makes tasktrap the task's trap handler (tc_TrapCode; the old one is kept in oldtc). The editor's token list (tokens) is the task's tc_UserData, which blitz2 sets for the program it runs. With d0.b = 0 the program stops at once ("Interrupted - program start"; the binary, not the source).
Fixed (#1069): the original set the vectors of TRAP #0-#5 in the VBR table (runerrlib getvbr) for the whole machine and took the token list from the old TRAP #1 vector, where blitz2 had put it.
| autorun | d0: low byte non zero for auto run, 0 = stop at the first line |
| void data | ( | void | ) |
| void debuglib_codeinit | ( | void | ) |
| void debuglib_docall | ( | void | ) |
$D509 docall: calls handler 6 of the front end's table.
New in the binary (not in the source). All registers are passed through to the handler and back (a1 = the handler's address).
| void dodetoke | ( | void | ) |
|
static |
$D503 dodetoke: detokenises a line (a0 -> a1).
A byte with bit 7 set starts a token (2 bytes, bit 15 cleared = the number), which is replaced by its name from the editor's token list ("?????" if unknown). Out: a0/a1 behind the terminating 0 (the wrapper passes them in memory: p[0] = a0, p[1] = a1).
| p | a0: p[0] = the tokenised line (a0), p[1] = the destination (a1); both are returned there |
| void doevaluate | ( | void | ) |
|
static |
$D504 doevaluate: evaluates an expression at the next new line.
Sets the evaluate flag: handleflags runs "Print "+expression with the output going to astring and passes it to the eval handler. All registers kept.
| text | a0: the expression |
| void doexecute | ( | void | ) |
|
static |
$D505 doexecute: executes a line of Blitz code at the next new line.
Sets the execute flag: handleflags lets the compiler run the text in direct mode and passes any output or error message to the eval handler. All registers kept.
| text | a0: the text to execute |
| void dofindoff | ( | void | ) |
|
static |
$D507 dofindoff: converts a position in a tokenised line into the position in the detokenised text.
Fixed (#127): the conversion ends when the position reaches 0 or less, also after a token. The original's loop end test (BEQ at 'loop) saw the flags of the last instruction: after a normal character SUBQ #1,d0, after a token SUBQ #1,d1 (the result, not the position); the position was lowered by 2 for a token without a test, so a position right after or inside a token ran on to the end of the string.
| s | a0: the tokenised line |
| pos | d0: the position in it (word) |
| void donewmode | ( | void | ) |
$D500 donewmode: nothing.
| void doquit | ( | void | ) |
|
static |
$D506 doquit: ends the program at the next new line.
Sets the end flag (handleflags: exitslib's end with the program's a5). Also the default super/user error handlers. All registers kept.
| void dosethandler | ( | void | ) |
|
static |
$D502 dosethandler: installs the debugger front end's handlers.
C part: copies the table (state, super, user, wait, eval, -, docall, procedure) into the handler variables and remembers the procedure flag word (TRAP #4/#5 call the procedure handler while it is non zero). The assembler wrapper below also returns a0/a1/a2 (the binary, not the source).
| pflag | d0: pointer to the procedure flag word |
| tab | a0: the handler table |
| void doskip | ( | void | ) |
|
static |
$D508 doskip: skips the current statement at the next new line.
Sets the skip flag: handleflags jumps over the statement if the word at trappc+6 (its distance) is not 0. All registers kept.
| void dostop | ( | void | ) |
|
static |
$D501 dostop: stops the program at the next new line.
Sets the user error flag with the text "***** Interupted *****"; all registers kept.
| void dout2 | ( | void | ) |
|
static |
| void dout3 | ( | void | ) |
|
static |
|
static |
| void executestate | ( | void | ) |
| void fixmode | ( | void | ) |
|
static |
|
inlinestatic |
| void handleflags | ( | void | ) |
| void printlib_ref | ( | void | ) |
| void tasktrap | ( | void | ) |
|
static |
|
extern |
|
extern |
|
extern |
| APTR evalhandler |
| char evalhandler_[] |
| const char * evaltext |
|
extern |
| const char * exectext |
|
extern |
|
extern |
|
extern |
| APTR h7 |
|
extern |
|
extern |
|
extern |
| UBYTE intstack[] |
|
extern |
| char mytrap1[] |
| char mytrap2[] |
| char mytrap3[] |
| char mytrap4[] |
| char mytrap5[] |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
| UBYTE procstack[] |
|
static |
|
extern |
|
extern |
| APTR superhandler |
| char superhandler_[] |
|
extern |
|
extern |
|
extern |
|
extern |
| APTR userhandler |
| char userhandler_[] |
| const char * usertext |
| APTR waithandler |
|
extern |
|
extern |