New --hexoffs option

git-svn-id: svn://svn.cc65.org/cc65/trunk@2433 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-09-11 20:19:09 +00:00
parent 2c63e4bc0b
commit 30594ce1f1
6 changed files with 29 additions and 1 deletions

View file

@ -157,6 +157,9 @@ void AddExtLabelRange (unsigned Addr, const char* Name, unsigned Count)
if (Count > 1) {
unsigned Offs;
/* Setup the format string */
const char* Format = UseHexOffs? "$%02X" : "%u";
/* Allocate memory for the dependent label names */
unsigned NameLen = strlen (Name);
char* DepName = xmalloc (NameLen + 7);
@ -168,7 +171,7 @@ void AddExtLabelRange (unsigned Addr, const char* Name, unsigned Count)
/* Define the labels */
for (Offs = 1; Offs < Count; ++Offs) {
sprintf (DepOffs, "%u", Offs);
sprintf (DepOffs, Format, Offs);
AddLabel (Addr + Offs, atDepLabel, DepName);
}

View file

@ -54,6 +54,7 @@ const char CfgExt[] = ".cfg"; /* Config file extension */
/* Flags and other command line stuff */
unsigned char DebugInfo = 0; /* Add debug info to the object file */
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? */
long StartAddr = -1L; /* Start/load address of the program */
long InputOffs = -1L; /* Offset into input file */

View file

@ -55,6 +55,7 @@ extern const char CfgExt[]; /* Config file extension */
/* Flags and other command line stuff */
extern unsigned char DebugInfo; /* Add debug info to the object file */
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 long StartAddr; /* Start/load address of the program */
extern long InputOffs; /* Offset into input file */

View file

@ -81,6 +81,7 @@ static void GlobalSection (void)
static const IdentTok GlobalDefs[] = {
{ "COMMENTS", INFOTOK_COMMENTS },
{ "CPU", INFOTOK_CPU },
{ "HEXOFFS", INFOTOK_HEXOFFS },
{ "INPUTNAME", INFOTOK_INPUTNAME },
{ "INPUTOFFS", INFOTOK_INPUTOFFS },
{ "INPUTSIZE", INFOTOK_INPUTSIZE },
@ -123,6 +124,16 @@ static void GlobalSection (void)
InfoNextTok ();
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:
InfoNextTok ();
InfoAssureStr ();

View file

@ -87,6 +87,7 @@ static void Usage (void)
" --debug-info\t\tAdd debug info to object file\n"
" --formfeeds\t\tAdd formfeeds to the output\n"
" --help\t\tHelp (this text)\n"
" --hexoffs\t\tUse hexadecimal label offsets\n"
" --info name\t\tSpecify an info file\n"
" --pagelength n\tSet the page length for the listing\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)
/* Handle the --info option */
{
@ -364,6 +374,7 @@ int main (int argc, char* argv [])
{ "--debug-info", 0, OptDebugInfo },
{ "--formfeeds", 0, OptFormFeeds },
{ "--help", 0, OptHelp },
{ "--hexoffs", 0, OptHexOffs },
{ "--info", 1, OptInfo },
{ "--pagelength", 1, OptPageLength },
{ "--start-addr", 1, OptStartAddr },

View file

@ -67,6 +67,7 @@ typedef enum token_t {
/* Global section */
INFOTOK_COMMENTS,
INFOTOK_CPU,
INFOTOK_HEXOFFS,
INFOTOK_INPUTNAME,
INFOTOK_INPUTOFFS,
INFOTOK_INPUTSIZE,