aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-04-29 20:01:51 -0400
committerB. Watson <urchlay@slackware.uk>2024-04-29 20:01:51 -0400
commit550356009c9eadf3c3718d885e6e5dde6c0e1bb9 (patch)
treec849f3c651f50c5da08ea087e9c2a1e587037465
parent4449304aeed23df6b742d988d68f95c7a1b18867 (diff)
downloadbw-atari8-tools-550356009c9eadf3c3718d885e6e5dde6c0e1bb9.tar.gz
xexcat: add -1 option for DOS 1.0 output.
-rw-r--r--xexcat.17
-rw-r--r--xexcat.c33
-rw-r--r--xexcat.rst5
3 files changed, 38 insertions, 7 deletions
diff --git a/xexcat.1 b/xexcat.1
index 21c8ea1..c832416 100644
--- a/xexcat.1
+++ b/xexcat.1
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.TH "XEXCAT" 1 "2024-04-28" "0.2.1" "Urchlay's Atari 8-bit Tools"
+.TH "XEXCAT" 1 "2024-04-29" "0.2.1" "Urchlay's Atari 8-bit Tools"
.SH NAME
xexcat \- Concatenate Atari 8-bit executables (XEX) into a single XEX file.
.\" RST source for xexcat(1) man page. Convert with:
@@ -105,6 +105,11 @@ second run of \fBxexcat\fP\&.
.UNINDENT
.INDENT 0.0
.TP
+.B \-1
+Output file will be an Atari DOS 1.0 executable. If there are any init
+addresses in the input, you will be warned about them, since DOS 1.0
+doesn\(aqt support the init mechanism.
+.TP
.B \-h
Print a short help message and exit.
.TP
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,
diff --git a/xexcat.rst b/xexcat.rst
index cfb9a64..2e862b3 100644
--- a/xexcat.rst
+++ b/xexcat.rst
@@ -81,6 +81,11 @@ OPTIONS
**dasm** file to a .xex, then combine the two .xex files with a
second run of **xexcat**.
+-1
+ Output file will be an Atari DOS 1.0 executable. If there are any init
+ addresses in the input, you will be warned about them, since DOS 1.0
+ doesn't support the init mechanism.
+
-h
Print a short help message and exit.