     $E31C/58140:   Expand side-sector

    Jump from $E0E5:

    E31C: 20 D3 D1  JSR $D1D3       ; get drive number
    E31F: 20 CB E1  JSR $E1CB       ; get last side-sector
    E322: 20 9C E2  JSR $E29C
    E325: 20 7B CF  JSR $CF7B
    E328: A5 D6     LDA $D6
    E32A: 85 87     STA $87
    E32C: A5 D5     LDA $D5         ; side-sector number
    E32E: 85 86     STA $86
    E330: A9 00     LDA #$00
    E332: 85 88     STA $88
    E334: A9 00     LDA #$00
    E336: 85 D4     STA $D4
    E338: 20 0E CE  JSR $CE0E       ; calculate side-sector number and pointer

    Jump from $CA85:

    E33B: 20 4D EF  JSR $EF4D       ; number of free blocks
    E33E: A4 82     LDY $82         ; channel number
    E340: B6 C7     LDX $C7,Y       ; record length
    E342: CA        DEX
    E343: 8A        TXA
    E344: 18        CLC
    E345: 65 D7     ADC $D7         ; plus pointer in data block
    E347: 90 0C     BCC $E355
    E349: E6 D6     INC $D6
    E34B: E6 D6     INC $D6         ; increment pointer to end by 2
    E34D: D0 06     BNE $E355
    E34F: E6 D5     INC $D5         ; increment side-sector number
    E351: A9 10     LDA #$10
    E353: 85 D6     STA $D6         ; set pointer to 16

    Jump from $E347, $E34D:

    E355: A5 87     LDA $87
    E357: 18        CLC
    E358: 69 02     ADC #$02
    E35A: 20 E9 DE  JSR $DEE9       ; set buffer pointer for side-sector
    E35D: A5 D5     LDA $D5         ; side-sector number
    E35F: C9 06     CMP #$06
    E361: 90 05     BCC $E368       ; smaller than 6?

    Jump from $E394, $E39B:

    E363: A9 52     LDA #$52
    E365: 20 C8 C1  JSR $C1C8       ; 52, 'file too large'

    Jump from $E361:

    E368: A5 D6     LDA $D6         ; end pointer
    E36A: 38        SEC
    E36B: E5 87     SBC $87         ; minus last end pointer
    E36D: B0 03     BCS $E372
    E36F: E9 0F     SBC #$0F        ; minus 16
    E371: 18        CLC

    Jump from $E36D:

    E372: 85 72     STA $72
    E374: A5 D5     LDA $D5         ; side-sector number
    E376: E5 86     SBC $86         ; minus last side-sector number
    E378: 85 73     STA $73         ; save
    E37A: A2 00     LDX #$00
    E37C: 86 70     STX $70         ; erase sum for calculation
    E37E: 86 71     STX $71
    E380: AA        TAX
    E381: 20 51 DF  JSR $DF51       ; calculate block # of rel-file
    E384: A5 71     LDA $71
    E386: D0 07     BNE $E38F
    E388: A6 70     LDX $70
    E38A: CA        DEX
    E38B: D0 02     BNE $E38F
    E38D: E6 88     INC $88

    Jump from $E386, $E38B:

    E38F: CD 73 02  CMP $0273       ; block number of rel-file
    E392: 90 09     BCC $E39D       ; greater than free blocks on disk?
    E394: D0 CD     BNE $E363       ; 52, 'file too large'
    E396: AD 72 02  LDA $0272
    E399: C5 70     CMP $70
    E39B: 90 C6     BCC $E363       ; 52, 'file too large'

    Jump from $E392:

    E39D: A9 01     LDA #$01
    E39F: 20 F6 D4  JSR $D4F6       ; get byte from buffer
    E3A2: 18        CLC
    E3A3: 69 01     ADC #$01        ; plus 1
    E3A5: A6 82     LDX $82
    E3A7: 95 C1     STA $C1,X       ; as write pointer
    E3A9: 20 1E F1  JSR $F11E       ; find free block in BAM
    E3AC: 20 FD DD  JSR $DDFD       ; track and sector in buffer
    E3AF: A5 88     LDA $88
    E3B1: D0 15     BNE $E3C8       ; only one block needed?
    E3B3: 20 5E DE  JSR $DE5E       ; write block

    Jump from $E40D, $E414:

    E3B6: 20 1E CF  JSR $CF1E       ; change buffer
    E3B9: 20 D0 D6  JSR $D6D0       ; transmit parameter to disk controller
    E3BC: 20 1E F1  JSR $F11E       ; find free block in BAM
    E3BF: 20 FD DD  JSR $DDFD       ; track and sector in buffer
    E3C2: 20 E2 E2  JSR $E2E2       ; erase buffer
    E3C5: 4C D4 E3  JMP $E3D4

    Jump from $E3B1, $E416:

    E3C8: 20 1E CF  JSR $CF1E       ; change buffer
    E3CB: 20 D0 D6  JSR $D6D0       ; transmit parameter to disk controller
    E3CE: 20 E2 E2  JSR $E2E2       ; erase buffer
    E3D1: 20 19 DE  JSR $DE19       ; zero byte and end pointer in buffer

    Jump from $E3C5:

    E3D4: 20 5E DE  JSR $DE5E       ; write block
    E3D7: 20 0C DE  JSR $DE0C       ; get track and sector
    E3DA: A5 80     LDA $80         ; track
    E3DC: 48        PHA
    E3DD: A5 81     LDA $81         ; and sector
    E3DF: 48        PHA             ; save
    E3E0: 20 3E DE  JSR $DE3E       ; get track and sector from disk
    E3E3: A5 81     LDA $81         ; controller
    E3E5: 48        PHA
    E3E6: A5 80     LDA $80         ; save track and sector
    E3E8: 48        PHA
    E3E9: 20 45 DF  JSR $DF45       ; set buffer pointer for side-sector
    E3EC: AA        TAX
    E3ED: D0 0A     BNE $E3F9       ; pointer not zero?
    E3EF: 20 4E E4  JSR $E44E       ; write side-sector
    E3F2: A9 10     LDA #$10
    E3F4: 20 E9 DE  JSR $DEE9       ; buffer pointer to 16
    E3F7: E6 86     INC $86         ; increment side-sector number

    Jump from $E3ED:

    E3F9: 68        PLA
    E3FA: 20 8D DD  JSR $DD8D       ; track in side-sector
    E3FD: 68        PLA
    E3FE: 20 8D DD  JSR $DD8D       ; sector in side-sector
    E401: 68        PLA
    E402: 85 81     STA $81         ; sector
    E404: 68        PLA
    E405: 85 80     STA $80         ; and get track back
    E407: F0 0F     BEQ $E418       ; no more blocks?
    E409: A5 86     LDA $86         ; side-sector number
    E40B: C5 D5     CMP $D5         ; changed?
    E40D: D0 A7     BNE $E3B6       ; yes
    E40F: 20 45 DF  JSR $DF45       ; set buffer pointer in side-sector
    E412: C5 D6     CMP $D6         ; end pointer
    E414: 90 A0     BCC $E3B6       ; smaller?
    E416: F0 B0     BEQ $E3C8       ; same

    Jump from $E407:

    E418: 20 45 DF  JSR $DF45       ; set buffer pointer in side-sector
    E41B: 48        PHA
    E41C: A9 00     LDA #$00
    E41E: 20 DC DE  JSR $DEDC       ; buffer pointer to zero
    E421: A9 00     LDA #$00
    E423: A8        TAY
    E424: 91 94     STA ($94),Y     ; zero as track number
    E426: C8        INY
    E427: 68        PLA             ; end pointer
    E428: 38        SEC
    E429: E9 01     SBC #$01        ; minus one
    E42B: 91 94     STA ($94),Y     ; as sector
    E42D: 20 6C DE  JSR $DE6C       ; write block
    E430: 20 99 D5  JSR $D599       ; and verify
    E433: 20 F4 EE  JSR $EEF4       ; update BAM
    E436: 20 0E CE  JSR $CE0E       ; update pointer for rel-file
    E439: 20 1E CF  JSR $CF1E       ; change buffer
    E43C: 20 F8 DE  JSR $DEF8       ; right side-sector?
    E43F: 70 03     BVS $E444       ; no
    E441: 4C 75 E2  JMP $E275

    Jump from $E43F:

    E444: A9 80     LDA #$80
    E446: 20 97 DD  JSR $DD97       ; set bit 7
    E449: A9 50     LDA #$50
    E44B: 20 C8 C1  JSR $C1C8       ; 50, 'record not present'

        Previous Page / Next Page