Category : BASIC Source Code
Archive   : QBCP.ZIP
Filename : TESTCP.BAS

 
Output of file : TESTCP.BAS contained in archive : QBCP.ZIP

'*****************************************************************************

'Copyright (c) 1988 Marcel Madonna

'This program can be used in conjunction with QBFORMCP.BAS to provide
'rudimentary copy protection. After running QBFORMCP, insert the code
'in this program at the beginning of the program that you want copy protected.

' ********************* N O T E *************************
'
'This program cannot be used from the DOS prompt without Microsoft
'QuickBasic V4.0 and a registered copy of QBWARE.
'
'To compile it, at the DOS prompt type:

' bc qbformcp;
' link /ex /noe testcp,,,brun40 qbware;
' del testcp.obj
' del testcp.map

'To run it from the QuickBasic development environment, type:
'
' qb testcp /l qbware
' [Shift] + F5

'To execute just type "testcp" at the DOS prompt


'*****************************************************************************

CLS

PRINT "Testcp - Version 1.0 (C) Copyright 1988 AJM Software"

Drive$ = "A" 'Use the A drive
Buffer$ = SPACE$(512)
Head% = 1: Track% = 39: Sector% = 10 'Location of CP sector


' Try to read to copy protection sector.

PRINT

CALL BsdRead(Buffer$, Drive$, Head%, Track%, Sector%, Rc%)
IF Rc% = 2 OR Rc% = 4 THEN
PRINT "This disk is not copy protected!!!!"
ELSEIF Rc% <> 0 AND Rc% <> 6 THEN
GOSUB Error.Routine
ELSE
PRINT "This is the copy protected disk!!!!!!"
END IF
END


Error.Routine:
' Rc% 1 - illegal command
' 2 - sector not found
' 3 - write protect error
' 4 - bad sector
' 6 - disk drive door opened (some 1.2M drives only)
' 8 - DMA failure
' 9 - DMA overrun
' 16 - bad CRC:parity check
' 32 - controller malfunction
' 64 - seek failure
' 128 - time out

IF Rc% = 1 THEN
PRINT "Illegal command issued"
ELSEIF Rc% = 2 THEN
PRINT "Sector not found"
ELSEIF Rc% = 3 THEN
PRINT "Write protect error"
ELSEIF Rc% = 4 THEN
PRINT "Bad sector found"
ELSEIF Rc% = 6 THEN
PRINT "Don't open the drive door during a format"
ELSEIF Rc% = 8 THEN
PRINT "DMA failure"
ELSEIF Rc% = 9 THEN
PRINT "DMA overrun"
ELSEIF Rc% = 16 THEN
PRINT "Bad CRC"
ELSEIF Rc% = 32 THEN
PRINT "Controller malfunction"
ELSEIF Rc% = 64 THEN
PRINT "Seek failure"
ELSEIF Rc% = 128 THEN
PRINT "Time-out"
PRINT "Make sure the drive door is closed"
ELSE
PRINT "Error "; Rc%
END IF
RETURN

END