1345
|
1 **************************************************
|
1387
|
2 * System Call: F$DelRAM
|
1345
|
3 *
|
|
4 * Function: Deallocate RAM blocks
|
|
5 *
|
|
6 * Input: B = Number of blocks
|
|
7 * X = Beginning block number
|
|
8 *
|
|
9 * Output: None
|
|
10 *
|
|
11 * Error: CC = C bit set; B = error code
|
|
12 *
|
1145
|
13 FDelRAM ldb R$B,u # of blocks to de-allocate
|
|
14 beq DelRAM.2 if none, exit
|
|
15 ldd <D.BlkMap+2 get end of the block map
|
|
16 subd <D.BlkMap subtract out start of the block map
|
|
17 subd R$X,u take out starting block number
|
|
18 bls DelRAM.2 exit if the starting block is ># of blocks available
|
|
19 tsta check high byte of RAM #
|
|
20 bne DelRAM.0 if not zero, skip it
|
|
21 cmpb R$B,u check against size of the block
|
|
22 bhs DelRAM.0 if size is >RAM available
|
|
23 stb R$B,u save actual # of blocks deleted
|
|
24 DelRAM.0 ldx <D.BlkMap get start address of the block map
|
|
25 ldd R$X,u starting address of the RAM to de-allocate
|
|
26 leax d,x slower, but smaller than ADDR
|
|
27 ldb R$B,u get actual # of blocks to de-allocate
|
|
28 DelRAM.1 equ *
|
|
29 IFNE H6309
|
|
30 aim #^RAMinUse,,x+ set to RAM not in use
|
|
31 ELSE
|
|
32 lda ,x
|
|
33 anda #^RAMinUse
|
|
34 sta ,x+
|
|
35 ENDC
|
|
36 decb count down a block
|
|
37 bne DelRAM.1 continue
|
|
38 DelRAM.2 clrb and exit
|
|
39 rts
|