diff --git a/README b/README index 6ad500e..37f2f9c 100644 --- a/README +++ b/README @@ -150,6 +150,11 @@ Options: This also works for extracting an object library (.OLB) file. + -rsx Tells macro11 to generate rsx style object files. + This is the default. + + -rt11 Tells macro11 to generate rt11 style object files. + Various options starting with -y enable extensions: -ysl Allow longer symbols up to the given length. diff --git a/macro11.c b/macro11.c index f21de1d..d748ee6 100644 --- a/macro11.c +++ b/macro11.c @@ -55,7 +55,6 @@ DAMAGE. #define stricmp strcasecmp - /* enable_tf is called by command argument parsing to enable and disable named options. */ @@ -344,6 +343,10 @@ int main( list_pass_0++; } else if (!stricmp(cp, "yd")) { enabl_debug++; + } else if (!stricmp(cp, "rt11")) { + rt11 = 1; + } else if (!stricmp(cp, "rsx")) { + rt11 = 0; } else { fprintf(stderr, "Unknown option %s\n", argv[arg]); print_help(); diff --git a/object.c b/object.c index 061117c..b6cbb27 100644 --- a/object.c +++ b/object.c @@ -47,6 +47,8 @@ DAMAGE. #include "rad50.h" #include "object.h" +int rt11 = 0; + /* writerec writes "formatted binary records." Each is preceeded by any number of 0 bytes, begins with a 1,0 pair, @@ -66,24 +68,27 @@ static int writerec( int chksum; /* Checksum is negative sum of all bytes including header and length */ int i; -#if RT11 - unsigned hdrlen = len + 4; -#else - unsigned hdrlen = len; -#endif + unsigned hdrlen; + + if (rt11) { + hdrlen = len + 4; + } else { + hdrlen = len; + } if (fp == NULL) return 1; /* Silently ignore this attempt to write. */ chksum = 0; -#if RT11 - if (fputc(FBR_LEAD1, fp) == EOF) /* All recs begin with 1,0 */ - return 0; - chksum -= FBR_LEAD1; - if (fputc(FBR_LEAD2, fp) == EOF) - return 0; - chksum -= FBR_LEAD2; -#endif /* RT11 */ + + if (rt11) { + if (fputc(FBR_LEAD1, fp) == EOF) /* All recs begin with 1,0 */ + return 0; + chksum -= FBR_LEAD1; + if (fputc(FBR_LEAD2, fp) == EOF) + return 0; + chksum -= FBR_LEAD2; + } /* RT11 */ i = hdrlen & 0xff; /* length, lsb */ chksum -= i; @@ -106,13 +111,13 @@ static int writerec( chksum &= 0xff; -#if RT11 - fputc(chksum, fp); /* Followed by the checksum byte */ -#else /* RT11 */ - if (hdrlen & 1) { - fputc(0, fp); /* Padding to even boundary */ + if (rt11) { + fputc(chksum, fp); /* Followed by the checksum byte */ + } else { /* RT11 */ + if (hdrlen & 1) { + fputc(0, fp); /* Padding to even boundary */ } -#endif /* RT11 */ +} /* RT11 */ return 1; /* Worked okay. */ } diff --git a/object.h b/object.h index bc35f44..80e706d 100644 --- a/object.h +++ b/object.h @@ -121,6 +121,8 @@ DAMAGE. number" and two bytes offset */ #define CPLX_CONST 020 /* Followed by two bytes constant value */ +extern int rt11; /* Use RT11 object file format */ + typedef struct gsd { FILE *fp; /* The file assigned for output */ char buf[122]; /* space for 15 GSD entries */