aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-05-24 15:06:18 -0400
committerB. Watson <urchlay@slackware.uk>2024-05-24 15:06:18 -0400
commit70299a6c57e6eaf95f15543e5c360de05aa64b62 (patch)
treeba2fd364fa33d1bca2faf52de4b3d9b967fb4e23
parenta095768910dde7a8581aa018eceef5f2f899d1fa (diff)
downloadbw-atari8-tools-70299a6c57e6eaf95f15543e5c360de05aa64b62.tar.gz
unprotbas: error if -pv and already var-protected.
-rw-r--r--unprotbas.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/unprotbas.c b/unprotbas.c
index cfdcf75..acbbecf 100644
--- a/unprotbas.c
+++ b/unprotbas.c
@@ -159,10 +159,8 @@ int fixline(int linepos) {
/* this works for lines with multiple statements (colons): */
while(!done) {
- fprintf(stderr, "offset was %02x\n", offset);
offset = data[linepos + offset];
token = data[linepos + offset - 1];
- fprintf(stderr, "offset %02x token %02x\n", offset, token);
if(token != 0x14)
done++;
}
@@ -171,7 +169,6 @@ int fixline(int linepos) {
next-statement offset. */
if(!offset) {
offset = data[linepos + 3];
- fprintf(stderr, "offset now %02x\n", offset);
}
data[linepos + 2] = offset;
@@ -196,7 +193,7 @@ int fixcode(void) {
offset = data[pos + 2];
/* fprintf(stderr, "pos %d, line #%d, offset %d\n", pos, lineno, offset); */
if(offset < 6) {
- if(verbose) fprintf(stderr, "Found invalid offset %d (<6) at line %d\n", offset, lineno);
+ if(verbose) fprintf(stderr, "Found invalid offset %d (<6) at line %d, file offset %04x\n", offset, lineno, pos);
offset += fixline(pos);
result++;
}
@@ -584,6 +581,11 @@ void apply_var_map(void) {
void scramble_vars(void) {
int i;
+ if(!vntable_ok()) {
+ fprintf(stderr, "%s: program already was variable-protected.\n", self);
+ exit(2);
+ }
+
for(i = vnstart; i < vvstart - 1; i++)
data[i] = '\x9b';