diff options
-rw-r--r-- | unprotbas.1 | 16 | ||||
-rw-r--r-- | unprotbas.c | 15 | ||||
-rw-r--r-- | unprotbas.rst | 18 |
3 files changed, 39 insertions, 10 deletions
diff --git a/unprotbas.1 b/unprotbas.1 index de1f947..4d381b2 100644 --- a/unprotbas.1 +++ b/unprotbas.1 @@ -27,17 +27,18 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "UNPROTBAS" 1 "2024-05-23" "0.2.1" "Urchlay's Atari 8-bit Tools" +.TH "UNPROTBAS" 1 "2024-05-24" "0.2.1" "Urchlay's Atari 8-bit Tools" .SH NAME -unprotbas \- Unprotect LIST-protected Atari 8-bit BASIC programs +unprotbas \- Unprotect or create LIST-protected Atari 8-bit BASIC programs .SH SYNOPSIS .sp -unprotbas [\fB\-v\fP] [\fB\-f\fP] [\fB\-n\fP] [\fB\-g\fP] [\fB\-c\fP] [\fB\-r\fP | \fB\-w\fP] \fBinput\-file\fP \fBoutput\-file\fP +unprotbas [\fB\-v\fP] [ [\fB\-f\fP] [\fB\-n\fP] [\fB\-g\fP] [\fB\-c\fP] [\fB\-r\fP | \fB\-w\fP] ] | [ [\fB\-p\fP | \fB\-pc\fP | \fB\-pv\fP] ] \fBinput\-file\fP \fBoutput\-file\fP .SH DESCRIPTION .sp \fBunprotbas\fP modifies a LIST\-protected Atari 8\-bit BASIC program, creating a new non\-protected copy. See \fBDETAILS\fP, below, to -understand how the protection and unprotection works. +understand how the protection and unprotection works. It\(aqs also capable +of LIST\-protecting an unprotected program. .sp \fBinput\-file\fP must be a tokenized (SAVEd) Atari BASIC program. Use \fI\-\fP to read from standard input. @@ -84,6 +85,13 @@ generating new ones. See \fBVARIABLE NAMES\fP, below. .B \fB\-r\fP Read variable names from \fBvarnames.txt\fP, and use them instead of generating the names. See \fBVARIABLE NAMES\fP, below. +.TP +.B \fB\-p\fP, \fB\-pc\fP, \fB\-pv\fP +LIST\-protect the program, rather than unprotecting it. \fB\-pc\fP sets +an invalid (0) next\-line pointer on the last line of code. \fB\-pv\fP +replaces the variable names with the Atari EOL character (\fB$9B\fP). +\fB\-p\fP does both. None of the other options except \fB\-v\fP (verbose) +can be used with these. .UNINDENT .SH EXIT STATUS .INDENT 0.0 diff --git a/unprotbas.c b/unprotbas.c index 8540e6a..a95e9a6 100644 --- a/unprotbas.c +++ b/unprotbas.c @@ -239,7 +239,8 @@ void breakcode(void) { } data[oldpos + 2] = 0; - fprintf(stderr, "set invalid line pointer at line %d\n", lineno); + if(verbose) + fprintf(stderr, "set invalid line length 0 at line %d, file offset %04x\n", lineno, oldpos + 2); } /* sometimes the variable name table isn't large enough to hold @@ -579,6 +580,9 @@ void scramble_vars(void) { for(i = vnstart; i < vvstart - 1; i++) data[i] = '\x9b'; + + if(verbose) + fprintf(stderr, "replaced %d byte variable name table with EOLs.\n", i); } void print_help(void) { @@ -704,6 +708,15 @@ int main(int argc, char **argv) { if(lomem) die("This doesn't look like an Atari BASIC program (no $0000 signature)"); if(protect_code || protect_vars) { + if(verbose) { + fprintf(stderr, "%s: protecting program, ", self); + if(protect_vars && !protect_code) + fprintf(stderr, "variables only.\n"); + else if(protect_code && !protect_vars) + fprintf(stderr, "code only.\n"); + else + fprintf(stderr, "both code and variables.\n"); + } if(protect_vars) scramble_vars(); if(protect_code) breakcode(); } else { diff --git a/unprotbas.rst b/unprotbas.rst index cd55dd8..138b228 100644 --- a/unprotbas.rst +++ b/unprotbas.rst @@ -2,23 +2,24 @@ unprotbas ========= ---------------------------------------------------- -Unprotect LIST-protected Atari 8-bit BASIC programs ---------------------------------------------------- +------------------------------------------------------------- +Unprotect or create LIST-protected Atari 8-bit BASIC programs +------------------------------------------------------------- .. include:: manhdr.rst SYNOPSIS ======== -unprotbas [**-v**] [**-f**] [**-n**] [**-g**] [**-c**] [**-r** | **-w**] **input-file** **output-file** +unprotbas [**-v**] [ [**-f**] [**-n**] [**-g**] [**-c**] [**-r** | **-w**] ] | [ [**-p** | **-pc** | **-pv**] ] **input-file** **output-file** DESCRIPTION =========== **unprotbas** modifies a LIST-protected Atari 8-bit BASIC program, creating a new non-protected copy. See **DETAILS**, below, to -understand how the protection and unprotection works. +understand how the protection and unprotection works. It's also capable +of LIST-protecting an unprotected program. **input-file** must be a tokenized (SAVEd) Atari BASIC program. Use *-* to read from standard input. @@ -67,6 +68,13 @@ will be treated as options. Read variable names from **varnames.txt**, and use them instead of generating the names. See **VARIABLE NAMES**, below. +**-p**, **-pc**, **-pv** + LIST-protect the program, rather than unprotecting it. **-pc** sets + an invalid (0) next-line pointer on the last line of code. **-pv** + replaces the variable names with the Atari EOL character (**$9B**). + **-p** does both. None of the other options except **-v** (verbose) + can be used with these. + EXIT STATUS =========== |