     $D506/54534:   Check track and sector numbers

    Jump from $D0D0, $DE92:

    D506: BD 5B 02  LDA $025B,X     ; command code for disk controller
    D509: 29 01     AND #$01        ; drive number
    D50B: 0D 4D 02  ORA $024D       ; plus command code

    Jump from $D596:

    D50E: 48        PHA             ; save
    D50F: 86 F9     STX $F9         ; buffer number
    D511: 8A        TXA
    D512: 0A        ASL             ; times 2
    D513: AA        TAX
    D514: B5 07     LDA $07,X       ; sector
    D516: 8D 4D 02  STA $024D       ; save
    D519: B5 06     LDA $06,X       ; track
    D51B: F0 2D     BEQ $D54A       ; 66, 'illegal track or sector'
    D51D: CD D7 FE  CMP $FED7       ; 36, highest track number + 1
    D520: B0 28     BCS $D54A       ; 66, 'illegal track or sector'
    D522: AA        TAX
    D523: 68        PLA             ; command code
    D524: 48        PHA
    D525: 29 F0     AND #$F0
    D527: C9 90     CMP #$90        ; code for writing?
    D529: D0 4F     BNE $D57A       ; no
    D52B: 68        PLA
    D52C: 48        PHA
    D52D: 4A        LSR
    D52E: B0 05     BCS $D535
    D530: AD 01 01  LDA $0101
    D533: 90 03     BCC $D538

    Jump from $D52E:

    D535: AD 02 01  LDA $0102

    Jump from $D533:

    D538: F0 05     BEQ $D53F
    D53A: CD D5 FE  CMP $FED5       ; 'A', format marker
    D53D: D0 33     BNE $D572       ; 73, 'cbm dos v2.6 1541'

    Jump from $D538:

    D53F: 8A        TXA             ; track number
    D540: 20 4B F2  JSR $F24B       ; get maximum sector number
    D543: CD 4D 02  CMP $024D       ; compare with sector number
    D546: F0 02     BEQ $D54A       ; equal, then error
    D548: B0 30     BCS $D57A       ; smaller?

    Jump from $D51B, $D520, $D546:

    D54A: 20 52 D5  JSR $D552       ; get track and sector number

    Jump from $D561, $D566, $D56D, $D56F:

    D54D: A9 66     LDA #$66
    D54F: 4C 45 E6  JMP $E645       ; 66, 'illegal track or sector'

        Previous Page / Next Page