Skip to content

Commit

Permalink
Little fix for AVR8 disassembler (can create gs() for avr-gcc now)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arakula committed Jul 15, 2016
1 parent 97f29a9 commit b743c22
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions DasmAvr8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -874,36 +874,47 @@ int relBus;
MemAttributeAvr8::RelType rt = GetRelative(addr, rel, relBus, bus);
if (rt != MemAttributeAvr8::RelUntyped)
{
// deal with LOW() / HIGH()
// deal with LOW()/HIGH() in data (8bit) or code (16bit) format
if (relBus == Avr8BusTypes)
relBus = bus;
Label *lbl = (rel == NO_ADDRESS) ? NULL : FindLabel(rel, Untyped, relBus);
if (lbl)
{
string s = Label2String(rel, true, addr, relBus);

if ((s.find_first_of("+-") != string::npos) &&
(rt == MemAttributeAvr8::RelLowMinus ||
rt == MemAttributeAvr8::RelHighMinus ||
rt == MemAttributeAvr8::RelLow2 ||
rt == MemAttributeAvr8::RelHigh2))
s = "(" + s + ")";

if (rt == MemAttributeAvr8::RelLow2 ||
rt == MemAttributeAvr8::RelHigh2)
{
if (avr_gcc)
s = "gs(" + s + ")";
else
s += ">>1";
}

switch (rt)
{
case MemAttributeAvr8::RelLow :
case MemAttributeAvr8::RelLowMinus :
case MemAttributeAvr8::RelLow2 :
s = sformat("LOW(%s%s%s)",
s = sformat("%s(%s%s)",
avr_gcc ? "lo8" : "LOW",
(rt == MemAttributeAvr8::RelLowMinus) ? "-" : "",
s.c_str(),
(rt == MemAttributeAvr8::RelLow2) ? ">>1" : "");
s.c_str());
return s;
case MemAttributeAvr8::RelHigh :
case MemAttributeAvr8::RelHighMinus :
case MemAttributeAvr8::RelHigh2 :
s = sformat("HIGH(%s%s%s)",
s = sformat("%s(%s%s)",
avr_gcc ? "hi8" : "HIGH",
(rt == MemAttributeAvr8::RelHighMinus) ? "-" : "",
s.c_str(),
(rt == MemAttributeAvr8::RelHigh2) ? ">>1" : "");
s.c_str());
return s;
}
}
Expand Down

0 comments on commit b743c22

Please sign in to comment.