MIXAL
machine_store.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include "machine.h"
3 
9 namespace mixal {
10 
12 void Computer::executeST(const InstructionWord& instruction, Register5* reg) {
13  int address = getIndexedAddress(instruction, true);
14  copyFromRegister5(instruction, *reg, &memory[address]);
15 }
16 
18 void Computer::executeSTi(const InstructionWord& instruction) {
19  int address = getIndexedAddress(instruction, true);
20  int registerIndex = instruction.operation() - Instructions::ST1 + 1;
21  auto& rIi = rI(registerIndex);
22  ComputerWord word(rIi.negative, 0, 0, 0, rIi[1], rIi[2]);
23  copyFromRegister5(instruction, word, &memory[address]);
24 }
25 
27 void Computer::executeSTJ(const InstructionWord& instruction) {
28  int address = getIndexedAddress(instruction, true);
29  ComputerWord word('+', 0, 0, 0, rJ[1], rJ[2]);
30  copyFromRegister5(instruction, word, &memory[address]);
31 }
32 
34 void Computer::executeSTZ(const InstructionWord& instruction) {
35  int address = getIndexedAddress(instruction, true);
36  ComputerWord word('+', 0, 0, 0, 0, 0);
37  copyFromRegister5(instruction, word, &memory[address]);
38 }
39 
40 }; // namespace mixal
mixal::Computer::memory
ComputerWord memory[NUM_MEMORY]
Definition: machine.h:38
machine.h
The virtual machine.
mixal::Computer::rI
Register2 & rI(int index)
Definition: machine.cpp:16
mixal::Computer::rJ
Register2 rJ
Definition: machine.h:33