; Pius Nippgen, Bergstr.12, D-6657 Gersheim 8, Tel. 06843/781 (06843/1522)
; WEST-GERMANY

; VIRUS-CONTROL V1.3  -  Sourcecode:
; ---------------------------------
; Sorry for my poor school-English
; done with SEKA-Assembler.
; 05. May 1989

start:
 move.l  $4.w,a6
 movem.l d0/a0,Parameter   ; save address + number of additional characters
 sub.l   a1,a1             ; FindTask() (or process)
 jsr     -294(a6)
 move.l  d0,a1
 tst.l   $ac(a1)           ; pointer to ConsoleLineInterpreter = 0 ->
 bne.s   clistart          ; Workbenchstart -> you have to get Workbench-
 move.l  d0,-(sp)          ; StartupMessage, else -> TaskHeld or Guru
 lea     $5c(a1),a0
 jsr     -384(a6)          ; WaitPort()
 move.l  (sp)+,a1
 lea     $5c(a1),a0
 jsr     -372(a6)          ; GetMsg()
 move.l  d0,-(sp)
 lea     NOBOOTRtext(pc),a0
 add.l   #reset,-8(a0)
 add.l   #reset,-12(a0)
 lea     NoWBStart(pc),a1
 lea     NOBOOTR(pc),a2
 lea     NOBOOTR(pc),a3    ; Requester points to CLI-Start
 bsr     autorequest
 sub.l   #reset,-8(a0)
 sub.l   #reset,-12(a0)
 move.l  (sp)+,a1
 jmp     -378(a6)          ; ReplyMsg() + end
clistart:
 move.l  #end-reset+9000,d0; real VIRUS-CONTROL-Routine + Task-stack
 move.l  #$10002,d1        ; MEMF_CLEAR
 jsr     -198(a6)          ; Chip-Memory exists in any Amiga, and can be
 move.l  d0,pointer        ; allocated already in Cool-vector-routine
 beq     weiter-2          ; error -> rts -> no installation-information
 move.l  -454(a6),oldDOIO  ; save oldDOIO, will be copied
 tst.l   546(a6)
 bne.s   kickchanged
 tst.l   550(a6)        ; if KICK-vectors are changed -> only warnings,
 bne.s   kickchanged    ; because changes can be caused by serious programs
 tst.l   554(a6)        ; (for instance rad:)
 beq.s   testBeginIO
kickchanged:
 move.l  #MeldungvectorEnde-Meldungvector,textlaenge
 move.l  #Meldungvector,textaddress
 bsr     meldungout
testBeginIO:
 lea     350(a6),a0     ; DeviceListstructure
 lea     trackdisk(pc),a1
 jsr     -276(a6)       ; Address of Trackdisk-Node = trackdisk.device-Base
 move.l  d0,a0
 lea     -28(a0),a0
 move.l  a0,BeginIOAdr  ; get addresse of BeginIO-vector
 cmp.l   #$00fc0000,(a0); if BeginIO-vector is changed -> only warning, because
 bhs.s   testDOIO       ; changes can be caused by serious programs (FACC)
 move.l  #MeldungvectorEnde-Meldungvector,textlaenge
 move.l  #Meldungvector,textaddress
 move.l  #"Begi",Meldungvector+4
 move.l  #"nIO-",Meldungvector+8
 bsr     meldungout
testDOIO:
 lea     newDOIO(pc),a0
 move.l  oldDOIO(pc),a3 ; is DOIO-vector already set to VIRUS-CONTROL
 moveq   #127,d0        ; if not install VIRUS-CONTROL, but only if DOIO-vector
aaaa:                   ; was not changed
 cmpm.l  (a3)+,(a0)+
 bne.s   install
 dbra    d0,aaaa        ; VIRUS-CONTROL already installed, because DOIO okay

 lea     reset(pc),a0   ; test if COOL-vector is set to VIRUS-CONTROL
 move.l  46(a6),a3      ; test 127 Bytes (moveq -> +127)
 moveq   #127,d0
bbbb:
 cmpm.l  (a3)+,(a0)+
 bne     COOLchanged    ; is Cool-vector set to another program (Virus?)
 dbra    d0,bbbb
 bra     isinstalled    ; both vectors set to VIRUS-CONTROL -> everthing okay
install:
 cmp.l   #$00fc0000,oldDOIO; is DOIO-vector set to ROM ?
 ; do not use a special ROM-address, because of compatibility with any version
 ; if not set to ROM -> set to a virus ?
 blo     DOIOchanged
 movem.l d1-d7/a0-a6,-(sp)
 lea     taskname(pc),a1; vector-control-Task could be active still, because
 jsr     -294(a6)       ; a Window or Requester could be still in work
 tst.l   d0             ; DOIO, COOL-vector is restored already.
 movem.l (sp)+,d1-d7/a0-a6
 bne     freemem
 move.l  pointer(pc),a1 ; a1 will be used in copy-routine
 move.l  a1,d0
 lea     Kennung(pc),a0 ; VIRUS-CONTROL-program can be file-proteced too,
 addq.b  #1,8(a0)       ; because mark does not stand in program
 lea     NOBOOT(pc),a0
 add.l   d0,lastDOIO       -NOBOOT(a0)    ; assemble absolute addresses with
 add.l   d0,lastCOOL       -NOBOOT(a0)    ; minus reset.
 add.l   d0,NOBOOTtext     -NOBOOT-8(a0)  ; now adapt these absolute addresses
 add.l   d0,NOBOOTtext     -NOBOOT-12(a0) ; to the actual memory-address
 add.l   d0,NOBOOTRtext    -NOBOOT-8(a0)
 add.l   d0,NOBOOTRtext    -NOBOOT-12(a0)
 add.l   d0,OPENERRtext    -NOBOOT-8(a0)
 add.l   d0,OPENERRtext    -NOBOOT-12(a0)
 add.l   d0,NAME0text      -NOBOOT-8(a0)
 add.l   d0,NAME0text      -NOBOOT-12(a0)
 add.l   d0,NAME1text      -NOBOOT-8(a0)
 add.l   d0,NAME1text      -NOBOOT-12(a0)
 add.l   d0,NAME2text      -NOBOOT-8(a0)
 add.l   d0,NAME2text      -NOBOOT-12(a0)
 add.l   d0,NAME3text      -NOBOOT-8(a0)
 add.l   d0,NAME3text      -NOBOOT-12(a0)
 add.l   d0,ONEDIFFtext    -NOBOOT-8(a0)
 add.l   d0,ONEDIFFtext    -NOBOOT-12(a0)
 add.l   d0,CORRECTtext    -NOBOOT-8(a0)
 add.l   d0,CORRECTtext    -NOBOOT-12(a0)
 add.l   d0,PROTECTtext    -NOBOOT-8(a0)
 add.l   d0,PROTECTLtext   -NOBOOT-8(a0)
 add.l   d0,ALREADYNOtext  -NOBOOT-8(a0)
 add.l   d0,ALREADYNOdeltext-NOBOOT-8(a0)
 add.l   d0,ALREADYVItext  -NOBOOT-8(a0)
 add.l   d0,ALREADYVItext  -NOBOOT-12(a0)
 add.l   d0,ALREADYWORKtext-NOBOOT-8(a0)
 add.l   d0,ALREADYNOnamtext-NOBOOT-8(a0)
 add.l   d0,ALREADYNOnamtext-NOBOOT-12(a0)
 add.l   d0,OPENFILEnamtext-NOBOOT-8(a0)
 add.l   d0,OPENFILEnamtext-NOBOOT-12(a0)
 add.l   d0,EXITtext       -NOBOOT-8(a0)
 add.l   d0,linktext       -NOBOOT-8(a0)
 add.l   d0,linktext       -NOBOOT-12(a0)
 add.l   d0,neuschtext     -NOBOOT-8(a0)
 add.l   d0,okktext        -NOBOOT-8(a0)
 add.l   d0,noloadftext    -NOBOOT-8(a0)
 add.l   d0,FILESCHUTZtext -NOBOOT-8(a0)
 add.l   d0,WRITEBBtext    -NOBOOT-8(a0)
 add.l   d0,WRITEBBtext    -NOBOOT-12(a0)
 add.l   d0,OVERWRITEtext  -NOBOOT-8(a0)
 add.l   d0,OVERWRITELtext -NOBOOT-8(a0)
 add.l   d0,OVERWRITERtext -NOBOOT-8(a0)
 add.l   d0,BOOTL          -NOBOOT-8(a0)
 add.l   d0,BOOTLtext      -NOBOOT-8(a0)
 add.l   d0,BOOTRtext      -NOBOOT-8(a0)
 add.l   d0,REALLYBOOTtext -NOBOOT-8(a0)
 add.l   d0,vector0text    -NOBOOT-8(a0)
 add.l   d0,vectorLtext    -NOBOOT-8(a0)
 add.l   d0,vectorLtext    -NOBOOT-12(a0)
 add.l   d0,gadtext16text  -NOBOOT-8(a0)
 add.l   d0,gadtext16text  -NOBOOT-12(a0)
 add.l   d0,gadtext15text  -NOBOOT-8(a0)
 add.l   d0,gadtext15text  -NOBOOT-12(a0)
 add.l   d0,gadtext14text  -NOBOOT-8(a0)
 add.l   d0,gadtext14text  -NOBOOT-12(a0)
 add.l   d0,gadtext13text  -NOBOOT-8(a0)
 add.l   d0,gadtext13text  -NOBOOT-12(a0)
 add.l   d0,gadtext12text  -NOBOOT-8(a0)
 add.l   d0,gadtext12text  -NOBOOT-12(a0)
 add.l   d0,gadtext11text  -NOBOOT-8(a0)
 add.l   d0,gadtext11text  -NOBOOT-12(a0)
 add.l   d0,gadtext8text   -NOBOOT-8(a0)
 add.l   d0,gadtext8text   -NOBOOT-12(a0)
 add.l   d0,gadtext7text   -NOBOOT-8(a0)
 add.l   d0,gadtext7text   -NOBOOT-12(a0)
 add.l   d0,gadtext6text   -NOBOOT-8(a0)
 add.l   d0,gadtext6text   -NOBOOT-12(a0)
 add.l   d0,gadtext5text   -NOBOOT-8(a0)
 add.l   d0,gadtext5text   -NOBOOT-12(a0)
 add.l   d0,gadtext4text   -NOBOOT-8(a0)
 add.l   d0,gadtext4text   -NOBOOT-12(a0)
 add.l   d0,gadtext3text   -NOBOOT-8(a0)
 add.l   d0,gadtext3text   -NOBOOT-12(a0)
 add.l   d0,gadtext2text   -NOBOOT-8(a0)
 add.l   d0,gadtext2text   -NOBOOT-12(a0)
 add.l   d0,gadtext1text   -NOBOOT-8(a0)
 add.l   d0,gadtext1text   -NOBOOT-12(a0)
 add.l   d0,gadtext0text   -NOBOOT-8(a0)
 add.l   d0,gadtext0text   -NOBOOT-12(a0)
 add.l   d0,gad90          -NOBOOT(a0)
 add.l   d0,gad90          -NOBOOT+18(a0)
 add.l   d0,gad90          -NOBOOT+34(a0)
 add.l   d0,string0        -NOBOOT(a0)
 add.l   d0,string0        -NOBOOT+4(a0)
 add.l   d0,gad91          -NOBOOT(a0)
 add.l   d0,gad91          -NOBOOT+18(a0)
 add.l   d0,gad91          -NOBOOT+34(a0)
 add.l   d0,string1        -NOBOOT(a0)
 add.l   d0,string1        -NOBOOT+4(a0)
 add.l   d0,gad92          -NOBOOT(a0)
 add.l   d0,gad92          -NOBOOT+18(a0)
 add.l   d0,gad92          -NOBOOT+34(a0)
 add.l   d0,string2        -NOBOOT(a0)
 add.l   d0,string2        -NOBOOT+4(a0)
 add.l   d0,gad93          -NOBOOT(a0)
 add.l   d0,gad93          -NOBOOT+18(a0)
 add.l   d0,gad93          -NOBOOT+34(a0)
 add.l   d0,string3        -NOBOOT(a0)
 add.l   d0,string3        -NOBOOT+4(a0)
 add.l   d0,gad0           -NOBOOT(a0)
 add.l   d0,gad0           -NOBOOT+18(a0)
 add.l   d0,gad0           -NOBOOT+26(a0)
 add.l   d0,gad1           -NOBOOT(a0)
 add.l   d0,gad1           -NOBOOT+18(a0)
 add.l   d0,gad1           -NOBOOT+26(a0)
 add.l   d0,gad2           -NOBOOT(a0)
 add.l   d0,gad2           -NOBOOT+18(a0)
 add.l   d0,gad2           -NOBOOT+26(a0)
 add.l   d0,gad3           -NOBOOT(a0)
 add.l   d0,gad3           -NOBOOT+18(a0)
 add.l   d0,gad3           -NOBOOT+26(a0)
 add.l   d0,gad4           -NOBOOT(a0)
 add.l   d0,gad4           -NOBOOT+18(a0)
 add.l   d0,gad4           -NOBOOT+26(a0)
 add.l   d0,gad5           -NOBOOT(a0)
 add.l   d0,gad5           -NOBOOT+18(a0)
 add.l   d0,gad5           -NOBOOT+26(a0)
 add.l   d0,gad6           -NOBOOT(a0)
 add.l   d0,gad6           -NOBOOT+18(a0)
 add.l   d0,gad6           -NOBOOT+26(a0)
 add.l   d0,gad7           -NOBOOT(a0)
 add.l   d0,gad7           -NOBOOT+18(a0)
 add.l   d0,gad7           -NOBOOT+26(a0)
 add.l   d0,gad8           -NOBOOT(a0)
 add.l   d0,gad8           -NOBOOT+18(a0)
 add.l   d0,gad8           -NOBOOT+26(a0)
 add.l   d0,gad10          -NOBOOT(a0)
 add.l   d0,gad10          -NOBOOT+18(a0)
 add.l   d0,gad10          -NOBOOT+26(a0)
 add.l   d0,gad11          -NOBOOT(a0)
 add.l   d0,gad11          -NOBOOT+18(a0)
 add.l   d0,gad11          -NOBOOT+26(a0)
 add.l   d0,gad12          -NOBOOT(a0)
 add.l   d0,gad12          -NOBOOT+18(a0)
 add.l   d0,gad12          -NOBOOT+26(a0)
 add.l   d0,gad13          -NOBOOT(a0)
 add.l   d0,gad13          -NOBOOT+18(a0)
 add.l   d0,gad13          -NOBOOT+26(a0)
 add.l   d0,gad14          -NOBOOT(a0)
 add.l   d0,gad14          -NOBOOT+18(a0)
 add.l   d0,gad14          -NOBOOT+26(a0)
 add.l   d0,gad15          -NOBOOT(a0)
 add.l   d0,gad15          -NOBOOT+18(a0)
 add.l   d0,gad15          -NOBOOT+26(a0)
 add.l   d0,gad16          -NOBOOT+18(a0)
 add.l   d0,gad16          -NOBOOT+26(a0)
 add.l   d0,gadborders     -NOBOOT-8(a0)
 add.l   d0,gadborder1     -NOBOOT-8(a0)
 add.l   d0,pairs          -NOBOOT-8(a0)
 add.l   d0,font           -NOBOOT(a0)
 add.l   d0,window         -NOBOOT+26(a0)
 add.l   d0,structtask     -NOBOOT+10(a0)
 add.l   d0,end            -NOBOOT-30(a0)
 add.l   d0,end            -NOBOOT-34(a0)
 add.l   d0,end            -NOBOOT-38(a0)
 lea     reset(pc),a0   ; pc-relative-address-mode is shorter
 move.w  #end-reset-1,d0; dbcc ends if -1 (ffff)
copy:
 move.b  (a0)+,(a1)+    ; copy the real VIRUS-CONTROL-Routine (reset: bis end:)
 dbra    d0,copy        ; to the allocated area
 move.l  pointer(pc),a1
 add.l   #newDOIO-reset,a1
 move.l  a1,-454(a6)    ; set DOIO-vector to VIRUS-CONTROL
 bsr     execchecksum   ; set COOL-vector to VIRUS-CONTROL
 move.l  pointer(pc),a1
 move.l  a1,a2
 add.l   #structtask-reset,a1  ; addtask
 add.l   #task-reset,a2
 sub.l   a3,a3          ; 2 Bytes instead of 6 Bytes(move.l #0,a3)
 jsr     -282(a6)
 move.l  #MeldungEnde-Meldung,textlaenge
 move.l  #Meldung,textaddress
 bsr.s   meldungout
 bra.s   checkdrive     ; check inserted disks
DOIOchanged:
 move.l  #"DOIO",vectorchanged
COOLchanged:
 bsr     freemem
 move.l  #MeldungDangerEnde-MeldungDanger,textlaenge
 move.l  #MeldungDanger,textaddress
 bra.s   meldungout
isinstalled:
 bsr     freemem
 move.l  #MeldungEnde-Meldung,textlaenge
 move.l  #Meldung,textaddress
 move.l  #"  al",Meldungmodify    ; modifying is shorter than
 move.l  #"read",Meldungmodify+4  ; an extra information
 move.l  #"y   ",Meldungmodify+8
 bsr.s   meldungout
 bra.s   checkdrive         ; check inserted disks
meldungout:
 bsr     OpenDOS            ; OpenLibrary("dos.library",0);
 jsr     -60(a6)            ; get outputhandle
 move.l  d0,d1
 movem.l textaddress(pc),d2-d3 ; address + length
 jsr     -48(a6)            ; write
 bra     CloseDOS           ; CloseLibrary("dos.library") + rts

checkdrive:                 ; test if -t -c -o -f
 move.l  46(a6),a1
 move.l  a1,VCreset
 move.b  #$ff,openflag-reset(a1)    ; dont change Open() =  default
 move.l  #"OFF ",gadtext15text-reset+14(a1)
 move.w  #$ffff,colorflag-reset(a1) ; colorflag, searchfiles = default
 move.l  #" ON ",gadtext0text-reset+14(a1)
 move.l  #" ON ",gadtext16text-reset+14(a1)
 movem.l Parameter(pc),d0/a0; get -t -c -o -f
 subq.l  #1,d0              ; d0 = Number of additional entered characters
 beq.s   noparameter        ; if only programname -> d0=1, only $0a(Return)
testline:
 cmp.b   #$20,(a0)          ; in a0 address of additional characters
 bne.s   testn              ; ignore spaces
 addq.l  #1,a0
 bra.s   testline
testn:
 cmp.b   #"-",(a0)+
 bne.s   noparameter
 cmp.b   #"c",(a0)          ; -c = insert disk -> no green color
 bne.s   testt
 clr.b   colorflag-reset(a1)
 move.l  #"OFF ",gadtext0text-reset+14(a1)
 addq.l  #1,a0
 bra.s   testline
testt:
 cmp.b   #"t",(a0)          ; -t = do not check inserted disks
 bne.s   testo
 clr.b   checkflag
 addq.l  #1,a0
 bra.s   testline
testo:
 cmp.b   #"o",(a0)          ; -o = set Open() to VIRUS-CONTROL
 bne.s   testf
 clr.b   openflag-reset(a1)
 move.l  #" ON ",gadtext15text-reset+14(a1)
 addq.l  #1,a0
 bra.s   testline
testf:
 cmp.b   #"f",(a0)+         ; -f = do not use S:NoWarning S:VirusName
 bne.s   noparameter
 clr.b   searchfiles-reset(a1)
 move.l  #"OFF ",gadtext16text-reset+14(a1)
 bra.s   testline

noparameter:                ; check inserted disks-routine
 moveq   #0,d0              ; df0: (also returncode)
 tst.b   checkflag
 beq     weiter-2
 bsr     OpenDOS
 moveq   #50,d1             ; wait for 1 second for vector-control-Task
 jsr     -198(a6)           ; to set Openflag correctly.
 bsr     CloseDOS
 bsr.s   check
 moveq   #1,d0              ; df1:
 bsr.s   check
 moveq   #2,d0              ; df2:
 bsr.s   check
 moveq   #3,d0              ; df3:
 bra.s   check
check:
 move.l  d0,-(sp)
 sub.l   a1,a1                       ; FindTask()
 jsr     -294(a6)
 move.l  VCreset(pc),a1
 lea     trackport-reset(a1),a1
 move.l  d0,16(a1)
 jsr     -354(a6)                    ; AddPort()
 move.l  VCreset(pc),a1
 lea     trackreq-reset(a1),a1
 lea     trackdisk(pc),a0
 moveq   #0,d1                       ; no flags
 move.l  (sp)+,d0                    ; dfx:
 jsr     -444(a6)                    ; OpenDevice()
 tst.l   d0
 bne.s   OpenDeviceError             ; d0 <> 0 -> dfx: does not exist
 move.l  VCreset(pc),a0
 lea     trackreq-reset(a0),a1
 lea     trackport-reset(a0),a3
 move.l  a3,14(a1)
 lea     blockbuff-reset(a0),a3
 move.l  a3,40(a1)
 moveq   #2,d0
 move.w  d0,28(a1)                   ; CMD_READ
 lsl.l   #8,d0                       ; 512 Bytes from 0 -> VIRUS-CONTROL
 move.l  d0,36(a1)                   ; first checks if disk is inserted,
 clr.l   44(a1)                      ; if not, jump to old DOIO-Routine
 jsr     -456(a6)                    ; DOIO -> jump to VIRUSCONTROL
 ; you have to use VCreset, not 46(a6), because 'remove Virus-Control'
 ; sets 46(a6) = 0
 ; before freemem, vector-control-Task waits for 5 seconds -> enough time
 ; for motor off, CloseDevice() RemPort(), which use this area
 move.l  VCreset(pc),a1
 lea     trackreq-reset(a1),a1
 move.w  #9,28(a1)                   ; motor
 clr.l   36(a1)                      ; off
 jsr     -456(a6)                    ; DOIO
 move.l  VCreset(pc),a1
 lea     trackreq-reset(a1),a1
 jsr     -450(a6)                    ; CloseDevice()
OpenDeviceError:
 move.l  VCreset(pc),a1
 lea     trackport-reset(a1),a1
 jsr     -360(a6)                    ; RemovePort()
 bra     returncode

textaddress:  dc.l 0     ; address of information
textlaenge:   dc.l 0     ; length of information
Parameter:    dc.l 0     ; number of additional entered characters
Parameteradr: dc.l 0     ; address of additional entered characters
VCreset:      dc.l 0     ; address of installed VIRUS-CONTROL
checkflag:    dc.b $ff
frei:         dc.b 0
trackdisk:    dc.b "trackdisk.device",0
 even
Meldung:
 dc.b $9b,"33mVIRUS-CONTROL V1.3  by PIUS NIPPGEN "
Meldungmodify: dc.b                       "    now       installed !",10,$9b,"31m"
 dc.b "100% assembler! survives reset! runs on any Amiga! vector-check every second!",10
 dc.b "Kill-Virus  by  vector-restoration!     Bootblock - write - access - control!",10
 dc.b "Reset+left M.button->removes VIRUS-CONTROL!  Reset+right M.button->NoFastMem!",10
 dc.b "insert suspect disk->WarnWindow!   +L-ALT->always WarnWindow!  +R-ALT->never!",10
 dc.b "Bootblock to screen or to File!    Standard, NoFastMem  or File to Bootblock!",10
 dc.b "Bootblockchecksum false->no more (Virus-)Boot,  right->(Virus-)Boot possible!",10
 dc.b "dangerless Boot  from Virus-Disk  because of  Boot-simulation!",10
 dc.b "save Bootblock           to S:NoWarning->only red Warn-Signal!",10
 dc.b "save Bootblock with name to S:VirusName->WarnWindow with name!",10
 dc.b "Protection from Link-Viruses  because of File-protection-mark!",10
 dc.b "-f  do not use  S:NoWarning, S:VirusName!",10
 dc.b "-c  insert disk -> no green color-signal!",10
 dc.b "-t  start -> do not check inserted disks!",10
 dc.b "-o  control   Open(file)   by  requester!",10
 dc.b "contacts    and    comments    welcomed !",10
MeldungEnde: even
MeldungDanger:
 dc.b $9b,"33mVIRUS-CONTROL V1.3 by P.NIPPGEN  not installed,",10,
 dc.b $9b,"31msince "
vectorchanged: ; vectorchanged-address even, because of .l
 dc.b         "COOL-vector already changed ->  by VIRUS?",10
 dc.b "the only  100% safe method  to remove Virus is:",10
 dc.b "AMIGA OFF, Wait, AMIGA ON, start VIRUS-CONTROL!",10
MeldungDangerEnde: even
Meldungvector: dc.b $9b,"33mKICK   -vector changed -> Virus ?",10,$9b,"31m"
MeldungvectorEnde: even
NoWBStart:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l 0,NoWBStarttext,0
NoWBStarttext:
 dc.b "use CLI, to start VIRUS-CONTROL V1.3 !",0
 even

; do not address absolutely in the real VIRUS-CONTROL-Routine (reset: - end:),
; since this routine is copied to the new, allocated area, therefore there
; are new absolute addresses, you have to address relatively:
; move address(pc),lea(pc),bsr,bra  instead of move address,lea,jsr,jmp
reset:                 ; if reset->if execchecksum correct->cool-vector
 btst    #6,$bfe001    ; cool-vector points to reset:
 bne.s   weiter        ; if left mouse-button is pressed during reset ->
 clr.l   $2e(a6)       ; remove VIRUS-CONTROL.
 rts
weiter:
 movem.l d0-d7/a0-a6,-(sp);
 move.l  pointer(pc),a1
 move.l  #end-reset+9000,d0
 jsr     -204(a6)      ; AllocAbs -> allocate the VIRUS-CONTROL-routine
 tst.l   d0
 bne.s   AllocAbsOkay  ; in COOL-Routine you cannot use Libraries, except
showend:               ; Exec-Library. expansion-ram is not recognized yet.
 bsr     optzeichen    ; Therfore use Chip-memory
 bra.s   showend
AllocAbsOkay:          ; AllocAbs does not fail, since nothing is allocated
 lea     taskflag(pc),a0  ; clear taskflag, resetflag, exitflag, exitcount
 clr.l   (a0)+            ; clear inuse-flags
 clr.l   (a0)             ; clear taskflag, exitcount, inuse-flags satisfies
 bsr     VCrestore        ; set vectors to VIRUS-CONTROL
 bsr     optzeichen       ; green color-signal -> VIRUS-CONTROL still active
 movem.l (sp)+,d0-d7/a0-a6; reset does not change coolvector, execchecksum
 rts

newDOIO:                ; new entry for DOIO-Routine.
 cmp.l   #$400,36(a1)   ; 1024 Bytes - reset
 beq.s   test
 cmp.l   #$200,36(a1)   ; 512 Bytes  - insert Disk, loadwb
 beq.s   test           ; keep code short, which is passed by every DOIO,
 bra     jmpoldDOIO     ; to avoid deadlock
; Code has to be reentrant, because code can be used simultaneously
; for df0:-Df3:. Therfore you cannot use an absolute address to store
; for instance gadgetID or windowpointer, because each task will use this
; only address -> crash. Use unused registers to store. If Task-change,
; these registers are automatically changed too.
; d6 = dfx: to modify requester-text  d7 = Windowpointer, a5 = bootblockbuffer
; d4 = IDCMPclass, d5 LowWord=gadgetID, d5 HiWord= 1Unterschied ausgeben
; the library-functions change d0,d1,(d2,d3),a0,a1 at least. Therfore save
; registers, before using a library-function.
; To keep VIRUS-CONTROL short, text is modified for dfx: before output.
; first forbid(), then modifying, then output, then permit().
; if not -> for instance a task modifies text, taskswitch to another task,
; this task also modifies this text, then correct output, taskswitch to old
; task, and now output of meanwhile incorrect text.
; Modifying of data is not very elegant, but if saves a lot of data.
; Without modifying you need 4*more data-structures ( df0: -df3: )
test:
 movem.l d0-d7/a0-a6,-(sp);
 move.l  $4.w,a6        ; a6 only mostly = exec-base,  DOIO(a5) works
 move.l  20(a1),a0      ; a1 pointer to I/O-request-structure
 move.l  10(a0),a0      ; in 20(a1) address of Device-structure, which starts
 cmp.l   #"trac",(a0)+  ; with a Node-structure, test name
 bne.s   shorter4       ; DOIO-access to Trackdisk.device ?
 cmp.l   #"kdis",(a0)+
 bne.s   shorter4
 cmp.l   #"k.de",(a0)
 bne.s   shorter4
 tst.l   44(a1)         ; from Block 0 ?
 bne.s   shorter4
 cmp.w   #$02,28(a1)    ; reading ?
 beq.s   read3
 cmp.w   #$03,28(a1)    ; writing ? -> requester in bootblockread
shorter4:               ; bne.s shorter4 = 2 byte, bne.l DOIOweiter = 4 byte
 bne     DOIOweiter1
read3:
 move.l  24(a1),a0      ; OpenDevice() enters address of dfx:-MsgPort
 move.b  67(a0),d0      ; in IO_UNIT
 move.b  d0,d6          ; d6 = dfx:
 btst    #1,64(a0)      ; dfx: no disk inserted -> jmp oldDOIO
 bne     shorter4
 lea     inuse0(pc),a0
 ext.w   d6             ; d6(byte)-> Word-> Longword, because of add.l
 ext.l   d6
 add.l   d6,a0
 tst.b   (a0)           ; test dfx:-inuse-Flag
 bne     shorter4       ; if aleady dfx:-WarnWindow jmp oldDOIO
 move.b  #$ff,(a0)      ; set inuse-flag
 lea     exitcount(pc),a0 ; exitcount +1, if work on disk
 addq.b  #1,(a0)
 moveq   #0,d5          ; if -f, do not print intuitext
 bsr     bootblockread  ; read bootblock (tests write-access)
 bsr     nameunknown    ; clear last virusname
 cmp.l   #$400,36(a1)   ; reset->1024->set reset-flag->ignore first 512-DOIO
 beq.s   checkiton
 lea     resetflag(pc),a0
 move.b  (a0),d0        ; ignore first DOIO() 512 Bytes from 0,
 clr.b   (a0)           ; because most dos.library-functions cannot be
 tst.b   d0             ; used yet. for instance Open() -> Task-Held
 bne     DOIOweiter
 cmp.b   #$35,$bfec01   ; right Alt-key pressed ?
 beq     DOIOweiter     ; R-ALT -> no VIRUS-CONTROL-Test
 lea     colorflag(pc),a0
 tst.b   (a0)
 beq.s   nocolor        ; colorflag = 0 -> no green color-signal
 bsr     optzeichen
nocolor:
 cmp.b   #$37,$bfec01   ; left Alt-key pressed ?
 beq     VirusNameFile  ; L-ALT -> always Warn-Window
checkiton:
 move.l  a5,a0          ; bootblockread puts bufferaddress into a5
 cmp.l   #$444f5300,(a0); "DOS",0 ?
 bne     DOIOweiter     ; no DOS-Disk
 bsr     bootchecksum   ; Bootblockchecksum false -> no danger, no boot
 bne     DOIOweiter
 ; it is a DOS-disk + CHECKSUM okay -> disk-Bootroutine will be used,
 ; therefore test if VIRUS-code.
 move.l  a5,a0
 add.l   #12,a0
 cmp.l   #$43fa0018,(a0)+ ; (a0)+ shorter than for instance 12(a0)
 bne.s   testreset      ;
 cmp.l   #$4eaeffa0,(a0)+ ; is it harmless standard-boot-code ?
 bne.s   testreset
 cmp.l   #$4a80670a,(a0)+
 bne.s   testreset
 cmp.l   #$20402068,(a0)+
 bne.s   testreset
 cmp.l   #$00167000,(a0)+
 bne.s   testreset
 cmp.l   #$4e7570ff,(a0)+
 bne.s   testreset
 cmp.l   #$60fa646f,(a0)
testreset:
 jsr     -528(a6)        ; getcc() -> 68010,20 compatible
 move.w  d0,-(sp)        ; save flags, beq=no virus  bne=virus
 cmp.l   #$400,36(a1)    ; 1024 Bytes=reset. insert Disk + loadwb = 512
 bne     nobootroutine
 move.l  62(sp),a0       ; test RTS-address, if ROM-call-DOIO.
 cmp.l   #$00fc0000,a0   ; in ROM only 1*DOIO with $400 -> in boot-routine.
 blo     nobootroutine   ; a program could jmp DOIO with an ROM-address
 cmp.w   #$4a80,(a0)     ; on stack by accident, therfore make sure, if it
 bne     nobootroutine   ; is reset-boot-routine really, by comparing code.
 cmp.l   #$2014b0ba,4(a0); Do not use a direct ROM-address, because this would
 bne     nobootroutine   ; not work with future ROM-versions.
 ; here in boot-routine you can use all libraries, except dos.library,
 ; because dos.library is prepared by bootblock-code.
 ; since 'system-configuration' is not read yet, Standard-Font is Topaz 9 ->
 ; 60 characters in a line.
 lea     resetflag(pc),a3
 move.b  #$ff,(a3)      ; set resetflag -> ignore 1*512-Bytes-DOIO
 cmp.w   #$100,$dff016  ; right mouse-button pressed ?
 bne.s   memokay
fastaway:
 move.l  #$20004,d1     ; get largest-Fastmem-area
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -216(a6)       ; availmem()
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0
 beq.s   memokay
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -198(a6)       ; allocate this area
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0
 bne.s   fastaway
memokay:
 move.w  (sp)+,ccr
 beq.s   bootsimul      ; faster than read again
 movem.l a0-a3,-(sp)    ; save a0, because of modifyunit, save a1,a2,a3
 jsr     -132(a6)       ; because of Requester-parameter
 bsr     modifyunit
 lea     NOBOOTtext(pc),a0
 clr.b   26(a0)         ; shorten 'String'
 lea     BOOT(pc) ,a1
 lea     BOOTL(pc),a2
 lea     BOOTR(pc),a3
 bsr     autorequest
 move.b  #" ",26(a0)    ; restore 'String', will be used in Warn-Window
 jsr     -138(a6)
 movem.l (sp)+,a0-a3    ; true  1  retry  = left  Gadget
 tst.l   d0             ; false 0  cancel = right Gadget
 beq.s   bootsimul      ; left -> Boot-simulation
 movem.l a0-a3,-(sp)
 jsr     -132(a6)
 bsr     modifyunit
 lea     REALLYBOOT(pc),a1
 lea     BOOTL(pc),a2
 lea     BOOTR(pc),a3   ; really Original-Disk-Boot-Routine ?
 bsr     autorequest    ; Danger -> can activate viruses !
 jsr     -138(a6)
 movem.l (sp)+,a0-a3
 tst.l   d0
 beq.s   bootsimul
 movem.l d0-d7/a0-a6,-(sp); in boot-routine dos.library cannot be used yet,
 bsr     settimer         ; you have to use timer.device directly instead of
 bsr     wait1            ; Delay(). wait for 2 sec., in this time, Screen,
 bsr     wait1            ; Window-lists can be updated .....This waiting is
 bsr     remreqport       ; needed only for a few dirty programmed BootIntros.
 bsr     addtask
 movem.l (sp)+,d0-d7/a0-a6
 bra     DOIOweiter ; read and execute original-bootcode->could activate Virus!

bootsimul:
 bsr     addtask
 move.l  40(a1),a0
 move.l  a0,a2
 bsr     clear1024
 lea     bootblock(pc),a0
 moveq   #bootblockend-bootblock-1,d0
loop6:
 move.b  (a0)+,(a2)+
 dbra    d0,loop6
 bsr     clearflags
 movem.l (sp)+,d0-d7/a0-a6
 moveq   #$0,d0 ; rts to ROM with d0=0 -> DOIO okay
 rts     ; instead of jmp oldDOIO (reads original-bootcode in buffer),
         ; copy harmless bootcode in buffer, rts to ROM (execute code)
nobootroutine:
 move.w  (sp)+,ccr
 beq     DOIOweiter        ; no Virus
 lea     searchfiles(pc),a0
 tst.b   (a0)              ; do not search S:NoWarning, S:VirusName,
 beq     openwindow        ; if searchfiles = 0
 ; if Bootblock is saved in S:NoWarning-File -> only red signal
 movem.l d0-d7/a0-a6,-(sp)
 bsr     OpenDOS           ; OpenLibrary("dos.library",0);
 lea     NoWarning(pc),a0
 move.l  a0,d1             ; Filename
 move.l  #1004,d2          ; MODE_READWRITE, to open existing S:NoWarning-File
 bsr     checkdevicename   ; EXCLUSIVE_LOCK, because multiple use could produce
 tst.l   d0                ; wrong data.
 beq     NoWarnError
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -30(a6)
 movem.l (sp)+,d1-d7/a0-a6 ; OpenError, for instance if not existing
 tst.l   d0                ; or EXCLUSIVE_LOCK by other process.
 beq     NoWarnError
 move.l  d0,d1             ; filehandle
nextbootblock:
 move.l  a5,a2
 lea     Nobuff(pc),a0
 move.l  a0,d2             ; use vector-control-Task-Stack-bottom
 move.l  #1024,d3          ; as 1024-buffer
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -42(a6)           ; read first Bootblock from S:NoWarning
 movem.l (sp)+,d1-d7/a0-a6
 cmp.l   #1024,d0          ; no more Bootblock -> end of file
 bne.s   fileende
 move.w  #$ff,d0
NoWarningloop:
 cmpm.l  (a0)+,(a2)+
 bne.s   nextbootblock
 dbra    d0,NoWarningloop
 bsr     CloseFile         ; 1024 Bytes identical -> found !
 move.l  #$0f000f00,d0     ; found -> red signal
 bsr     optzeichen2
 movem.l (sp)+,d0-d7/a0-a6
 bra     DOIOweiter
fileende:                  ; not found !
 bsr     CloseFile         ; Close File + Close dos.library
 bra.s   allclosed
NoWarnError:
 bsr     CloseDOS          ; Close dos.library
allclosed:
 movem.l (sp)+,d0-d7/a0-a6

VirusNameFile:
 ; before opening Warn-Window, test, if Bootblock saved in VirusName-File,
 ; if found -> use this name
 lea     searchfiles(pc),a0
 tst.b   (a0)              ; if -f ignore S:VirusName, even if L-ALT pressed
 beq     openwindow
 movem.l d0-d7/a0-a6,-(sp)
 bsr     nameunknown       ; default
 bsr     OpenDOS           ; OpenLibrary("dos.library",0);
 lea     VirusName(pc),a0
 move.l  a0,d1             ; Filename-address
 move.l  #1004,d2          ; MODE_READWRITE, to open existing S:NoWarning-File
 bsr     checkdevicename   ; EXCLUSIVE_LOCK, because multiple use could produce
 tst.l   d0                ; wrong data.
 beq     OpenFailed
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -30(a6)
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0                ; OpenError, for instance if not existing
 beq     OpenFailed        ; or EXCLUSIVE_LOCK by other process.
 move.l  d0,d1             ; filehandle
nextbootblock1:
 clr.b   20(sp)               ; movem -> 20(sp)=d5, (GadgetID now not used)
 lea     Vibuff(pc),a0
 move.l  a0,d2                ; use vector-control-Task-Stack-bottom
 move.l  #1024+buff1-buff0,d3 ; as 1024+32-buffer
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -42(a6)              ; read 1 Virusname+Bootblock from S:VirusName
 movem.l (sp)+,d1-d7/a0-a6
 cmp.l   #1024+buff1-buff0,d0
 bne.s   fileende1            ; end of file
 lea     NAME0text(pc),a2
 moveq   #buff1-buff0+20,d0   ; copy Virusname into corresponding Intuitext-
 mulu    d6,d0                ; structure, will be printeted in Warn-Window
 add.l   d0,a2
 bsr     copyname
 move.w  #$ff,d0
 move.l  a5,a2
VirusNameloop:
 cmpm.l  (a0)+,(a2)+
 beq.s   issame
 cmp.l   #"FREE",-4(a0)
 beq.s   nextbootblock1
 tst.b   20(sp)
 bne.s   nextbootblock1
countit:                   ; accept 1 Longword-difference (infection-counter)
 move.b  #$ff,20(sp)       ; 1 Longword-difference-flag
issame:
 dbra    d0,VirusNameloop  ; 1024 Bytes identical -> found !
 bra.s   CloseFileDOS
fileende1:                 ; not found !
 bsr     nameunknown
CloseFileDOS:
 bsr     CloseFile         ; Close File + Close dos.library
 bra.s   allclosed1
OpenFailed:
 bsr     CloseDOS          ; Close dos.library
allclosed1:
 movem.l (sp)+,d0-d7/a0-a6
 bra     openwindow

Checksumfalsch:
 move.l  24(a1),a0      ; write false Bootblock-Checksum -> inactivates
 btst    #4,64(a0)      ; Bootblock-Virus, because of no more Boot.
 ; first check write-protection. OpenDevice() entered address of dfx:-MsgPort
 ; in IO_UNIT. MsgPort byte 64: if Bit 4 is set -> Disk is write-protected.
 beq.s   noprotect
 bsr.s   writeprotected ; write-protected -> Requester
 bne.s   Checksumfalsch ; retry
 rts
noprotect:
 bsr     setchecksum    ; get correct Bootblockchecksum
 addq.l  #1,4(a0)       ; -> no more correct
writecheck:
 bra     bootblockwrite ; write incorrect checksum -> no more boot

Checksumrichtig:
 move.l  24(a1),a0
 btst    #4,64(a0)
 beq.s   noprotect1
 bsr.s   writeprotected
 bne.s   Checksumrichtig
 rts
noprotect1:
 bsr     setchecksum    ; get correct Bootblockchecksum
 bra.s   writecheck

writeprotected:         ; write-protected-requester
 movem.l a0-a3,-(sp)
 jsr     -132(a6)
 bsr     modifyunit
 lea     PROTECT(pc) ,a1
 lea     PROTECTL(pc),a2
 lea     NOBOOTR(pc) ,a3
 bra     shorter2

showbootblock:             ; if a4(=Filename) = RAW: -> Bootblock-ASCII-Dump
 movem.l d0-d7/a0-a6,-(sp) ; else save to file
 jsr     -132(a6)
 bsr     modifyunit
 bsr     OpenDOS           ; OpenLibrary("dos.library",0);
 move.l  a4,d1             ; showbootblock is called with a4=filename
 move.l  #1006,d2          ; newmode
 bsr     checkdevicename
 tst.l   d0
 bne.s   deviceokay
 movem.l d1-d7/a0-a6,-(sp)
 bra.s   deviceunknown
deviceokay:
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -30(a6)           ; Open() (if RAW:-Window -> modified title-line)
deviceunknown:
 move.l  $4.w,a6
 jsr     -138(a6)
 movem.l (sp)+,d1-d7/a0-a6 ; DOIO->writeprotect->own requester
 tst.l   d0                ; DOSfunctions->writeprotect->AmigaDOSAutorequester
 bne.s   NoErrorShow       ; OpenError(wrong filename)->own requester
 bsr     openerror
 bra     OpenFailed
NoErrorShow:
 move.l  d0,d1             ; filehandle
 bsr     WriteInFile
 cmp.l   #"RAW:",(a4)
 bne     CloseFileDOS
 lea     unit2(pc),a0      ; you can use unit2 as read-buffer, because
 move.l  a0,d2             ; it will be restored
 moveq   #1,d3             ; get 1 character
 movem.l d0-d7/a0-a6,-(sp)
 jsr     -42(a6)           ; Read  RAW:  waits for key
 movem.l (sp)+,d0-d7/a0-a6
 bsr     CloseFile
 movem.l (sp)+,d0-d7/a0-a6; restore a1-IORequest
 bsr     bootblockread    ; because ASCII-dump changed Bootblock-data
 bra     openwindow

autorequest:              ; call with a6=exec.base
 movem.l d1-d7/a0-a6,-(sp)
 movem.l a1-a3,-(sp)      ; maintext, left text, right text
 bsr     OpenIntuition
 jsr     -342(a6)         ; WBenchToFront() -> like an AmigaDOS-Autorequester
 sub.l   a0,a0            ; 2 Bytes, move.l #0,a3 needs 6 Bytes
 movem.l (sp)+,a1-a3      ; maintext, left text, right text
 moveq   #0,d0            ; no IDCMP-Flags for left Gadget
 moveq   #0,d1            ; no IDCMP-Flags for right Gadget
 move.l  #640,d2          ; Autorequester-width
 moveq   #100,d3          ; Autorequester-height
 jsr     -348(a6)         ; AutoRequest()
 move.l  a6,a1            ; intuitionbase
 move.l  $4.w,a6
 move.l  d0,-(sp)         ; save BOOL
 jsr     -414(a6)         ; CloseLibrary("intuition.library");
 move.l  (sp)+,d0         ; BOOL
 movem.l (sp)+,d1-d7/a0-a6; movem does not overwrite d0
 rts

optzeichen:
 move.l  #$00f000f0,d0 ; green green -> VirusControl okay
optZeichen2:           ; color in d0
 movem.l d0-d7/a0-a6,-(sp)
 move.l  $4.w,a6       ; Disable() -> color-registers are permanently set
 jsr     -120(a6)      ; -> Copperlist has no effect
 move.w  #40,d1        ; use vertical beam-position as 'Timer'
red:                   ; -> can be used in cool-routine already and same delay
 move.b  $dff005,d2    ; for any processors
waittick:
 move.l  d0,$dff180
 move.l  d0,$dff184    ; overwrite 4 Workbench-colors
 cmp.b   $dff005,d2
 beq.s   waittick
 dbra    d1,red
 jsr     -126(a6)      ; Enable()
 movem.l (sp)+,d0-d7/a0-a6
 rts
                       ; a6=exec.base, a1=IO-Request
bootblockread:         ; changes a0,d0, a5
 moveq   #0,d0         ; if write-access -> requester
bb:
 move.l  36(a1),-(sp)  ; save original-number of bytes
 move.l  40(a1),-(sp)  ; save original-buffer
 tst.l   d0
 bne.s   readaccess    ; do write-access without requester
 cmp.w   #$02,28(a1)   ; read-access ?
 beq.s   readaccess
 bsr     writebbzugriff
 bne.s   changetoread
 add.l   #12,sp        ; correct Stack
 bra     DOIOweiter    ; write-access -> oldDOIO-routine
changetoread:
 move.w  #$02,28(a1)   ; change to harmless read-access
readaccess:
 lea     bootblock0(pc),a0
 move.l  #bootblock1-bootblock0,d0
 mulu    d6,d0
 add.l   d0,a0
 move.l  a0,a5         ; a5 = bootblockbuffer for dfx:
 move.l  a0,40(a1)
 move.l  #1024,36(a1)  ; 1024 -> read total Bootblock
 movem.l d1-d7/a0-a6,-(sp)
 bsr     jmpoldDOIO
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0
 beq.s   bootblockreadokay
 bsr     openerror
bootblockreadokay:
 move.l  (sp)+,40(a1)  ; restore original-buffer
 move.l  (sp)+,36(a1)  ; restore original-number of bytes
 rts

bootblockwrite:        ; a6=exec.base, a1=IO-Request
 move.l  24(a1),a0     ; changes a0,d0, a5
 btst    #4,64(a0)
 beq.s   noprotect3
 bsr     writeprotected; if Disk writeprotected or removed
 bne.s   bootblockwrite
 rts
noprotect3:
 moveq   #-1,d0        ; write without requester
 move.w  #3,28(a1)     ; 3 = CMD_WRITE
 bsr     bb
 move.w  #2,28(a1)     ; 2 = CMD_READ
 rts
; Before writing to disk by DOIO, you have to check if write-protected.
; If you write to disk by dos.library-functions, then there are AmigaDos-
; autorequesters automatically.

bootchecksum:          ; a0=address of bootblockbuffer
 move.w  #$ff,d1       ; changes a0, d0,d1
 moveq   #$0,d0        ; rts with d0=bootblockchecksum
loop:
 add.l   (a0)+,d0
 bcc.s   jump
 addq.l  #1,d0
jump:
 dbra d1,loop
 not.l   d0
 rts

setchecksum:
 move.l  a5,a0
 clr.l   4(a0)         ; clear old Bootblockchecksum
 bsr.s   bootchecksum  ; calc new, correct Bootblockchecksum
 move.l  a5,a0
 move.l  d0,4(a0)      ; set correct Bootblockchecksum
 rts

WriteInFile:           ; changes a0, d0,d1,d2,d3
 move.l  a5,d2         ; d2 = address of write-buffer
 move.l  #1024,d3      ; d3 = number of write-bytes
 move.w  #1023,d0      ; 1024-1 counter for dbra
 move.l  d2,a0
modifybuffer:
 cmp.l   #"RAW:",(a4)  ; if filename starts with "RAW:" -> prepare data
 bne.s   writeokay     ; for ASCII-dump
 cmp.b   #$20,(a0)
 blo.s   writedefault
 cmp.b   #127,(a0)
 blo.s   writeokay
writedefault:          ; if byte < 32  or byte > 126 -> show  .
 move.b  #".",(a0)
writeokay:
 addq.l  #1,a0
 dbra    d0,modifybuffer
 movem.l d0-d7/a0-a6,-(sp)
 jsr     -48(a6)       ; Write
 movem.l (sp)+,d0-d7/a0-a6
 rts

modifyunit:            ; modifies output-text for dfx:
 move.b  d6,d0         ; d6=dfx:
 add.b   #48,d0
 lea     unit0(pc),a0
 move.b  d0,(a0)
 lea     unit1(pc),a0
 move.b  d0,(a0)
 lea     unit2(pc),a0
 move.b  d0,(a0)
 lea     unit3(pc),a0
 move.b  d0,(a0)
 lea     unit4(pc),a0
 move.b  d0,(a0)
 lea     unit5(pc),a0
 move.b  d0,(a0)
 lea     unit6(pc),a0
 move.b  d0,(a0)
 lea     unit7(pc),a0
 move.b  d0,(a0)
 lea     unit8(pc),a0
 move.b  d0,(a0)
 rts

DOIOweiter:
 bsr     clearflags
DOIOweiter1:
 movem.l (sp)+,d0-d7/a0-a6
jmpoldDOIO: dc.w $4ef9 ; Opcode for jmp
oldDOIO:    dc.l 0     ; address of Original-DOIO-Routine

bootblock:             ; harmless Original-Bootblock for Boot-Simulation
 dc.b    "DOS",0       ; if you change Bootblock, you have to correct
 dc.l    $c0200f19     ; Bootblock-Checksum
 dc.l    $00000370
 lea     dosname(pc),a1
 jsr     -96(a6)
 tst.l   d0
 beq.s   error
 move.l  d0,a0
 move.l  22(a0),a0
returncode:
 moveq   #0,d0
ende0:
 rts
error:
 moveq   #-1,d0
 bra.s ende0
dosname: dc.b "dos.library",0
bootblockend: even

nofastbootblock:       ; NoFastMem-Bootblock
 dc.b    "DOS",0
 dc.l    $aadce5ec
 dc.l    $00000370
 movem.l d0-d7/a0-a6,-(sp)
 btst    #6,$bfe001
 beq.s   memokay1      ; if you press left mouse-button during reset
fastaway1:             ; -> no NoFastMem
 move.l  #$20004,d1
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -216(a6)      ; availmem()
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0
 beq.s   optzeichen1
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -198(a6)      ; allocmem()
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0
 bne.s   fastaway1
optZeichen1:           ; NoFastMem -> blue color-signal
 jsr     -132(a6)      ; Forbid() -> color-registers are permanently set
 move.l  #$000f000f,d0 ; -> Copperlist has no effect
 move.w  #40,d1
farbe:
 move.b  $dff005,d2
waittick1:
 move.l  d0,$dff180
 move.l  d0,$dff184    ; overwrite 4 Workbench-colors
 cmp.b   $dff005,d2
 beq.s   waittick1
 dbra    d1,farbe
 jsr     -138(a6)      ; Permit()
memokay1:
 movem.l (sp)+,d0-d7/a0-a6
 lea     dosname1(pc),a1; now the real Standard-Bootblock
 jsr     -96(a6)
 tst.l   d0
 beq.s   error1
 move.l  d0,a0
 move.l  22(a0),a0
 moveq   #0,d0
ende1:
 rts
error1:
 moveq   #-1,d0
 bra.s   ende1
dosname1:dc.b "dos.library",0
 even
taskname:dc.b " VIRUS-CONTROL V1.3 by PIUS NIPPGEN, D-6657 Gersheim 8,"
         dc.b " 06843/1522",0
; operating instructions
dc.b "automatically switching off FASTMEM can be prevented by pressing "
dc.b "left mouse-button during reset"
nofastbootblockend: even

openfile:
 cmp.b   #$39,$bfec01   ; CTRL-Taste ?
 beq.s   jmpoldopen     ; -> Original-Open()
 movem.l a0-a1,-(sp)
 move.l  d1,a0
 cmp.b   #"*",(a0)      ; ignore Open("*")
 movem.l (sp)+,a0-a1
 beq.s   jmpoldopen
 movem.l d1-d7/a0-a6,-(sp)
 moveq   #-2,d2         ; ACCESS_READ
 move.l  dosbase(pc),a6 ; because a5=dos.base works too
 jsr     -84(a6)        ; Lock() ( RAW:Window->for a short time RAW:Window)
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0
 beq.s   jmpoldopen     ; file not existing -> no danger
 movem.l d1-d7/a0-a6,-(sp)
 move.l  d0,d1
 move.l  dosbase(pc),a6 ; because a5=dos.base works too
 jsr     -90(a6)        ; Unlock()
 movem.l (sp)+,d1-d7/a0-a6
 movem.l d1-d7/a0-a6,-(sp)
 lea     opencount(pc),a0
 addq.b  #1,(a0)
 bsr     allowaccess    ; wait for mouse-click
 subq.b  #1,(a0)        ; VIRUS-CONTROL can be finished, if opencount=0
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0
 bne.s   jmpoldopen
 bra     returncode

jmpoldopen: dc.w 0     ; will be copied 'moveq #$ff,d1'
jmp:        dc.w $4ef9 ; Opcode for jmp
oldopen:    dc.l 0     ; address of Original-Open-Routine
savebra:    dc.l 0     ; save Original bra offset

; SYSTEM-VECTOR-CONTROL-TASK.
; dos.library-functions can be used by processes only.
; Therefore use timer.device for waiting, instead of Delay()
task:
 move.l  $4.w,a6
 bsr     settimer          ; prepare timer.device
 lea     taskflag(pc),a0   ; if CLI-Start do not wait
 tst.b   (a0)              ; after Reset wait for a few seconds until
 bne.s   ttt               ; WorkBenchScreen is open. If you do not wait
 move.l  #10,32(a1)        ; for WorkBenchScreen -> a StandardScreen is
 bsr     wait              ; opened, if there is an autorequester for a
ttt:                       ; changed vector. Because of this StandardScreen
 bsr     opendos           ; 'system-configuration' will not be used completely
 lea     dosbase(pc),a0    ; for instance width>640, Interlace is ignored.
 move.l  d0,(a0)           ; also there has to be waiting, because dos.library
taskweiter:                ; has to be installed (boot-code) before calling
 lea     openflag(pc),a0   ; opendos
 tst.b   (a0)              ; openflag can be set by -o  or Window-Gadget
 bne.s   tt
 move.l  dosbase(pc),a6    ;
 cmp.w   #$4ef9,-30(a6)
 beq.s   tt                ; already set to VIRUS-CONTROL
 lea     jmpoldopen(pc),a0
 move.w  -30(a6),(a0)      ; moveq #$ff,d1
 lea     -26(a6),a4        ; turn relative address to
 add.w   -26(a6),a4        ; absolute address
 move.l  a4,4(a0)
 move.l  -28(a6),8(a0)
 move.l  $4.w,a4
 exg     a4,a6
 jsr     -120(a6)          ; Disable(), because theoretically task-switch
 exg     a4,a6             ; after 1 instruction
 lea     openfile(pc),a0
 move.w  #$4ef9,-30(a6)    ; set Open() to VIRUS-CONTROL
 move.l  a0,-28(a6)
 exg     a4,a6
 jsr     -126(a6)          ; Enable()
tt:
 move.l  $4.w,a6
 lea     openflag(pc),a0   ; openflag can be set by -o  or Window-Gadget
 tst.b   (a0)
 beq.s   tttt
 bsr     restoreopen       ; restore Open()
tttt:
 bsr     wait1             ; wait for 1 sec
 lea     exitflag(pc),a0   ; is VIRUS-CONTROL to be finished
 tst.b   (a0)
 beq.s   noexitflag
 clr.l   $2e(a6)           ; next reset will no more activate VIRUSCONTROL
 move.l  oldDOIO(pc),-454(a6) ; restore DOIO-vector -> no more disk-check
 bsr     restoreopen       ; restore Open()
 lea     exitcount(pc),a0
 tst.b   (a0)              ; Warn-Window on screen ?
 bne.s   tttt              ; wait for no Warn-Window
 lea     opencount(pc),a0  ; Open()-Requester on screen ?
 tst.b   (a0)              ; wait for no requester
 bne.s   tttt              ; because Warn-Window, Requester use programcode.
 move.l  #5,32(a1)         ; before freemem wait for 5 sec. -> time for all
 bsr     wait              ; routines, which use this memory, to come to an end
 bsr     remreqport        ; closedevice + remport
 bra     freemem           ; freemem + rts->EndTask
noexitflag:
 move.l  BeginIOAdr(pc),a0
 lea     lastBeginIO(pc),a1
 tst.l   (a1)
 bne.s   alreadyset
 move.l  (a0),(a1)+        ; actual BeginIO-vector -> lastBeginIO
 move.l  (a0),(a1)         ; actual BeginIO-vector -> restoreIO
alreadyset:
 cmp.l   #$00fc0000,(a0)   ; if BeginIO points to ROM (z.B. nach Reset),
 bhs.s   restoreIOROM      ; then use it for restoreIO
 move.l  lastBeginIO(pc),a2
 lea     lastBeginIO(pc),a3
 move.l  (a0),(a3)         ; save actual vector for next comparison
 cmp.l   (a0),a2           ; BeginIO-vector has been changed in last second ?
 beq.s   testKICK1         ; not changed
 lea     vector0text(pc),a0; changed -> Warn-Requester
 move.l  #"Begi",(a0)+
 move.l  #"nIO-",(a0)      ; modify Warn-Text for BeginIO-vector
 bsr     vectoropenwindow
 bra     taskweiter
restoreIOROM:              ; Original-BeginIO-vector is needed in deletevirus-
 lea     restoreIO(pc),a1  ; routine. BeginIO-vector-Handling is somewhat
 move.l  (a0),(a1)         ; complex to be ROM-version-compatible
 move.l  (a0),-4(a1)
testKICK1:
 tst.l   546(a6)           ; if Kick-vector is changed to 0 -> okay
 bne.s   testKICK2
 tst.l   550(a6)
 bne.s   testKICK2
 tst.l   554(a6)
 beq.s   testCool1
testKICK2:
 move.l  546(a6),a0
 move.l  lastKickMem(pc),a2
 lea     lastKickMem(pc),a3
 move.l  a0,(a3)           ; save actual vector for next comparison
 cmp.l   a0,a2             ; KickMemPtr has been changed in last second ?
 bne.s   kickchanged1
 move.l  550(a6),a0
 move.l  lastKickTag(pc),a2
 lea     lastKickTag(pc),a3
 move.l  a0,(a3)           ; save actual vector for next comparison
 cmp.l   a0,a2             ; KickTagPtr has been changed in last second ?
 bne.s   kickchanged1
 move.l  554(a6),a0
 move.l  lastKickCheck(pc),a2
 lea     lastKickCheck(pc),a3
 move.l  a0,(a3)           ; save actual KickcheckSum for next comparison
 cmp.l   a0,a2             ; KickCheckSum has been changed in last second ?
 beq.s   testcool1
kickchanged1:
 lea     vector0text(pc),a0
 move.l  #"KICK",(a0)+
 move.l  #" -  ",(a0)
 bsr.s   vectoropenwindow
 bra     taskweiter
testcool1:
 move.l  pointer(pc),a2    ; a2 = VIRUS-CONTROL-address
 move.l  46(a6),a0
 cmp.l   a0,a2             ; COOL-vector points to VIRUS-CONTROL ?
 beq.s   testDOIO1
 move.l  lastCOOL(pc),a2
 lea     lastCOOL(pc),a3
 move.l  a0,(a3)
 cmp.l   a0,a2             ; COOL-vector has been changed in last second ?
 beq.s   testDOIO1
 lea     vector0text(pc),a0
 move.l  #"COOL",(a0)+
 move.l  #" -  ",(a0)
 bsr.s   vectoropenwindow
 bra     taskweiter
testDOIO1:
 lea     newDOIO(pc),a2
 move.l  -454(a6),a0
 cmp.l   a0,a2             ; DOIO-vector points to my (newDOIO-)routine ?
 beq     taskweiter
 move.l  lastDOIO(pc),a2
 lea     lastDOIO(pc),a3
 move.l  a0,(a3)
 cmp.l   a0,a2             ; DOIO-vector has been changed in last second ?
 beq     taskweiter
 lea     vector0text(pc),a0
 move.l  #"DOIO",(a0)+
 move.l  #" -  ",(a0)
 bsr.s   vectoropenwindow
 bra     taskweiter

; BeginIO-vector, KICK-vector, COOL-vector or DOIO-vector has been changed
; -> Warn-Requester, changed by a VIRUS ??
; the best and simplest method to get rid of a virus is to switch Amiga off
vectoropenwindow:
 lea     vector0(pc),a1
kill:
 lea     vectorL(pc),a2
 lea     NOBOOTR(pc),a3
 bsr     autorequest
 tst.l   d0
 beq.s   vectortested
 bsr     deletevirus       ; kill Virus
vectortested:
 rts

wait1:
 lea     timereq(pc),a1
 move.l  #1,32(a1)         ; wait for 1 sec.
wait:
 move.w  #9,28(a1)
 jmp     -456(a6)

openwindow:
 movem.l d1-d7/a0-a6,-(sp) ; save a1=IO-Request
nopush:
 move.l  $4.w,a6          ; Forbid() -> set corresponding string-gadget and
 jsr     -132(a6)         ;             modify information-gadget
 bsr     OpenIntuition
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -342(a6)         ; WBenchToFront()
 movem.l (sp)+,d1-d7/a0-a6
 lea     window(pc),a2
 tst.b   d6
 bne.s   test1
 lea     gad90(pc),a1   ; for df0: corresponding Stringgadget
 move.l  a1,18(a2)      ; with its own buffer
test1:
 cmp.b   #1,d6
 bne.s   test2
 lea     gad91(pc),a1   ; for df1: corresponding Stringgadget
 move.l  a1,18(a2)      ; with its own buffer
test2:
 cmp.b   #2,d6
 bne.s   test3
 lea     gad92(pc),a1   ; for df2: corresponding Stringgadget
 move.l  a1,18(a2)      ; with its own buffer
test3:
 cmp.b   #3,d6
 bne.s   testende
 lea     gad93(pc),a1   ; for df3: corresponding Stringgadget
 move.l  a1,18(a2)      ; with its own buffer
testende:
 move.l  34(a1),a4      ; address of StringInfo
 move.l  (a4),a4        ; a4 = address of buffer(=Filename)
 bsr     modifyunit     ; modify information-gadget-text
 lea     window(pc),a0
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -204(a6)       ; OpenWindow() (with Gadgets)
 movem.l (sp)+,d1-d7/a0-a6
 move.l  d0,d7          ; d7 =  Windowpointer
 bne.s   openok
 moveq   #0,d0          ; no more memory for Warn-Window,
 bsr     optzeichen2    ; therefore black color-signal for suspected disk
 bra     openwindowerror
openok:
 move.l  d7,a0
 move.l  50(a0),a0      ; RastPort of Window
 lea     NAME0(pc),a1   ; set virusname
 moveq   #buff1-buff0+20,d0
 mulu    d6,d0
 add.l   d0,a1
 moveq   #38,d0         ; x
 moveq   #40,d1         ; y
 movem.l d0-d7/a0-a6,-(sp)
 jsr     -216(a6)       ; PrintIText
 movem.l (sp)+,d0-d7/a0-a6
 movem.l d0-d7/a0-a6,-(sp)
 btst    #31,d5         ; test any bit out of 24-31, for instance bit 31
 beq.s   noonediff      ; GadgetID only uses bit 0-15
 movem.l (sp)+,d0-d7/a0-a6
 moveq   #56,d1         ; y
 lea     ONEDIFF(pc),a1
 movem.l d0-d7/a0-a6,-(sp)
 jsr     -216(a6)       ; PrintIText
noonediff:
 move.l  $4.w,a6
 jsr     -138(a6)       ; Permit()
 movem.l (sp)+,d0-d7/a0-a6
 move.l  a6,-(sp)       ; save intuitionbase
 move.l  $4.w,a6
waitmessage:
 move.l  d7,a0
 move.l  86(a0),a0      ; UserPort of Window
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -384(a6)       ; WaitPort(UserPort)
 movem.l (sp)+,d1-d7/a0-a6
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -372(a6)       ; GetMsg(UserPort)
 movem.l (sp)+,d1-d7/a0-a6
 move.l  d0,a0
 move.l  d0,a1          ; ReplyMsg needs message in a1
 move.l  20(a0),d4      ; d4 = Class = IDCMP-Flags
 cmp.l   #$200,d4       ; if you click a system-gadget, Intuition-Objekt-
 beq.s   closegadget    ; address is not set, by accident there can be an odd
 move.l  28(a0),a0      ; address -> if move.w -> TaskHeld
 move.w  38(a0),d5      ; therfore test if close-gadget
closegadget:
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -378(a6)       ; ReplyMsg(a1=intuimessage), after getting GadgetID
 movem.l (sp)+,d1-d7/a0-a6
 cmp.w   #9,d5          ; stringgadget -> wait on
 beq.s   itis9          ; information-gadget -> wait on
 cmp.w   #10,d5
 bne.s   portleeren
itis9:
 clr.w   d5
 bra.s   waitmessage
portleeren:
 move.l  d7,a0
 move.l  86(a0),a0      ; UserPort of Window
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -372(a6)       ; GetMsg(UserPort)
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0
 beq.s   leerende
 move.l  d0,a1
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -378(a6)       ; ReplyMsg(a1=intuimessage)
 movem.l (sp)+,d1-d7/a0-a6
 bra.s   portleeren
leerende:
 move.l  (sp)+,a6
 move.l  d7,a0
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -72(a6)        ; CloseWindow()
 movem.l (sp)+,d1-d7/a0-a6
 move.l  a6,a1
 move.l  $4.w,a6
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -414(a6)       ; CloseLibrary("intuition.library")
 movem.l (sp)+,d1-d7/a0-a6

 cmp.l   #$200,d4       ; CloseWindow-Gadget -> end
 bne.s   testgad0
openwindowerror:
 movem.l (sp)+,d1-d7/a0-a6
 bra     DOIOweiter

; closewindow breaks loop
testgad0:
 tst.w   d5
 bne.s   testgad1          ; colorsignal
 jsr     -132(a6)
 lea     colorflag(pc),a0
 not.b   (a0)
 lea     gadtext0text(pc),a1
 move.l  #"OFF ",14(a1)
 tst.b   (a0)
 beq.s   aus
 move.l  #" ON ",14(a1)
aus:
 jsr     -138(a6)
 bra     nopush
testgad1:                  ; Bootblock -> Screen
 cmp.w   #1,d5
 bne.s   testgad2
 movem.l (sp)+,d1-d7/a0-a6 ; a1=IORequest
 lea     filename(pc),a4
 bra     showbootblock

testgad2:
 cmp.w   #2,d5
 bne.s   testgad3          ; Bootblock -> File
 move.l  a4,d0             ; movem overwrites a4
 movem.l (sp)+,d1-d7/a0-a6 ; a1=IORequest
 move.l  d0,a4
 bsr     namecorrect
 beq     openwindow
 bra     showbootblock

testgad3:
 cmp.w   #3,d5
 bne     testgad4          ; File -> Bootblock
 move.l  a4,d0             ; movem overwrites a4
 movem.l (sp)+,d1-d7/a0-a6 ; a1=IORequest
 move.l  d0,a4
 bsr     namecorrect
 beq     openwindow
 bsr     reallyoverwrite
 beq     openwindow
 movem.l d0-d7/a0-a6,-(sp)
 bsr     OpenDOS           ; OpenLibrary("dos.library",0);
 move.l  a4,d1             ; d1=Filename-address
 move.l  #1004,d2          ; MODE_READWRITE to open existing file,
 bsr     checkdevicename   ; EXCLUSIVE_LOCK, because multiple use could produce
 tst.l   d0                ; wrong data
 beq.s   deviceunknown1
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -30(a6)
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0                ; Device write-protected
 bne.s   noErrorFile       ; -> AmigaDOS-Autorequester
deviceunknown1:
 bsr     openerror         ; OpenError, for instance if not existing
 bra     OpenFailed        ; or EXCLUSIVE_LOCK by other process
noErrorFile:               ; -> own requester
 move.l  d0,d1             ; filehandle
 move.l  a5,d2             ; d2 = read-buffer
 move.l  #1024,d3          ; d3 = number of read-data
 movem.l d0-d7/a0-a6,-(sp)
 jsr     -42(a6)           ; Read() 1024 Bytes from file
 movem.l (sp)+,d0-d7/a0-a6
 move.l  $4.w,a3
 exg     a3,a6
 bsr     bootblockwrite    ; and write it as Bootblock
 exg     a3,a6
 bra     CloseFileDOS

testgad4:
 cmp.w   #4,d5
 bne.s   testgad5          ; Standard-Bootblock
 movem.l (sp)+,d1-d7/a0-a6 ; a1=IORequest
 bsr     reallyoverwrite
 beq     openwindow
 bsr     bootblockclear    ; clear bootblock
 lea     bootblock(pc),a0
 moveq   #bootblockend-bootblock-1,d0
loop7:
 move.b  (a0)+,(a2)+
 dbra    d0,loop7          ; copy StandardBootblock in buffer
 bsr     bootblockwrite
 bra     openwindow

testgad5:
 cmp.w   #5,d5
 bne.s   testgad6          ; NoFastMem-Bootblock
 movem.l (sp)+,d1-d7/a0-a6 ; a1=IORequest
 bsr     reallyoverwrite
 beq     openwindow
 bsr     bootblockclear    ; clear bootblock
 lea     nofastbootblock(pc),a0
 move.l  #nofastbootblockend-nofastbootblock-1,d0
 bra.s   loop7             ; write NoFastMemBootblock

testgad6:
 cmp.w   #6,d5
 bne.s   testgad7          ; false Checksum -> Boot is not possible
 movem.l (sp)+,d1-d7/a0-a6 ; a1=IORequest
 bsr     Checksumfalsch
 bra     openwindow

testgad7:
 cmp.w   #7,d5
 bne.s   testgad8          ; correct Checksum -> Boot is possible
 movem.l (sp)+,d1-d7/a0-a6 ; a1=IORequest
 bsr     Checksumrichtig
 bra     openwindow

testgad8:                  ; remove Virus-Control
 cmp.w   #8,d5
 bne.s   testgad11
 movem.l (sp)+,d1-d7/a0-a6 ; a1=IORequest
 bsr     reallyexit        ; really
 beq     openwindow
 lea     exitflag(pc),a0
 move.b  #$ff,(a0)         ; set exitflag for vector-Control-Task
 bra     DOIOweiter

testgad11:
 cmp.w   #11,d5
 bne     testgad12         ; in NoWarning-File
 movem.l (sp)+,d1-d7/a0-a6 ; a1=IORequest
 movem.l d0-d7/a0-a6,-(sp)
 lea     freeposition(pc),a0
 clr.l   (a0)
 bsr     OpenDOS           ; OpenLibrary("dos.library",0);
 lea     NoWarning(pc),a0
 move.l  a0,d1             ; Filename
 move.l  #1004,d2          ; MODE_READWRITE, to open existing S:NoWarning-File
 bsr     checkdevicename   ; EXCLUSIVE_LOCK, because multiple use could produce
 tst.l   d0                ; wrong data.
 beq.s   unknowndevice2
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -30(a6)
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0
 bne.s   noErrorNoWarning
 move.l  #1006,d2          ; MODE_NEWFILE(=EXCLUSIVE_LOCK) to create
 movem.l d1-d7/a0-a6,-(sp) ; S:NoWarning-File
 jsr     -30(a6)
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0
 bne.s   noErrorNoWarning  ; OpenError, because of EXCLUSIVE_LOCK by
unknowndevice2:            ; other process
 bsr     openerror
 bra     OpenFailed
noErrorNoWarning:
 move.l  d0,d1             ; filehandle
nextbootblock2:
 move.l  a5,a2
 lea     Nobuff(pc),a0
 move.l  a0,d2             ; use vectorcontrolTask-Stackbottom as 1024-buffer
 move.l  #1024,d3
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -42(a6)           ; read first Bootblock from S:NoWarning lesen
 movem.l (sp)+,d1-d7/a0-a6
 cmp.l   #1024,d0          ; no more Bootblock -> end of file
 bne     appendnext        ; search file for bootblock ( notice free Block )
 move.w  #$ff,d0           ; if there is not such a bootblock, write bootblock
NoWarningloop2:            ; to free position or append to file.
 cmp.l   #"FREE",(a0)
 bne.s   notfree
 bsr     getposition
notfree:
 cmpm.l  (a0)+,(a2)+
 bne.s   nextbootblock2
 dbra    d0,NoWarningloop2
 bsr     alreadynoset      ; Bootblock already exists in S:NoWarning
 beq     CloseFileDOS
 bsr     getposition
 sub.l   #1024,d0
 move.l  d0,d2
 bsr     seekback1
 move.l  (a5),-(sp)        ; save
 move.l  #"FREE",(a5)
 move.l  a5,d2             ; d2=bootblockbuffer
 move.l  #1024,d3          ; d3=number of write-bytes
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -48(a6)           ; mark Bootblock as FREE
 movem.l (sp)+,d1-d7/a0-a6
 move.l  (sp)+,(a5)        ; restore
 bra     CloseFileDOS

testgad12:                 ; in VirusName-File
 cmp.w   #12,d5
 bne     testgad13
 move.l  a4,d0             ; movem will overwrite a4
 movem.l (sp)+,d1-d7/a0-a6 ; a1=IORequest
 move.l  d0,a4
 bsr     namecorrect
 beq     openwindow
 movem.l d0-d7/a0-a6,-(sp)
 lea     freeposition(pc),a0
 clr.l   (a0)
 bsr     OpenDOS           ; OpenLibrary("dos.library",0);
 lea     VirusName(pc),a0
 move.l  a0,d1             ; Filename
 move.l  #1004,d2          ; MODE_READWRITE, to open existing S:VirusName-File
 bsr     checkdevicename   ; EXCLUSIVE_LOCK, because multiple use could produce
 tst.l   d0                ; wrong data.
 beq.s   unknowndevice3
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -30(a6)
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0
 bne.s   noErrorVirusName
 move.l  #1006,d2          ; MODE_NEWFILE(=EXCLUSIVE_LOCK) to create
 movem.l d1-d7/a0-a6,-(sp) ; S:VirusName-File
 jsr     -30(a6)
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0
 bne.s   noErrorVirusName  ; OpenError, because of EXCLUSIVE_LOCK by
unknowndevice3:            ; other process
 bsr     openerror
 bra     OpenFailed
noErrorVirusName:
 move.l  d0,d1             ; filehandle
nextbootblock3:
 lea     onediff1(pc),a0
 clr.b   (a0)
 lea     Vibuff(pc),a0
 move.l  a0,d2               ; use vectorcontrolTask-Stackbottom
 move.l  #1024+buff1-buff0,d3; as 1024+32 buffer
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -42(a6)             ; read first Virusname+Bootblock from S:VirusName
 movem.l (sp)+,d1-d7/a0-a6
 cmp.l   #1024+buff1-buff0,d0
 bne.s   fileende2
 lea     oldname(pc),a2
 bsr     copyname
 move.w  #$ff,d0
 move.l  a5,a2
VirusNameloop1:
 cmp.l   #"FREE",(a0)
 bne.s   notfree1
 bsr     getposition       ; while searching for bootblock,
notfree1:                  ; notice free-bootblock
 cmpm.l  (a0)+,(a2)+
 beq.s   issame1
 movem.l a0/a1,-(sp)
 lea     onediff1(pc),a0
 tst.b   (a0)
 movem.l (sp)+,a0/a1
 bne.s   nextbootblock3
countit1:
 movem.l a0/a1,-(sp)
 lea     onediff1(pc),a0   ; set flag for 1 Longword-difference
 move.b  #$ff,(a0)
 movem.l (sp)+,a0/a1
issame1:
 dbra    d0,VirusNameloop1
 bsr     alreadyviset         ; found !
 beq     CloseFileDOS
 bsr     getposition
 sub.l   #1024+buff1-buff0,d0 ; minus 1 entry
 move.l  d0,d2
 bsr     seekback1
 move.l  a4,a0
 lea     nameoverwrite(pc),a2
 bsr     copyname
 bsr     alreadyviwork
 beq.s   nixfrei3          ; overwrite with new name
 move.l  #"FREE",(a5)
 bra.s   nixfrei3          ; mark as FREE
fileende2:                 ; not found !
 move.l  freeposition(pc),d2
 beq.s   nixfrei3          ; if free entry -> use this
 sub.l   #1024+buff1-buff0,d2
 bsr     seekback1
nixfrei3:
 move.l  a4,d2             ; 32-byte-VirusName
 moveq   #buff1-buff0,d3
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -48(a6)           ; append VirusName to S:VirusName
 movem.l (sp)+,d1-d7/a0-a6
 bra.s   nixfrei
appendnext:
 move.l  freeposition(pc),d2
 beq.s   nixfrei           ; if free entry -> use this
 sub.l   #1024,d2
 bsr     seekback1
nixfrei:
 move.l  a5,d2             ; d2 = bootblockbuffer
 move.l  #1024,d3          ; d3 = number of write-bytes
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -48(a6)           ; append bootblock to file
 movem.l (sp)+,d1-d7/a0-a6 ; stack will be restored in CloseFileDos,
 move.l  $4.w,a3           ; nevertheless you can call bootblockread,
 exg     a3,a6             ; because a1=IORequest is not changed.
 bsr     bootblockread     ; bootblockread does not change d1=filehandle.
 exg     a3,a6             ; bootblockread restores bootblockbuffer
 bra     CloseFileDOS

testgad13:                 ; deletevirus
 cmp.w   #13,d5
 bne.s   testgad14
 lea     gadtext13(pc),a1  ; 'invisible' colors
 bsr     kill              ; a6=exec.base
 bra     nopush

testgad14:                 ; File - Protection
 cmp.w   #14,d5
 bne     testgad15
 move.l  a4,d0
 movem.l (sp)+,d1-d7/a0-a6 ; a1=IORequest
 move.l  d0,a4
 moveq   #0,d4             ; clear flag for check directory (noloadfi:)
 movem.l d0-d7/a0-a6,-(sp)
 bsr     OpenDOS           ; OpenLibrary("dos.library",0);
 move.l  a4,d1             ; Filename
 move.l  #1004,d2          ; MODE_READWRITE, to open existing file
 bsr     checkdevicename   ; EXCLUSIVE_LOCK, because multiple use could produce
 tst.l   d0                ; wrong data.
 beq     nodirectory
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -30(a6)
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0
 bne     noErrorFile1
 move.l  a4,d1             ; Directory ?
 moveq   #-2,d2            ; ACCESS_READ
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -84(a6)           ; Lock()
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0
 beq     nodirectory       ; neither file nor directory
 move.l  d0,-(sp)          ; SAVE for Unlock()
 move.l  d0,d1
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -126(a6)          ; cd directory
 movem.l (sp)+,d1-d7/a0-a6
 move.l  d0,-(sp)          ; SAVE for restoration
 movem.l d1-d7/a0-a6,-(sp)
 move.l  #260,d0
 moveq   #1,d1
 move.l  $4.w,a6           ; allocate memory for struct FileInfoBlock
 jsr     -198(a6)
 movem.l (sp)+,d1-d7/a0-a6
 move.l  d0,d2
 beq.s   mmm
 move.l  d0,-(sp)          ; SAVE address of memory
 move.l  8(sp),d1
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -102(a6)          ; Examine()
 movem.l (sp)+,d1-d7/a0-a6
 moveq   #-1,d4            ; Flag for check directory (noloadfi:)
exnext:
 move.l  8(sp),d1          ; Lock
 move.l  (sp),d2           ; memory-address of FileInfoBlock
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -108(a6)          ; ExNext()
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0                ; d0=0 -> no more files
 beq.s   kkk
 move.l  d2,a0
 lea     8(a0),a4
 move.l  a4,d1             ; Filename
 move.l  #1004,d2          ; MODE_READWRITE, to open existing file
 movem.l d1-d7/a0-a6,-(sp) ; EXCLUSIVE_LOCK, because multiple use could produce
 jsr     -30(a6)           ; wrong data.
 movem.l (sp)+,d1-d7/a0-a6
 tst.l   d0
 bne.s   noErrorFile1
 bra.s   exnext            ; if Directory
kkk:
 move.l  a1,a0             ; save IORequest
 move.l  (sp)+,a1
 move.l  #260,d0
 movem.l d1-d7/a0-a6,-(sp)
 move.l  $4.w,a6
 jsr     -210(a6)          ; FreeMem
 movem.l (sp)+,d1-d7/a0-a6
 move.l  a0,a1
mmm:
 move.l  (sp)+,d1
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -126(a6)          ; restore cd
 movem.l (sp)+,d1-d7/a0-a6
 move.l  (sp)+,d1
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -90(a6)           ; Unlock()
 movem.l (sp)+,d1-d7/a0-a6
 move.l  $4.w,a3           ; stack will be restored in Openfailed,
 exg     a3,a6             ; nevertheless you can call bootblockread,
 bsr     bootblockread     ; because a1=IORequest is not changed.
 exg     a3,a6             ; bootblockread does not change d1=filehandle.
 bra     Openfailed        ; bootblockread restores bootblockbuffer
nodirectory:
 bsr     openerror         ; OpenError(wrong filename)->own requester
 bra     OpenFailed
noErrorFile1:
 move.l  d0,d1             ; filehandle
nextbootblock4:
 move.l  a5,a0
 bsr     clear1024
 bsr     testfile          ; read first 1024 bytes from file
 cmp.l   #$000003f3,(a5)
 beq.s   isloadfile
 bsr     noloadfile
 bra     noloadfi
isloadfile:
 move.w  #$ff,d0
 move.l  a5,a2             ; d0,a2 counter
piusloop:
 cmp.l   #$000003e8,(a2)+
 bne.s   cvb
 subq.l  #1,d0
 bpl.s   yyx
 bsr     testfile          ; next 1024 Bytes
 tst.l   d0                ; end of file ?
 beq.s   bbn
 move.w  #$ff,d0
 move.l  a5,a2             ; d0,a2 counter
yyx:
 cmp.l   #$00000002,(a2)+
 bne.s   cvb
 subq.l  #1,d0
 bpl.s   yyy
 bsr     testfile          ; next 1024 Bytes
 tst.l   d0                ; end of file ?
 beq.s   bbn
 move.w  #$ff,d0
 move.l  a5,a2             ; d0,a2 counter
yyy:
 cmp.l   #"PIUS",(a2)+
 beq.s   marked
cvb:
 dbra    d0,piusloop
 bsr     testfile          ; next 1024 Bytes
 tst.l   d0                ; end of file ?
 bne.s   isloadfile
bbn:
 bsr     schuetzenodweiter
 beq     noloadfi
 bsr     setend            ; get file-length
 lea     Kennung(pc),a0
 move.l  d0,Kennzahl-Kennung(a0)
 move.l  a0,d2
 moveq   #20,d3
 movem.l d0-d7/a0-a6,-(sp)
 jsr     -48(a6)           ; append MARK to file
 movem.l (sp)+,d0-d7/a0-a6
 bra     noloadfi
marked:
 tst.l   d0                ; has to be read next 1024-block, ?
 bne.s   notblockend       ; because I need original-filelength
 bsr     testfile
 move.l  a5,a2
notblockend:
 bsr     setend            ; setend returns d0=actual filelength
 sub.l   #20,d0            ; minus MARK
 move.l  d0,d7             ; save filelength
 cmp.l   (a2),d0           ; d0=actual filelength  a2=original filelength
 beq.s   fileokay
 bsr     filedanger
 bra     noloadfi
fileokay:
 bsr     FileIsOkay
noloadfi:
 tst.l   d4
 beq.s   onlyfile
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -36(a6)           ; Close() file
 movem.l (sp)+,d1-d7/a0-a6
 bra     exnext
onlyfile:
 move.l  $4.w,a3           ; stack will be restored in CloseFileDos,
 exg     a3,a6             ; nevertheless you can call bootblockread,
 bsr     bootblockread     ; because a1=IORequest is not changed.
 exg     a3,a6             ; bootblockread does not change d1=filehandle.
 bra     CloseFileDOS      ; bootblockread restores bootblockbuffer

testgad15:                 ; CheckOpen
 cmp.w   #15,d5
 bne.s   testgad16
 jsr     -132(a6)
 lea     openflag(pc),a0
 not.b   (a0)
 lea     gadtext15text(pc),a1
 move.l  #"OFF ",14(a1)
 tst.b   (a0)
 bne.s   aus1
 move.l  #" ON ",14(a1)
aus1:
 jsr     -138(a6)
 bra     nopush

testgad16:                 ; search files
; cmp.w   #16,d5
; bne.s   testgad17
 jsr     -132(a6)
 lea     searchfiles(pc),a0
 not.b   (a0)
 lea     gadtext16text(pc),a1
 move.l  #"OFF ",14(a1)
 tst.b   (a0)
 beq.s   aus2
 move.l  #" ON ",14(a1)
aus2:
 jsr     -138(a6)
 bra     nopush

; testgad17:

namecorrect:
 movem.l a0-a3,-(sp)
 jsr     -132(a6)
 move.l  a4,a0
 lea     correctname(pc),a2; copy actual contents of Stringadget-buffer
 bsr     copyname          ; into Intuitext-structure
 bsr     modifyunit        ; and ask if okay
 lea     CORRECT(pc) ,a1
 bra.s   shorter1

reallyexit:
 movem.l a0-a3,-(sp)       ; really remove VirusControl
 jsr     -132(a6)
 lea     EXIT(pc) ,a1
 bra.s   shorter1

writebbzugriff:
 movem.l a0-a3,-(sp)       ; change bootblock-write-access to read-access ?
 jsr     -132(a6)
 bsr     modifyunit
 lea     WRITEBB(pc) ,a1
 bra.s   shorter1

reallyoverwrite:
 movem.l a0-a3,-(sp)       ; really overwrite bootblock
 jsr     -132(a6)
 bsr     modifyunit
 lea     OVERWRITE(pc) ,a1
shorter1:
 lea     OVERWRITEL(pc),a2
 lea     OVERWRITER(pc),a3
shorter2:
 bsr     autorequest
 jsr     -138(a6)
 movem.l (sp)+,a0-a3
 tst.l   d0                ; rts does not change flags
 rts

fileprotect:
 movem.l a0-a3,-(sp)
 jsr     -132(a6)
 move.l  a4,a0
 lea     checkfilename(pc),a2
 bsr     copyname
 lea     FILESCHUTZ(pc),a1
 bra.s   shorter1

openerror:                 ; requester for Open-Error
 movem.l a0-a6,-(sp)       ; save a6=dosbase
 move.l  $4.w,a6           ; autorequest: needs a6=exec.base
 jsr     -132(a6)
 bsr     modifyunit
 lea     OPENERR(pc),a1
shorter7:
 lea     NOBOOTR(pc),a2
shorter5:
 lea     NOBOOTR(pc),a3
shorter6:
 bsr     autorequest
 jsr     -138(a6)
 movem.l (sp)+,a0-a6
 tst.l   d0
 rts

alreadynoset:              ; requester for bootblock already in
 movem.l a0-a6,-(sp)       ; S:NoWarning
 move.l  $4.w,a6
 jsr     -132(a6)
 bsr     modifyunit
 lea     ALREADYNO(pc),a1
 lea     ALREADYNOdel(pc),a2
 bra.s   shorter5

alreadyviset:              ; requester for bootblock already in
 movem.l a0-a6,-(sp)       ; S:VirusName
 move.l  $4.w,a6
 jsr     -132(a6)
 bsr     modifyunit
 lea     ALREADYVI(pc),a1
 lea     ALREADYWORK(pc),a2
 bra.s   shorter5

alreadyviwork:             ; requester to remove bootblock+name from
 movem.l a0-a6,-(sp)       ; S:VirusName or to overwrite old name by new name
 move.l  $4.w,a6
 jsr     -132(a6)
 bsr     modifyunit
 lea     ALREADYVI(pc),a1
 lea     ALREADYNOdel(pc),a2
 lea     ALREADYNOnam(pc),a3
 bra.s   shorter6

noloadfile:
 movem.l a0-a6,-(sp)       ; save a6=dosbase
 move.l  $4.w,a6           ; forbid(),autorequest: needs a6=exec.base
 jsr     -132(a6)
 move.l  a4,a0
 lea     keinloadfile(pc),a2
 bsr     copyname
 lea     noloadf(pc),a1
 bra     shorter7

filedanger:
 movem.l a0-a6,-(sp)       ; save a6=dosbase
 move.l  $4.w,a6           ; forbid(),autorequest: needs a6=exec.base
 jsr     -132(a6)
 move.l  a4,a0
 lea     linkname(pc),a2
 bsr     copyname
 lea     link(pc),a1
 bra     shorter7

FileIsOkay:
 movem.l a0-a6,-(sp)       ; save a6=dosbase
 move.l  $4.w,a6           ; forbid(),autorequest: needs a6=exec.base
 jsr     -132(a6)
 move.l  a4,a0
 lea     checkfilename(pc),a2
 bsr     copyname
 lea     FILESCHUTZ(pc),a1
 lea     okk(pc),a2
 lea     okk(pc),a3
 bra     shorter6

schuetzenodweiter:
 movem.l a0-a6,-(sp)       ; save a6=dosbase
 move.l  $4.w,a6           ; forbid(),autorequest: needs a6=exec.base
 jsr     -132(a6)
 move.l  a4,a0
 lea     checkfilename(pc),a2
 bsr     copyname
 lea     FILESCHUTZ(pc),a1
 lea     neusch(pc),a2
 bra     shorter5

allowaccess:
 movem.l a0-a3,-(sp)       ; allow file-access ?
 move.l  $4.w,a6
 jsr     -132(a6)
 move.l  d1,a0
 lea     filewrite(pc),a2
 bsr     copyname
 lea     OPENFILEnam(pc) ,a1
 bra     shorter1

getposition:
 moveq   #0,d2
 moveq   #0,d3
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -66(a6)           ; Seek() -> get actual fileposition
 lea     freeposition(pc),a0
 move.l  d0,(a0)           ; save position
 movem.l (sp)+,d1-d7/a0-a6
 rts

seekback1:
 moveq   #-1,d3
seekit:
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -66(a6)
 movem.l (sp)+,d1-d7/a0-a6
 rts

addtask:
 ; start vector-control-task, which checks system-vectors every second.
 ; in coolroutine you cannot call addtask -> guru.
 ; only a few exec-functions can be used in coolroutine.
 movem.l d0-d7/a0-a6,-(sp);
 lea     structtask(pc),a1
 lea     task(pc),a2
 sub.l   a3,a3          ; 2 Bytes, move.l #0,a3 needs 6 Bytes
 jsr     -282(a6)       ; addtask
 movem.l (sp)+,d0-d7/a0-a6
 rts

deletevirus:
 bsr     optzeichen
 clr.l   546(a6)           ; clear KickMemPtr
 clr.l   550(a6)           ; clear KickTagPtr
 clr.l   554(a6)           ; clear KickCheckSum
 clr.l   42(a6)            ; clear COLD-vector
 move.l  58(a6),a0         ; clear 1024 Bytes at Supervisorstackbottom,
 bsr.s   clear1024         ; because sometimes there are viruses
 move.l  BeginIOAdr(pc),a0 ; set Original-BeginIO-vector
 move.l  restoreIO(pc),(a0); all ROM-version-compatible
VCrestore:
 lea     lastBeginIO(pc),a0; clear last BeginIO
 clr.l   (a0)
 lea     lastKickMem(pc),a0
 clr.l   (a0)+             ; clear lastKickMem
 clr.l   (a0)+             ; clear lastKickTag
 clr.l   (a0)              ; clear lastKickCheck
 lea     newDOIO(pc),a0    ; reset restores DOIO -> DOIO has to be set to
 move.l  a0,-454(a6)       ;                        Virus-control
 move.l  a0,-(sp)
 lea     lastDOIO(pc),a0   ; set VIRUS-CONTROL-DOIO as lastDOIO
 move.l  (sp)+,(a0)
execchecksum:
 lea     lastCOOL(pc),a0
 move.l  pointer(pc),(a0)   ; set VIRUS-CONTROL-COOL as lastCOOL
 move.l  pointer(pc),$2e(a6); set Cool-vector to VIRUS-CONTROL
 lea     $22(a6),a0         ; calc new execchecksum
 clr.w   d0                 ; Cool-vector and execchecksum is not changed by
 moveq   #$17,d1            ; Reset
execcheck:
 add.w   (a0)+,d0
 dbra    d1,execcheck
 not.w   d0
 move.w  d0,(a0)
 rts

clear1024:              ; clear 256*4=1024 Bytes
 move.w   #$00ff,d0     ; dbra uses word
clearloop:              ; call clearloop with d0=$007f clears 128*4=512 Bytes
 clr.l   (a0)+
 dbra    d0,clearloop
 rts

Bootblockclear:
 move.l  a5,a0
 move.l  a0,a2
 bra.s   clear1024

nameunknown:
 movem.l d0-d7/a0-a6,-(sp)
 lea     NAME0text(pc),a2
 moveq   #buff1-buff0+20,d0
 mulu    d6,d0
 add.l   d0,a2
 lea     unknown(pc),a0
 bsr.s   copyname
 movem.l (sp)+,d0-d7/a0-a6
 rts

copyname:
 moveq   #buff1-buff0-1,d0
copyvirusname:
 move.b  (a0)+,(a2)+
 dbra    d0,copyvirusname
 rts

checkdevicename:           ; df0:-trackdisk.device-task often task-held,
 movem.l d1-d7/a0-a6,-(sp) ; if you try to open an not existing device
 move.l  d1,a4             ; df1: df2: df3:-trackdisk.device-task never
 move.l  d1,a0             ; task-held, but it appears an AmigaDOSAutorequester
 move.l  $4.w,a3           ; why only df0:-task-held ???
 exg     a3,a6             ; to prevent df0:-task-held, check devicename,
 jsr     -132(a6)          ; before Open()
 exg     a3,a6
 moveq   #-1,d0
isitdevice:
 tst.b   (a0)              ; Filename
 beq.s   searchend         ; no devicename -> end with d0=$ffffffff
 cmp.b   #":",(a0)+
 bne.s   isitdevice
 move.l  34(a6),a0         ; RootNode
 move.l  24(a0),d0         ; DosInfo
 lsl.l   #2,d0             ; BPTR * 4 = APTR
 move.l  d0,a0
 move.l  4(a0),d0          ; DevInfo
nextdevice:
 move.l  a4,a3             ; a3 = Filename-address
 lsl.l   #2,d0             ; BPTR * 4 = APTR
 move.l  d0,a0
 move.l  40(a0),d0         ; DeviceName
 lsl.l   #2,d0             ; BPTR * 4 = APTR
 move.l  d0,a2
 move.b  (a2)+,d1          ; first byte = Stringlength (BSTR)
 ext.w   d1                ; dbra uses word
 subq.w  #1,d1             ; dbra  -1
testdevice:
 cmpm.b  (a2)+,(a3)+
 bne.s   testgrossklein
teston:
 dbra    d1,testdevice
 cmp.b   #":",(a3)
 beq.s   isdevice
 moveq   #0,d0
 bra.s   searchend         ; for instance RAMM: statt RAM: eingegeben
isdevice:
 moveq   #-1,d0            ; Device exists -> d0 = $ffffffff
 bra.s   searchend
testgrossklein:            ; AmigaDOS does not distinguish capital/small letter
 add.b   #32,-(a3)
 subq.l  #1,a2
 cmpm.b  (a2)+,(a3)+       ; try it as a capital letter
 beq.s   teston
 sub.b   #64,-(a3)
 subq.l  #1,a2
 cmpm.b  (a2)+,(a3)+       ; try it as a small letter
 beq.s   teston
 add.b   #32,-(a3)         ; restore
 move.l  (a0),d0           ; no more device -> d0 = 0
 bne.s   nextdevice        ; NextDevice
searchend:
 move.l  $4.w,a6
 jsr     -138(a6)          ; okay -> d0=$ffffffff, if no devicename or
 movem.l (sp)+,d1-d7/a0-a6 ;                       if device exists.
 rts                       ; d0=0 -> device does not exist

OpenIntuition:             ; OpenLibrary("intuition.library",0);
 movem.l d1-d7/a0-a6,-(sp) ; changes d0,a6
 lea     intuition(pc),a1
 bra.s   shorter3

OpenDOS:                   ; OpenLibrary("dos.library",0);
 movem.l d1-d7/a0-a6,-(sp) ; changes d0,a6
 lea     dosname(pc),a1
shorter3:
 moveq   #0,d0             ; Version >= 0
 jsr     -552(a6)          ; OpenLibrary("intuition.library",0)
 movem.l (sp)+,d1-d7/a0-a6
 move.l  d0,a6             ; base -> a6
 rts                       ; ROM-Library -> always okay -> forget checking

CloseFile:
 jsr     -36(a6)           ; Close() file
CloseDOS:
 move.l  a6,a1
 move.l  $4.w,a6
 jmp     -414(a6)          ; CloseLibrary("dos.library",0) + rts

clearflags:
 lea     exitcount(pc),a0
 subq.b  #1,(a0)           ; exitcount -1  if disk-working is finished
 lea     inuse0(pc),a0     ; if exitcount=0  VIRUS-CONTROL can be finished
 add.l   d6,a0
 clr.b   (a0)              ; dfx: no more in use
 rts

settimer:                  ; prepare timer.device
 sub.l   a1,a1
 jsr     -294(a6)
 lea     timeport(pc),a1
 move.l  d0,16(a1)
 jsr     -354(a6)
 lea     timerdev(pc),a0
 lea     timereq(pc),a1    ; my task sends message(=request) to timerdevicetask
 moveq   #1,d0             ; when time is over, timerdevicetask sends message
 moveq   #0,d1             ; to port of my task, port-address stands in
 jsr     -444(a6)          ; message(request). my task is informed of the
 lea     timeport(pc),a3   ; arrived message, because my task-address stands
 lea     timereq(pc),a1    ; in port.
 move.l  a3,14(a1)
 rts

freemem:
 move.l  #end-reset+9000,d0 ; Bytesize
 move.l  pointer(pc),a1
 jmp     -210(a6)           ; FreeMem + rts

remreqport:
 lea     timereq(pc),a1
 jsr     -450(a6)          ; CloseDevice()
 lea     timeport(pc),a1
 jmp     -360(a6)          ; RemPort()

restoreopen:
 lea     jmpoldopen(pc),a0
 move.l  dosbase(pc),a4
 cmp.w   #$4ef9,-30(a4)
 bne.s   notchanged
 jsr     -120(a6)          ; Disable(), because theoretically task-switch
 move.w  (a0),-30(a4)      ; after 1 instruction
 move.l  8(a0),-28(a4)     ; retore Open()
 jsr     -126(a6)          ; Enable()
notchanged:
 rts

testfile:
 move.l  a5,d2             ; d2 = read-buffer
 move.l  #1024,d3          ; d3 = number of read-bytes
 movem.l d1-d7/a0-a6,-(sp)
 jsr     -42(a6)           ; Read()
 movem.l (sp)+,d1-d7/a0-a6
 rts

setend:                    ; return with d0=filelength
 moveq   #0,d2
 moveq   #1,d3             ; END
 bra     seekit

openflag:      dc.b $ff ; $ff->Open() is not set to VIRUSCONTROL by controlTask
opencount:     dc.b 0   ; number of OpenRequester, finish VControl only if = 0
colorflag:     dc.b $ff ; insert disk -> green color-signal
searchfiles:   dc.b $ff ; search S:NoWarning, S:VirusName-File
taskflag:      dc.b $ff ; $ff -> vector-control-task checks vectors at once
resetflag:     dc.b 0   ; to ignore first 512-Disk-DOIO
exitflag:      dc.b 0   ; VIRUS-CONTROL is to be finished
exitcount:     dc.b 0   ; exitcount=number of WarnWindows, finish VControl if=0
inuse0:        dc.b 0   ; if dfx:-inuse-flag is set->disk already worked on
inuse1:        dc.b 0   ; df1:
inuse2:        dc.b 0   ; df2:
inuse3:        dc.b 0   ; df3:
pointer:       dc.l 0   ; pointer to VIRUS-CONTROL (-memory)
BeginIOAdr:    dc.l 0   ; BeginIO-vector-address of trackdisk-device
lastBeginIO:   dc.l 0   ; last BeginIO-vector
restoreIO:     dc.l 0   ; remove systemvirus -> set this BeginIO-vector
lastKickMem:   dc.l 0
lastKickTag:   dc.l 0
lastKickCheck: dc.l 0
lastDOIO:      dc.l newdoio-reset ; if CLI-Start
lastCOOL:      dc.l reset-reset   ; if CLI-Start
freeposition:  dc.l 0
dosbase:       dc.l 0
onediff1:      dc.b 0
nochfrei:      dc.b 0
intuition:     dc.b "intuition.library",0
 even
timerdev:      dc.b "timer.device",0
 even
unknown:       dc.b "Virus-Name unknown !           ",0
unknownend:    even
NoWarning:     dc.b "S:NoWarning",0
 even
VirusName:     dc.b "S:VirusName",0
 even
Kennung:       dc.l $000003e8  ; hunk_name
               dc.l $00000002  ; Name 2 Longword long
               dc.b  "OIUS"    ; identification ( start Vcontrol -> PIUS)
Kennzahl:      dc.l $00000000  ; original filelength
               dc.l $000003f2  ; hunk_end
filename:
 dc.b "RAW:0/0/640/170/BOOTBLOCK-DF"
unit4:                       dc.b "0:  hit any key ",0
 even
; in reset-boot-routine Topaz 9 (60 characters) -> RAW: y=170 to prevent
; vertical scrolling.

NOBOOT:
 dc.b 1,0,0,0
 dc.w 7,8
 dc.l font-reset,NOBOOTtext-reset,0
NOBOOTtext:
 dc.b "Bootblock-Virus in DF"
unit0:         dc.b "0: ?       PUBLIC DOMAIN !! CONTACTS WELCOMED !!",0
 even
NAME0:
 dc.b 1,0,0,0
 dc.w 0,0
 dc.l font-reset,NAME0text-reset,0
NAME0text:
 dc.b "                               ",0
 even
NAME1:
 dc.b 1,0,0,0
 dc.w 0,0
 dc.l font-reset,NAME1text-reset,0
NAME1text:
 dc.b "                               ",0
 even
NAME2:
 dc.b 1,0,0,0
 dc.w 0,0
 dc.l font-reset,NAME2text-reset,0
NAME2text:
 dc.b "                               ",0
 even
NAME3:
 dc.b 1,0,0,0
 dc.w 0,0
 dc.l font-reset,NAME3text-reset,0
NAME3text:
 dc.b "                               ",0
 even
ONEDIFF:
 dc.b 1,0,0,0
 dc.w 0,0
 dc.l font-reset,ONEDIFFtext-reset,0
ONEDIFFtext:
 dc.b "1 Longword-difference",0
 even
OPENERR:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l font-reset,OPENERRtext-reset,0
OPENERRtext:
 dc.b "Warn-Window-DF"
unit3:         dc.b "0: Open-Error",0
 even
CORRECT:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l font-reset,CORRECTtext-reset,0
CORRECTtext:
 dc.b "String-Gadget-contents-DF"
unit5: dc.b "0: correct ? "
correctname:        dc.b "                                  ",0
 even
NOBOOTR:
 dc.b 0,1,0,0
 dc.w 7,4
 dc.l font-reset,NOBOOTRtext-reset,0
NOBOOTRtext: dc.b " END ",0
 even
PROTECT:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l 0,PROTECTtext-reset,0
PROTECTtext:
 dc.b "Disk in DF"
unit2:     dc.b "0: is write-protected !",0
 even
PROTECTL:
 dc.b 0,1,0,0
 dc.w 7,4
 dc.l 0,PROTECTLtext-reset,0
PROTECTLtext: dc.b " RETRY ",0
 even
ALREADYNO:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l 0,ALREADYNOtext-reset,0
ALREADYNOtext:
 dc.b "Bootblock DF"
unit6:       dc.b "0: already in S:NoWarning !",0
 even
ALREADYNOdel:
 dc.b 0,1,0,0
 dc.w 7,4
 dc.l 0,ALREADYNOdeltext-reset,0
ALREADYNOdeltext:
 dc.b " REMOVE ",0
 even
ALREADYVI:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l font-reset,ALREADYVItext-reset,0
ALREADYVItext:
 dc.b "Bootblock DF"
unit7:       dc.b "0: already in S:VirusName: "
oldname:                              dc.b "                               ",0
 even
ALREADYWORK:
 dc.b 0,1,0,0
 dc.w 7,4
 dc.l 0,ALREADYWORKtext-reset,0
ALREADYWORKtext:
 dc.b " REMOVE or OVERWRITE ",0
 even
ALREADYNOnam:
 dc.b 0,1,0,0
 dc.w 7,4
 dc.l font-reset,ALREADYNOnamtext-reset,0
ALREADYNOnamtext:
 dc.b " OVERWRITE with "
nameoverwrite:       dc.b "                               ",0
 even
OPENFILEnam:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l font-reset,OPENFILEnamtext-reset,0
OPENFILEnamtext:
 dc.b "ATTENTION: ACCESS to "
filewrite:           dc.b "                               ",0
 even
EXIT:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l 0,EXITtext-reset,0
EXITtext:
 dc.b "finish VIRUS-CONTROL really ?",0
 even
neusch:
 dc.b 0,1,0,0
 dc.w 7,4
 dc.l 0,neuschtext-reset,0
neuschtext:
 dc.b " Protect ",0
 even
okk:
 dc.b 0,1,0,0
 dc.w 7,4
 dc.l 0,okktext-reset,0
okktext:
 dc.b " File okay ",0
 even
noloadf:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l 0,noloadftext-reset,0
noloadftext:
 dc.b "no load-file: "
keinloadfile:        dc.b "                               ",0
 even
FILESCHUTZ:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l 0,FILESCHUTZtext-reset,0
FILESCHUTZtext:
 dc.b "File-Protection: "
checkfilename:       dc.b "                               ",0
 even
link:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l font-reset,linktext-reset,0
linktext:
 dc.b "Filelength has changed !! -> LINK-VIRUS ?? -> "
linkname: dc.b "                               ",0
 even
WRITEBB:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l font-reset,WRITEBBtext-reset,0
WRITEBBtext:
 dc.b "ATTENTION: WRITE-ACCESS to Bootblock DF"
unit8:                                   dc.b "0:  turn to READ ?",0
 even
OVERWRITE:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l 0,OVERWRITEtext-reset,0
OVERWRITEtext:
 dc.b "Bootblock  in DF"
unit1:          dc.b "0: really write over it ?",0
 even
OVERWRITEL:
 dc.b 0,1,0,0
 dc.w 7,4
 dc.l 0,OVERWRITELtext-reset,0
OVERWRITELtext: dc.b " YES ",0
 even
OVERWRITER:
 dc.b 0,1,0,0
 dc.w 7,4
 dc.l 0,OVERWRITERtext-reset,0
OVERWRITERtext: dc.b "  NO  ",0
 even
BOOT:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l 0,NOBOOTtext-reset,0
BOOTL:
 dc.b 0,1,0,0
 dc.w 7,4
 dc.l 0,BOOTLtext-reset,0
BOOTLtext: dc.b " Disk-Boot-Routine ",0
 even
BOOTR:
 dc.b 0,1,0,0
 dc.w 7,4
 dc.l 0,BOOTRtext-reset,0
BOOTRtext: dc.b " Boot-Simulation ",0
 even
REALLYBOOT:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l 0,REALLYBOOTtext-reset,0
REALLYBOOTtext:
 dc.b "left: could start a Disk-Boot-VIRUS !!",0
 even

vector0:
 dc.b 0,1,0,0
 dc.w 15,30
 dc.l 0,vector0text-reset,0
vector0text: dc.b "       -vector changed -> VIRUS ? - AMIGA OFF !!",0
 even
vectorL:
 dc.b 0,1,0,0
 dc.w 7,4
 dc.l font-reset,vectorLtext-reset,0  ; Topaz80 da > 60 Zeichen
vectorLtext:
 dc.b " KILL-SYSTEM-VIRUS -> Danger of Guru -> better AMIGA OFF !! ",0
 even

gadtext16:
 dc.b 1,0,0,0
 dc.w 7,3
 dc.l font-reset,gadtext16text-reset,0
gadtext16text: dc.b " SearchFiles   ON ",0
 even
gadtext15:
 dc.b 1,0,0,0
 dc.w 7,3
 dc.l font-reset,gadtext15text-reset,0
gadtext15text: dc.b "  CheckOpen   OFF ",0
 even
gadtext14:
 dc.b 1,0,0,0
 dc.w 7,3
 dc.l font-reset,gadtext14text-reset,0
gadtext14text:dc.b " File - Protection",0
 even
gadtext13:
 dc.b 1,0,0,0
 dc.w 7,3
 dc.l font-reset,gadtext13text-reset,0
gadtext13text:dc.b " Kill System-Virus",0
 even
gadtext12:
 dc.b 1,0,0,0
 dc.w 7,3
 dc.l font-reset,gadtext12text-reset,0
gadtext12text:dc.b "in S:VirusName-File",0
 even
gadtext11:
 dc.b 1,0,0,0
 dc.w 7,3
 dc.l font-reset,gadtext11text-reset,0
gadtext11text:dc.b "in S:NoWarning-File",0
 even
gadtext8:
 dc.b 1,0,0,0
 dc.w 7,3
 dc.l font-reset,gadtext8text-reset,0
gadtext8text: dc.b "Finish VirusControl",0
 even
gadtext7:
 dc.b 1,0,0,0
 dc.w 7,3
 dc.l font-reset,gadtext7text-reset,0
gadtext7text: dc.b "r.Checksum ->  Boot",0
 even
gadtext6:
 dc.b 1,0,0,0
 dc.w 7,3
 dc.l font-reset,gadtext6text-reset,0
gadtext6text: dc.b "f.Checksum ->NoBoot",0
 even
gadtext5:
 dc.b 1,0,0,0
 dc.w 7,3
 dc.l font-reset,gadtext5text-reset,0
gadtext5text: dc.b "NoFastMem-BootBlock",0
 even
gadtext4:
 dc.b 1,0,0,0
 dc.w 7,3
 dc.l font-reset,gadtext4text-reset,0
gadtext4text: dc.b "Standard -BootBlock",0
 even
gadtext3:
 dc.b 1,0,0,0
 dc.w 7,3
 dc.l font-reset,gadtext3text-reset,0
gadtext3text: dc.b "File   -> BootBlock",0
 even
gadtext2:
 dc.b 1,0,0,0
 dc.w 7,3
 dc.l font-reset,gadtext2text-reset,0
gadtext2text: dc.b "Bootblock ->   File",0
 even
gadtext1:
 dc.b 1,0,0,0
 dc.w 7,3
 dc.l font-reset,gadtext1text-reset,0
gadtext1text: dc.b "BootBlock -> Screen",0
 even
gadtext0:
 dc.b 1,0,0,0
 dc.w 7,3
 dc.l font-reset,gadtext0text-reset,0
gadtext0text: dc.b  " Color-Signal  ON ",0
 even

gad16:            ; search files
 dc.l 0
 dc.w 430,6*18+48,166,12,0,1,1
 dc.l gadborder-reset,0,gadtext16-reset,0,0
 dc.w 16
 dc.l 0
gad15:            ; Check Open
 dc.l gad16-reset
 dc.w 430,5*18+48,166,12,0,1,1
 dc.l gadborder-reset,0,gadtext15-reset,0,0
 dc.w 15
 dc.l 0
gad14:            ; protect files
 dc.l gad15-reset
 dc.w 430,3*18+43,166,12,0,1,1
 dc.l gadborder-reset,0,gadtext14-reset,0,0
 dc.w 14
 dc.l 0
gad13:            ; Kill System-Virus
 dc.l gad14-reset
 dc.w 230,6*18+48,166,12,0,1,1
 dc.l gadborder-reset,0,gadtext13-reset,0,0
 dc.w 13
 dc.l 0
gad12:           ; in S:VirusName-File
 dc.l gad13-reset
 dc.w 230,3*18+43,166,12,0,1,1
 dc.l gadborder-reset,0,gadtext12-reset,0,0
 dc.w 12
 dc.l 0
gad11:           ; in S:NoWarning-File
 dc.l gad12-reset
 dc.w 230,2*18+43,166,12,0,1,1
 dc.l gadborder-reset,0,gadtext11-reset,0,0
 dc.w 11
 dc.l 0
gad10:
 dc.l gad11-reset
 dc.w 30,1*18-3,566,53,3,1,1  ; GADGHNONE since only information
 dc.l gadborder1-reset,0,NOBOOT-reset,0,0
 dc.w 10
 dc.l 0
gad8:            ; finish Virus-Control
 dc.l gad10-reset
 dc.w 430,2*18+43,166,12,0,1,1
 dc.l gadborder-reset,0,gadtext8-reset,0,0
 dc.w 8
 dc.l 0
gad7:            ; (Virus)DiskBoot  ON
 dc.l gad8-reset
 dc.w 230,5*18+48,166,12,0,1,1
 dc.l gadborder-reset,0,gadtext7-reset,0,0
 dc.w 7
 dc.l 0
gad6:            ; (Virus)DiskBoot OFF
 dc.l gad7-reset
 dc.w 230,4*18+48,166,12,0,1,1
 dc.l gadborder-reset,0,gadtext6-reset,0,0
 dc.w 6
 dc.l 0
gad5:            ; NoFastMem-BootBlock
 dc.l gad6-reset
 dc.w 30,6*18+48,166,12,0,1,1
 dc.l gadborder-reset,0,gadtext5-reset,0,0
 dc.w 5
 dc.l 0
gad4:            ; Standard -BootBlock
 dc.l gad5-reset
 dc.w 30,5*18+48,166,12,0,1,1
 dc.l gadborder-reset,0,gadtext4-reset,0,0
 dc.w 4
 dc.l 0
gad3:            ; File   -> BootBlock
 dc.l gad4-reset
 dc.w 30,4*18+48,166,12,0,1,1
 dc.l gadborder-reset,0,gadtext3-reset,0,0
 dc.w 3
 dc.l 0
gad2:            ; Bootblock ->   File
 dc.l gad3-reset
 dc.w 30,3*18+43,166,12,0,1,1
 dc.l gadborder-reset,0,gadtext2-reset,0,0
 dc.w 2
 dc.l 0
gad1:            ; BootBlock -> screen
 dc.l gad2-reset
 dc.w 30,2*18+43,166,12,0,1,1
 dc.l gadborder-reset,0,gadtext1-reset,0,0
 dc.w 1
 dc.l 0
gad0:            ; colorsignal
 dc.l gad1-reset
 dc.w 430,4*18+48,166,12,0,1,1
 dc.l gadborder-reset,0,gadtext0-reset,0,0
 dc.w 0
 dc.l 0

gad90:                                     ; 4 stringadgets, because of
 dc.l gad0-reset                           ; reentrance df0: - df3:
 dc.w 37,8*18+38,566,12,0,1,4              ; stringgadget will be FirstGadget
 dc.l gadborders-reset,0,0,0,string0-reset
 dc.w 9
 dc.l 0
string0:
 dc.l buff0-reset,undo0-reset
 dc.w 0,buff1-buff0,0,0,0,0,0,0
 dc.l 0,0,0
gad91:
 dc.l gad0-reset
 dc.w 37,8*18+38,566,12,0,1,4
 dc.l gadborders-reset,0,0,0,string1-reset
 dc.w 9
 dc.l 0
string1:
 dc.l buff1-reset,undo1-reset
 dc.w 0,buff1-buff0,0,0,0,0,0,0
 dc.l 0,0,0
gad92:
 dc.l gad0-reset
 dc.w 37,8*18+38,566,12,0,1,4
 dc.l gadborders-reset,0,0,0,string2-reset
 dc.w 9
 dc.l 0
string2:
 dc.l buff2-reset,undo2-reset
 dc.w 0,buff1-buff0,0,0,0,0,0,0
 dc.l 0,0,0
gad93:
 dc.l gad0-reset
 dc.w 37,8*18+38,566,12,0,1,4
 dc.l gadborders-reset,0,0,0,string3-reset
 dc.w 9
 dc.l 0
string3:
 dc.l buff3-reset,undo3-reset
 dc.w 0,buff1-buff0,0,0,0,0,0,0
 dc.l 0,0,0

gadborder:           ; all Gadgets, execept Stringgadget and top-Gadget
 dc.w -1,-1
 dc.b 2,1,0,18
 dc.l pairs-reset,0
gadborders:          ; Stringgadget
 dc.w -8,-4          ; GadgetID = 9
 dc.b 2,1,0,18
 dc.l pairss-reset,0
gadborder1:          ; large-top-Information-Gadget
 dc.w -1,-1          ; GadgetID = 10
 dc.b 2,1,0,18
 dc.l pairs1-reset,0

pairs:               ; shadow by borderlines
 dc.w 0,13, 0,0, 167,0, 167,13, 0,13, 1,14, 168,14, 168,0, 169,1,
 dc.w 169,15, 170,15, 170,2, 171,3, 171,15, 2,15, 3,16, 172,16, 172,4
pairss:
 dc.w 0,13, 0,0, 567,0, 567,13, 0,13, 1,14, 568,14, 568,0, 569,1,
 dc.w 569,15, 570,15, 570,2, 571,3, 571,15, 2,15, 3,16, 572,16, 572,4
pairs1:
 dc.w 0,54, 0,0, 567,0, 567,54, 0,54, 1,55, 568,55, 568,0, 569,1,
 dc.w 569,56, 570,56, 570,2, 571,3, 571,56, 2,56, 3,57, 572,57, 572,4

font:                   ; some requester-texts are to long for Topaz 60
 dc.l topazfont-reset
 dc.w 8
 dc.b 0,1
topazfont: dc.b "topaz.font",0
 even

; 4 Stringgadget-buffer, because of reentrance df0: - df3:
buff0: dc.b "ram:filename",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; 32 Bytes
buff1: dc.b "ram:filename",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; is even
buff2: dc.b "ram:filename",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
buff3: dc.b "ram:filename",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

window:            ; New-Window-structure of Warn-Window
 dc.w 0,0,640,200
 dc.b 0,1          ; CLOSEWINDOW|GADGETUP
 dc.l $240,$100f,0 ; ACTIVATE|W.DEPTH|W.DRAG|W.CLOSE|W.SIZING|SMART_REFRESH
 dc.l 0,taskname-reset,0,0
 dc.w 290,68,640,200,1 ; WBENCHSCREEN
 ; WINDOWSIZING -> do not destroy PrintIText, SMART_REFRESH does not restore
structtask: dc.l 0,0
            dc.b 1,0
            dc.l taskname-reset
            dc.b 0,0,0,0
            dc.l 0,0,0,0
            dc.w 0,0
            dc.l 0,0,0,0
            dc.l end-reset+9000,end-reset,end-reset+9000
            dc.l 0,0,0,0,0
            dc.w 0,0,0
end:
; +9000 Bytes duch AllocMem belegen.
; end       bis end+1024             Bootblock-buffer for NoWarning-Funktion
; end+1024  bis end+2*1024+32        Bootblock-buffer for VirusName-Funktion
; end+2080  bis end+2080+128         4 * 32-byte-String-Gadget-Undo-buffer
; end+2208  bis end+2208+40+48+2*34  2*Request-structure,2*Port-structure
; end+2364  bis end+2364+512         512-byte-Sektor-buffer for -t Option
; end+2876  bis end+2876+1024        1024-byte-Bootblock-buffer for df0:
; end+3900  bis end+3900+1024        1024-byte-Bootblock-buffer for df1:
; end+4924  bis end+4924+1024        1024-byte-Bootblock-buffer for df2:
; end+5948  bis end+5948+1024        1024-byte-Bootblock-buffer for df3:
; end+6972  bis end+9000             vector-control-Task-Stack
; vector-control-Task uses jsr AutoRequest() -> needs 1.2 KB Stack
; 9000-6972 = 2028  Stack is enough.
Nobuff      = end
Vibuff      = Nobuff+1024
undo0       = Vibuff+1024+32
undo1       = undo0+32
undo2       = undo1+32
undo3       = undo2+32
timereq     = undo3+32         ; IORequest(32)+timeval(8) -> AllocMem
timeport    = timereq+40       ; MsgPort(34)              -> MEMF_CLEAR
trackreq    = timeport+34      ; IOStdRequest(48)
trackport   = trackreq+48      ; MsgPort(34)
blockbuff   = trackport+34
bootblock0  = blockbuff+512;
bootblock1  = bootblock0+1024
bootblock2  = bootblock1+1024
bootblock3  = bootblock2+1024
