complete first version
This commit is contained in:
@@ -73,7 +73,6 @@ static unsigned ListBytes = 12; /* Number of bytes to list for one line
|
|||||||
|
|
||||||
/* Switch the listing on/off */
|
/* Switch the listing on/off */
|
||||||
static int ListingEnabled = 1; /* Enabled if > 0 */
|
static int ListingEnabled = 1; /* Enabled if > 0 */
|
||||||
static int EverReloc = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -122,7 +121,6 @@ void NewListingLine (const StrBuf* Line, unsigned char File, unsigned char Depth
|
|||||||
LineLast->Next = L;
|
LineLast->Next = L;
|
||||||
}
|
}
|
||||||
LineLast = L;
|
LineLast = L;
|
||||||
EverReloc = EverReloc || L->Reloc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,9 +325,11 @@ void CreateListing (void)
|
|||||||
PageNumber = 0;
|
PageNumber = 0;
|
||||||
PrintPageHeader (F, LineList);
|
PrintPageHeader (F, LineList);
|
||||||
|
|
||||||
/* Terminate the header buffer. The last byte will never get overwritten */
|
/* Terminate the header buffer. The last byte will never get overwritten
|
||||||
|
** the - 3 adjust is for when the segnum gets prepended to the header.
|
||||||
|
*/
|
||||||
|
|
||||||
HeaderBuf [(SegList ? LINE_HEADER_LEN : LINE_HEADER_LEN -3)] = '\0';
|
HeaderBuf [(SegList ? LINE_HEADER_LEN : LINE_HEADER_LEN - 3)] = '\0';
|
||||||
|
|
||||||
/* Walk through all listing lines */
|
/* Walk through all listing lines */
|
||||||
L = LineList;
|
L = LineList;
|
||||||
@@ -463,7 +463,8 @@ void CreateListing (void)
|
|||||||
L = L->Next;
|
L = L->Next;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (SegList)
|
||||||
|
ListSegments (F);
|
||||||
/* Close the listing file */
|
/* Close the listing file */
|
||||||
(void) fclose (F);
|
(void) fclose (F);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ struct StrBuf;
|
|||||||
|
|
||||||
/* Length of the header of a listing line */
|
/* Length of the header of a listing line */
|
||||||
#define LINE_HEADER_LEN 27
|
#define LINE_HEADER_LEN 27
|
||||||
static unsigned LineHeaderLen = 24;
|
|
||||||
|
|
||||||
/* One listing line as it is stored in memory */
|
/* One listing line as it is stored in memory */
|
||||||
typedef struct ListLine ListLine;
|
typedef struct ListLine ListLine;
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ static void Usage (void)
|
|||||||
" -s\t\t\t\tEnable smart mode\n"
|
" -s\t\t\t\tEnable smart mode\n"
|
||||||
" -t sys\t\t\tSet the target system\n"
|
" -t sys\t\t\tSet the target system\n"
|
||||||
" -v\t\t\t\tIncrease verbosity\n"
|
" -v\t\t\t\tIncrease verbosity\n"
|
||||||
|
" -S\t\t\t\tEnable segment offset listing\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Long options:\n"
|
"Long options:\n"
|
||||||
" --auto-import\t\t\tMark unresolved symbols as import\n"
|
" --auto-import\t\t\tMark unresolved symbols as import\n"
|
||||||
@@ -129,7 +130,8 @@ static void Usage (void)
|
|||||||
" --smart\t\t\tEnable smart mode\n"
|
" --smart\t\t\tEnable smart mode\n"
|
||||||
" --target sys\t\t\tSet the target system\n"
|
" --target sys\t\t\tSet the target system\n"
|
||||||
" --verbose\t\t\tIncrease verbosity\n"
|
" --verbose\t\t\tIncrease verbosity\n"
|
||||||
" --version\t\t\tPrint the assembler version\n",
|
" --version\t\t\tPrint the assembler version\n"
|
||||||
|
" --segment-list\t\tEnable segment offset listing\n",
|
||||||
ProgName);
|
ProgName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -967,6 +969,7 @@ int main (int argc, char* argv [])
|
|||||||
{ "--verbose", 0, OptVerbose },
|
{ "--verbose", 0, OptVerbose },
|
||||||
{ "--version", 0, OptVersion },
|
{ "--version", 0, OptVersion },
|
||||||
{ "--warnings-as-errors", 0, OptWarningsAsErrors },
|
{ "--warnings-as-errors", 0, OptWarningsAsErrors },
|
||||||
|
{ "--segment-list", 0, OptSeglist },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Name of the global name space */
|
/* Name of the global name space */
|
||||||
@@ -1074,6 +1077,7 @@ int main (int argc, char* argv [])
|
|||||||
case 'W':
|
case 'W':
|
||||||
WarnLevel = atoi (GetArg (&I, 2));
|
WarnLevel = atoi (GetArg (&I, 2));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'S':
|
case 'S':
|
||||||
OptSeglist (Arg, 0);
|
OptSeglist (Arg, 0);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -476,7 +476,17 @@ void SegDump (void)
|
|||||||
printf ("\n");
|
printf ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ListSegments (FILE* destination)
|
||||||
|
{
|
||||||
|
/* summary of segments when seglist requested */
|
||||||
|
unsigned I;
|
||||||
|
fprintf (destination, "\nSegment summary\n\n");
|
||||||
|
for (I = 0; I < CollCount (&SegmentList); ++I) {
|
||||||
|
Segment* S = CollAtUnchecked (&SegmentList, I);
|
||||||
|
if(S->FragCount)
|
||||||
|
fprintf (destination, "Segment: %02X = %s\n", S->Num, S->Def->Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SegInit (void)
|
void SegInit (void)
|
||||||
/* Initialize segments */
|
/* Initialize segments */
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#ifndef SEGMENT_H
|
#ifndef SEGMENT_H
|
||||||
#define SEGMENT_H
|
#define SEGMENT_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
#include "coll.h"
|
#include "coll.h"
|
||||||
@@ -96,6 +96,9 @@ extern Segment* ActiveSeg;
|
|||||||
Fragment* GenFragment (unsigned char Type, unsigned short Len);
|
Fragment* GenFragment (unsigned char Type, unsigned short Len);
|
||||||
/* Generate a new fragment, add it to the current segment and return it. */
|
/* Generate a new fragment, add it to the current segment and return it. */
|
||||||
|
|
||||||
|
void ListSegments (FILE* destination);
|
||||||
|
/* List the segments to the given file when seglist set */
|
||||||
|
|
||||||
void UseSeg (const SegDef* D);
|
void UseSeg (const SegDef* D);
|
||||||
/* Use the given segment */
|
/* Use the given segment */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user