AND does not clear the carry flag
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 12
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
OP.AND in Z80IL.py uses flags="z", while OP.OR and OP.XOR use flags="*".
The Z80 AND also clears C (and N, and sets H). This matters because AND A / OR A is the idiomatic way to clear carry before SBC HL,rr — with only Z modelled, the carry clear is invisible and the following SBC looks like it depends on a stale flag.
139 sites in one test binary.
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.
Research direction
Start in Z80IL.py at OP.AND and compare its flags handling with OP.OR and OP.XOR. Check how the flags string represents Z80 carry, subtract, and half-carry behavior, then verify the referenced test binary's AND and subsequent SBC cases no longer depend on stale carry.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 75/100