Navigation Menu

Skip to content

Commit

Permalink
Implemented verify opcode, but I have no idea if this is actually cor…
Browse files Browse the repository at this point in the history
…rect.
  • Loading branch information
icculus committed Aug 27, 2015
1 parent 7e2a1e8 commit 9ca95f1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion mojozork.c
Expand Up @@ -1282,6 +1282,18 @@ static void opcode_read(void)
*(GStory + GOperands[1] + 1) = numtoks;
} // opcode_read

static void opcode_verify(void)
{
const uint32 total = GHeader.story_len;
uint32 checksum = 0;
uint32 i;

for (i = 0x40; i < total; i++)
checksum += GStory[i];

doBranch((((uint16) (checksum % 0x10000)) == GHeader.story_checksum) ? 1 : 0);
} // opcode_verify

static void loadStory(const char *fname);

static void opcode_restart(void)
Expand Down Expand Up @@ -1598,7 +1610,7 @@ static void initOpcodeTable(void)
return; // we're done.

OPCODE(188, show_status);
OPCODE_WRITEME(189, verify);
OPCODE(189, verify);
OPCODE_WRITEME(234, split_window);
OPCODE_WRITEME(235, set_window);
OPCODE_WRITEME(243, output_stream);
Expand Down

0 comments on commit 9ca95f1

Please sign in to comment.