1345
|
1 **************************************************
|
|
2 * System Call: F$MapBlk
|
|
3 *
|
|
4 * Function: Map specific block
|
|
5 *
|
|
6 * Input: B = Number of blocks
|
|
7 * X = Beginning block number
|
|
8 *
|
|
9 * Output: U = Address of first block
|
|
10 *
|
|
11 * Error: CC = C bit set; B = error code
|
|
12 *
|
1145
|
13 FMapBlk lda R$B,u get # blocks
|
|
14 beq L0BAA can't map 0 blocks, return error
|
|
15 cmpa #DAT.BlCt within range of DAT image?
|
|
16 bhi L0BAA no, return error
|
|
17 leas -$10,s make a buffer to hold DAT image
|
|
18 ldx R$X,u get start block #
|
|
19 ldb #1 block increment value
|
1245
|
20 IFNE H6309
|
1145
|
21 * Change to W 05/19/93 - used W since one cycle faster per block
|
|
22 tfr s,w point to buffer
|
|
23 FMapBlk2 stx ,w++ save block # to buffer
|
1245
|
24 ELSE
|
|
25 tfr s,y point to buffer
|
|
26 FMapBlk2 stx ,y++ save block # to buffer
|
|
27 ENDC
|
1145
|
28 abx Next block
|
|
29 deca done?
|
|
30 bne FMapBlk2 no, keep going
|
|
31 ldb R$B,u get block count again
|
|
32 ldx <D.Proc get process pointer
|
|
33 leay <P$DATImg,x point to DAT image
|
|
34 os9 F$FreeHB find the highest free block offset
|
|
35 bcs L0BA6 no room, return error
|
1245
|
36 IFNE H6309
|
1145
|
37 tfr d,w Preserve start block # & # of blocks
|
1245
|
38 ELSE
|
|
39 pshs d
|
|
40 ENDC
|
1145
|
41 lsla Multiply start block # by 32
|
|
42 lsla
|
|
43 lsla
|
|
44 lsla
|
|
45 lsla
|
|
46 clrb
|
|
47 std R$U,u save address of first block
|
1245
|
48 IFNE H6309
|
1145
|
49 tfr w,d Restore offset
|
1245
|
50 ELSE
|
|
51 puls d
|
|
52 ENDC
|
1145
|
53 leau ,s move DAT image into process descriptor
|
|
54 os9 F$SetImg Change process dsc to reflect new blocks
|
|
55 L0BA6 leas <$10,s Eat DAT image copy & return
|
|
56 rts
|
|
57
|
|
58 L0BAA comb Illegal Block address error
|
|
59 ldb #E$IBA
|
|
60 rts
|