diff options
author | B. Watson <urchlay@slackware.uk> | 2024-05-16 05:46:44 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-05-16 05:46:44 -0400 |
commit | 97142cb95b19c4b07a721a0b449c308b04d64e58 (patch) | |
tree | 1804885c6649ce110489875752b4b36d62cad70d | |
parent | 82538a0230ff580c1ba251e8756c881380585587 (diff) | |
download | bw-atari8-tools-97142cb95b19c4b07a721a0b449c308b04d64e58.tar.gz |
blob2xex: warn on address wraparound.
-rw-r--r-- | blob2xex.1 | 38 | ||||
-rw-r--r-- | blob2xex.c | 9 | ||||
-rw-r--r-- | blob2xex.rst | 34 |
3 files changed, 68 insertions, 13 deletions
@@ -117,14 +117,40 @@ Print version number and exit. .sp Error messages and warnings are printed to standard error, and are hopefully self\-explanatory. Any message containing \fIfatal\fP causes -\fBblob2xex\fP to exit without creating the output file. +\fBblob2xex\fP to exit with nonzero status, without creating the output +file. .sp Messages containing \fIwarning\fP are non\-fatal, and the output file is -created. The only warning messages are there to let you know if your -\&.xex file\(aqs start/end addresses mean it would load into ROM (or, the -unmapped area at \fB$C000\fP on a 400/800). Normally this means the .xex -file won\(aqt load properly on the Atari, but feel free to ignore the -warnings if you know exactly what you\(aqre doing. +created. There are only a few possible warnings: +.INDENT 0.0 +.INDENT 3.5 +.INDENT 0.0 +.TP +.B start/end address XXXX loads into ROM. +This means your .exe file\(aqs start/end addresses will load the +file into ROM (or the unmapped area at \fB$C000\fP on a 400/800). +Normally this means the .xex file won\(aqt load properly on the +Atari, but feel free to ignore this warning if you know exactly +what you\(aqre doing. +.TP +.B address would exceed $FFFF! truncated N bytes to N. +The segment would wrap around the Atari\(aqs 64KB address space. +\fBblob2xex\fP has truncated the input so the last address +loaded is \fB$FFFF\fP\&. This warning usually means you gave the +wrong load address or the wrong input file entirely. +.TP +.B extra arguments after last input file ignored. +You gave at least one option that would affect the next file, +after the last file on the command line. Such options are ignored, +since there\(aqs no file for them to apply to. Probably you made +a typo or forgot the last input file. +.UNINDENT +.UNINDENT +.UNINDENT +.SH EXIT STATUS +.sp +Zero for success (the output file was created), even if there were +warnings. Non\-zero for failure (the output file wasn\(aqt created). .SH EXAMPLES .SS Simple Example .sp @@ -99,8 +99,12 @@ int write_segment( } /* make sure we don't wrap the Atari's address space. */ - if(size + loadaddr > 0xffff) + if(size + loadaddr > 0xffff) { + int oldsize = size; size = (size - loadaddr) + 1; + fprintf(stderr, SELF ": " + "warning: %s: address would exceed $FFFF! truncated %d bytes to %d.\n", infile, oldsize, size); + } /* read <size> bytes, or until EOF (which is not an error) */ while(size) { @@ -209,6 +213,7 @@ int main(int argc, char **argv) { if( (bytes = write_segment(infile, outfile, loadaddr, initaddr, offset, size)) ) { segcount++; loadaddr += bytes; + loadaddr %= 0xffff; } else { segcount = 0; break; @@ -245,6 +250,8 @@ int main(int argc, char **argv) { fprintf(stderr, SELF ": read %d input files, wrote %d segments to %s.\n", incount, segcount, outfile); } else { + if(xex_verbose) + fprintf(stderr, SELF ": no output file created, due to fatal error.\n"); unlink(outfile); return 1; } diff --git a/blob2xex.rst b/blob2xex.rst index a3161ab..9984b2b 100644 --- a/blob2xex.rst +++ b/blob2xex.rst @@ -97,14 +97,36 @@ DIAGNOSTICS Error messages and warnings are printed to standard error, and are hopefully self-explanatory. Any message containing *fatal* causes -**blob2xex** to exit without creating the output file. +**blob2xex** to exit with nonzero status, without creating the output +file. Messages containing *warning* are non-fatal, and the output file is -created. The only warning messages are there to let you know if your -.xex file's start/end addresses mean it would load into ROM (or, the -unmapped area at **$C000** on a 400/800). Normally this means the .xex -file won't load properly on the Atari, but feel free to ignore the -warnings if you know exactly what you're doing. +created. There are only a few possible warnings: + + start/end address XXXX loads into ROM. + This means your .exe file's start/end addresses will load the + file into ROM (or the unmapped area at **$C000** on a 400/800). + Normally this means the .xex file won't load properly on the + Atari, but feel free to ignore this warning if you know exactly + what you're doing. + + address would exceed $FFFF! truncated N bytes to N. + The segment would wrap around the Atari's 64KB address space. + **blob2xex** has truncated the input so the last address + loaded is **$FFFF**. This warning usually means you gave the + wrong load address or the wrong input file entirely. + + extra arguments after last input file ignored. + You gave at least one option that would affect the next file, + after the last file on the command line. Such options are ignored, + since there's no file for them to apply to. Probably you made + a typo or forgot the last input file. + +EXIT STATUS +=========== + +Zero for success (the output file was created), even if there were +warnings. Non-zero for failure (the output file wasn't created). EXAMPLES ======== |