From 0eec7d8a8775efe72aa01e64b2cd47c2e7314c6d Mon Sep 17 00:00:00 2001 From: cuz Date: Thu, 17 Feb 2005 17:26:16 +0000 Subject: [PATCH] More comment handling git-svn-id: svn://svn.cc65.org/cc65/trunk@3389 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/da65/attrtab.c | 19 ++++--------------- src/da65/attrtab.h | 2 +- src/da65/output.c | 47 +++++++++++++++++++++++++++++++--------------- src/da65/output.h | 3 +++ 4 files changed, 40 insertions(+), 31 deletions(-) diff --git a/src/da65/attrtab.c b/src/da65/attrtab.c index 1eb7d9f2c..90233e2bb 100644 --- a/src/da65/attrtab.c +++ b/src/da65/attrtab.c @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 2000-2003 Ullrich von Bassewitz */ +/* (C) 2000-2005 Ullrich von Bassewitz */ /* Römerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ @@ -387,17 +387,6 @@ unsigned char GetLabelAttr (unsigned Addr) -static void DefineConst (unsigned Addr) -/* Define an address constant */ -{ - Output ("%s", SymTab[Addr]->Name); - Indent (AIndent); - Output ("= $%04X", Addr); - LineFeed (); -} - - - void DefOutOfRangeLabels (void) /* Output any labels that are out of the loaded code range */ { @@ -409,7 +398,7 @@ void DefOutOfRangeLabels (void) Addr = 0; while (Addr < CodeStart) { if (MustDefLabel (Addr)) { - DefineConst (Addr); + DefineConst (SymTab[Addr]->Name, SymTab[Addr]->Comment, Addr); } ++Addr; } @@ -417,7 +406,7 @@ void DefOutOfRangeLabels (void) /* Skip areas in code range */ while (Addr <= CodeEnd) { if ((AttrTab[Addr] & atStyleMask) == atSkip && MustDefLabel (Addr)) { - DefineConst (Addr); + DefineConst (SymTab[Addr]->Name, SymTab[Addr]->Comment, Addr); } ++Addr; } @@ -425,7 +414,7 @@ void DefOutOfRangeLabels (void) /* High range */ while (Addr < 0x10000) { if (MustDefLabel (Addr)) { - DefineConst (Addr); + DefineConst (SymTab[Addr]->Name, SymTab[Addr]->Comment, Addr); } ++Addr; } diff --git a/src/da65/attrtab.h b/src/da65/attrtab.h index aba6bd65f..42b41a32d 100644 --- a/src/da65/attrtab.h +++ b/src/da65/attrtab.h @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 2000-2004 Ullrich von Bassewitz */ +/* (C) 2000-2005 Ullrich von Bassewitz */ /* Römerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ diff --git a/src/da65/output.c b/src/da65/output.c index 60541c93f..2a21d329a 100644 --- a/src/da65/output.c +++ b/src/da65/output.c @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 2000-2003 Ullrich von Bassewitz */ +/* (C) 2000-2005 Ullrich von Bassewitz */ /* Römerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ @@ -74,12 +74,12 @@ static void PageHeader (void) /* Print a page header */ { fprintf (F, - "; da65 V%u.%u.%u - (C) Copyright 2000-2003 Ullrich von Bassewitz\n" - "; Input file: %s\n" - "; Page: %u\n\n", + "; da65 V%u.%u.%u - (C) Copyright 2000-2005 Ullrich von Bassewitz\n" + "; Input file: %s\n" + "; Page: %u\n\n", VER_MAJOR, VER_MINOR, VER_PATCH, - InFile, - Page); + InFile, + Page); } @@ -286,17 +286,17 @@ void LineComment (unsigned PC, unsigned Count) Output ("; %04X", PC); if (Comments >= 3) { for (I = 0; I < Count; ++I) { - Output (" %02X", CodeBuf [PC+I]); + Output (" %02X", CodeBuf [PC+I]); } if (Comments >= 4) { - Indent (TIndent); - for (I = 0; I < Count; ++I) { - unsigned char C = CodeBuf [PC+I]; - if (!isprint (C)) { - C = '.'; - } - Output ("%c", C); - } + Indent (TIndent); + for (I = 0; I < Count; ++I) { + unsigned char C = CodeBuf [PC+I]; + if (!isprint (C)) { + C = '.'; + } + Output ("%c", C); + } } } } @@ -318,3 +318,20 @@ void OutputSettings (void) +void DefineConst (const char* Name, const char* Comment, unsigned Addr) +/* Define an address constant */ +{ + if (Pass == PassCount) { + Output ("%s", Name); + Indent (AIndent); + Output (":= $%04X", Addr); + if (Comment) { + Indent (CIndent); + Output ("; %s", Comment); + } + LineFeed (); + } +} + + + diff --git a/src/da65/output.h b/src/da65/output.h index 161a12f39..568a1b0af 100644 --- a/src/da65/output.h +++ b/src/da65/output.h @@ -94,6 +94,9 @@ void LineComment (unsigned PC, unsigned Count); void OutputSettings (void); /* Output CPU and other settings */ +void DefineConst (const char* Name, const char* Comment, unsigned Addr); +/* Define an address constant */ + /* End of output.h */ -- 2.39.5