$F11E/61726: Find and allocate free block Jump from $D1A6, $DD1D, $E3A9, $E3BC, $E44E: F11E: 20 3E DE JSR $DE3E ; get track and sector number F121: A9 03 LDA #$03 F123: 85 6F STA $6F ; counter F125: A9 01 LDA #$01 F127: 0D F9 02 ORA $02F9 F12A: 8D F9 02 STA $02F9 Jump from $F14A, $F158, $F161, $F16F, $D49B: F12D: A5 6F LDA $6F ; save counter F12F: 48 PHA F130: 20 11 F0 JSR $F011 ; find BAM field for this track F133: 68 PLA F134: 85 6F STA $6F ; get counter back F136: B1 6D LDA ($6D),Y ; number of free blocks in track F138: D0 39 BNE $F173 ; blocks still free? F13A: A5 80 LDA $80 ; track F13C: CD 85 FE CMP $FE85 ; 18, directory track? F13F: F0 19 BEQ $F15A ; yes, 'disk full' F141: 90 1C BCC $F15F ; smaller, then next lower track F143: E6 80 INC $80 ; increment track number F145: A5 80 LDA $80 F147: CD D7 FE CMP $FED7 ; 36, highest track number plus one F14A: D0 E1 BNE $F12D ; no, continue searching this track F14C: AE 85 FE LDX $FE85 ; 18, directory track F14F: CA DEX ; decrement F150: 86 80 STX $80 ; save as track number F152: A9 00 LDA #$00 F154: 85 81 STA $81 ; begin with sector number zero F156: C6 6F DEC $6F ; decrement counter F158: D0 D3 BNE $F12D ; not yet zero, then continue Jump from $F13F, $F171: F15A: A9 72 LDA #$72 F15C: 20 C8 C1 JSR $C1C8 ; 72, 'disk full' Jump from $F141: F15F: C6 80 DEC $80 ; decrement track number F161: D0 CA BNE $F12D ; not yet 0, continue in this track F163: AE 85 FE LDX $FE85 ; 18, directory track F166: E8 INX ; increment F167: 86 80 STX $80 ; save as track number F169: A9 00 LDA #$00 F16B: 85 81 STA $81 ; begin with sector zero F16D: C6 6F DEC $6F ; decrement counter F16F: D0 BC BNE $F12D ; not yet zero, then continue F171: F0 E7 BEQ $F15A ; else 'disk full' Jump from $F138: F173: A5 81 LDA $81 ; sector number F175: 18 CLC F176: 65 69 ADC $69 ; plus step width (10) F178: 85 81 STA $81 ; as new number F17A: A5 80 LDA $80 ; track number F17C: 20 4B F2 JSR $F24B ; get maximum sector number F17F: 8D 4E 02 STA $024E F182: 8D 4D 02 STA $024D ; and save F185: C5 81 CMP $81 ; greater than selected sector number? F187: B0 0C BCS $F195 ; yes F189: 38 SEC ; else F18A: A5 81 LDA $81 ; sector number F18C: ED 4E 02 SBC $024E ; minus maximum sector number F18F: 85 81 STA $81 ; save as new sector number F191: F0 02 BEQ $F195 ; zero? F193: C6 81 DEC $81 ; else decrement sector number by one Jump from $F187, $F191: F195: 20 FA F1 JSR $F1FA ; check BAM, find free sector F198: F0 03 BEQ $F19D ; not found? Jump from $F1A4: F19A: 4C 90 EF JMP $EF90 ; allocate block in BAM Jump from $F198: F19D: A9 00 LDA #$00 F19F: 85 81 STA $81 ; sector zero F1A1: 20 FA F1 JSR $F1FA ; find free sector F1A4: D0 F4 BNE $F19A ; found? F1A6: 4C F5 F1 JMP $F1F5 ; no, 'dir sector' Previous Page / Next Page |