aboutsummaryrefslogtreecommitdiff
path: root/engines/glk
diff options
context:
space:
mode:
authorPaul Gilbert2019-06-10 07:24:30 -0700
committerPaul Gilbert2019-06-10 19:08:58 -0700
commit1de8c3d7308512b4eae556511a468d9b59d26f90 (patch)
tree966e57ba6ff84e6ab725bd3f04d8086b0e19f6e7 /engines/glk
parent75da8ddd06a08e26fd006ff0033ee911e5bd5411 (diff)
downloadscummvm-rg350-1de8c3d7308512b4eae556511a468d9b59d26f90.tar.gz
scummvm-rg350-1de8c3d7308512b4eae556511a468d9b59d26f90.tar.bz2
scummvm-rg350-1de8c3d7308512b4eae556511a468d9b59d26f90.zip
GLK: ADVSYS: More opcodes
Diffstat (limited to 'engines/glk')
-rw-r--r--engines/glk/advsys/glk_interface.cpp5
-rw-r--r--engines/glk/advsys/glk_interface.h5
-rw-r--r--engines/glk/advsys/vm.cpp21
3 files changed, 31 insertions, 0 deletions
diff --git a/engines/glk/advsys/glk_interface.cpp b/engines/glk/advsys/glk_interface.cpp
index c83f0c137c..800d70836e 100644
--- a/engines/glk/advsys/glk_interface.cpp
+++ b/engines/glk/advsys/glk_interface.cpp
@@ -39,5 +39,10 @@ void GlkInterface::print(int number) {
print(s);
}
+Common::String GlkInterface::getLine() {
+ // TODO: Stub
+ return "";
+}
+
} // End of namespace AdvSys
} // End of namespace Glk
diff --git a/engines/glk/advsys/glk_interface.h b/engines/glk/advsys/glk_interface.h
index b316f1f84f..44f3db9939 100644
--- a/engines/glk/advsys/glk_interface.h
+++ b/engines/glk/advsys/glk_interface.h
@@ -52,6 +52,11 @@ protected:
* @param number Number to print
*/
void print(int number);
+
+ /**
+ * Get an input line
+ */
+ Common::String getLine();
public:
/**
* Constructor
diff --git a/engines/glk/advsys/vm.cpp b/engines/glk/advsys/vm.cpp
index ef943e620f..a06cd28512 100644
--- a/engines/glk/advsys/vm.cpp
+++ b/engines/glk/advsys/vm.cpp
@@ -285,30 +285,51 @@ void VM::opSVAR() {
}
void VM::opSSET() {
+ setVariable(getCodeByte(), _stack.top());
}
void VM::opSPLIT() {
+ _stack.top() = readCodeByte();
}
void VM::opSNLIT() {
+ _stack.top() = readCodeByte();
}
void VM::opYORN() {
+ Common::String line = getLine();
+ _stack.top() = line[0] == 'Y' || line[0] == 'y' ? TRUE : NIL;
}
void VM::opSAVE() {
+ if (saveGame().getCode() != Common::kNoError)
+ print("Sorry, the savegame couldn't be created");
}
void VM::opRESTORE() {
+ if (saveGame().getCode() != Common::kNoError)
+ print("Sorry, the savegame couldn't be restored");
}
void VM::opARG() {
+ int argNum = readCodeByte();
+ int varsSize = _stack[_fp - 3];
+ if (argNum >= varsSize)
+ error("Invalid argument number");
+ _stack.top() = _stack[_fp - 4 - argNum];
}
void VM::opASET() {
+ int argNum = readCodeByte();
+ int varsSize = _stack[_fp - 3];
+ if (argNum >= varsSize)
+ error("Invalid argument number");
+ _stack[_fp - 4 - argNum] = _stack.top();
}
void VM::opTMP() {
+ int val = readCodeByte();
+
}
void VM::opTSET() {