Vector35 / Vector35/Z80

DEC (HL) / (IX+d) dereferences the destination twice

Open Beginner friendly
#14 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
12
Forks
5
PR merge metrics
No merged PRs in 30d

Description

The non-register branch of OP.DEC in Z80IL.py reuses the loaded value as the store address:

mem = operand_to_il(oper_type, oper_val, il, 1)   # this is a load
tmp = il.sub(1, mem, il.const(1, 1), flags="not_c")
tmp = il.store(1, mem, tmp)                        # ...used as an address

35 (DEC (HL)) lifts as [[HL].b].b = sub.b{not_c}([HL].b, 1) — it stores to the address formed by the loaded byte.

OP.INC handles the same operand correctly with peel_load=True; DEC should match. 19 sites in one test binary.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Z80IL.py at the non-register branch of OP.DEC, then compare it with OP.INC, which handles the same operand correctly with peel_load=True. Run the referenced test binary or existing lifting tests and confirm DEC (HL) and DEC (IX+d) store through the intended destination for all 19 sites.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
reverse-engineering
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.