aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/console.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2012-06-23 21:38:46 +0300
committerFilippos Karapetis2012-06-23 21:45:26 +0300
commit20b677080881580706652b17dd5a4c3ed3e36c07 (patch)
tree299521363c9962767c2acc7f28a6bb4f8aa747de /engines/sci/console.cpp
parentc1eb93bc5a9866787f27add5ca1d821e1470a4be (diff)
downloadscummvm-rg350-20b677080881580706652b17dd5a4c3ed3e36c07.tar.gz
scummvm-rg350-20b677080881580706652b17dd5a4c3ed3e36c07.tar.bz2
scummvm-rg350-20b677080881580706652b17dd5a4c3ed3e36c07.zip
SCI: Change the program counter (PC) to be a 32-bit variable
This is needed for future support of large SCI3 scripts. The program counter is isolated and does not interfere with other parts of the VM, plus it does not get stored in saved games, so it's pretty straightforward to convert
Diffstat (limited to 'engines/sci/console.cpp')
-rw-r--r--engines/sci/console.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index b0ed7e6225..40a6fd1415 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -2913,7 +2913,8 @@ bool Console::cmdDisassemble(int argc, const char **argv) {
if (jumpTarget > farthestTarget)
farthestTarget = jumpTarget;
}
- addr = disassemble(_engine->_gamestate, addr, printBWTag, printBytecode);
+ // TODO: Use a true 32-bit reg_t for the position (addr)
+ addr = disassemble(_engine->_gamestate, make_reg32(addr.getSegment(), addr.getOffset()), printBWTag, printBytecode);
if (addr.isNull() && prevAddr < farthestTarget)
addr = prevAddr + 1; // skip past the ret
} while (addr.getOffset() > 0);
@@ -2961,7 +2962,8 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) {
}
do {
- vpc = disassemble(_engine->_gamestate, vpc, printBWTag, printBytes);
+ // TODO: Use a true 32-bit reg_t for the position (vpc)
+ vpc = disassemble(_engine->_gamestate, make_reg32(vpc.getSegment(), vpc.getOffset()), printBWTag, printBytes);
} while ((vpc.getOffset() > 0) && (vpc.getOffset() + 6 < size) && (--opCount));
return true;
@@ -3652,10 +3654,14 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV
relativeOffset = true;
if (!scumm_strnicmp(str + 1, "PC", 2)) {
- *dest = s->_executionStack.back().addr.pc;
+ // TODO: Handle 32-bit PC addresses
+ reg32_t pc = s->_executionStack.back().addr.pc;
+ *dest = make_reg(pc.getSegment(), (uint16)pc.getOffset());
offsetStr = str + 3;
} else if (!scumm_strnicmp(str + 1, "P", 1)) {
- *dest = s->_executionStack.back().addr.pc;
+ // TODO: Handle 32-bit PC addresses
+ reg32_t pc = s->_executionStack.back().addr.pc;
+ *dest = make_reg(pc.getSegment(), (uint16)pc.getOffset());
offsetStr = str + 2;
} else if (!scumm_strnicmp(str + 1, "PREV", 4)) {
*dest = s->r_prev;