home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / SOURCE.ZIP / SURVIVE.ASM < prev    next >
Assembly Source File  |  1992-11-07  |  5KB  |  227 lines

  1.  
  2. ; Survive a warm reboot on a XT.
  3. ;
  4. ; Compile under Turbo Assembler 2.5
  5. ; This program works on a generic IBM PC/XT
  6.  
  7.  
  8.         .model  tiny
  9.         .radix  16
  10.         .code
  11.  
  12.         org     100
  13.  
  14. start:
  15.         jmp     init
  16.  
  17. handler:
  18.         push    ds
  19.         push    ax
  20.         xor     ax,ax
  21.         mov     ds,ax
  22.         mov     al,ds:[417]
  23.         and     al,0c
  24.         cmp     al,0c
  25.         jnz     no_ctrl_alt
  26.         in      al,[60]
  27.         cmp     al,53
  28.         jz      now_fuck
  29. no_ctrl_alt:
  30.         pop     ax
  31.         pop     ds
  32.         db      0ea
  33. oldvect dd      ?
  34. now_fuck:
  35.         mov     ds:[472],1234
  36.         mov     ax,ds:[413]
  37.         mov     cx,6
  38.         shl     ax,cl
  39.         push    ax
  40.         mov     es,ax
  41.         mov     di,offset handler
  42.         push    cs
  43.         pop     ds
  44.         mov     si,di
  45.         repz    cmpsw
  46.         jnz     new_move
  47.         mov     dl,es:[top_seg]
  48.         pop     ax
  49.         jmp     short set_segm
  50. new_move:
  51.         mov     al,ah
  52.         cmp     al,0a0
  53.         jnc     set_top
  54.         mov     al,0a0
  55. set_top:
  56.         xchg    ax,dx
  57.         pop     ax
  58.         sub     ax,1000
  59. set_segm:
  60.         mov     cs:[top_seg],dl
  61.         push    ax
  62.         mov     es,ax
  63.         mov     di,0e000
  64.         mov     ax,0f000
  65.         mov     ds,ax
  66.         mov     si,di
  67.         mov     cx,1000
  68.         cld
  69.         rep     movsw
  70.         cmp     byte ptr [si-10],0ea
  71.         jnz     cant_fuck
  72.         cmp     [si-0dh],0f000
  73.         jnz     cant_fuck
  74.         mov     di,[si-0f]
  75.         cmp     di,0e000
  76.         jc      cant_fuck
  77.         mov     al,[di]
  78.         cmp     al,0e9
  79.         jnz     no_jmp
  80.         add     di,[di+1]
  81.         add     di,3
  82. no_jmp:
  83.         push    di
  84.         mov     cx,800
  85.         call    protect_ram
  86.         call    replace_ints
  87.         push    es
  88.         pop     ds
  89.         mov     bx,0e000
  90.         mov     cx,2000
  91.         xor     al,al
  92. check_lup:
  93.         add     al,[bx]
  94.         inc     bx
  95.         loop    check_lup
  96.         neg     al
  97.         mov     [di-1],al
  98.         push    cs
  99.         pop     ds
  100.         mov     word ptr ds:[tmp_handler],5ebh
  101.         mov     si,offset start
  102.         mov     di,si
  103.         mov     cx,init-start
  104.         rep     movsb
  105.         retf
  106. cant_fuck:
  107.         db      0ea
  108.         dw      0
  109.         dw      0ffff
  110.  
  111. protect_ram:
  112.         jcxz    cant_fuck
  113.         mov     al,80
  114.         repnz   scasb
  115.         jnz     protect_ram
  116.         mov     ax,[di]
  117.         and     al,0f8
  118.         cmp     al,0f8
  119.         jnz     protect_ram
  120.         cmp     ah,dl
  121.         jnz     protect_ram
  122.         mov     ax,es
  123.         mov     es:[di+1],ah
  124.         ret
  125.  
  126. top_seg db      ?
  127.  
  128. replace_ints:
  129.         jcxz    cant_fuck
  130.         mov     al,0a5
  131.         repnz   scasb
  132.         jnz     replace_ints
  133.         cmp     [di],4747
  134.         jnz     replace_ints
  135.         cmp     [di+2],0fbe2
  136.         jnz     replace_ints
  137.         add     di,4
  138.         push    cs
  139.         pop     ds
  140.         mov     [dummy],di
  141.         mov     si,offset my_piece
  142.         mov     cx,my_top-my_piece
  143.         rep     movsb
  144. exit_prn:
  145.         ret
  146.  
  147. my_piece:
  148.         push    ax
  149.         mov     cx,20
  150.         xor     di,di
  151. re_init:
  152.         scasw
  153.         mov     ax,0f000
  154.         stosw
  155.         loop    re_init
  156.         mov     ax,offset tmp_handler
  157.         xchg    ax,es:[di+44-80]
  158.         mov     cs:[old_tmp],ax
  159.         mov     ax,cs
  160.         xchg    ax,es:[di+46-80]
  161.         mov     cs:[old_tmp+2],ax
  162.         pop     ax
  163.         db      0ea
  164. dummy   dw      ?
  165.         dw      0f000
  166.         db      0
  167. my_top:
  168.  
  169. print:
  170.         mov     si,offset message
  171. print_msg:
  172.         lodsb
  173.         cmp     al,'$'
  174.         jz      exit_prn
  175.         mov     ah,0e
  176.         int     10
  177.         jmp     print_msg
  178.  
  179. tmp_handler:
  180.         jmp     $
  181. go_old:
  182.         db      0ea
  183. old_tmp dw      ?
  184.         dw      ?
  185.         push    ds
  186.         push    si
  187.         push    ax
  188.         xor     ax,ax
  189.         mov     ds,ax
  190.         mov     ax,offset handler
  191.         xchg    ax,ds:[24]
  192.         mov     word ptr cs:[oldvect],ax
  193.         mov     ax,cs
  194.         xchg    ax,ds:[26]
  195.         mov     word ptr cs:[oldvect+2],ax
  196.         push    cs
  197.         pop     ds
  198.         mov     word ptr [tmp_handler],9090
  199.         call    print
  200.         pop     ax
  201.         pop     si
  202.         pop     ds
  203.         jmp     go_old
  204.  
  205. message:
  206.         db      'Never ending story...',0dh,0a,'$'
  207.  
  208. init:
  209.         mov     ax,3509
  210.         int     21
  211.         mov     word ptr [oldvect],bx
  212.         mov     word ptr [oldvect+2],es
  213.         mov     dx,offset handler
  214.         mov     ah,25
  215.         int     21
  216.         call    print
  217.         mov     dx,offset init
  218.         int     27
  219.  
  220.         end     start
  221. 
  222. ; ─────────────────────────────────────────────────────────────────────────
  223. ; ────────────────────> and Remember Don't Forget to Call <────────────────
  224. ; ────────────> ARRESTED DEVELOPMENT +31.79.426o79 H/P/A/V/AV/? <──────────
  225. ; ─────────────────────────────────────────────────────────────────────────
  226.  
  227.