New --hexoffs option
git-svn-id: svn://svn.cc65.org/cc65/trunk@2433 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -157,6 +157,9 @@ void AddExtLabelRange (unsigned Addr, const char* Name, unsigned Count)
|
|||||||
if (Count > 1) {
|
if (Count > 1) {
|
||||||
unsigned Offs;
|
unsigned Offs;
|
||||||
|
|
||||||
|
/* Setup the format string */
|
||||||
|
const char* Format = UseHexOffs? "$%02X" : "%u";
|
||||||
|
|
||||||
/* Allocate memory for the dependent label names */
|
/* Allocate memory for the dependent label names */
|
||||||
unsigned NameLen = strlen (Name);
|
unsigned NameLen = strlen (Name);
|
||||||
char* DepName = xmalloc (NameLen + 7);
|
char* DepName = xmalloc (NameLen + 7);
|
||||||
@@ -168,7 +171,7 @@ void AddExtLabelRange (unsigned Addr, const char* Name, unsigned Count)
|
|||||||
|
|
||||||
/* Define the labels */
|
/* Define the labels */
|
||||||
for (Offs = 1; Offs < Count; ++Offs) {
|
for (Offs = 1; Offs < Count; ++Offs) {
|
||||||
sprintf (DepOffs, "%u", Offs);
|
sprintf (DepOffs, Format, Offs);
|
||||||
AddLabel (Addr + Offs, atDepLabel, DepName);
|
AddLabel (Addr + Offs, atDepLabel, DepName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ const char CfgExt[] = ".cfg"; /* Config file extension */
|
|||||||
/* Flags and other command line stuff */
|
/* Flags and other command line stuff */
|
||||||
unsigned char DebugInfo = 0; /* Add debug info to the object file */
|
unsigned char DebugInfo = 0; /* Add debug info to the object file */
|
||||||
unsigned char FormFeeds = 0; /* Add form feeds to the output? */
|
unsigned char FormFeeds = 0; /* Add form feeds to the output? */
|
||||||
|
unsigned char UseHexOffs = 0; /* Use hexadecimal label offsets */
|
||||||
unsigned char PassCount = 2; /* How many passed do we do? */
|
unsigned char PassCount = 2; /* How many passed do we do? */
|
||||||
long StartAddr = -1L; /* Start/load address of the program */
|
long StartAddr = -1L; /* Start/load address of the program */
|
||||||
long InputOffs = -1L; /* Offset into input file */
|
long InputOffs = -1L; /* Offset into input file */
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ extern const char CfgExt[]; /* Config file extension */
|
|||||||
/* Flags and other command line stuff */
|
/* Flags and other command line stuff */
|
||||||
extern unsigned char DebugInfo; /* Add debug info to the object file */
|
extern unsigned char DebugInfo; /* Add debug info to the object file */
|
||||||
extern unsigned char FormFeeds; /* Add form feeds to the output? */
|
extern unsigned char FormFeeds; /* Add form feeds to the output? */
|
||||||
|
extern unsigned char UseHexOffs; /* Use hexadecimal label offsets */
|
||||||
extern unsigned char PassCount; /* How many passed do we do? */
|
extern unsigned char PassCount; /* How many passed do we do? */
|
||||||
extern long StartAddr; /* Start/load address of the program */
|
extern long StartAddr; /* Start/load address of the program */
|
||||||
extern long InputOffs; /* Offset into input file */
|
extern long InputOffs; /* Offset into input file */
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ static void GlobalSection (void)
|
|||||||
static const IdentTok GlobalDefs[] = {
|
static const IdentTok GlobalDefs[] = {
|
||||||
{ "COMMENTS", INFOTOK_COMMENTS },
|
{ "COMMENTS", INFOTOK_COMMENTS },
|
||||||
{ "CPU", INFOTOK_CPU },
|
{ "CPU", INFOTOK_CPU },
|
||||||
|
{ "HEXOFFS", INFOTOK_HEXOFFS },
|
||||||
{ "INPUTNAME", INFOTOK_INPUTNAME },
|
{ "INPUTNAME", INFOTOK_INPUTNAME },
|
||||||
{ "INPUTOFFS", INFOTOK_INPUTOFFS },
|
{ "INPUTOFFS", INFOTOK_INPUTOFFS },
|
||||||
{ "INPUTSIZE", INFOTOK_INPUTSIZE },
|
{ "INPUTSIZE", INFOTOK_INPUTSIZE },
|
||||||
@@ -123,6 +124,16 @@ static void GlobalSection (void)
|
|||||||
InfoNextTok ();
|
InfoNextTok ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case INFOTOK_HEXOFFS:
|
||||||
|
InfoNextTok ();
|
||||||
|
InfoBoolToken ();
|
||||||
|
switch (InfoTok) {
|
||||||
|
case INFOTOK_FALSE: UseHexOffs = 0; break;
|
||||||
|
case INFOTOK_TRUE: UseHexOffs = 1; break;
|
||||||
|
}
|
||||||
|
InfoNextTok ();
|
||||||
|
break;
|
||||||
|
|
||||||
case INFOTOK_INPUTNAME:
|
case INFOTOK_INPUTNAME:
|
||||||
InfoNextTok ();
|
InfoNextTok ();
|
||||||
InfoAssureStr ();
|
InfoAssureStr ();
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ static void Usage (void)
|
|||||||
" --debug-info\t\tAdd debug info to object file\n"
|
" --debug-info\t\tAdd debug info to object file\n"
|
||||||
" --formfeeds\t\tAdd formfeeds to the output\n"
|
" --formfeeds\t\tAdd formfeeds to the output\n"
|
||||||
" --help\t\tHelp (this text)\n"
|
" --help\t\tHelp (this text)\n"
|
||||||
|
" --hexoffs\t\tUse hexadecimal label offsets\n"
|
||||||
" --info name\t\tSpecify an info file\n"
|
" --info name\t\tSpecify an info file\n"
|
||||||
" --pagelength n\tSet the page length for the listing\n"
|
" --pagelength n\tSet the page length for the listing\n"
|
||||||
" --start-addr addr\tSet the start/load address\n"
|
" --start-addr addr\tSet the start/load address\n"
|
||||||
@@ -181,6 +182,15 @@ static void OptHelp (const char* Opt attribute ((unused)),
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void OptHexOffs (const char* Opt attribute ((unused)),
|
||||||
|
const char* Arg attribute ((unused)))
|
||||||
|
/* Handle the --hexoffs option */
|
||||||
|
{
|
||||||
|
UseHexOffs = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void OptInfo (const char* Opt attribute ((unused)), const char* Arg)
|
static void OptInfo (const char* Opt attribute ((unused)), const char* Arg)
|
||||||
/* Handle the --info option */
|
/* Handle the --info option */
|
||||||
{
|
{
|
||||||
@@ -364,6 +374,7 @@ int main (int argc, char* argv [])
|
|||||||
{ "--debug-info", 0, OptDebugInfo },
|
{ "--debug-info", 0, OptDebugInfo },
|
||||||
{ "--formfeeds", 0, OptFormFeeds },
|
{ "--formfeeds", 0, OptFormFeeds },
|
||||||
{ "--help", 0, OptHelp },
|
{ "--help", 0, OptHelp },
|
||||||
|
{ "--hexoffs", 0, OptHexOffs },
|
||||||
{ "--info", 1, OptInfo },
|
{ "--info", 1, OptInfo },
|
||||||
{ "--pagelength", 1, OptPageLength },
|
{ "--pagelength", 1, OptPageLength },
|
||||||
{ "--start-addr", 1, OptStartAddr },
|
{ "--start-addr", 1, OptStartAddr },
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ typedef enum token_t {
|
|||||||
/* Global section */
|
/* Global section */
|
||||||
INFOTOK_COMMENTS,
|
INFOTOK_COMMENTS,
|
||||||
INFOTOK_CPU,
|
INFOTOK_CPU,
|
||||||
|
INFOTOK_HEXOFFS,
|
||||||
INFOTOK_INPUTNAME,
|
INFOTOK_INPUTNAME,
|
||||||
INFOTOK_INPUTOFFS,
|
INFOTOK_INPUTOFFS,
|
||||||
INFOTOK_INPUTSIZE,
|
INFOTOK_INPUTSIZE,
|
||||||
|
|||||||
Reference in New Issue
Block a user