aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bas.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/bas.c b/bas.c
index 94ba310..5321070 100644
--- a/bas.c
+++ b/bas.c
@@ -103,6 +103,8 @@ void dump_header_vars(void) {
}
void parse_header(void) {
+ int vntp_offset;
+
lomem = getword(0);
vntp = getword(2);
vntd = getword(4);
@@ -110,11 +112,20 @@ void parse_header(void) {
stmtab = getword(8);
stmcur = getword(10);
starp = getword(12);
+
codestart = stmtab - TBL_OFFSET - (vntp - 256);
vnstart = vntp - TBL_OFFSET;
vvstart = vvtp - TBL_OFFSET;
code_end = starp - TBL_OFFSET;
+ if(vnstart > 0x0e) {
+ if(verbose)
+ fprintf(stderr, "VNTP is $%02x (not ($100), adjusting pointers.\n", vntp);
+ vntp_offset = vnstart - 0x0e;
+ vnstart -= vntp_offset;
+ vvstart -= vntp_offset;
+ }
+
if(filelen < code_end) {
fprintf(stderr, "Warning: file is truncated: %d bytes, should be %d.\n", filelen, code_end);
}