home *** CD-ROM | disk | FTP | other *** search
/ Various Unprotection Examples / unprotect.zip / unprotect / STBP / STBP.ASM < prev    next >
Assembly Source File  |  1987-03-14  |  3KB  |  113 lines

  1. PAGE 64,132
  2. title    (Faking Out Star Trek's Copy Protection - Version #01)
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4. ;
  5. ;    This program was specifically designed to thwart a copy 
  6. ;    protection scheme that formatted one track with 16 sectors.  
  7. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  8. envrnmt_seg    equ    2Ch    ; pointer to program's environment segment
  9. int03loc    equ    03*04    ; vector location for int03
  10. int13loc    equ    13h*04    ; vector location for int13h
  11. ;
  12. cseg    segment 
  13.     org 100h
  14. ;
  15. bypass    proc far
  16.         assume cs:cseg,ds:cseg
  17. ;
  18.     jmp    install
  19. ;
  20.         dw    'BP'    ; flag that this program was already installed 
  21. oldint13    dd    00    ; save area for old int13 vector
  22. ;
  23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  24. newint13    equ    $
  25.     sti            ; first reenable interrupts 
  26.     pushf            ; this will get altered 
  27. ;
  28.     or    dx,dx        ; side zero on drive A: ???
  29.     jnz    intcall        ; if not don't bother 
  30.     cmp    ch,09        ; track #09 ???
  31.     jnz    intcall        ; if not don't bother 
  32.     cmp    ax,0401h    ; only verify one sector ???
  33.     jnz    intcall
  34. ;                ; looks like we have it men 
  35. ;;;    call    cs:oldint13    ; this is no longer needed 
  36.     popf
  37.     mov    ah,00        ; fake out verify operation with OK status 
  38.     clc            ; clear carry flag 
  39.     ret    02
  40. ;
  41. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  42. intcall    equ    $
  43.     popf
  44.     jmp    cs:oldint13    ; branch to normal int 13h routine 
  45. ;
  46. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  47. inst_msg    db    'Star Trek Bypass is now installed.......'
  48.         db    0Dh,0Ah,'$'
  49. deinst_msg    db    'Star Trek Bypass is now deinstalled.......'
  50.         db    0Dh,0Ah,'$'
  51. ;
  52. install    label    near        ; install and make routine resident 
  53.     xor    ax,ax        ; first get old interrupt 13h vector
  54.     mov    es,ax
  55.     mov    bx,es:word ptr int13loc
  56.     mov    ax,es:word ptr int13loc+02
  57. ;
  58.     mov    ds,ax        ; see if this program was already installed 
  59.     cmp    ds:[bx-06],'BP'
  60.     jnz    install02    ; no 
  61. ;
  62.     cli
  63.     mov    ax,ds:[bx-04]    ; restore old vector offset 
  64.     mov    es:word ptr int13loc,ax
  65.     mov    ax,ds:[bx-02]    ; restore old vector segment 
  66.     mov    es:word ptr int13loc+02,ax
  67.     sti
  68. ;
  69.     mov    ax,ds
  70.     mov    es,ax
  71.     mov    ah,49h
  72.     int    21h        ; deallocate old bypass program segment 
  73. ;
  74.     mov    ax,cs        ; bring ds back to reality 
  75.     mov    ds,ax
  76. ;
  77.     mov    dx,offset deinst_msg
  78.     mov    ah,09        ; message offset already in dx 
  79.     int    21h        ; print string 
  80. ;
  81.     mov    ah,4Ch        ; exit to DOS 
  82.     int    21h
  83. ;
  84. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  85. install02    equ    $
  86.     push    cs
  87.     pop    ds        ; restore ds
  88. ;
  89.     mov    ds:word ptr oldint13,bx
  90.     mov    ds:word ptr oldint13+02,ax
  91.     cli            ; disable interrupts 
  92.     mov    es:word ptr int13loc,offset newint13
  93.     mov    es:word ptr int13loc+02,cs
  94. ;                ; write in our new interrupt 13h vector 
  95.     sti            ; reenable interrupts 
  96. ;
  97.     mov    es,ds:word ptr envrnmt_seg
  98.     mov    ah,49h
  99.     int    21h        ; deallocate old bypass environment segment
  100. ;
  101.     mov    dx,offset inst_msg
  102.     mov    ah,09        ; Print string function
  103.     int    21h        ; Print "install" message
  104. ;                ; get rid of code after label inst_msg 
  105.     mov    dx,offset inst_msg
  106.     int    27h        ; Terminate and stay resident
  107. ;
  108. bypass    endp
  109. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  110. cseg    ends
  111.     end    bypass
  112.