Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inaccuracies in DAA exact behavior documentation #1602

Open
calc84maniac opened this issue Jan 6, 2025 · 0 comments
Open

Inaccuracies in DAA exact behavior documentation #1602

calc84maniac opened this issue Jan 6, 2025 · 0 comments
Assignees
Labels
docs This affects the documentation (web-specific issues go to rgbds-www) rgbasm This affects RGBASM
Milestone

Comments

@calc84maniac
Copy link

In v0.9.0 documentation, there are a couple of problems in the DAA explanation.

The first problem is the carry flag output. For both addition and subtraction, the carry output should always be based on the condition in step 3 (set if $60 is added to the adjustment, reset otherwise). Incidentally, for subtraction, this means it always preserves the carry flag, which might be worth mentioning.

The second problem is in the condition in step 3 for addition. "If the carry flag is set or A > $9F" should be "If the carry flag is set or A > $99". Comparing to $9F would only be valid if the adjustment value from step 2 was already added to A and the carry-out from that was also OR'd into the carry flag. Comparing to $99, on the other hand, handles this case cleanly because values between $9A and $9F always have an adjustment of $6 in step 2, and if it were added to A it would then be greater than $9F.

@Rangi42 Rangi42 added docs This affects the documentation (web-specific issues go to rgbds-www) rgbasm This affects RGBASM labels Jan 6, 2025
@Rangi42 Rangi42 added this to the 0.9.1 milestone Jan 6, 2025
@Rangi42 Rangi42 self-assigned this Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This affects the documentation (web-specific issues go to rgbds-www) rgbasm This affects RGBASM
Projects
None yet
Development

No branches or pull requests

2 participants