     $CD03/52483:   B-A block allocate

    CD03: 20 F5 CD  JSR $CDF5       ; get track, sector and drive number
    CD06: A5 81     LDA $81         ; sector
    CD08: 48        PHA             ; save
    CD09: 20 FA F1  JSR $F1FA       ; find block in BAM
    CD0C: F0 0B     BEQ $CD19       ; block allocated?
    CD0E: 68        PLA             ; desired sector
    CD0F: C5 81     CMP $81         ; = next free sector?
    CD11: D0 19     BNE $CD2C       ; no
    CD13: 20 90 EF  JSR $EF90       ; allocate block in BAM
    CD16: 4C 94 C1  JMP $C194       ; done

    Jump from $CD0C:

    CD19: 68        PLA

    Jump from $CD2A:

    CD1A: A9 00     LDA #$00
    CD1C: 85 81     STA $81         ; sector 0
    CD1E: E6 80     INC $80         ; next track
    CD20: A5 80     LDA $80         ; track number
    CD22: CD D7 FE  CMP $FED7       ; 36, last track number + 1
    CD25: B0 0A     BCS $CD31       ; >=, then 'no block'
    CD27: 20 FA F1  JSR $F1FA       ; find free block in next track
    CD2A: F0 EE     BEQ $CD1A       ; not found, check next track

    Jump from $CD11:

    CD2C: A9 65     LDA #$65
    CD2E: 20 45 E6  JSR $E645       ; 65, 'no block' next free block

    Jump from $CD25:

    CD31: A9 65     LDA #$65
    CD33: 20 C8 C1  JSR $C1C8       ; 65, 'no block' no more free blocks

        Previous Page / Next Page