Skip to content

Commit

Permalink
Slight improvements
Browse files Browse the repository at this point in the history
Documented [no]code and [no]labeleqs,
corrected info file handling
  • Loading branch information
Arakula committed May 6, 2022
1 parent d47eb05 commit a70219e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 17 deletions.
16 changes: 5 additions & 11 deletions dasmfw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ if (!fp)

int fc;
string line;
bool bMod = false, bEnd = false, bEsc = false, bSkip = false;
bool bMod = false, bEnd = false;
do
{
fc = fgetc(fp);
Expand All @@ -1372,12 +1372,7 @@ do
}
if (fc != '\r' && fc != '\n' && fc != EOF)
{
if ((fc == '*' /*|| fc == ';'*/) && /* catch comment characters */
!bEsc)
bSkip = true;
bEsc = fc == '\\'; /* get whether escaping next char */
if (!bSkip)
line += (char)fc;
line += (char)fc;
continue;
}
if (bProcInfo)
Expand Down Expand Up @@ -1501,7 +1496,7 @@ do
idx = value.find_first_of(" \t");
if (idx == value.npos) idx = value.size();
option = value.substr(0, idx);
value = trim(value.substr(idx));
value = triminfo(value.substr(idx));
ParseOption(option, value, !bProcInfo);
}
break;
Expand Down Expand Up @@ -2101,7 +2096,7 @@ do
for (; i < value.size() && value[i] != delim1 && value[i] != delim2; i++)
name += value[i];
if (i < value.size())
value = trim(value.substr(i + 1));
value = triminfo(value.substr(i + 1), true, false);
else
value.clear();
if (name.size())
Expand All @@ -2117,7 +2112,6 @@ do
}
line.clear();
bMod = false;
bEsc = bSkip = false; /* reset in-line flags */
} while (fc != EOF && !bEnd);

(void)bMod; // unused ATM, but might become useful
Expand Down Expand Up @@ -2440,7 +2434,7 @@ else
}
printf(" Output formatting options:\n");
ListOptionLine("logo", "{off|on}\toutput logo in file", showLogo ? "on" : "off");
ListOptionLine("code", "{off|on}\toutput code", showComments ? "on" : "off");
ListOptionLine("code", "{off|on}\toutput code", showCode ? "on" : "off");
ListOptionLine("addr", "{off|on}\toutput address dump", showAddr ? "on" : "off");
ListOptionLine("hex", "{off|on}\toutput hex dump", showHex ? "on" : "off");
ListOptionLine("asc", "{off|on}\toutput ASCII rendering of code/data", showAsc ? "on" : "off");
Expand Down
2 changes: 1 addition & 1 deletion dasmfw.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ using namespace std;
/* Global definitions */
/*****************************************************************************/

#define DASMFW_VERSION "0.24"
#define DASMFW_VERSION "0.25"

// set these to int64_t once 64bit processors become part of the framework
typedef uint32_t cadr_t; /* container for maximal code address*/
Expand Down
28 changes: 23 additions & 5 deletions dasmfw.htm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ <h1>dasmfw / the DisASseMbler FrameWork</h1>
That is, a framework for disassemblers&hellip;</li>
</ul>
<p>So I did a complete redesign - dasmfw was born. A framework that makes it relatively easy
to "plug in" new disassemblers, regardless of the architecture involved.</p>
to "plug in" new disassemblers, regardless of the architecture involved.<br />
Purists may wrinkle their noses - it's written in a very basic, very much "C with objects" style,
without any of the modern C++ finesses. That's actually intentional; this way, it can be
used with practically any C++ compiler that this millennium has to offer. A single "auto",
for example, would break that compatibility, no matter how convenient it would be.</p>
<p align="right">Hermann Seib, 2021</p>

<h2>Syntax</h2>
Expand Down Expand Up @@ -176,6 +180,15 @@ <h3>Output Formatting Options</h3>
instuctions on a disassembly line, which can be provided in an info file, see below).<br />
Normally, line comments are enabled.<br />
Turning off comments completely also turns off line comments.</dd>
<dt><b>code <i>on|off</i></b><br />
<b>nocode</b></dt>
<dd>can be used to prevent output of code lines. Makes sense if the disassembler run is
used to create a list of labels only (useful if you want to generate an include
file for another assembler source, together with <b>labeleqs on</b>)</dd>
<dt><b>labeleqs <i>on|off</i></b><br />
<b>nolabeleqs</b></dt>
<dd>can be used to emit code and data labels as equates (useful if you want to generate
an include file for another assembler source)</dd>
</dl>
<h3>Disassembler Options</h3>
<p>Most of the following options are universally usable; some, however, are disassembler-specific.
Expand Down Expand Up @@ -351,11 +364,15 @@ <h2>Info File</h2>
<p>Normally, dasmfw will try to interpret everything as <i>code</i>;
it doesn't try to find out which areas contain code and which areas contain data,
or the format of the data. Using an info file, you can give it detailed instructions
how to process the file, add comments, insert additional stuff, and so on.</p>
how to process the file, add comments, patch existing areas, insert additional stuff,
and so on.</p>
<p>The info file is a simple text file, which contains one instruction per line.<br />
The instructions are case-insensitive.<br />
Addresses need to be given in <i>hexadecimal</i> notation.
Anything following an asterisk (<b>*</b>) is interpreted as a comment.</p>
Addresses need to be given in <i>hexadecimal</i> notation.<br />
Anything following an asterisk (<b>*</b>) is interpreted as a comment. If an asterisk
needs to be given, it has to be preceded by a backslash (<b>\</b>). Backslash acts as
an <i>escape character</i>; if a single backslash is needed, it has to be preceded by
another backslash.</p>
<p>dasmfw looks for default information files in the following positions:</p>
<ol>
<li>in a subdirectory <b>.dasmfw</b> of the current user's home directory</li>
Expand All @@ -368,7 +385,8 @@ <h2>Info File</h2>

<h3>Info File Instructions</h3>
<p>Each instruction line has the following syntax:</p>
<pre>inst [bus tgtbus] [range] [value] [* comment]</pre>
<pre>* [comment]
inst [bus tgtbus] [range] [value] [* comment]</pre>
<p><b>inst</b> is one of the instructions described below.<br />
<b>tgtbus</b> is one of the busses defined for the current disassembler; for the AVR8, this can be
<i>code</i>, <i>data</i>, <i>io</i>, or <i>eeprom</i>;
Expand Down
5 changes: 5 additions & 0 deletions history.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,8 @@ v0.24 2022-05-05 Phillip Eaton went at it again :-)
https://github.com/Arakula/dasmfw/issues/4
Fix for https://github.com/Arakula/dasmfw/issues/5
Slight 650X improvements
v0.25 2022-05-06 [no]code option documented
[no]labeleqs option documented
Slight changes to info file handling against v0.24 as
neither "option cchar *" nor "option cchar \*" worked <sigh> ...
now it should work as documented and it's "option cchar \*"

0 comments on commit a70219e

Please sign in to comment.