Make the produced object file configurable...

at run time, from the command line.
This commit is contained in:
Kevin Handy
2020-03-03 19:13:20 +01:00
committed by Olaf Seibert
parent c80c87b2d4
commit e2fb29e3f2
4 changed files with 35 additions and 20 deletions

5
README
View File

@@ -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 <num> Allow longer symbols up to the given length.

View File

@@ -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();

View File

@@ -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. */
}

View File

@@ -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 */