1145
|
1 **************************************************
|
|
2 * System Call: F$CmpNam
|
|
3 *
|
|
4 * Function: Compare two names
|
|
5 *
|
|
6 * Input: X = Address of first name
|
|
7 * Y = Address of second name
|
|
8 * B = length of first name
|
|
9 *
|
|
10 * Output: None
|
|
11 *
|
|
12 * Error: CC = C bit set; B = error code
|
|
13 *
|
|
14 FCmpNam ldx <D.Proc get current process ptr
|
|
15 leay P$DATImg,x Point to the DAT image
|
|
16 ldx R$X,u Get pointer to string #1
|
|
17 pshs y,x preserve 'em
|
|
18 bra L07CF
|
|
19
|
|
20 * F$CmpNam entry point for system state
|
|
21 FSCmpNam ldx <D.Proc Get current proc. dsc. ptr
|
|
22 leay P$DATImg,x Point to it's DAT image
|
|
23 ldx R$X,u get pointer to string #1
|
|
24 pshs x,y
|
|
25 ldy <D.SysDAT get pointer to system DAT
|
|
26 L07CF ldx R$Y,u get pointer to string #2
|
|
27 pshs y,x Preserve them
|
|
28 ldd R$D,u get length
|
|
29 leax 4,s point to string #1 info packet
|
|
30 leay ,s point to string #2 info packet
|
|
31 bsr L07DE go compare 'em
|
|
32 leas 8,s purge stack
|
|
33 rts return
|
|
34
|
|
35 * Compare 2 strings
|
|
36 *
|
|
37 * Input: D = Length of string #1 (only requires B)
|
|
38 * X = Ptr to string #1 info packet
|
|
39 * 0,X = DAT image pointer
|
|
40 * 2,X = Pointer to string
|
|
41 * Y = Ptr to string #2 info packet
|
|
42 * 0,Y = DAT image pointer
|
|
43 * 2,Y = Pointer to string
|
|
44 * U = Register stack ptr
|
|
45 L07DE pshs d,x,y,u preserve registers
|
|
46 tfr x,u U=ptr to string #1 packet
|
|
47 pulu x,y get DAT ptr to Y and string ptr to X
|
|
48 lbsr AdjBlk0 adjust X to use block 0
|
|
49 pshu x,y put them back
|
|
50 ldu 4,s get pointer to string #2 packet
|
|
51 pulu x,y get DAT ptr to Y and string ptr to X
|
|
52 lbsr AdjBlk0 Adjust X to block 0
|
|
53 bra L07F6 go compare the strings
|
|
54
|
|
55 L07F2 ldu 4,s get pointer to string #2 packet
|
|
56 pulu x,y get DAT ptr to Y and string ptr to X
|
|
57 L07F6 lbsr LDAXY Map in the block & grab a byte from string
|
|
58 pshu x,y Put updated DAT & string ptr back
|
|
59 pshs a Save the character
|
|
60 ldu 3,s pointer to string #1 packet
|
|
61 pulu x,y get DAT ptr to Y and string ptr to X
|
|
62 lbsr LDAXY get byte from string #1
|
|
63 pshu y,x put pointers back
|
|
64 eora ,s
|
|
65 tst ,s+ was it high bit?
|
|
66 bmi L0816 yes, check if last character in string #2
|
|
67 decb
|
|
68 beq L0813
|
|
69 anda #$DF match?
|
|
70 beq L07F2 yes, check next character
|
|
71 L0813 comb set carry
|
|
72 puls d,x,y,u,pc
|
|
73
|
|
74 L0816 decb done whole string?
|
|
75 bne L0813 no, exit with no match
|
|
76 anda #$5F match?
|
|
77 bne L0813 yes, keep checking
|
|
78 clrb strings match, clear carry
|
|
79 puls d,x,y,u,pc restore & return
|