|
| void | finalscheck (void) |
| | finalscheck ($C300) - at program end a7 must be where it was at init (ostack).
|
| void | retchk (void) |
| | retchk ($C305) - Return: the Gosub frame (return address, "gS") must be on the stack; pop it and return there.
|
| void | nextchkw (void) |
| | nextchkw/nextchkl ($C306/$C307) - Next: the For frame ("fO") must be on the stack (at 12(a7) for a word loop, 16(a7) for a long one).
|
| void | nextchkl (void) |
| void | stackchk (void) |
| | stackchk ($C308) - out of stack: a7 below maxstack (not while in supervisor mode, supernest <> 0).
|
| void | arrerr (void) |
| void | maxerr (void) |
| void | gosuper (void) |
| | gosuper ($C30B) - the start of a SetInt routine (the compiler calls it there, in front of the routine's TRAP #2, only with runtime error checking): no stack check (supernest + 1), and the CPU's TRAP #0-#5 vectors lead to the program's trap handler while the routine runs.
|
| void | gouser (void) |
| | gouser ($C30C) - the end of a SetInt routine: supernest - 1, and the six vectors saved by gosuper back into the CPU's table (fixed (#1069), see gosuper). The saved vectors are taken from the stack. Keeps all registers.
|
| void | sarraychk (void) |
| void | aarraychk (void) |
| void | datachk (void) |
| void | bmodechk (void) |
| | bmodechk/amodechk ($C311/$C312) - Blitz / Amiga mode only: the caller has just tested the mode flag (N set = Blitz mode).
|
| void | amodechk (void) |
| void | casechkw (void) |
| | casechkw/casechkl ($C313/$C314) - End Select, Case, Default: the Select frame ("sE") must be on the stack (6(a7) / 8(a7)).
|
| void | casechkl (void) |
| void | currentchk (void) |
| void | ltobover (void) |
| void | wtobover (void) |
| void | ltowover (void) |
| void | qtobover (void) |
| void | ftobover (void) |
| void | ftowover (void) |
| void | ftolover (void) |
| void | getvbr (void) |
| void | getcpu (void) |
| void | runerrlib_codeinit (void) |
| void | ctrlcend (void) |
| | ctrlcend ($C321) - end the program with return code 20 (fixed, #43: Ctrl-C at an input or output on the console).
|
| static void | codefinit (void) |
| | Library finit: restore the task's trap handler.
|
| void | data (void) |
| static void | ltob (LONG v) |
| static void | ltow (LONG v) |
| static void | ltobover_c (LONG v) |
| | ltobover ($C316) - long to byte: -128..127.
|
| static void | wtobover_c (LONG v) |
| | wtobover ($C317) - word to byte (CMP.w): -128..127.
|
| static void | ltowover_c (LONG v) |
| | ltowover ($C318) - long to word: -32768..32767.
|
| static void | qtobover_c (ULONG v) |
| | qtobover ($C319) - quick (16.16 fixed point) to byte: the integer part is the upper word (SWAP d0:CMP.w), -128..127.
|
| static LONG | spfix (ULONG x, APTR base, UBYTE *v) |
| static void | ftobover_c (ULONG f, APTR ffp) |
| | ftobover ($C31A) - float to byte: SPFix must not overflow and the integer must be -128..127.
|
| static void | ftowover_c (ULONG f, APTR ffp) |
| | ftowover ($C31B) - float to word: SPFix must not overflow and the integer must be -32768..32767.
|
| static void | ftolover_c (ULONG f, APTR ffp) |
| | ftolover ($C31C) - float to long: SPFix must not overflow (V flag).
|
| static void | sarraychk_c (ULONG d) |
| | sarraychk ($C30E) - an array dimension (its highest index) must be < 65535.
|
| static void | aarraychk_c (ULONG d) |
| | aarraychk ($C30F) - as sarraychk, the dimension in d1 (the check of each dimension of Dim and Dim List).
|
| static void | datachk_c (ULONG type) |
| | datachk ($C310) - Read: the data item at a3 must be "D" + type.
|
| static void | currentchk_c (APTR item) |
| | currentchk ($C315) - a list command needs a current item.
|
| static ULONG | getvbr_c (void) |
| | getvbr ($C31D) - the vector base register as read by the init.
|
| static UWORD | getcpu_c (void) |
| | getcpu ($C31E) - the CPU type.
|
| static void | codeinit_c (UBYTE *sp, ULONG stack) |
| | Library init: stack limits, trap handler, CPU and VBR.
|
Library finit: restore the task's trap handler.
The handler the program started with: since #1069 also the end of the handlers of debuglib, rundebuglib and errtraplib, which init after runerrlib and put theirs in front (debuglib and rundebuglib leave theirs until here, for SetInt routines that run until intlib's finit).
| void codeinit_c |
( |
UBYTE * | sp, |
|
|
ULONG | stack ) |
|
static |
Library init: stack limits, trap handler, CPU and VBR.
maxstack = the lowest allowed stack pointer (with 1K reserve), ostack = the stack pointer expected at the end; trapper becomes the task's tc_TrapCode (CPU exceptions become runtime errors "GURU! - ..."); the CPU type from AttnFlags and, from a 68010 on, the VBR (MOVEC in supervisor state). The original returns d2 = VBR (and changes d0-d1/a0/a6); the thunk keeps everything.
Fixed (intended deviation, #42): the original reads the VBR only from a 68020 on, though a 68010 has one too.
- Parameters
-
| sp | a0: the stack pointer at entry (pointing to the return address; the thunk computes it) |
| stack | d2: the stack size |
ctrlcend ($C321) - end the program with return code 20 (fixed, #43: Ctrl-C at an input or output on the console).
Called by inputoutputlib's Ctrl-C checks, which only error check code calls. The program's return address (the long above the stack of its main code: ostack + 4, the level finalscheck compares) is replaced by rc20, then exitslib's endjmp ends the program as End does: the finits run and the end code's moveq #0,d0:rts returns to rc20, which sets the return code 20 (that of a C program after Ctrl-C) and goes on to the caller. Without a change of the end code every program has, which would change every executable. Assembler: it works on the program's stack. Does not return.
getvbr ($C31D) - the vector base register as read by the init.
Keeps d0-d1/a1 (the thunk moves the result to a0).
Fixed (intended deviation, #42): also on a 68010 (the original gives 0 there, though a 68010 has a VBR).
- Returns
- a0: the VBR (0 on a 68000)
gosuper ($C30B) - the start of a SetInt routine (the compiler calls it there, in front of the routine's TRAP #2, only with runtime error checking): no stack check (supernest + 1), and the CPU's TRAP #0-#5 vectors lead to the program's trap handler while the routine runs.
Fixed (#1069): debuglib, rundebuglib and errtraplib take the traps of their program through its task's trap handler (tc_TrapCode), not the CPU's vector table, which belongs to the whole machine. exec passes only a trap of user mode to tc_TrapCode; one in supervisor mode (an interrupt) is a dead end. So gosuper saves the six vectors on the stack (24 bytes, the vector of TRAP #0 first, left there for gouser) and sets stubs that hand the trap to the program's handler as exec does for user mode (the trap number as a long on the stack, then the exception frame). No other task runs while an interrupt routine runs, and nested interrupts restore in reverse order, so nothing else sees the stubs. rundebuglib reads the saved vectors there (its more2). The original only counted supernest; the CPU's vectors were the libraries' all the time. Keeps all registers.
| void sarraychk_c |
( |
ULONG | d | ) |
|
|
static |
sarraychk ($C30E) - an array dimension (its highest index) must be < 65535.
An array or list has at most 65535 elements: arrmult counts the elements of a dimension as a word (highest index + 1). Fixed (#1037): the highest index 65535 is refused too (the original refused only 65536 and more; 65535 gave 0 elements, every access outside the block).
Errors: "Array Dimension out of Range".
- Parameters
-