Mercurial > hg > Members > kono > nitros9-code
comparison level2/modules/kernel/funload.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$UnLoad entry point | |
2 FUnLoad pshs u preserve register stack pointer | |
3 lda R$A,u get module type | |
4 ldx <D.Proc get current process pointer | |
5 leay P$DATImg,x point to DAT image | |
6 ldx R$X,u get pointer to name | |
7 os9 F$FModul find it in module directory | |
8 puls y restore register stack pointer | |
9 bcs L0A4F couldn't find it, return error | |
10 stx R$X,y save update name pointer | |
11 IFNE H6309 | |
12 ldw MD$Link,u get link count | |
13 beq L0A21 already 0 check if it's a I/O module | |
14 decw subtract 1 | |
15 stw MD$Link,u save it back | |
16 ELSE | |
17 ldx MD$Link,u get module link count | |
18 beq L0A21 branch if zero | |
19 leax -1,x else decrement | |
20 stx MD$Link,u | |
21 ENDC | |
22 bne L0A4E not zero, don't remove from memory, return | |
23 | |
24 * Link count is zero, check if module can be removed from memory | |
25 L0A21 cmpa #FlMgr is it a I/O module? | |
26 blo L0A4B no, remove module from memory | |
27 | |
28 * Special handling for I/O module deletion | |
29 clra | |
30 ldx [MD$MPDAT,u] get 1st 2 blocks in DAT image of module | |
31 ldy <D.SysDAT get pointer to system DAT image | |
32 L0A2B adda #2 | |
33 cmpa #DAT.ImSz done entire DAT? | |
34 bcc L0A4B yes, delete the module from memory | |
35 cmpx a,y find block? | |
36 bne L0A2B no, keep looking | |
37 lsla multiply by 16 to calculate the offset | |
38 lsla | |
39 lsla | |
40 lsla | |
41 clrb | |
42 addd MD$MPtr,u add in the pointer | |
43 tfr d,x copy it to X | |
44 os9 F$IODel delete the device from memory | |
45 bcc L0A4B no error, skip ahead | |
46 | |
47 IFNE H6309 | |
48 ldw MD$Link,u put link count back | |
49 incw | |
50 stw MD$Link,u | |
51 ELSE | |
52 ldx MD$Link,u put link count back | |
53 leax 1,x | |
54 stx MD$Link,u | |
55 ENDC | |
56 rts Return with error | |
57 | |
58 * Delete module from memory | |
59 L0A4B lbsr DelMod Delete module from memory | |
60 L0A4E clrb clear errors | |
61 L0A4F rts return |