annotate level2/modules/kernel/fcmpnam.asm @ 1145:ca83286ded5b

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