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);
/* Define the labels */
for (Offs = 1; Offs < Count; ++Offs) {
- sprintf (DepOffs, "%u", Offs);
+ sprintf (DepOffs, Format, Offs);
AddLabel (Addr + Offs, atDepLabel, DepName);
}
/* 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 */
/* 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 */
static const IdentTok GlobalDefs[] = {
{ "COMMENTS", INFOTOK_COMMENTS },
{ "CPU", INFOTOK_CPU },
+ { "HEXOFFS", INFOTOK_HEXOFFS },
{ "INPUTNAME", INFOTOK_INPUTNAME },
{ "INPUTOFFS", INFOTOK_INPUTOFFS },
{ "INPUTSIZE", INFOTOK_INPUTSIZE },
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 ();
" --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"
+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 */
{
{ "--debug-info", 0, OptDebugInfo },
{ "--formfeeds", 0, OptFormFeeds },
{ "--help", 0, OptHelp },
+ { "--hexoffs", 0, OptHexOffs },
{ "--info", 1, OptInfo },
{ "--pagelength", 1, OptPageLength },
{ "--start-addr", 1, OptStartAddr },
/* Global section */
INFOTOK_COMMENTS,
INFOTOK_CPU,
+ INFOTOK_HEXOFFS,
INFOTOK_INPUTNAME,
INFOTOK_INPUTOFFS,
INFOTOK_INPUTSIZE,