sim: bugfix in stackop
authorMartin Perner <martin@perner.cc>
Tue, 9 Nov 2010 16:42:13 +0000 (17:42 +0100)
committerMartin Perner <martin@perner.cc>
Tue, 9 Nov 2010 16:42:13 +0000 (17:42 +0100)
3c_disasm/instr/stackop.cpp

index d4a1a774f3ea19bca5e04b54d09a2e2f21b76f61..1e56cfa833a96b0c86fdb5917283596f64b44ed8 100644 (file)
@@ -77,8 +77,8 @@ void Cstackop::execInstr()
 
        switch(this->m_typ) {
                case 0:
-                       sp += 4;
                        this->m_cpu->setRegister(m_rd, this->m_cpu->getRAM(sp));
+                       sp += 4;
                        break;
                case 1:
                        sp += 4;
@@ -87,8 +87,8 @@ void Cstackop::execInstr()
                        this->m_cpu->setRegister(m_rd, this->m_cpu->getRAM(sp));
                        break;
                case 3:
-                       this->m_cpu->setRAM(sp, this->m_cpu->getRegister(m_rd));
                        sp -= 4;
+                       this->m_cpu->setRAM(sp, this->m_cpu->getRegister(m_rd));
                        break;
                default:
                        cerr << "What have you done? 2 bits that have more than 4 values?!" << endl;