Compare Two Strings (.Strcmp) - Motorola M68CPU32BUG User Manual

Debug monitor
Table of Contents

Advertisement

.STRCMP
5.2.18 Compare Two Strings
SYSCALL
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 ==>
Exit Conditions:
SP ==>
EXAMPLE
If A1 and A2 contain the addresses of the two strings.
SUBQ.L
#4,A7
PEA
(A1)
PEA
(A2)
SYSCALL
.STRCMP
MOVE.L
(A7)+,D0
TST.B
D0
BNE
ARE SAME
M68CPU32BUG/D REV 1
Compare Two Strings
.STRCMP
Address of string#1
Address of string#2
Three bytes (unused)
Byte to receive string comparison result
Three bytes (unused)
Byte that received string comparison result
Allocate longword to receive result
Push address of one string
Push address of the other string
Compare the strings
Pop boolean flag into data register
Check boolean flag
Branch if strings are identical
5-22
SYSTEM CALLS
.STRCMP

Advertisement

Table of Contents
loading

Table of Contents