4
3. D-Bug12:
D-Bug12 is the monitor program for the 6812 EVB. This is similar to the BUFFALO
monitor used on the 6811. Unlike the BUFFALO monitor, the D-Bug12 monitor is a
series of C functions that are stored in an EPROM on the EVB. These functions can
be called by the user to handle both I/O and several of the common C language ANSI
functions.
All calls to the D-Bug12 routines follow the same format. The format is:
DB12->"routine name";
The "DB12->" is used as a cast pointer that allows the compiler to reference the
EPROM for the different routines. The routine name is just the name of the routine
and any parameters that are being passed to the function. If the function returns
a value to the program the return value can be assigned to a variable. This is
done as follows:
temp=DB12->"routine name";
This assigns the return value of the routine to a variable named temp.
As always the variable must be declared in the program.
It is important to note that if you do not include the "DB12->" with the function
call the compiler will return an error message. The error message that is returned
is that the function does not exist. Putting the "DB12->" before the function name
will solve this problem.
D-Bug12 Functions
Readers interested in a more in-depth explanation of the D-Bug12 routines are
referred to Motorola Document an1280a, "Using the Callable Routines in D-Bug 12"
(available on the web at http://www.ecse.rpi.edu/Courses/CStudio/appnotes/).
getchar
This function will get a single character of input from the user.
Function Prototype: int getchar(void);
Return Value: This returns the character from the keyboard in
hexadecimal ASCII.
printf
This will display a string of characters to the screen.
Function Prototype: int printf(char *s);
Return value: The number of characters that were transmitted.
NOTE: The Introl 4.0 compiler has an error in this function. The first parameter in
the list is not printed properly. There are workarounds for some cases that are
given in examples in class handouts. In any case, simple strings without variables
will work without problems.
To display a variable, the variable is represented using %y in the printf
statement, where y is chosen from the table below to match the variable type. To
display a signed decimal integer stored in a variable num, the function call would
look like:
Summary of Contents for 68HC12
Page 31: ...31 ...