annotate level2/modules/kernel/funload.asm @ 1948:7010c08050b7

Couldn't give yourself write permission to a file 'cause you didn't have write prmission, fixed.
author chrish
date Mon, 12 Dec 2005 03:13:04 +0000
parents 1da8ab9ba433
children 039ddb7c8ad7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1345
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
1 **************************************************
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
2 * System Call: F$UnLoad
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
3 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
4 * Function: Unlink a module by name
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
5 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
6 * Input: A = Module type
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
7 * X = Pointer to module name
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
8 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
9 * Output: None
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
10 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
11 * Error: CC = C bit set; B = error code
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1145
diff changeset
12 *
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
13 FUnLoad pshs u preserve register stack pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
14 lda R$A,u get module type
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
15 ldx <D.Proc get current process pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
16 leay P$DATImg,x point to DAT image
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
17 ldx R$X,u get pointer to name
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
18 os9 F$FModul find it in module directory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
19 puls y restore register stack pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
20 bcs L0A4F couldn't find it, return error
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
21 stx R$X,y save update name pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
22 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
23 ldw MD$Link,u get link count
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
24 beq L0A21 already 0 check if it's a I/O module
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
25 decw subtract 1
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
26 stw MD$Link,u save it back
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
27 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
28 ldx MD$Link,u get module link count
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
29 beq L0A21 branch if zero
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
30 leax -1,x else decrement
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
31 stx MD$Link,u
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
32 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
33 bne L0A4E not zero, don't remove from memory, 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 * Link count is zero, check if module can be removed from memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
36 L0A21 cmpa #FlMgr is it a I/O module?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
37 blo L0A4B no, remove module from memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
38
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
39 * Special handling for I/O module deletion
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
40 clra
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
41 ldx [MD$MPDAT,u] get 1st 2 blocks in DAT image of module
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
42 ldy <D.SysDAT get pointer to system DAT image
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
43 L0A2B adda #2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
44 cmpa #DAT.ImSz done entire DAT?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
45 bcc L0A4B yes, delete the module from memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
46 cmpx a,y find block?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
47 bne L0A2B no, keep looking
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
48 lsla multiply by 16 to calculate the offset
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
49 lsla
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
50 lsla
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
51 lsla
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
52 clrb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
53 addd MD$MPtr,u add in the pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
54 tfr d,x copy it to X
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
55 os9 F$IODel delete the device from memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
56 bcc L0A4B no error, skip ahead
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
57
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
58 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
59 ldw MD$Link,u put link count back
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
60 incw
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
61 stw MD$Link,u
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
62 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
63 ldx MD$Link,u put link count back
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
64 leax 1,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
65 stx MD$Link,u
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
66 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
67 rts Return with error
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
68
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
69 * Delete module from memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
70 L0A4B lbsr DelMod Delete module from memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
71 L0A4E clrb clear errors
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
72 L0A4F rts return