word size for V8 games is 4 bytes, as opposed to 2 bytes in V6/V7 games. Hence we adjust fetchScriptWord - this way we can reuse all sorts of code (and no, this is not really a hack - word size by tradition is something which varies depending on the architecture, so it is even consistent)

svn-id: r6064
This commit is contained in:
Max Horn 2002-12-23 00:23:36 +00:00
parent 11a48a2b01
commit 58f2ee45cd
5 changed files with 48 additions and 10 deletions

View file

@ -161,8 +161,8 @@ void Scumm_v8::setupOpcodes()
OPCODE(o8_unknown),
OPCODE(o8_unknown),
/* 64 */
OPCODE(o6_jumpFalse),
OPCODE(o6_jumpTrue),
OPCODE(o6_jumpFalse), // Not sure about which of these two is which (false==if or true==if ?!?)...
OPCODE(o6_jumpTrue), // ... since "if" could mean 'jump "if"' or 'execute following code "if", otherwise jump'.
OPCODE(o6_jump),
OPCODE(o6_breakHere),
/* 68 */
@ -371,6 +371,25 @@ const char *Scumm_v8::getOpcodeDesc(int i)
return _opcodesV8[i].desc;
}
// In V8, the word size is 4 byte, not 2 bytes as in V6/V7 games
uint Scumm_v8::fetchScriptWord()
{
int a;
if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) {
uint32 oldoffs = _scriptPointer - _scriptOrgPointer;
getScriptBaseAddress();
_scriptPointer = _scriptOrgPointer + oldoffs;
}
a = READ_LE_UINT32(_scriptPointer);
_scriptPointer += 4;
return a;
}
int Scumm_v8::fetchScriptWordSigned()
{
return (int32)fetchScriptWord();
}
void Scumm_v8::o8_unknown()
{
warning("Unknown opcode '%x' at %x", _opcode, _scriptPointer - _scriptOrgPointer);