mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-25 19:56:30 +00:00
Adapt the generating and dumping of object files to what is observed
in RSX-11M+ files. Use conditional compilation so the RT-11 version can be restored.
This commit is contained in:
16
object.c
16
object.c
@@ -55,6 +55,10 @@ DAMAGE.
|
||||
Each is preceeded by any number of 0 bytes, begins with a 1,0 pair,
|
||||
followed by 2 byte length, followed by data, followed by 1 byte
|
||||
negative checksum.
|
||||
|
||||
The RSX version is similar but subtly different:
|
||||
There are no "any number of 0 bytes", nor the "1,0 pair" following it.
|
||||
There is no checksum byte, but odd lengths are padded with a 0-byte.
|
||||
*/
|
||||
|
||||
static int writerec(
|
||||
@@ -65,18 +69,24 @@ 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
|
||||
|
||||
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 */
|
||||
|
||||
i = hdrlen & 0xff; /* length, lsb */
|
||||
chksum -= i;
|
||||
@@ -99,7 +109,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 */
|
||||
}
|
||||
#endif /* RT11 */
|
||||
|
||||
return 1; /* Worked okay. */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user