User manual

Table Of Contents
SYSTEM CALLS
M68CPU32BUG/D REV 1 5-28
.WRITD Output String with Data ..WRITD
.WRITDLN .WRITDLN
EXAMPLE
The following section of code .....
ERRMESSG DC.B $15,’ERROR CODE = ’,’|10,8Z|’
MOVE.L #3,-(A5)
Push error code on data stack
PEA (A5)
Push data stack location
PEA ERRMESSG(PC)
Push address of string
SYSCALL .WRITDLN
Invoke function
TST.L (A5)+
De-allocate data from data stack
. . . . . prints this message:
ERROR CODE = 3
NOTE
The string must be formatted such that the first byte (the byte
pointed to by the passed address) contains the byte count of the
string, including the data field specifiers (pointer/count format –
see 5.1.2).
Format data fields within the string as follows:
'|<radix>,<fieldwidth>[Z]|' where <radix> is the data's numerical
base (in hexadecimal, i.e., ''A'' is base 10, ''10'' is base 16, etc.) and
<fieldwidth> is the number of data characters to output. The data is
right-justified and left-most characters are truncated to size.
Include ''Z'' to suppress leading zeros in the output.
All data is placed in the stack as longwords. Each time a data field
is encountered in the user string, a longword is displayed from the
data stack.
The data stack is not destroyed by this routine. Use the call routine
(see example above) to de-allocate space in the data stack. If it is
necessary for the space in the data stack to be de-allocated, it must
be done using the call routine, as shown in the above example.
SYSTEM CALLS
M68CPU32BUG/D REV 1 5-29
.WRITE Output String Using Character Count .WRITE
.WRITELN .WRITELN
5.2.23 Output String Using Character Count
SYSCALL .WRITE – Output string
TRAP CODE: $0023
SYSCALL .WRITELN – Output string and <CR><LF>
TRAP CODE: $0024
.WRITE and .WRITELN format character strings with a count byte and output the string to the
default output port. After formatting, the count byte is the first byte in the string. The user passes
the starting address of the string. .WRITELN appends a <CR><LF> to the end of the string.
Entry Conditions:
Four bytes of parameters are positioned in the stack as follows:
SP ==> Address of string.<long>
Exit Conditions:
SP ==> Top of stack (parameter bytes removed)
EXAMPLE
MESSAGE1 DC.B 9,
"MOTOROLA "
MESSAGE2 DC.B 8,
"QUALITY!"
PEA MESSAGE1(PC)
Push address of string
SYSCALL .WRITE
Use TRAP #15 macro
PEA MESSAGE2(PC) Push address of other string
SYSCALL .WRITE Invoke function again
Fr
eescale S
emiconduct
or
, I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
nc...