From 302bbdc7ac18cd355f9f081cae202f5434427262 Mon Sep 17 00:00:00 2001 From: bd Date: Tue, 22 Apr 2025 23:39:14 -0400 Subject: Use a struct for InstrDTO --- src/mm.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/mm.cc') diff --git a/src/mm.cc b/src/mm.cc index 3df1578..ac77433 100644 --- a/src/mm.cc +++ b/src/mm.cc @@ -25,12 +25,13 @@ void MM::advance_helper() signed int data; int i; - switch (this->curr_instr->get_mnemonic()) { + switch (this->curr_instr->mnemonic) { case LOAD: - i = this->storage->read_word(this, this->curr_instr->get_s1(), data); + i = this->storage->read_word( + this, this->curr_instr->operands.integer.slot_one, data); this->status = i ? OK : STALLED; if (this->status == OK) { - this->curr_instr->set_s1(data); + this->curr_instr->operands.integer.slot_one = data; } else this->status = STALLED; break; @@ -38,7 +39,8 @@ void MM::advance_helper() case PUSH: case STORE: i = this->storage->write_word( - this, this->curr_instr->get_s2(), this->curr_instr->get_s1()); + this, this->curr_instr->operands.integer.slot_two, + this->curr_instr->operands.integer.slot_one); this->status = i ? OK : STALLED; if (this->status != OK) { this->status = STALLED; @@ -46,10 +48,10 @@ void MM::advance_helper() break; case POP: - i = this->storage->read_word(this, this->curr_instr->get_s3(), data); + i = this->storage->read_word(this, this->curr_instr->operands.integer.slot_three, data); this->status = i ? OK : STALLED; if (this->status == OK) { - this->curr_instr->set_s3(data); + this->curr_instr->operands.integer.slot_three = data; } else this->status = STALLED; break; -- cgit v1.2.3