aboutsummaryrefslogtreecommitdiff
path: root/xexcat.c
diff options
context:
space:
mode:
Diffstat (limited to 'xexcat.c')
-rw-r--r--xexcat.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/xexcat.c b/xexcat.c
index 46f418e..3ec45c7 100644
--- a/xexcat.c
+++ b/xexcat.c
@@ -12,7 +12,7 @@
#endif
#define SELF "xexcat"
-#define OPTIONS "hvo:l:r:i:cf:a"
+#define OPTIONS "hvo:l:r:i:cf:a1"
char *usage =
SELF " v" VERSION " - by B. Watson (WTFPL)\n"
@@ -20,14 +20,15 @@ char *usage =
"usage: " SELF " -[hvc] [-f 1|2 ] [-l address] [-i address] [-r address]\n"
" [-o outfile.xex] [infile1.xex] [infile2.xex ...]\n"
" -o outfile.xex Output file (default: standard output)\n"
- " -h Print this help\n"
- " -v Verbose operation\n"
" -c Check only; no output (same as -v -o/dev/null)\n"
" -l address Force first load address (decimal, $hex, or 0xhex)\n"
" -i address Force first init address\n"
" -r address Force run address\n"
" -a Force run address to load address of 1st segment.\n"
- " -f 1|2 Input is DASM -f1 or -f2 format, not xex.\n";
+ " -1 Output is an Atari DOS 1.0 executable, not xex.\n"
+ " -f 1|2 Input is DASM -f1 or -f2 format, not xex.\n"
+ " -h Print this help\n"
+ " -v Verbose operation\n";
static int readaddr(FILE *f) {
int i, j;
@@ -113,6 +114,7 @@ int main(int argc, char **argv) {
int force_load = -1, force_run = -1, force_init = -1;
int read_stdin = 0, run_1st_seg = 0;
int input_type = 0; /* 0 = xex, 1 and 2 are dasm -f1/-f2. */
+ int dos1_output = 0;
/* parse args */
while( (c = getopt(argc, argv, OPTIONS)) > 0) {
@@ -162,6 +164,10 @@ int main(int argc, char **argv) {
run_1st_seg = 1;
break;
+ case '1':
+ dos1_output = 1;
+ break;
+
default:
fprintf(stderr, usage);
exit(1);
@@ -228,8 +234,17 @@ int main(int argc, char **argv) {
infile, force_run);
}
- /* normalize the $FFFF headers: only the first segment needs one */
- seg.has_ff_header = (count == 1);
+ /* normalize the $FFFF headers: only the first segment needs one.
+ though if the output is DOS 1.0, it's $0984 instead. */
+ if(count == 1) {
+ if(dos1_output) {
+ seg.has_ff_header = 0;
+ fputc(0x84, out);
+ fputc(0x09, out);
+ } else {
+ seg.has_ff_header = 1;
+ }
+ }
/* process -l option */
if(count == 1 && force_load > -1) {
@@ -247,6 +262,12 @@ int main(int argc, char **argv) {
/* process -i option */
if(seg.start_addr == XEX_INITAD && seg.len == 2) {
+ if(dos1_output) {
+ fprintf(stderr,
+ SELF ": %s: "
+ "warning: found init segment, but DOS 1.0 doesn't support them.\n",
+ infile);
+ }
if(force_init == 0) {
if(xex_verbose)
fprintf(stderr,