Skip to content

Fix half carry flag logic in alu_add_hl#14

Merged
mohanson merged 1 commit into
libraries:masterfrom
nwtnni:master
Jul 15, 2019
Merged

Fix half carry flag logic in alu_add_hl#14
mohanson merged 1 commit into
libraries:masterfrom
nwtnni:master

Conversation

@nwtnni

@nwtnni nwtnni commented Jul 14, 2019

Copy link
Copy Markdown
Contributor

Correct me if I'm wrong, but I think a mask of 0x0FFF is consistent with the 8-bit alu_add function:

self.reg.set_flag(C, u16::from(a) + u16::from(n) > 0xff);
self.reg.set_flag(H, (a & 0x0f) + (n & 0x0f) > 0x0f);

and other emulators I've checked with: SameBoy, binjgb, CoffeeGB

@mohanson

Copy link
Copy Markdown
Collaborator

Thanks! you are correct.

@mohanson mohanson merged commit 49e7d89 into libraries:master Jul 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants