aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--unprotbas.122
-rw-r--r--unprotbas.rst20
2 files changed, 31 insertions, 11 deletions
diff --git a/unprotbas.1 b/unprotbas.1
index 7149414..8719710 100644
--- a/unprotbas.1
+++ b/unprotbas.1
@@ -27,7 +27,7 @@ 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-26" "0.2.1" "Urchlay's Atari 8-bit Tools"
+.TH "UNPROTBAS" 1 "2024-05-28" "0.2.1" "Urchlay's Atari 8-bit Tools"
.SH NAME
unprotbas \- Unprotect or create LIST-protected Atari 8-bit BASIC programs
.SH SYNOPSIS
@@ -201,8 +201,8 @@ prevents LIST, it actually prevents any immediate mode command:
after LOADing such a file, \fInothing\fP will work (even pressing RESET
won\(aqt get you out of it). The only way to use such a program is to
use the RUN command with a filename, and if the program ever exits
-(due to END, STOP, an error, or the Break key), BASIC will get stuck
-again.
+(due to END, STOP, an error, Break key, or even System Reset), BASIC
+will get stuck again.
.sp
This doesn\(aqt \fIhave\fP to be done with the last line in the
program. The "poisoned" line could be followed by more lines of
@@ -212,9 +212,16 @@ Line 32100 in the example above does this job, taking advantage of
the STMCUR pointer used by BASIC, which holds the address of the
line of tokenized code currently being executed.
.sp
-\fBunprotbas\fP fixes this simply by calculating what the pointer
-should be (based on the tokens in the line) and changing it. No
-information is lost by doing this.
+Each statement in the line also has a statement\-length byte. For
+lines with only one statement, its value is the same as the line
+length. For lines with multiple statements (separated by \fI:\fP), it\(aqs
+a pointer to the next statement, counting from the start of the
+current line. For the last statement on a line, it\(aqs a pointer to
+the next line of code, meaning it\(aqs identical to the line length.
+.sp
+\fBunprotbas\fP fixes bad line lengths by setting the line length to
+the statement length of the last statement. No information is lost
+by doing this.
.sp
The program \fBUNPROTEC\fP, from the \fIPirate\(aqs Treasure Chest\fP, can
fix bad pointers in protected programs, though it doesn\(aqt do
@@ -255,6 +262,9 @@ The first 26 array variables will be \fIA(\fP to \fIZ(\fP, then \fIA1(\fP to
.UNINDENT
.UNINDENT
.sp
+Note that array variables have only the \fI(\fP as part of the name. The
+closing \fI)\fP is "cosmetic" and not part of the actual name.
+.sp
To properly reverse\-engineer the protected program, it\(aqs necessary to assign
meaningful variable names. \fBunprotbas\fP isn\(aqt smart enough to do this for you,
but it can semi\-automate the process.
diff --git a/unprotbas.rst b/unprotbas.rst
index 9a9a47d..d0ba0dc 100644
--- a/unprotbas.rst
+++ b/unprotbas.rst
@@ -175,8 +175,8 @@ Bad next-line pointer
after LOADing such a file, *nothing* will work (even pressing RESET
won't get you out of it). The only way to use such a program is to
use the RUN command with a filename, and if the program ever exits
- (due to END, STOP, an error, or the Break key), BASIC will get stuck
- again.
+ (due to END, STOP, an error, Break key, or even System Reset), BASIC
+ will get stuck again.
This doesn't *have* to be done with the last line in the
program. The "poisoned" line could be followed by more lines of
@@ -186,9 +186,16 @@ Bad next-line pointer
the STMCUR pointer used by BASIC, which holds the address of the
line of tokenized code currently being executed.
- **unprotbas** fixes this simply by calculating what the pointer
- should be (based on the tokens in the line) and changing it. No
- information is lost by doing this.
+ Each statement in the line also has a statement-length byte. For
+ lines with only one statement, its value is the same as the line
+ length. For lines with multiple statements (separated by *:*), it's
+ a pointer to the next statement, counting from the start of the
+ current line. For the last statement on a line, it's a pointer to
+ the next line of code, meaning it's identical to the line length.
+
+ **unprotbas** fixes bad line lengths by setting the line length to
+ the statement length of the last statement. No information is lost
+ by doing this.
The program **UNPROTEC**, from the *Pirate's Treasure Chest*, can
fix bad pointers in protected programs, though it doesn't do
@@ -227,6 +234,9 @@ longer exist. **unprotbas** will generate them, according to these rules:
The first 26 array variables will be *A(* to *Z(*, then *A1(* to
*A9(*, *B1(* to *B9(*, etc.
+Note that array variables have only the *(* as part of the name. The
+closing *)* is "cosmetic" and not part of the actual name.
+
To properly reverse-engineer the protected program, it's necessary to assign
meaningful variable names. **unprotbas** isn't smart enough to do this for you,
but it can semi-automate the process.