1145
|
1 * F$FreeHB entry point (Called from F$MapBlk - called from SS.MpGPB)
|
|
2 FFreeHB ldb R$B,u Get # blocks requested
|
|
3 ldy R$Y,u Get DAT Img ptr
|
|
4 bsr L0A31 Go find free blocks in high part of DAT
|
|
5 L0A2C bcs L0A30 Couldn't find any, exit with error
|
|
6 sta R$A,u Save starting block #
|
|
7 L0A30 rts Return
|
|
8
|
|
9 L0A31 tfr b,a Copy # blocks requested to A
|
|
10 * This gets called directly from within F$Link
|
|
11 L0A33 suba #$09 Invert within 8
|
|
12 nega
|
|
13 pshs x,d Save X, block # & block count
|
|
14 ldd #$FFFF -1'
|
|
15 L0A56 pshs d
|
|
16
|
1258
|
17 * Move to next block - SHOULD OPTIMIZE WITH W
|
1145
|
18 L0A58 clra # free blocks found so far=0
|
|
19 ldb 2,s Get block #
|
|
20 addb ,s Add block increment (point to next block)
|
|
21 stb 2,s Save new block # to check
|
|
22 cmpb 1,s Same as block count?
|
|
23 bne L0A75 No, skip ahead
|
|
24 ldb #E$MemFul Preset error for 207 (Process mem full)
|
|
25 cmpy <D.SysDAT Is it the system process?
|
|
26 bne L0A6C No, exit with error 207
|
|
27 ldb #E$NoRam System Mem full (237)
|
|
28 L0A6C stb 3,s Save error code
|
|
29 comb set carry
|
|
30 bra L0A82 Exit with error
|
|
31
|
|
32 L0A71 tfr a,b Copy # blocks to B
|
|
33 addb 2,s Add to current start block #
|
|
34 L0A75 lslb Multiply block # by 2
|
|
35 ldx b,y Get DAT marker for that block
|
|
36 cmpx #DAT.Free Empty block?
|
|
37 bne L0A58 No, move to next block
|
|
38 inca Bump up # blocks free counter
|
|
39 cmpa 3,s Have we got enough?
|
|
40 bne L0A71 No, keep looking
|
|
41 L0A82 leas 2,s Eat temporary stack
|
|
42 puls d,x,pc Restore reg, error code & return
|
|
43
|
|
44 * F$FreeLB entry point (WHERE DOES THIS EVER GET CALLED FROM???)
|
1258
|
45 * Rodney says: "it's called via os9p1 syscall vector in line 393"
|
1145
|
46 FSFreeLB ldb R$B,u Get block count
|
|
47 ldy R$Y,u Get ptr to DAT Image
|
|
48 bsr L0A4B Go find block #'s
|
|
49 bra L0A2C Do error checking & exit (since never called,
|
|
50 * not worried about speed)
|
|
51
|
|
52 L0A4B lda #$FF Value to start loop at block 0
|
|
53 pshs x,d Preserve X,flag & block count
|
|
54 * lda #$01 # to add to go to next block (positive here)
|
|
55 nega -(-1)=+1
|
|
56 subb #9 Drop block count to -8 to -1 (invert within 8)
|
|
57 negb Negate so it is a positive # again
|
|
58 bra L0A56 Go into main find loop
|
|
59
|
1258
|
60 * F$FreeLB entry point
|
1145
|
61 FFreeLB ldd R$D,u
|
|
62 ldx R$X,u
|
|
63 ldu R$U,u
|
|
64 L0A8C pshs d,x,y,u
|
|
65 leay <P$DATImg,x
|
|
66 lsla
|
|
67 leay a,y
|
|
68 IFNE H6309
|
|
69 clra
|
1258
|
70 * Rodney claims this is a bug...
|
1145
|
71 lslb
|
|
72 tfr d,w
|
|
73 tfm u+,y+
|
|
74 oim #ImgChg,P$State,x
|
|
75 ELSE
|
1250
|
76 lslb
|
|
77 L0ALoop lda ,u+
|
|
78 sta ,y+
|
1145
|
79 decb
|
|
80 bne L0ALoop
|
|
81 lda P$State,x
|
|
82 ora #ImgChg
|
|
83 sta P$State,x
|
|
84 ENDC
|
|
85 clrb
|
|
86 puls d,x,y,u,pc
|