NOTE: PROTECT WILL ONLY RUN ON A Z80 CPU. IT MUST BE ASSEMBLED WITH M80 AND LINKED WITH L80 PROTECT.MAC by Simon Ewins, Sysop EMX RCPM, Toronto, Ontario Based on: PASSWORD.ASM v3.0 by: Bo McCormick 08/06/81 Before assembling the file the following values must be set: 1: the address of the base of your CCP (=(byte 03h)-16h) 2: the 'unprotect' character you wish to use 3: the location of the access byte in memory to check 4: whether you wish to check for exact match or > match All the above are explained in detail in the source code... ------------------------------------------------------------------------ - The command line allows an ASCII value (CTL-A through the upper- case letter Z) to be passed as the level of protection for the .COM file. If a code or level that is less than an ASCII 'space' is desired, you may use a caret (^) before the ASCII character that is desired to turn it into a 'control' character. One character value is reserved as an 'unprotect' switch. In the example below CTL-Z is such a value. The the character '^' may be used as in ^^ but a space or @ or any other character less than ASCII 'A' may NOT. If you enter a single ^ as an argument an error will occur. - Syntax is: PROTECT FILENAME[.COM] ^Z <-- to 'unprotect' the file PROTECT FILENAME[.COM] 5 <-- set level to (ASCII) 5 (35 hex) PROTECT FILENAME[.COM] Q <-- set level to (ASCII) Q (51 hex) PROTECT FILENAME[.COM] ^I <-- set to (ASCII) CTR-I (9 hex) - The .COM filetype is optional as .COM will be assumed and any other filetype will generate an error exit. - This file, when run, relocates itself under the CCP and then loads the .COM file requested. The first record is moved to the end of the file and replaced with a jump at 100h to the next record at the end of the file. There a little routine reads the byte in memory that is your 'control' byte and tries to match the protection level of the file. If there is no match, a warm boot is done. If there is a match or the level of protection is less than the level of the file, then the last record is moved back to 100h and the file is executed. - Alternately you can set EXACT to TRUE and then the file will run only if the levels match exactly (none of this 'less than' stuff) - If you update this file, be careful since the relocated code uses only relative jumps and some of the ranges are at their limit now. It is possible to use 'stepping stones' to effect longer jumps eg: . . JR LABEL1 ; We want to get to label but from here to ; there is too far for a relative jump so... . . LABEL1: JR LABEL ; We jump here (halfway) and then continue to ; label . . . LABEL: ..... ; Made it! Further, any addresses that are used to load registers or call sub- routines must be of the form OFF+LABEL to maintain the relocatability of the file. If you do update this file please forward a copy to me so that I can incorporate your changes into any that I may since have made myself. Send to: EMX RCPM, Toronto, Ontario ... 416 484-9663 - Simon Ewins