User`s manual

330 digi.com Hints and Tips
The suggested method to use with Dynamic C 9.30 or later involves editing the file RABBITBIOS.C to
include the user-defined BIOS file. To do so, find the “#if __RABBITSYS == 0” statement and modify the
code as follows:
#if MYBIOS == 1
#use “mybios.c”
#elif __RABBITSYS == 0
#use “STDBIOS.C”
#elif __RABBITSYS == 1
#use “sysBIOS.C”
#else
#use”rkBIOS.c”
#endif
To select the customized BIOS, define “MYBIOS = 1” in the Defines tab of the Options | Project Options
dialog box.
17.2 Efficiency
There are a number of methods that can be used to reduce the size of a program, or to increase its speed.
Let’s look at the events that occur when a program enters a function.
The function saves IX on the stack and makes IX the stack frame reference pointer (if the program is in
the useix mode).
The function creates stack space for auto variables.
The function sets up stack corruption checks if stack checking is enabled (on).
The program notifies Dynamic C of the entry to the function so that single stepping modes can be
resolved (if in debug mode).
The last two consume significant execution time and are eliminated when stack checking is disabled or if
the debug mode is off.
17.2.1 Nodebug Keyword
When the PC is connected to a target controller with Dynamic C running, the normal code and debugging
features are enabled. Dynamic C places an RST 28H instruction at the beginning of each C statement to
provide locations for breakpoints. This allows the programmer to single step through the program or to set
breakpoints. (It is possible to single step through assembly code at any time.) During debugging there is
additional overhead for entry and exit bookkeeping, and for checking array bounds, stack corruption, and
pointer stores. These “jumps” to the debugger consume one byte of code space and also require execution
time for each statement.
At some point, the Dynamic C program will be debugged and can run on the target controller without the
Dynamic C debugger. This saves on overhead when the program is executing. The nodebug keyword is
used in the function declaration to remove the extra debugging instructions and checks.
nodebug int myfunc( int x, int z ){
...
}