aboutsummaryrefslogtreecommitdiff
path: root/blob2xex.c
diff options
context:
space:
mode:
Diffstat (limited to 'blob2xex.c')
-rw-r--r--blob2xex.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/blob2xex.c b/blob2xex.c
index 0f17371..413fb52 100644
--- a/blob2xex.c
+++ b/blob2xex.c
@@ -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;
}