// SECT.C - Code Generation, Fixups and Section Management
// Copyright (C) 199x Landon Dyer, 2011 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// SECT.C - Code Generation, Fixups and Section Management
// Copyright (C) 199x Landon Dyer, 2011 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// These are copied from the section descriptor, the current code chunk
// descriptor and the current fixup chunk descriptor when a switch is made into
// a section. They are copied back to the descriptors when the section is left.
// These are copied from the section descriptor, the current code chunk
// descriptor and the current fixup chunk descriptor when a switch is made into
// a section. They are copied back to the descriptors when the section is left.
-CHUNK * scode; // Current (last) code chunk
-LONG challoc; // # bytes alloc'd to code chunk
-LONG ch_size; // # bytes used in code chunk
-char * chptr; // Deposit point in code chunk buffer
+CHUNK * scode; // Current (last) code chunk
+LONG challoc; // # bytes alloc'd to code chunk
+LONG ch_size; // # bytes used in code chunk
+char * chptr; // Deposit point in code chunk buffer
-CHUNK * sfix; // Current (last) fixup chunk
-LONG fchalloc; // # bytes alloc'd to fixup chunk
-LONG fchsize; // # bytes used in fixup chunk
-PTR fchptr; // Deposit point in fixup chunk buffer
+CHUNK * sfix; // Current (last) fixup chunk
+LONG fchalloc; // # bytes alloc'd to fixup chunk
+LONG fchsize; // # bytes used in fixup chunk
+PTR fchptr; // Deposit point in fixup chunk buffer
// Return a size (SIZB, SIZW, SIZL) or 0, depending on what kind of fixup is
// associated with a location.
// Return a size (SIZB, SIZW, SIZL) or 0, depending on what kind of fixup is
// associated with a location.
- MakeSection(ABS, SUSED | SABS | SBSS); // ABS
- MakeSection(TEXT, SUSED | TEXT ); // TEXT
- MakeSection(DATA, SUSED | DATA ); // DATA
- MakeSection(BSS, SUSED | BSS | SBSS); // BSS
+ MakeSection(ABS, SUSED | SABS | SBSS); // ABS
+ MakeSection(TEXT, SUSED | TEXT ); // TEXT
+ MakeSection(DATA, SUSED | DATA ); // DATA
+ MakeSection(BSS, SUSED | BSS | SBSS); // BSS
- // Hairy, ugly linear search for a mark on our location;
- // the speed doesn't matter, since this is only done when generating a
- // listing, which is SLOW.
+ // Hairy, ugly linear search for a mark on our location; the speed doesn't
+ // matter, since this is only done when generating a listing, which is
+ // SLOW.
-// Check that there are at least `amt' bytes left in the current chunk. If
-// there are not, allocate another chunk of at least `amt' bytes (and probably
+// Check that there are at least 'amt' bytes left in the current chunk. If
+// there are not, allocate another chunk of at least 'amt' bytes (and probably
-// This is really wrong. We need to make some proper structures here so we don't
-// have to count sizes of objects, that's what the compiler's for! :-P
+// This is really wrong. We need to make some proper structures here so we
+// don't have to count sizes of objects, that's what the compiler's for! :-P
#define FIXUP_BASE_SIZE (sizeof(WORD) + sizeof(LONG) + sizeof(WORD) + sizeof(WORD))
//
// Arrange for a fixup on a location
#define FIXUP_BASE_SIZE (sizeof(WORD) + sizeof(LONG) + sizeof(WORD) + sizeof(WORD))
//
// Arrange for a fixup on a location
#warning "!!! AddFixup() is filled with VOODOO !!!"
DEBUG printf("FIXUP@$%X: $%X\n", loc, attr);
#warning "!!! AddFixup() is filled with VOODOO !!!"
DEBUG printf("FIXUP@$%X: $%X\n", loc, attr);
- PTR fup; // Current fixup
- WORD * fuend; // End of last fixup (in this chunk)
- WORD w; // Fixup word (type+modes+flags)
- char * locp; // Location to fix (in cached chunk)
- LONG loc; // Location to fixup
- VALUE eval; // Expression value
- WORD eattr; // Expression attrib
- SYM * esym; // External symbol involved in expr
- SYM * sy; // (Temp) pointer to a symbol
- WORD i; // (Temp) word
- WORD tdb; // eattr & TDB
+ PTR fup; // Current fixup
+ WORD * fuend; // End of last fixup (in this chunk)
+ WORD w; // Fixup word (type+modes+flags)
+ char * locp; // Location to fix (in cached chunk)
+ LONG loc; // Location to fixup
+ VALUE eval; // Expression value
+ WORD eattr; // Expression attrib
+ SYM * esym; // External symbol involved in expr
+ SYM * sy; // (Temp) pointer to a symbol
+ WORD i; // (Temp) word
+ WORD tdb; // eattr & TDB