santiontanon / castlemaster2-disassembly

Disassembly of the original 1990 Castle Master II: The Crypt ZX Spectrum game

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wrong name for RULE_TYPE_END_RULE_IF_VARIABLE_LARGER

farmboy0 opened this issue · comments

Lba49:
            cp RULE_TYPE_END_RULE_IF_VARIABLE_LARGER
            jr nz, Lba53

            ; Rule type 46 (#2e): if variable > value, skip rest of script.
            ld a, e
            cp (hl)
            jr c, Lba5a_next_rule
            jr Lba57_next_rule_skipping

This seems wrong:
A (accumulator) := value
N (cp's operand) := variable
cp sets the carry flag when A < N according to https://learn.cemetech.net/index.php?title=Z80:Opcodes:CP
so if value < variable or variable > value execution continues
so this rule skips execution when variable <= value

Do i miss anything here?

Ah, true, you are right! I labeled it in reverse! I just fixed this in this commit: bf2961c

Thanks for reporting!