annotate level2/modules/kernel/fsrqmem.asm @ 1387:1451bc7ef0b9

Updates source comments
author boisy
date Tue, 30 Sep 2003 02:06:19 +0000
parents 1da8ab9ba433
children 5ecf6e023a64
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$SRqMem
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: Request memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
5 *
1345
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
6 * It also updates 8K DAT blocks-if it finds an empty block, it re-does the 32
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
7 * entries in the SMAP table to indicate that they are free
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
8 *
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
9 * Input: D = Byte count
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
10 *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
11 * Output: U = Address of allocated memory area
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
12 *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
13 * Error: CC = C bit set; B = error code
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
14 *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
15 FSRqMem ldd R$D,u get size requested
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
16 addd #$00FF round it up to nearest 256 byte page
1387
1451bc7ef0b9 Updates source comments
boisy
parents: 1345
diff changeset
17 clrb just keep # of pages (and start 8K block #)
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
18 std R$D,u save rounded version back to user
1387
1451bc7ef0b9 Updates source comments
boisy
parents: 1345
diff changeset
19 IFGT Level-1
1451bc7ef0b9 Updates source comments
boisy
parents: 1345
diff changeset
20 ldy <D.SysMem get ptr to SMAP table
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
21 leay $ED,y
1387
1451bc7ef0b9 Updates source comments
boisy
parents: 1345
diff changeset
22 ENDC
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
23
1387
1451bc7ef0b9 Updates source comments
boisy
parents: 1345
diff changeset
24 * leay $20,y skip Block 0 (always reserved for system)
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
25 * Change to pshs a,b:use 1,s for block # to check, and ,s for TFM spot
1387
1451bc7ef0b9 Updates source comments
boisy
parents: 1345
diff changeset
26 * incb skip block 0 (always reserved for system)
1451bc7ef0b9 Updates source comments
boisy
parents: 1345
diff changeset
27 pshs d reserve a byte & put 0 byte on stack
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
28
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
29 * This loop updates the SMAP table if anything can be marked as unused
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
30 *L082F ldx <D.SysDAT get pointer to system DAT block list
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
31 * lslb adjust block offset for 2 bytes/entry
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
32 * ldd b,x get block type/# from system DAT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
33 * cmpd #DAT.Free Unused block?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
34 * beq L0847 yes, mark it free in SMAP table
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
35 * ldx <D.BlkMap No, get ptr to MMAP table
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
36 * lda d,x Get block marker for 2 meg mem map
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
37 * cmpa #RAMinUse Is it in use (not free, ROM or used by module)?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
38 * bne L0848 No, mark it as type it is in SMAP table
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
39 * leay $20,y Yes, move to next block in pages
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
40 * bra L084F move to next block & try again
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
41
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
42 *L0847 clra Byte to fill system page map with (0=Not in use)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
43 *L0848 sta ,s Put it on stack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
44 * ldw #$0020 Get size of 8K block in pages
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
45 * tfm s,y+ Mark entire block's worth of pages with A
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
46 *L084F inc 1,s Bump up to next block to check
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
47 * ldb 1,s Get it
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
48 * cmpb #8 Done whole 64k system space?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
49 * blo L082F no, keep checking
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
50 * Now we can actually attempt to allocate the system RAM requested
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
51 * NOTE: Opt for Coco/TC9 OS9 ONLY: skip last 17 pages with leay -17,y since
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
52 * they are: Kernal (REL/BOOT/OS9P1 - 15 pages), vector RAM & I/O (2 pages)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
53 * (Already permanently marked @ L01D2)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
54 * At the start, Y is pointing to the end of the SMAP table+1
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
55 ldx <D.SysMem Get start of table ptr
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
56 ldb #$20 skip block 0: it's always full
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
57 abx same size, but faster than leax $20,x
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
58 * leay -17,y Skip Kernel, Vector RAM & I/O (Can't be free)
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
59 L0857 ldb R$A,u Get # 256 byte pages requested
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
60 * Loop (from end of system mem map) to look for # continuous pages requested
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
61 L0859 equ *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
62 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
63 cmpr x,y We still have any system RAM left to try?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
64 ELSE
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
65 pshs x
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
66 cmpy ,s++
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
67 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
68 bhi L0863 Yes, continue
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
69 comb Exit with No System RAM Error
1387
1451bc7ef0b9 Updates source comments
boisy
parents: 1345
diff changeset
70 ldb #E$NoRAM
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
71 bra L0894 Eat stack & exit
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
72
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
73 L0863 lda ,-y Get page marker (starting @ end of SMAP)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
74 bne L0857 Used, try next lower page
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
75 decb Found 1 page, dec # pages we need to allocate
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
76 bne L0859 Still more pages needed, check if we can get more
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
77 sty ,s Found free contiguous pages, save SMAP entry ptr
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
78 lda 1,s Get LSB of ptr
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
79 lsra Divide by 32 (Calculate start 8K block #)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
80 lsra
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
81 lsra
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
82 lsra
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
83 lsra
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
84 ldb 1,s Get LSB of ptr again
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
85 andb #%00011111 Keep only within 8K block offset
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
86 addb R$A,u Add # pages requested
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
87 addb #$1F Round up to nearest 8K block
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
88 lsrb Divide by 32 (Calculate end 8K block #)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
89 lsrb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
90 lsrb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
91 lsrb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
92 lsrb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
93 ldx <D.SysPrc Get ptr to system proc. dsc.
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
94 lbsr L09BE Allocate an image with our start/end block #'s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
95 bcs L0894 Couldn't, exit with error
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
96 ldb R$A,u Get # pages requested
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
97 lda #RAMinUse Get SMAP in use flag
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
98 L088A sta ,y+ Mark all the pages requested as In Use
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
99 decb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
100 bne L088A
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
101 lda 1,s Get MSB of ptr to start of newly allocated Sys RAM
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
102 std R$U,u Save for caller
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
103 clrb No error
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
104 L0894 puls u,pc Eat stack (U is changed after it exits) & return
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
105
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
106
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
107 **************************************************
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
108 * System Call: F$SRtMem
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
109 *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
110 * Function: Return memory
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
111 *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
112 * Input: U = Address of memory to return
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
113 * D = Number of bytes to return
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
114 *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
115 * Output: None
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
116 *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
117 * Error: CC = C bit set; B = error code
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
118 *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
119 FSRtMem ldd R$D,u get # pages to free up
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
120 beq L08F2 nothing to free, return without error
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
121 addd #$00FF round it up to nearest page
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
122 ldb R$U+1,u get LSB of address
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
123 beq L08A6 it's a even page, skip ahead
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
124 comb set carry
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
125 ldb #E$BPAddr get error code
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
126 rts return
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
127
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
128 L08A6 ldb R$U,u get MSB of page address
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
129 beq L08F2 not a legal page, return without error
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
130 ldx <D.SysMem get pointer to system memory map
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
131 abx set pointer into map
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
132 L08AD equ *
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
133 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
134 aim #^RAMinUse,,x+
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
135 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
136 ldb ,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
137 andb #^RAMinUse
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
138 stb ,x+
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
139 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
140 deca
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
141 bne L08AD
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
142 * Scan DAT image to find memory blocks to free up
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
143 ldx <D.SysDAT get pointer to system DAT image
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
144 IFNE H6309
1239
90bad6d8388c Major changes to bring kernel closer to L2 port
boisy
parents: 1236
diff changeset
145 lde #DAT.BlCt get # blocks to check
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
146 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
147 ldy #DAT.BlCt
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
148 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
149 L08BC ldd ,x get block image
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
150 cmpd #DAT.Free is it already free?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
151 beq L08EC yes, skip to next one
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
152 ldu <D.BlkMap get pointer to MMU block map
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
153 lda d,u get allocation flag for this block: 16-bit offset
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
154 cmpa #RAMinUse being used?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
155 bne L08EC no, move to next block
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
156 tfr x,d
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
157 subd <D.SysDAT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
158 lslb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
159 lslb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
160 lslb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
161 lslb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
162 ldu <D.SysMem get pointer to system map
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
163 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
164 addr d,u
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
165 * Check if we can remove the entire memory block from system map
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
166 ldf #16 get # pages per block/2
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
167 L08DA ldd ,u++ Either of these 2 pages allocated?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
168 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
169 leau d,u
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
170 ldb #32
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
171 L08DA lda ,u+ Either of these 2 pages allocated?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
172 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
173 bne L08EC yes, can't free block, skip to next one
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
174 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
175 decf checked all pages?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
176 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
177 decb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
178 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
179 bne L08DA no, keep looking
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
180 ldd ,x get block # into B: could be >$80
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
181 ldu <D.BlkMap point to allocation table
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
182 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
183 sta d,u clear the block using 16-bit offset
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
184 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
185 clr d,u
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
186 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
187 ldd #DAT.Free get free block marker
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
188 std ,x save it into DAT image
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
189 L08EC leax 2,x move to next DAT block
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
190 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
191 dece done?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
192 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
193 leay -1,y
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
194 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
195 bne L08BC no, keep checking
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
196 L08F2 clrb clear errors
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
197 L08F3 rts return
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
198
1345
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
199
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
200 **************************************************
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
201 * System Call: F$Boot
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
202 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
203 * Function: Bootstrap the system
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
204 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
205 * Optimized for size, as it's only called once...
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
206 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
207 * Input: None
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
208 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
209 * Output: None
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
210 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
211 * Error: CC = C bit set; B = error code
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
212 *
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
213 FBoot lda #'t tried to boot
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
214 jsr <D.BtBug
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
215 coma Set boot flag
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
216 lda <D.Boot we booted once before?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
217 bne L08F3 Yes, return
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
218 inc <D.Boot Set boot flag
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
219 ldx <D.Init Get ptr to init module if it exists
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
220 beq L0908 it doesn't, point to boot name
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
221 ldd <BootStr,x Get offset to text
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
222 beq L0908 Doesn't exist, get hard coded text
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
223 leax d,x Adjust X to point to boot module
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
224 bra L090C Try & link to module
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
225
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
226 boot fcs /Boot/
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
227
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
228 L0908 leax <boot,pcr
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
229 * Link to module and execute
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
230 L090C lda #Systm+Objct
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
231 os9 F$Link
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
232 bcs L08F3
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
233 lda #'b calling boot
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
234 jsr <D.BtBug
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
235 jsr ,y load boot file
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
236 bcs L08F3
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
237 std <D.BtSz save boot file size
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
238 stx <D.BtPtr save start pointer of bootfile
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
239 lda #'b boot returns OK
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
240 jsr <D.BtBug
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
241
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
242 * added for IOMan system memory extentions
1236
8508d75c91e0 Ported OS9P1 and OS9P2 to OS-9 Level Two
boisy
parents: 1145
diff changeset
243 IFNE H6309
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
244 ldd M$Name,x grab the name offset
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
245 ldd d,x find the first 2 bytes of the first module
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
246 cmpd #$4E69 'Ni' ? (NitrOS9 module?)
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
247 bne not.ext no, not system memory extensions
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
248 ldd M$Exec,x grab the execution ptr
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
249 jmp d,x and go execute the system memory extension module
1236
8508d75c91e0 Ported OS9P1 and OS9P2 to OS-9 Level Two
boisy
parents: 1145
diff changeset
250 ENDC
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
251
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
252 not.ext ldd <D.BtSz
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
253 bsr I.VBlock internal verify block routine
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
254 ldx <D.SysDAT get system DAT pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
255 ldb $0D,x get highest allocated block number
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
256 incb allocate block 0, too
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
257 ldx <D.BlkMap point to the memory block map
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
258 lbra L01DF and go mark the blocks as used.
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
259
1345
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
260
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
261 **************************************************
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
262 * System Call: F$VBlock
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
263 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
264 * Function: ???
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
265 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
266 * Input: D = Size of block to verify
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
267 * X = Start address to verify
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
268 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
269 * Output: None
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
270 *
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
271 * Error: CC = C bit set; B = error code
1da8ab9ba433 Added consistent comments to each system call
boisy
parents: 1247
diff changeset
272 *
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
273 FVBlock ldd R$D,u size of block to verify
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
274 ldx R$X,u start address to verify
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
275
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
276 I.VBlock leau d,x point to end of bootfile
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
277 tfr x,d
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
278 anda #$E0
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
279 clrb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
280 pshs d,u
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
281 lsra
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
282 lsra
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
283 lsra
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
284 lsra
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
285 ldy <D.SysDAT get pointer to system DAT
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
286 leay a,y offset to bootfile
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
287 L092D ldd M$ID,x get module ID
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
288 cmpd #M$ID12 legal ID?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
289 bne L0954 no, keep looking
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
290 ldd M$Name,x find name offset pointer
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
291 pshs x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
292 leax d,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
293
1247
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1239
diff changeset
294 bsr name.prt
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1239
diff changeset
295 *name.prt lda ,x+ get first character of the name
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1239
diff changeset
296 * jsr <D.BtBug print it out
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1239
diff changeset
297 * bpl name.prt
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1239
diff changeset
298 * lda #C$SPAC a space
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1239
diff changeset
299 * jsr <D.BtBug
1145
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
300
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
301 puls x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
302 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
303 ldd ,s offset into block
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
304 subr d,x make X=offset into block
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
305 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
306 tfr x,d
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
307 subd ,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
308 tfr d,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
309 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
310 tfr y,d
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
311 os9 F$VModul
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
312 IFNE H6309
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
313 ldw ,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
314 leax w,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
315 ELSE
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
316 pshs b
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
317 ldd 1,s
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
318 leax d,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
319 puls b
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
320 ENDC
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
321 bcc L094E
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
322 cmpb #E$KwnMod
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
323 bne L0954
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
324 L094E ldd M$Size,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
325 leax d,x
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
326 fcb $8C skip 2 bytes
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
327
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
328 L0954 leax 1,x move to next byte
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
329 L0956 cmpx 2,s gone thru whole bootfile?
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
330 bcs L092D no, keep looking
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
331 leas 4,s purge stack
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
332 clrb
ca83286ded5b Start of new OS-9 L2 Kernel
boisy
parents:
diff changeset
333 rts
1247
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1239
diff changeset
334
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1239
diff changeset
335
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1239
diff changeset
336 name.prt lda ,x+ get first character of the name
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1239
diff changeset
337 jsr <D.BtBug print it out
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1239
diff changeset
338 bpl name.prt
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1239
diff changeset
339 lda #C$SPAC a space
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1239
diff changeset
340 jsr <D.BtBug
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1239
diff changeset
341 rts
121c6e31fe55 IFNE'd out seemingly useless fcb $24,00 for 6809
boisy
parents: 1239
diff changeset
342