         ORG   $2000
DEVCNT   EQU   $BF31
DEVLST   EQU   $BF32
MLI      EQU   $BF00
SAFE     EQU   $1FFF
CROUT    EQU   $FD8E
*
         LDA   DEVCNT
         STA   SAFE
         JSR   $FC58
         LDX   #$00
DL       LDA   DATA2,X
         BEQ   START
         JSR   $FDED
         INX
         JMP   DL
START    LDA   #$03       ;Parm count
         STA   $4000
         LDA   #$10       ;Low byte of data buffer ($1000)
         STA   $4003
         LDA   #$00
         STA   $4002      ;Hi byte of data buffer
         STA   $4005      ;Low byte of block #
         LDA   #$02
         STA   $4004      ;Hi byte of block # ($0002)
ALL2     LDA   SAFE       ;Loads in current value
         BMI   END        ;Done, quit program
         TAY
         LDA   DEVLST,Y   ;Get next drive
         BNE   GO1        ;Perform check
ALL3     DEC   SAFE       ;One less drive to go
         JMP   ALL2
GO1      STA   $4001      ;Store current device
         ASL
         AND   #$E0
         CLC
         ROR
         ROR
         ROR
         ROR
         ROR
         STA   $BE3C      ;Default slot
         LDA   $4001      ;Load it again
         AND   #$80
         CLC
         ROL
         ROL
         STA   $BE3D      ;Default drive
         INC   $BE3D      ;Actually, it's one more than that
         JSR   MLI        ;Read in the block
         hex   800040     ;Function code (read), buffer address
         BCS   IGNORE     ;Error detected
         LDA   $11FF      ;Counter byte
         BEQ   IGNORE     ;No error, but not infected either
         LDA   #$00       ;Counter found, zero it
         STA   $11FF
         JSR   MLI
         hex   810040     ;Write block back to disk w/o counter
         INC   SAFE1      ;Update counter for end of program
         LDX   #$00
B3       LDA   DATA1,X    ;Get "PREFIX" text
         STA   $200,X
         INX
         CPX   #$06
         BNE   B3
         LDA   #$8D       ;<CR>
         STA   $206
         JSR   $BE03      ;BI's location
         SEC
         LDA   $25        ;Vertical cursor position
         SBC   #$02       ;Move it up two to get rid of
         STA   $25        ;the extra <cr>'s
B2       LDX   #$00
PR1      LDA   DATA,X
         BEQ   IGNORE
         JSR   $FDED
         INX
         JMP   PR1
IGNORE   JMP   ALL3
END      LDA   SAFE1
         BEQ   END1
END2     JSR   CROUT      ;Print two <cr>'s and end
         JMP   CROUT
END1     LDX   #$00
PR2      LDA   DATA3,X
         BEQ   END2
         JSR   $FDED
         INX
         JMP   PR2
DATA     HEX   87878700
DATA1    ASC   "PREFIX"
DATA2    ASC   "Festering Hate Virus Detector v1.0a"
         hex   8D
         ASC   "Written by -DC- : Call 206/838-7686!"
         hex   8D8D
         ASC   "Scanning online devices..."
         hex   00
DATA3    ASC   "nothing."
         HEX   00
SAFE1    HEX   00
