SBC HL,rr writes its result to A instead of HL
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- python
- Domain
- reverse-engineering
Research direction
Start in Z80IL.py at OP.SBC and inspect how the destination register is selected for each operand size. Reproduce the ed 42 example and verify that SBC HL,BC produces a 16-bit result in HL while the existing 8-bit behavior remains correct.
Written by the indexing model from the issue text.
Description
In Z80IL.py, OP.SBC computes the subtraction at the operand size but always stores to A as one byte:
tmp = il.sub_borrow(size, lhs, rhs, il.flag("c"), flags="*")
tmp = il.set_reg(1, "A", tmp)
So ed 42 (SBC HL,BC) lifts as A = sbb.w{*}(HL, BC, flag:c) and the 16-bit result never reaches HL.
16-bit compare/subtract is common, so this silently drops pointer arithmetic — 39 sites in one test binary. Example: AND A / SBC HL,BC / LD A,(HL).
- Dominant language
- Python
- Stars
- 12
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Vector35/Z80
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
INC writes no flags Open
Difficulty 1/5 Under an hour Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100