1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-01 13:41:34 +00:00

complete first version

This commit is contained in:
paul moore 2023-12-03 13:58:04 -08:00
parent d21616ea71
commit c43557d4ed
6 changed files with 9072 additions and 9 deletions

9046
l.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -73,7 +73,6 @@ static unsigned ListBytes = 12; /* Number of bytes to list for one line
/* Switch the listing on/off */
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 = L;
EverReloc = EverReloc || L->Reloc;
}
}
@ -327,9 +325,11 @@ void CreateListing (void)
PageNumber = 0;
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 */
L = LineList;
@ -463,7 +463,8 @@ void CreateListing (void)
L = L->Next;
}
if (SegList)
ListSegments (F);
/* Close the listing file */
(void) fclose (F);
}

View File

@ -61,7 +61,6 @@ struct StrBuf;
/* Length of the header of a listing line */
#define LINE_HEADER_LEN 27
static unsigned LineHeaderLen = 24;
/* One listing line as it is stored in memory */
typedef struct ListLine ListLine;

View File

@ -107,6 +107,7 @@ static void Usage (void)
" -s\t\t\t\tEnable smart mode\n"
" -t sys\t\t\tSet the target system\n"
" -v\t\t\t\tIncrease verbosity\n"
" -S\t\t\t\tEnable segment offset listing\n"
"\n"
"Long options:\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"
" --target sys\t\t\tSet the target system\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);
}
@ -967,6 +969,7 @@ int main (int argc, char* argv [])
{ "--verbose", 0, OptVerbose },
{ "--version", 0, OptVersion },
{ "--warnings-as-errors", 0, OptWarningsAsErrors },
{ "--segment-list", 0, OptSeglist },
};
/* Name of the global name space */
@ -1074,6 +1077,7 @@ int main (int argc, char* argv [])
case 'W':
WarnLevel = atoi (GetArg (&I, 2));
break;
case 'S':
OptSeglist (Arg, 0);
break;

View File

@ -476,7 +476,17 @@ void SegDump (void)
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)
/* Initialize segments */

View File

@ -36,7 +36,7 @@
#ifndef SEGMENT_H
#define SEGMENT_H
#include <stdio.h>
/* common */
#include "coll.h"
@ -96,6 +96,9 @@ extern Segment* ActiveSeg;
Fragment* GenFragment (unsigned char Type, unsigned short Len);
/* 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);
/* Use the given segment */