diff options
-rw-r--r-- | bas.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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); } |