home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff338.lzh / SASTools / VirusTools / JAFVK.asm < prev    next >
Assembly Source File  |  1990-03-23  |  7KB  |  216 lines

  1. ****************************************************************************
  2. *  Programme : JAFVK.asm                                                   *
  3. *  Usage     : JAFVK                                                       *
  4. *  Version   : V3.00                                                       *
  5. *  Date      : 30.01.1990 - 06.02.1990                                     *
  6. *  Author    : Jörg Sixt                                                   *
  7. *  Purpose   : - prints and deletes reset-vectors (latter only if you      *
  8. *                really want to)                                           *
  9. *              - looks out for the 'Revenge of the Lamer Exterminator'     *
  10. *              - Checks its own length to warn you against link virus      *
  11. *  Language  : A68K-Assembler,Blink from Fish 110                          *
  12. *  Bugs      :                                                             *
  13. ****************************************************************************
  14.  
  15.              SECTION BEGIN,CODE
  16.  
  17. OWNLENGTH:   EQU      1372
  18. * ^-- if you change the programme/length correct this constant
  19. EXECBASE:    EQU      $4
  20. OPENLIBRARY: EQU     -$228
  21. CLOSELIBRARY: EQU    -$19E
  22. OUTPUT:      EQU     -$3C
  23. INPUT:       EQU     -$36
  24. OPEN:        EQU     -$1E
  25. CLOSE:       EQU     -$24
  26. WRITE:       EQU     -$30
  27. READ:        EQU     -$2A
  28. EXAMINE:     EQU     -$66
  29. LOCK:        EQU     -$54
  30. UNLOCK:      EQU     -$5A
  31. CSI:         EQU      $9B
  32. SHAREDLOCK:  EQU     -$2
  33. MODE_READWRITE: EQU    1005
  34.  
  35. * OPENLIB    LibName,LibBase,Errorlabel
  36. OPENLIB:     MACRO
  37.              lea      \1,a1
  38.              moveq    #0,d0
  39.              jsr      OPENLIBRARY(a6)
  40.              move.l   d0,\2
  41.              beq      \3
  42.              ENDM
  43. * CLOSELIB   LibBase
  44. CLOSELIB:    MACRO
  45.              move.l   \1,a1
  46.              jsr      CLOSELIBRARY(a6)
  47.              ENDM
  48. * PRINT      BufferPtr,length
  49. PRINT:       MACRO
  50.              move.l   Outhandle,d1
  51.              move.l   \1,d2
  52.              move.l   \2,d3
  53.              jsr      WRITE(a5)
  54.              ENDM
  55. * ASK        noLabel
  56. ASK:         MACRO
  57.              move.l   Inhandle,d1
  58.              move.l   #Buffer,d2
  59.              move.l   #2,d3
  60.              jsr      READ(a5)
  61.              cmp.b    #2,d0
  62.              bne      \1
  63.              move.b   #'y',d0
  64.              cmp.b    Buffer,d0
  65.              bne      \1
  66.              ENDM
  67.  
  68. * Initialize variables
  69. Begin:       move.l   EXECBASE,a6
  70.              OPENLIB  Dosname,Dosbase,End
  71.              move.l   Dosbase,a5
  72.              jsr      INPUT(a5)
  73.              move.l   d0,Inhandle
  74.              beq      CloseDOS
  75.              jsr      OUTPUT(a5)
  76.              move.l   d0,Outhandle
  77.              beq      CloseDOS
  78.              PRINT    #Headline,#65
  79.  
  80. * PART I
  81. * Displays and deletes reset-vectors
  82. Vectors:     lea      firsta0,a0
  83.              lea      VecOffset,a1
  84.              moveq    #5,d0
  85. * fetch reset vectors and turn them into a
  86. * sedidecimal number
  87. VecLoop:     move.w   (a1)+,d1
  88.              move.l   0(a6,d1.w),d2
  89.              beq.s    zero
  90.              move.b   #1,Used
  91. zero:        move.l   #7,d3
  92. HexLoop:     rol.l    #4,d2
  93.              move.b   d2,d4
  94.              and.b    #$f,d4
  95.              cmp.b    #9,d4
  96.              ble.s    noadd
  97.              add.b    #7,d4
  98. noadd:       add.b    #48,d4
  99.              move.b   d4,(a0)+
  100.              dbf      d3,HexLoop
  101.              adda.l   #33,a0
  102.              dbf      d0,VecLoop
  103. * Prints vectors and asks whether the
  104. * vectors are to be deleted (only if
  105. * they aren't already zero) or not
  106.              PRINT    #VecText,#246
  107.              move.b   Used,d0
  108.              beq      KillRLE
  109.              PRINT    #DelVecMess,#32
  110.              ASK      #KillRLE
  111.              lea      VecOffset,a1
  112.              move.l   #5,d0
  113. ZeroLoop:    move.w   (a1)+,d1
  114.              move.l   #0,0(a6,d1.w)
  115.              dbf.s    d0,ZeroLoop
  116.  
  117. * The following part checks the existence
  118. * of the 'Revenge of the Lamer Exterminator'
  119. * (=RLE)  ^              ^     ^
  120. KillRLE:     move.l   #sssName,d1
  121.              move.l   #MODE_READWRITE,d2
  122.              jsr      OPEN(a5)
  123.              move.l   d0,sssHandle
  124.              beq      openError
  125.  
  126.              move.l   sssHandle,d1
  127.              move.l   #Buffer,d2
  128.              move.l   #5,d3
  129.              jsr      READ(a5)
  130.  
  131.              lea      RLE,a0
  132.              lea      Buffer,a1
  133.              move.l   #4,d0
  134. CompareLoop: cmpm.b   (a0)+,(a1)+
  135.              bne.s    sssClose
  136.              dbf.s    d0,CompareLoop
  137.  
  138.              PRINT    #RLEMess,#95
  139.              bsr.s    sssClose
  140.              move.l   #30,d0
  141.              rts
  142.  
  143. sssClose:    move.l   sssHandle,d1
  144.              jsr      CLOSE(a5)
  145.  
  146. * Am I too long ?? Could be one of these
  147. * damned link virus
  148. CheckLength: move.l   #OwnName,d1
  149.              move.l   #SHAREDLOCK,d2
  150.              jsr      LOCK(a5)
  151.              move.l   d0,-(a7)
  152.              beq      lockError
  153.  
  154.              move.l   (a7),d1
  155.              move.l   #VecOffset,d2
  156.              jsr      EXAMINE(a5)
  157.              tst.l    d0
  158.              beq      examError
  159.  
  160.              lea      VecOffset,a0
  161.              move.l   124(a0),d0
  162.              cmp.l    #OWNLENGTH,d0
  163.              beq      UnLockMe
  164.              PRINT    #LinkVirMess,#57
  165. UnLockMe:    move.l   (a7)+,d1
  166.              jsr      UNLOCK(a5)
  167.  
  168. * A happy end, but not for the virus-community
  169. CloseDOS:    CLOSELIB Dosbase
  170. End:         move.l   #0,d0
  171.              rts
  172.  
  173. * Error-handle routines
  174. openError:   PRINT    #openErrMess,#29
  175.              bra      CheckLength
  176. lockError:   PRINT    #lockErrMess,#26
  177.              move.l   (a7)+,d1
  178.              bra      CloseDOS
  179. examError:   PRINT    #lockErrMess,#26
  180.              bra      UnLockMe
  181.  
  182.              SECTION  VARS,BSS
  183.              even
  184. Dosbase:     ds.l     1
  185. Outhandle:   ds.l     1
  186. Inhandle:    ds.l     1
  187. sssHandle:   ds.l     1
  188. Buffer:      ds.b     5
  189. Used:        ds.b     1
  190.  
  191.              SECTION  CONST,DATA
  192.              even
  193. Dosname:     dc.b     'dos.library',0
  194.              even
  195.  
  196. VecOffset:   dc.w     42,46,50,546,550,554
  197. VecText:     dc.b     CSI,'1;33;40mColdCapture  ',CSI,'0;31;40m$'
  198. firsta0:     dc.b     '00000000',10
  199.              dc.b     CSI,'1;33;40mCoolCapture  ',CSI,'0;31;40m$00000000',10
  200.              dc.b     CSI,'1;33;40mWarmCapture  ',CSI,'0;31;40m$00000000',10
  201.              dc.b     CSI,'1;33;40mKickMemPtr   ',CSI,'0;31;40m$00000000',10
  202.              dc.b     CSI,'1;33;40mKickTagPtr   ',CSI,'0;31;40m$00000000',10
  203.              dc.b     CSI,'1;33;40mKickCheckSum ',CSI,'0;31;40m$00000000',10
  204. Headline:    dc.b     CSI,'3;32;40mJAFVK V3.00 by Jörg Sixt (c) by s.a.s. in 1990',CSI,'0;33;40m',10
  205. DelVecMess:  dc.b     'Shall I delete the vectors?(y/n)'
  206. sssName:     dc.b     'S:Startup-Sequence',0
  207. RLE:         dc.b     $A0,$A0,$A0,$A0,$A0,0
  208. RLEMess:     dc.b     'This Disk is infected with the "Revenge of the',10
  209.              dc.b     'Lamer Exterminator". Use "KillRLE" to kill him.',10
  210. OwnName:     dc.b     'C:JAFVK',0
  211. LinkVirMess: dc.b     'I`ve grown larger!!',10
  212.              dc.b     'I may be infected with a link virus.',10
  213. openErrMess: dc.b     'Can`t open startup-sequence!',10
  214. lockErrMess: dc.b     'Can`t determine my length',10
  215.              END
  216.