comparison level2/modules/kernel/fgcmdir.asm @ 1145:ca83286ded5b

Start of new OS-9 L2 Kernel
author boisy
date Tue, 22 Apr 2003 19:35:48 +0000
parents
children 1da8ab9ba433
comparison
equal deleted inserted replaced
1144:2cdb7acff8aa 1145:ca83286ded5b
1 * F$GCMDir entry point
2 *
3 * This system call is only used by OS9p1 to get rid of all the empty spaces
4 * in the module directory to keep it small & compact.
5 FGCMDir ldx <D.ModDir get pointer to module directory start
6 bra L0C1D skip ahead
7 L0C17 ldu MD$MPDAT,x DAT initialized?
8 beq L0C23 no it's empty skip ahead
9 leax MD$ESize,x move to next entry
10 L0C1D cmpx <D.ModEnd end of module directory?
11 bne L0C17 no, keep looking
12 bra L0C4B
13 * Move all entrys up 1 slot in directory
14 L0C23 tfr x,y move empty entry pointer to Y
15 bra L0C2B
16 L0C27 ldu MD$MPDAT,y
17 bne L0C34
18 L0C2B leay MD$ESize,y
19 cmpy <D.ModEnd done complete directory?
20 bne L0C27 no, keep going
21 bra L0C49
22 * Move entry up 1 slot in directory
23 L0C34 equ *
24 IFNE H6309
25 ldw #MD$ESize
26 tfm y+,x+
27 ELSE
28 ldu ,y++
29 stu ,x++
30 ldu ,y++
31 stu ,x++
32 ldu ,y++
33 stu ,x++
34 ldu ,y++
35 stu ,x++
36 ENDC
37 L0C44 cmpy <D.ModEnd done complete directory?
38 bne L0C27 no, keep going
39
40 L0C49 stx <D.ModEnd save new module directory end pointer
41 * Shrink DAT table
42 L0C4B ldx <D.ModDir+2 get module directory DAT end pointer
43 bra L0C53
44
45 L0C4F ldu ,x
46 beq L0C5B
47 L0C53 leax -2,x Bump module ptr down by 2
48 cmpx <D.ModDAT Hit beginning yet?
49 bne L0C4F No, keep checking
50 clrb Yes, return without error
51 rts
52
53 L0C5B ldu -2,x
54 bne L0C53
55 tfr x,y
56 bra L0C67
57
58 L0C63 ldu ,y
59 bne L0C70
60 L0C67 leay -2,y
61 L0C69 cmpy <D.ModDAT
62 bcc L0C63
63 bra L0C81
64 L0C70 leay 2,y
65 ldu ,y
66 stu ,x
67 L0C76 ldu ,--y
68 stu ,--x
69 beq L0C87
70 cmpy <D.ModDAT
71 bne L0C76
72
73 L0C81 stx <D.ModDAT
74 bsr L0C95
75 clrb Yes, return without error
76 rts
77
78 L0C87 leay 2,y
79 leax 2,x
80 bsr L0C95
81 leay -4,y
82 leax -2,x
83 bra L0C69
84
85 * Update Module Dir Image Ptrs
86 L0C95 pshs u
87 ldu <D.ModDir
88 bra L0CA4
89 L0C9B cmpy MD$MPDAT,u same DAT ptrs?
90 bne L0CA2 no, skip
91 stx MD$MPDAT,u else update ptrs
92 L0CA2 leau MD$ESize,u next entry
93 L0CA4 cmpu <D.ModEnd last entry?
94 bne L0C9B no
95 puls u,pc else yes... return