1345
|
1 **************************************************
|
|
2 * System Call: F$GCMDir
|
|
3 *
|
|
4 * Notes:
|
|
5 * This system call is only used by OS9p1 to get rid of all
|
|
6 * the empty spaces in the module directory to keep it small
|
|
7 * and compact.
|
1145
|
8 *
|
1345
|
9 * Input: X = Address of allocation bitmap
|
|
10 * D = Number of first bit to set
|
|
11 * Y = Bit count (number of bits to set)
|
|
12 *
|
|
13 * Output: None
|
|
14 *
|
|
15 * Error: CC = C bit set; B = error code
|
|
16 *
|
1145
|
17 FGCMDir ldx <D.ModDir get pointer to module directory start
|
|
18 bra L0C1D skip ahead
|
|
19 L0C17 ldu MD$MPDAT,x DAT initialized?
|
|
20 beq L0C23 no it's empty skip ahead
|
|
21 leax MD$ESize,x move to next entry
|
|
22 L0C1D cmpx <D.ModEnd end of module directory?
|
|
23 bne L0C17 no, keep looking
|
|
24 bra L0C4B
|
|
25 * Move all entrys up 1 slot in directory
|
|
26 L0C23 tfr x,y move empty entry pointer to Y
|
|
27 bra L0C2B
|
|
28 L0C27 ldu MD$MPDAT,y
|
|
29 bne L0C34
|
|
30 L0C2B leay MD$ESize,y
|
|
31 cmpy <D.ModEnd done complete directory?
|
|
32 bne L0C27 no, keep going
|
|
33 bra L0C49
|
|
34 * Move entry up 1 slot in directory
|
|
35 L0C34 equ *
|
|
36 IFNE H6309
|
|
37 ldw #MD$ESize
|
|
38 tfm y+,x+
|
|
39 ELSE
|
|
40 ldu ,y++
|
|
41 stu ,x++
|
|
42 ldu ,y++
|
|
43 stu ,x++
|
|
44 ldu ,y++
|
|
45 stu ,x++
|
|
46 ldu ,y++
|
|
47 stu ,x++
|
|
48 ENDC
|
|
49 L0C44 cmpy <D.ModEnd done complete directory?
|
|
50 bne L0C27 no, keep going
|
|
51
|
|
52 L0C49 stx <D.ModEnd save new module directory end pointer
|
|
53 * Shrink DAT table
|
|
54 L0C4B ldx <D.ModDir+2 get module directory DAT end pointer
|
|
55 bra L0C53
|
|
56
|
|
57 L0C4F ldu ,x
|
|
58 beq L0C5B
|
|
59 L0C53 leax -2,x Bump module ptr down by 2
|
|
60 cmpx <D.ModDAT Hit beginning yet?
|
|
61 bne L0C4F No, keep checking
|
|
62 clrb Yes, return without error
|
|
63 rts
|
|
64
|
|
65 L0C5B ldu -2,x
|
|
66 bne L0C53
|
|
67 tfr x,y
|
|
68 bra L0C67
|
|
69
|
|
70 L0C63 ldu ,y
|
|
71 bne L0C70
|
|
72 L0C67 leay -2,y
|
|
73 L0C69 cmpy <D.ModDAT
|
|
74 bcc L0C63
|
|
75 bra L0C81
|
|
76 L0C70 leay 2,y
|
|
77 ldu ,y
|
|
78 stu ,x
|
|
79 L0C76 ldu ,--y
|
|
80 stu ,--x
|
|
81 beq L0C87
|
|
82 cmpy <D.ModDAT
|
|
83 bne L0C76
|
|
84
|
|
85 L0C81 stx <D.ModDAT
|
|
86 bsr L0C95
|
|
87 clrb Yes, return without error
|
|
88 rts
|
|
89
|
|
90 L0C87 leay 2,y
|
|
91 leax 2,x
|
|
92 bsr L0C95
|
|
93 leay -4,y
|
|
94 leax -2,x
|
|
95 bra L0C69
|
|
96
|
|
97 * Update Module Dir Image Ptrs
|
|
98 L0C95 pshs u
|
|
99 ldu <D.ModDir
|
|
100 bra L0CA4
|
|
101 L0C9B cmpy MD$MPDAT,u same DAT ptrs?
|
|
102 bne L0CA2 no, skip
|
|
103 stx MD$MPDAT,u else update ptrs
|
|
104 L0CA2 leau MD$ESize,u next entry
|
|
105 L0CA4 cmpu <D.ModEnd last entry?
|
|
106 bne L0C9B no
|
|
107 puls u,pc else yes... return
|