One way was to place an in-line reboot command into the actual listing.
Apple II DOS had a feature that would monitor the output stream and, if it found a special character output at the start of a line, the rest of the line would be treated as a command. This character was Ctrl+D, meaning you could get a disk listing from your program with something like:
PRINT CHR$(4);"CATALOG"
You could also use the slot activation command IN#6 which would generally reboot the machine, assuming your disk controller was in slot 6 (it usually was).
But, of course, that would only work with a print command if you were running your program. For protecting against someone listing it, an extra layer of trickery was required.
To do this, you would create a line at the start of your program:
10 REM XXIN#6
and then use POKE commands to change the XX into a Ctrl+M (to start a new line) and Ctrl+D (to flag a command), before saving.
After that, an attempt to LIST the program would result in the machine rebooting. So this is probably something you wanted to do once development was done, just before shipping :-)
In order to bypass it, it's a simple matter of working out the errant line and just deleting it. In the case above, that would be achieved by just entering the stand-alone:
10
on the command line and, voila, the program is unprotected. To stop this, some developers started numbering the programs with less "normal" line numbers such as 2718. However, since the line numbers are stored in memory as well, you could PEEK at the program to work out what the first line number was, and then delete that one.
:PR#0with a colon before it to ensure it's processed as a BASIC command rather than a DOS one. – supercat Nov 23 '18 at 02:56chr$(13)- have adjusted the answer to incorporate this information. – Nov 26 '18 at 02:00