Hardware Reference
In-Depth Information
4.8 Using the D-Bug12 Functions to Perform I/O Operations
The D-Bug12 monitor provides a few subroutines to support I/O operations. One can uti-
lize these I/O routines to facilitate program developments on a demo board that contains the
D-Bug12 monitor. A summary of these routines is in Table 4.2.
These user-accessible routines are written in C. All except the first parameter are passed to
the user-callable functions on the stack. Parameters must be pushed onto the stack in the re-
verse order (right to left) so that they are listed in the function declaration. The first parameter
is passed to the function in accumulator D. If a function has only a single parameter, then the
parameter is passed in accumulator D. Parameters of type char must be converted to an integer
(16-bit). Parameters of type char will occupy the lower-order byte (higher address) of a word
pushed onto the stack or accumulator B if the parameter is passed in D.
Parameters pushed onto the stack before the function is called remain on the stack when the
function returns. It is the responsibility of the caller to remove passed parameters from the stack.
All 8- and 16-bit function values are returned in accumulator D. A value of type char re-
turned in accumulator D is located in the 8-bit accumulator B. A Boolean function returns a
zero value for false and a nonzero value for true.
None of the CPU register contents, except the stack pointer, are preserved by the called
functions. If any of the register values need to be preserved, they should be pushed onto the stack
before any of the parameters have been pushed and restored after deallocating the parameters.
Pointer
Address
Subroutine
Function
far main ()
Start of D-Bug12
$EE80
getchar ()
Get a character from SCI0 or SCI1
$EE84
putchar ()
Send a character out to SCI0 or SCI1
$EE86
printf ()
Formatted string output-translates binary values to string
$EE88
far GetCmdLine ()
Get a line of input from the user
$EE8A
far sscanhex()
Convert ASCII hex string to a binary integer
$EE8E
isxdigit ()
Check if a character (in B) is a hex digit
$EE92
toupper()
Convert lowercase characters to uppercase
$EE94
isalpha ()
Check if a character is alphabetic
$EE96
strlen ()
Returns the length of a NULL-terminated string
$EE98
strcpy ()
Copy a NULL-terminated string
$EE9A
far out2hex ()
Output 8-bit number as two ASCII hex characters
$EE9C
far out4hex ()
Output a 16-bit number as four ASCII hex characters
$EEAO
SetUserVector ()
Set up a vector to a user's interrupt service routine
$EEA4
far WriteEEByte()
Write a byte to the on-chip EEPROM memory
$EEA6
far EraseEE ()
Bulk erase the on-chip EEPROM memory
$EEAA
far ReadMem ()
Read data from the HCS12 memory map
$EEAE
far WriteMem ()
Write data to the HCS12 memory map
$EEB2
Table 4.2 D-Bug12 monitor (version 4.x.x) routines
 
Search WWH ::




Custom Search