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