     $C823/51235:   Perform [S] - Scratch command

    C823: 20 98 C3  JSR $C398       ; ascertain file type
    C826: 20 20 C3  JSR $C320       ; get drive number
    C829: 20 CA C3  JSR $C3CA       ; initialize drive if needed
    C82C: A9 00     LDA #$00
    C82E: 85 86     STA $86         ; counter for erased files
    C830: 20 9D C4  JSR $C49D       ; search for file in directory
    C833: 30 3D     BMI $C872       ; not found?

    Jump from $C870:

    C835: 20 B7 DD  JSR $DDB7       ; is file open
    C838: 90 33     BCC $C86D       ; yes
    C83A: A0 00     LDY #$00
    C83C: B1 94     LDA ($94),Y     ; file type
    C83E: 29 40     AND #$40        ; scratch protect
    C840: D0 2B     BNE $C86D       ; yes
    C842: 20 B6 C8  JSR $C8B6       ; erase file and note in directory
    C845: A0 13     LDY #$13
    C847: B1 94     LDA ($94),Y     ; track number of the first side-sector
    C849: F0 0A     BEQ $C855       ; none present?
    C84B: 85 80     STA $80         ; note track number
    C84D: C8        INY
    C84E: B1 94     LDA ($94),Y     ; and sector number
    C850: 85 81     STA $81
    C852: 20 7D C8  JSR $C87D       ; erase side-sector

    Jump from $C849:

    C855: AE 53 02  LDX $0253       ; file number
    C858: A9 20     LDA #$20
    C85A: 35 E7     AND $E7,X       ; bit 5 set?
    C85C: D0 0D     BNE $C86B       ; yes, file not closed
    C85E: BD 80 02  LDA $0280,X     ; get track
    C861: 85 80     STA $80
    C863: BD 85 02  LDA $0285,X     ; and sector
    C866: 85 81     STA $81
    C868: 20 7D C8  JSR $C87D       ; erase file

    Jump from $C85C:

    C86B: E6 86     INC $86         ; increment number of erased files

    Jump from $C838, $C840:

    C86D: 20 8B C4  JSR $C48B       ; search for next file
    C870: 10 C3     BPL $C835       ; if present, erase

    Jump from $C833:

    C872: A5 86     LDA $86         ; number of erased files
    C874: 85 80     STA $80         ; save as 'track'
    C876: A9 01     LDA #$01        ; 1 as disk status
    C878: A0 00     LDY #$00        ; 0 as 'sector'
    C87A: 4C A3 C1  JMP $C1A3       ; message 'files scratched'

        Previous Page / Next Page