Mercurial > hg > Members > kono > nitros9-code
annotate level2/modules/kernel/fallram.asm @ 2229:918c7c68ea4d
Made formats quiet
author | boisy |
---|---|
date | Sun, 22 Mar 2009 12:21:59 +0000 |
parents | 5ecf6e023a64 |
children | 039ddb7c8ad7 |
rev | line source |
---|---|
1345 | 1 ************************************************** |
2 * System Call: F$AllRAM | |
3 * | |
4 * Function: Allocate RAM blocks | |
5 * | |
6 * Input: B = Desired block count | |
7 * | |
8 * Output: D = Beginning RAM block number | |
9 * | |
10 * Error: CC = C bit set; B = error code | |
11 * | |
1387 | 12 FAllRAM ldb R$B,u Get # blocks requested |
1145 | 13 pshs b,x,y Save regs |
14 ldx <D.BlkMap Get ptr to start of block map | |
15 L0974 leay ,x Point Y to current block | |
16 ldb ,s Get # blocks requested | |
1634
5ecf6e023a64
ioman.asm: Fixed bug where descriptor wasn't being unlinked in I$Detach if V$USRS > 0
boisy
parents:
1387
diff
changeset
|
17 srchblk cmpx <D.BlkMap+2 Hit end of map yet? |
1145 | 18 bhs L0995 Yes, exit with No RAM error |
19 lda ,x+ Get block marker | |
20 bne L0974 Already used, start over with next block up | |
21 decb Dec # blocks still needed | |
1634
5ecf6e023a64
ioman.asm: Fixed bug where descriptor wasn't being unlinked in I$Detach if V$USRS > 0
boisy
parents:
1387
diff
changeset
|
22 bne srchblk Still more, keep checking |
1145 | 23 * Entry: Y=ptr to start of memory found |
24 * Note: Due to fact that block map always starts @ $200 (up to $2FF), we | |
25 * don't need to calc A | |
26 L0983 tfr y,d Copy start of requested block mem ptr to D (B) | |
27 lda ,s Get # blocks requested | |
28 stb ,s Save start block # | |
29 L098D inc ,y+ Flag blocks as used | |
30 deca (for all blocks allocated) | |
31 bne L098D Do until done | |
32 puls b Get start block # | |
33 clra (allow for D as per original calls) | |
34 std R$D,u Save for caller | |
35 puls x,y,pc Restore regs & return | |
36 | |
37 L0995 comb Exit with No RAM error | |
1387 | 38 ldb #E$NoRAM |
1145 | 39 stb ,s |
40 puls b,x,y,pc | |
41 | |
1345 | 42 |
43 ************************************************** | |
44 * System Call: F$AlHRAM | |
45 * | |
46 * Function: Allocate RAM blocks from top of RAM | |
47 * | |
48 * Input: B = Desired block count | |
49 * | |
50 * Output: D = Beginning RAM block number | |
51 * | |
52 * Error: CC = C bit set; B = error code | |
53 * | |
1387 | 54 FAlHRAM ldb R$B,u Get # blocks to allocate |
1145 | 55 pshs b,x,y Preserve regs |
56 ldx <D.BlkMap+2 Get ptr to end of block map | |
57 L09A9 ldb ,s Get # blocks requested | |
58 L09AB cmpx <D.BlkMap Are we at beginning of RAM yet? | |
59 bls L0995 Yes, exit with No RAM error | |
60 lda ,-x Get RAM block marker | |
61 bne L09A9 If not free, start checking next one down | |
62 decb Free block, dec # blocks left to find count | |
63 bne L09AB Still more needed, keep checking | |
64 tfr x,y Found enough contigous blocks, move ptr to Y | |
65 bra L0983 Go mark blocks as used, & return info to caller |