Instruction length fixes
This commit is contained in:
@@ -270,6 +270,7 @@ class MemoryImpl : public Memory, public Loggable {
|
||||
} else {
|
||||
// Handle stack underflow
|
||||
std::cout << "Stack underflow!" << std::endl;
|
||||
throw std::runtime_error("Stack underflow!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +280,7 @@ class MemoryImpl : public Memory, public Loggable {
|
||||
} else {
|
||||
// Handle stack overflow
|
||||
std::cout << "Stack overflow!" << std::endl;
|
||||
return 0;
|
||||
throw std::runtime_error("Stack overflow!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ class MockMemory : public Memory {
|
||||
memory_[address + 1] = (value >> 8) & 0xFF;
|
||||
});
|
||||
ON_CALL(*this, PushByte(::testing::_)).WillByDefault([this](uint8_t value) {
|
||||
memory_.at(SP_) = value;
|
||||
memory_.at(SP_--) = value;
|
||||
});
|
||||
ON_CALL(*this, PopByte()).WillByDefault([this]() {
|
||||
uint8_t value = memory_.at(SP_);
|
||||
@@ -151,6 +151,7 @@ class MockMemory : public Memory {
|
||||
.WillByDefault([this](uint16_t value) {
|
||||
memory_.at(SP_) = value & 0xFF;
|
||||
memory_.at(SP_ + 1) = (value >> 8) & 0xFF;
|
||||
this->SetSP(SP_ - 2);
|
||||
});
|
||||
ON_CALL(*this, PopWord()).WillByDefault([this]() {
|
||||
uint16_t value = static_cast<uint16_t>(memory_.at(SP_)) |
|
||||
|
||||
Reference in New Issue
Block a user