stari sic format ukazi v1
This commit is contained in:
parent
e65262a3e0
commit
12472d2590
1 changed files with 42 additions and 1 deletions
|
|
@ -167,11 +167,52 @@ bool Machine::execF2(int opcode, int operand) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Machine::execSICF3F4(int opcode, int ni, int operand) {
|
bool Machine::execSICF3F4(int opcode, int ni, int operand) {
|
||||||
|
int x_val = 0;
|
||||||
|
int operand2 = fetch();
|
||||||
|
int UA;
|
||||||
|
int UV;
|
||||||
|
if (ni == 0) { // stari SIC (neposredno in enostavno naslavljanje)
|
||||||
|
if (((operand >> 7) & 0x1) == 1) { //preverimo ali je indeksno naslavljanje
|
||||||
|
x_val = getX();
|
||||||
|
}
|
||||||
|
|
||||||
|
UA = (((operand & 0x7F) << 8) | operand2) + x_val; //izracun uporabnega naslova: operand brez bita x + drugi del naslova + x_val
|
||||||
|
|
||||||
|
if (UA + 2 > MAX_ADDRESS) {
|
||||||
|
invalidAddressing();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
UV = (memory[UA] << 16) | (memory[UA + 1] << 8) | memory[UA + 2]; //izracunamo operand oz. uporabno vrednost
|
||||||
|
|
||||||
|
switch (opcode) {
|
||||||
|
case Opcode::ADD:
|
||||||
|
setA(getA() + UV);
|
||||||
|
return true;
|
||||||
|
case Opcode::AND:
|
||||||
|
setA(getA() & UV);
|
||||||
|
return true;
|
||||||
|
case Opcode::COMP:
|
||||||
|
if (getA() < UV) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
notImplemented(opcode);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (((operand >> 4) & 0x1) == 0) { // ce e bit ni prizgan e je F3, sicer F4
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Machine::execute() {
|
void Machine::execute() {
|
||||||
int opcode = fetch();
|
int opcode = fetch();
|
||||||
int operand;
|
int operand;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue