Skip to content

Conditional branch in emulator is incorrect #241

@mnemonikr

Description

@mnemonikr

The conditional branch in the emulator reads the least significant bit of the byte specified to determine whether or not to branch.

condition: memory.read_bit(&instruction.inputs[1])?.try_into().ok(),

However, the specification for CBRANCH states:

This is a conditional branch instruction where the dynamic condition for taking the branch is determined by the 1 byte variable input1. If this variable is non-zero, the condition is considered true and the branch is taken. [emph. added]

Therefore this check should be updated to compare the byte to the zero byte.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions