home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 167 / NOCOPY.ZIP / NOCOPY.ASM next >
Assembly Source File  |  1986-10-11  |  5KB  |  109 lines

  1. ;NOCOPY.ASM - utility to prevent DISKCOPY from copying a diskette
  2. ;           - use in conjunction with PREVENT.ASM program
  3. ;<c> 1986 by Debbie Cooper
  4. stacksg segment para 'stack'
  5.         db      512 dup(?)
  6. stacksg ends
  7. datasg  segment para 'data'
  8. base    db      0dfh            ;step-rate time
  9.         db      2               ;dma mode
  10.         db      25h             ;how long disk motor should run
  11.         db      2               ;1=256, 2=512, etc (bytes per sector)
  12.         db      9               ;last sector number is 9
  13.         db      2ah             ;gap length normally 2ah
  14.         db      0ffh            ;data transfer length
  15.         db      50h             ;gap length for format
  16.         db      0f6h            ;fill byte
  17.         db      19h             ;head settle time
  18.         db      2               ;motor speed time
  19. addr    db      39,0,1,2        ;sector address data
  20.         db      39,0,2,2
  21.         db      39,0,3,2
  22.         db      39,0,4,2
  23.         db      39,0,5,2
  24.         db      39,0,6,2
  25.         db      39,0,11,2
  26.         db      39,0,8,2
  27.         db      39,0,9,2
  28. secret  db      'Debbie Cooper',499 dup(' ')
  29. buffer  db      512 dup(' ')
  30. oldvec  dw      ?               ;used to save the original
  31. oldseg  dw      ?               ;disk parameter vector address
  32. count   db      0               ;counter for disk tries
  33. msg     db      0dh,0ah,'NOCOPY - A utility to prevent DISKCOPY DOS function'
  34.         db      0dh,0ah,'<c> 1986 by Debbie Cooper'
  35.         db      0dh,0ah,0dh,0ah
  36.         db      'Insert diskette to be made un-copyable in Drive A'
  37.         db      0dh,0ah,'Press <ENTER> when ready to format'
  38.         db      0dh,0ah,'or <A> to abort program','$'
  39. msg2    db      0dh,0ah,'Diskette in Drive A has been copy-protected','$'
  40. datasg  ends
  41. codesg  segment para 'code'
  42.         assume  cs:codesg,ds:datasg,ss:stacksg,es:datasg
  43.         push    ds              ;set
  44.         xor     ax,ax           ;up
  45.         push    ax              ;return
  46. start:  mov     ax,datasg       ;to
  47.         mov     ds,ax           ;dos for
  48.         mov     es,ax           ;later
  49. begin:  lea     dx,msg          ;copyright,etc message
  50.         mov     ah,09h          ;display function
  51.         int     21h             ;call dos
  52. inkey:  mov     ah,00h          ;wait for keystroke
  53.         int     16h             ;call bios
  54.         cmp     al,0dh          ;was ENTER pressed?
  55.         je      doit            ;go if so
  56.         and     al,5fh          ;else convert to uppercase
  57.         cmp     al,'A'          ;was function aborted?
  58.         je      done1           ;go abort program then
  59.         jmp     inkey           ;else invalid selection so go back
  60. doit:   mov     al,1eh          ;vector 1eh
  61.         mov     ah,35h          ;get vector function
  62.         int     21h             ;call dos
  63.         mov     oldvec,bx       ;save the old
  64.         mov     oldseg,es       ;1eh vector address
  65.         mov     al,1eh          ;vector 1eh
  66.         mov     ah,25h          ;set vector function
  67.         lea     dx,base         ;set up pointer
  68.         int     21h             ;call dos
  69.         mov     count,3         ;set up counter for number of tries
  70. format: push    ds              ;get address of DS segment
  71.         pop     es              ;into ES so we can address it
  72.         lea     bx,addr         ;point to formatting parameters
  73.         mov     dx,0            ;drive 0,side 0
  74.         mov     ch,39           ;track number
  75.         mov     ah,05h          ;format function
  76.         int     13h             ;call bios
  77.         jnc     ok              ;go if no error occurred
  78.         dec     count           ;try three times
  79.         jne     format          ;go
  80.         jmp     done            ;did not format
  81. ok:     mov     count,3         ;reset this for 3 tries
  82. write:  push    ds              ;get address of DS segment
  83.         pop     es              ;set up buffer pointer
  84.         lea     bx,secret       ;date to write to our disk for protecting
  85.         mov     dx,0            ;drive 0, side 0
  86.         mov     ch,39           ;track 39
  87.         mov     cl,8            ;sector number
  88.         mov     al,1            ;number of sectors
  89.         mov     ah,3            ;write function
  90.         int     13h             ;call bios
  91.         jnc     done            ;write ok
  92.         dec     count           ;adjust our counter
  93.         jne     write           ;try 3 times
  94. done:   mov     dx,oldvec       ;get the old 1eh vector
  95.         mov     ds,oldseg       ;addresses to restore original
  96.         mov     al,1eh          ;reset 1eh vector
  97.         mov     ah,25h          ;set vector function
  98.         int     21h             ;call dos
  99.         push    es              ;set up DS segment
  100.         pop     ds              ;so we can display message
  101.         lea     dx,msg2         ;copy-protected message
  102.         mov     ah,09h          ;display function
  103.         int     21h             ;call dos
  104. done1:  mov     ah,4ch          ;terminate program function to
  105.         int     21h             ;return to DOS
  106. codesg  ends                    ;end of code segment
  107.         end     start           ;the end!
  108.  
  109.