Vector35 / Vector35/Z80

AND does not clear the carry flag

Open Beginner friendly
#16 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

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

  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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.