Dokoncal racunanje uporabnih naslovov
This commit is contained in:
parent
e79d4ae214
commit
705c7bcb58
3 changed files with 37 additions and 10 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -6,3 +6,5 @@ sictools.jar
|
|||
Appendix_A_thru_C.pdf
|
||||
rek_sum.asm
|
||||
ass2/sic
|
||||
ass2/CMakeLists.txt
|
||||
ass2/build
|
||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
|
@ -51,5 +51,6 @@
|
|||
"thread": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"sstream": "cpp"
|
||||
}
|
||||
},
|
||||
"cmake.sourceDirectory": "/home/boobsson/Desktop/3. letnik FRI/SPO/spo-vaje/ass2"
|
||||
}
|
||||
|
|
@ -174,10 +174,39 @@ machine::machine() {
|
|||
naprave[num] = make_unique<fileDevice>(filename);
|
||||
}
|
||||
|
||||
int getUN(int n, int i, int x, int b, int p, int e, int operand) {
|
||||
//NEED TO IMPLEMENT
|
||||
return 1;
|
||||
int machine::getUN(int n, int i, int x, int b, int p, int e, int operand){
|
||||
int UN;
|
||||
|
||||
if (e == 1) {
|
||||
UN = operand;
|
||||
}
|
||||
else if (n == 0 && i == 0) {
|
||||
// SIC format
|
||||
UN = operand;
|
||||
}
|
||||
else {
|
||||
if (p == 1)//PC relativno
|
||||
UN = PC + operand;
|
||||
else if (b == 1)//Bazno relativno
|
||||
UN = B + operand;
|
||||
else
|
||||
UN = operand;
|
||||
}
|
||||
//indeksno
|
||||
if (x == 1)
|
||||
UN += X;
|
||||
//takojsnje
|
||||
if (n == 0 && i == 1)
|
||||
return UN;
|
||||
|
||||
//posredno
|
||||
if (n == 1 && i == 0)
|
||||
return getWord(UN);
|
||||
|
||||
//enostavno n=i=1
|
||||
return UN;
|
||||
}
|
||||
|
||||
|
||||
void machine::outOfMemoryRange(int memory) {
|
||||
throw out_of_range("Naslov je izven pomnilniškega obmocja: " + to_string(memory));
|
||||
|
|
@ -247,9 +276,6 @@ machine::machine() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//TO DO, racunanje uporabnih naslovov!!!!
|
||||
bool machine::execF1(uint8_t opcode, const string& mnemonic){
|
||||
//FIX, FLOAT, HIO, TIO, SIO, NORM
|
||||
auto it = Opcode::OPCODES.find(opcode);
|
||||
|
|
@ -325,5 +351,3 @@ machine::machine() {
|
|||
|
||||
return it->second(UN); // tukaj dejansko pozenemo ukaz z uporabnim naslovom
|
||||
}
|
||||
//TO DO
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue