FREESCAPE: fix corner case in 8bit instruction parsing

This commit is contained in:
neuromancer 2023-01-29 19:12:25 +01:00
parent 5a0ee7b946
commit 7dee4515bd
3 changed files with 12 additions and 1 deletions

View file

@ -111,6 +111,7 @@ Common::String detokenise8bitCondition(Common::Array<uint8> &tokenisedCondition,
case 0:
detokenisedStream += "NOP ";
currentInstruction = FCLInstruction(Token::NOP);
break; // NOP
case 1: // add three-byte value to score
{
@ -180,6 +181,8 @@ Common::String detokenise8bitCondition(Common::Array<uint8> &tokenisedCondition,
currentInstruction.setDestination(1);
conditionalInstructions->push_back(currentInstruction);
currentInstruction = FCLInstruction(Token::UNKNOWN);
bytePointer++;
numberOfArguments = 0;
break;
case 10:
detokenisedStream += "SUBVAR (1, v";
@ -188,7 +191,8 @@ Common::String detokenise8bitCondition(Common::Array<uint8> &tokenisedCondition,
currentInstruction.setDestination(1);
conditionalInstructions->push_back(currentInstruction);
currentInstruction = FCLInstruction(Token::UNKNOWN);
break;
bytePointer++;
numberOfArguments = 0;
break;
case 11: // end condition if a variable doesn't have a particular value
@ -347,6 +351,7 @@ Common::String detokenise8bitCondition(Common::Array<uint8> &tokenisedCondition,
case 35:
detokenisedStream += "SCREEN (";
currentInstruction = FCLInstruction(Token::SCREEN);
break;
case 44:
@ -394,6 +399,7 @@ Common::String detokenise8bitCondition(Common::Array<uint8> &tokenisedCondition,
}
detokenisedStream += ")";
assert(currentInstruction.getType() != Token::UNKNOWN);
conditionalInstructions->push_back(currentInstruction);
currentInstruction = FCLInstruction(Token::UNKNOWN);
}

View file

@ -171,6 +171,9 @@ void FreescapeEngine::executeCode(FCLInstructionVector &code, bool shot, bool co
case Token::SPFX:
executeSPFX(instruction);
break;
case Token::SCREEN:
// TODO
break;
case Token::BITNOTEQ:
if (executeEndIfBitNotEqual(instruction))
ip = codeSize;

View file

@ -54,6 +54,7 @@ public:
MOVE,
MOVETO,
NOTV,
NOP,
OR,
ORV,
GETXPOS,
@ -63,6 +64,7 @@ public:
RESTART,
REDRAW,
REMOVE,
SCREEN,
SOUND,
SETVAR,
SHOTQ,