[sim] bug + display
authorMartin Perner <martin@perner.cc>
Fri, 17 Dec 2010 13:49:51 +0000 (14:49 +0100)
committerMartin Perner <martin@perner.cc>
Fri, 17 Dec 2010 13:49:51 +0000 (14:49 +0100)
fixed bug in branch, jumps are not counting the instr. amount, not
the address difference

displaying of branch and add changed/fixed

3c_disasm/instr/add.cpp
3c_disasm/instr/branch.cpp

index b5cd4f9fb6d90662941c78b3d956a2ff7f81cd09..a6967e490999e48a3a44366f337472a3c1c55454 100644 (file)
@@ -76,6 +76,6 @@ std::string Cadd::toString()
        if(m_d) op << 'D';
        if(m_c) op << 'C';
 
-       op << " r" << m_rd << ", r" << m_ra << ", r" << m_rb;
+       op << this->getConditionFlag() << " r" << m_rd << ", r" << m_ra << ", r" << m_rb;
        return op.str();
 }
index b8781da5d07ed42c323e2b67da8acbf189b9e01b..b79776224726137cac74bc9f1a85791447f0c4c4 100644 (file)
@@ -94,8 +94,9 @@ void Cbranch::execInstr()
                        this->m_cpu->setRAM(sp, this->m_cpu->getNextPC());
                        this->m_cpu->setStack(sp);
                        }
+                       /* fall through */
                case 0:
-                       this->m_cpu->setNextPC(pc+this->m_imm);
+                       this->m_cpu->setNextPC(pc+(this->m_imm*4));
                        break;
                case 2:
                case 3:
@@ -117,7 +118,7 @@ std::string Cbranch::toString()
 
        op << this->getConditionFlag() << (m_taken ? '+' : '-');
        if(m_typ < 2) {
-               op << " 0x" << std::hex << m_imm << "(" << std::dec << m_imm << ")";
+               op << " 0x" << std::hex << m_imm << "(" << std::dec << m_imm << ", " << (int) m_imm << ")";
        }
        return op.str();
 }