1453
|
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
|
|
15 IFGT Level-1
|
|
16
|
|
17 FCmpNam ldx <D.Proc get current process ptr
|
|
18 leay P$DATImg,x Point to the DAT image
|
|
19 ldx R$X,u Get pointer to string #1
|
|
20 pshs y,x preserve 'em
|
|
21 bra L07CF
|
|
22
|
|
23 * F$CmpNam entry point for system state
|
|
24 FSCmpNam ldx <D.Proc Get current proc. dsc. ptr
|
|
25 leay P$DATImg,x Point to it's DAT image
|
|
26 ldx R$X,u get pointer to string #1
|
|
27 pshs x,y
|
|
28 ldy <D.SysDAT get pointer to system DAT
|
|
29 L07CF ldx R$Y,u get pointer to string #2
|
|
30 pshs y,x Preserve them
|
|
31 ldd R$D,u get length
|
|
32 leax 4,s point to string #1 info packet
|
|
33 leay ,s point to string #2 info packet
|
|
34 bsr L07DE go compare 'em
|
|
35 leas 8,s purge stack
|
|
36 rts return
|
|
37
|
|
38 * Compare 2 strings
|
|
39 *
|
|
40 * Input: D = Length of string #1 (only requires B)
|
|
41 * X = Ptr to string #1 info packet
|
|
42 * 0,X = DAT image pointer
|
|
43 * 2,X = Pointer to string
|
|
44 * Y = Ptr to string #2 info packet
|
|
45 * 0,Y = DAT image pointer
|
|
46 * 2,Y = Pointer to string
|
|
47 * U = Register stack ptr
|
|
48 L07DE pshs d,x,y,u preserve registers
|
|
49 tfr x,u U=ptr to string #1 packet
|
|
50 pulu x,y get DAT ptr to Y and string ptr to X
|
|
51 lbsr AdjBlk0 adjust X to use block 0
|
|
52 pshu x,y put them back
|
|
53 ldu 4,s get pointer to string #2 packet
|
|
54 pulu x,y get DAT ptr to Y and string ptr to X
|
|
55 lbsr AdjBlk0 Adjust X to block 0
|
|
56 bra L07F6 go compare the strings
|
|
57
|
|
58 L07F2 ldu 4,s get pointer to string #2 packet
|
|
59 pulu x,y get DAT ptr to Y and string ptr to X
|
|
60 L07F6 lbsr LDAXY Map in the block & grab a byte from string
|
|
61 pshu x,y Put updated DAT & string ptr back
|
|
62 pshs a Save the character
|
|
63 ldu 3,s pointer to string #1 packet
|
|
64 pulu x,y get DAT ptr to Y and string ptr to X
|
|
65 lbsr LDAXY get byte from string #1
|
|
66 pshu y,x put pointers back
|
|
67 eora ,s
|
|
68 tst ,s+ was it high bit?
|
|
69 bmi L0816 yes, check if last character in string #2
|
|
70 decb
|
|
71 beq L0813
|
|
72 anda #$DF match?
|
|
73 beq L07F2 yes, check next character
|
|
74 L0813 comb set carry
|
|
75 puls d,x,y,u,pc
|
|
76
|
|
77 L0816 decb done whole string?
|
|
78 bne L0813 no, exit with no match
|
|
79 anda #$5F match?
|
|
80 bne L0813 yes, keep checking
|
|
81 clrb strings match, clear carry
|
|
82 puls d,x,y,u,pc restore & return
|
|
83
|
|
84 ELSE
|
|
85
|
|
86 FCmpNam ldb R$B,u
|
|
87 leau R$X,u
|
|
88 pulu y,x
|
|
89 L07AB pshs y,x,b,a
|
|
90 L07AD lda ,y+
|
|
91 bmi L07BE
|
|
92 decb
|
|
93 beq L07BA
|
|
94 eora ,x+
|
|
95 anda #$DF
|
|
96 beq L07AD
|
|
97 L07BA orcc #Carry
|
|
98 puls pc,y,x,b,a
|
|
99 L07BE decb
|
|
100 bne L07BA
|
|
101 eora ,x
|
|
102 anda #$5F
|
|
103 bne L07BA
|
|
104 puls y,x,b,a
|
|
105 L07C9 andcc #^Carry
|
|
106 rts
|
|
107
|
|
108 ENDC
|