     $DCDA/56538:   Construct a new block

    Jump from $D48A, $D902, $D9E9:

    DCDA: 20 A9 F1  JSR $F1A9       ; find free sector in BAM
    DCDD: A9 01     LDA #$01
    DCDF: 20 DF D1  JSR $D1DF       ; open channel
    DCE2: 20 D0 D6  JSR $D6D0       ; transmit parameter to disk controller
    DCE5: 20 B6 DC  JSR $DCB6       ; reset pointer
    DCE8: A6 82     LDX $82         ; channel number
    DCEA: AD 4A 02  LDA $024A       ; file type
    DCED: 48        PHA
    DCEE: 0A        ASL
    DCEF: 05 7F     ORA $7F         ; drive number
    DCF1: 95 EC     STA $EC,X       ; save as flag
    DCF3: 68        PLA
    DCF4: C9 04     CMP #$04        ; rel-file?
    DCF6: F0 05     BEQ $DCFD       ; yes
    DCF8: A9 01     LDA #$01
    DCFA: 95 F2     STA $F2,X       ; set WRITE flag
    DCFC: 60        RTS

    Jump from $DCF6:

    DCFD: A4 83     LDY $83         ; secondary address
    DCFF: B9 2B 02  LDA $022B,Y     ; channel number in table
    DD02: 29 3F     AND #$3F        ; erase the top two bits
    DD04: 09 40     ORA #$40        ; set bit 6
    DD06: 99 2B 02  STA $022B,Y     ; READ and WRITE flag
    DD09: AD 58 02  LDA $0258       ; record length
    DD0C: 95 C7     STA $C7,X       ; in table
    DD0E: 20 8E D2  JSR $D28E       ; find buffer
    DD11: 10 03     BPL $DD16       ; found?
    DD13: 4C 0F D2  JMP $D20F       ; 70, 'no channel'

    Jump from $DD11:

    DD16: A6 82     LDX $82         ; channel number
    DD18: 95 CD     STA $CD,X       ; buffer number for side-sector
    DD1A: 20 C1 DE  JSR $DEC1       ; erase buffer
    DD1D: 20 1E F1  JSR $F11E       ; find free block in BAM
    DD20: A5 80     LDA $80         ; track
    DD22: 8D 59 02  STA $0259       ; for side-sector
    DD25: A5 81     LDA $81         ; sector
    DD27: 8D 5A 02  STA $025A       ; for side-sector
    DD2A: A6 82     LDX $82         ; channel number
    DD2C: B5 CD     LDA $CD,X       ; buffer number
    DD2E: 20 D3 D6  JSR $D6D3       ; transmit parameter to disk controller
    DD31: A9 00     LDA #$00
    DD33: 20 E9 DE  JSR $DEE9       ; buffer pointer to zero
    DD36: A9 00     LDA #$00
    DD38: 20 8D DD  JSR $DD8D
    DD3B: A9 11     LDA #$11        ; 17
    DD3D: 20 8D DD  JSR $DD8D       ; as end pointer in buffer
    DD40: A9 00     LDA #$00        ; zero
    DD42: 20 8D DD  JSR $DD8D       ; as side-sector number in buffer
    DD45: AD 58 02  LDA $0258       ; record length
    DD48: 20 8D DD  JSR $DD8D       ; in buffer
    DD4B: A5 80     LDA $80         ; track number of this block
    DD4D: 20 8D DD  JSR $DD8D       ; in buffer
    DD50: A5 81     LDA $81         ; sector number
    DD52: 20 8D DD  JSR $DD8D       ; in buffer
    DD55: A9 10     LDA #$10        ; 16
    DD57: 20 E9 DE  JSR $DEE9       ; buffer pointer to 16
    DD5A: 20 3E DE  JSR $DE3E       ; get track and sector number
    DD5D: A5 80     LDA $80         ; track number of the first data block
    DD5F: 20 8D DD  JSR $DD8D       ; in buffer
    DD62: A5 81     LDA $81         ; sector number of the first data block
    DD64: 20 8D DD  JSR $DD8D       ; in buffer
    DD67: 20 6C DE  JSR $DE6C       ; write block to disk
    DD6A: 20 99 D5  JSR $D599       ; and check
    DD6D: A9 02     LDA #$02
    DD6F: 20 C8 D4  JSR $D4C8       ; buffer pointer to 2
    DD72: A6 82     LDX $82         ; channel number
    DD74: 38        SEC
    DD75: A9 00     LDA #$00
    DD77: F5 C7     SBC $C7,X       ; record length
    DD79: 95 C1     STA $C1,X       ; pointer for writing
    DD7B: 20 E2 E2  JSR $E2E2       ; erase buffer
    DD7E: 20 19 DE  JSR $DE19       ; write link bytes in buffer
    DD81: 20 5E DE  JSR $DE5E       ; write block to disk
    DD84: 20 99 D5  JSR $D599       ; and check
    DD87: 20 F4 EE  JSR $EEF4       ; write BAM
    DD8A: 4C 98 DC  JMP $DC98       ; and done

        Previous Page / Next Page