Motorola M68CPU32BUG User Manual Page 67

  • Download
  • Add to my manuals
  • Print
  • Page
    / 98
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 66
SYSTEM CALLS
M68CPU32BUG/D REV 1 5-22
.STRCMP Compare Two Strings .STRCMP
5.2.18 Compare Two Strings
SYSCALL .STRCMP
TRAP CODE: $0068
An equality comparison is made and a boolean flag is returned to the caller. If the strings are not
identical the flag is $00, otherwise it is $FF.
Entry Conditions:
SP ==> Address of string#1
Address of string#2
Three bytes (unused)
Byte to receive string comparison result
Exit Conditions:
SP ==> Three bytes (unused)
Byte that received string comparison result
EXAMPLE
If A1 and A2 contain the addresses of the two strings.
SUBQ.L #4,A7
Allocate longword to receive result
PEA (A1)
Push address of one string
PEA (A2)
Push address of the other string
SYSCALL .STRCMP
Compare the strings
MOVE.L (A7)+,D0
Pop boolean flag into data register
TST.B D0 Check boolean flag
BNE ARE SAME Branch if strings are identical
SYSTEM CALLS
M68CPU32BUG/D REV 1 5-19
.READSTR Read String Into Variable-Length Buffer .READSTR
5.2.15 Read String Into Variable-Length Buffer
SYSCALL .READSTR
TRAP CODE: $0003
Reads a string of characters from the default input port into a buffer. The first byte in the buffer
defines the maximum number of characters that can be written to the buffer. The buffer’s size
should be no less than the first byte + 2. The maximum number of characters written to a buffer
is 254 characters, making the maximum buffer size 256. On exit, the count byte defines the
number of characters in the buffer. Enter a carriage return (<CR>) and line feed (<LF>) to
terminate the input. The characters echo to the default output port. <CR> is not echoed.
Entry Conditions:
SP ==> Address of input buffer <long>
Exit Conditions:
SP ==> Top of stack
The count byte containing the number of bytes in the buffer.
EXAMPLE
If A0 contains the string buffer address;
PEA (A0)
Push buffer address
TRAP #15
(May also invoke by SYSCALL
DC.W 3
macro (’’SYSCALL .READSTR’’)
NOTE
This routine allows the caller to define the maximum character
input length (254 characters). If more than 254 characters are
entered, then the buffer input is truncated. See Terminal
Input/Output Control character processing as described in Chapter
1.
Fr
eescale S
emiconduct
or
, I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
nc...
Page view 66
1 2 ... 62 63 64 65 66 67 68 69 70 71 72 ... 97 98

Comments to this Manuals

No comments