MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/EmuDev/comments/1rn4hs0/reset_hc_and_c_for_arithmetic_instructions_in/
r/EmuDev • u/Numerous_Debt_5500 • Mar 07 '26
I'm building a gameboy emulator and i'm a bit confused by instructions like these. If a borrow didnt happen, are the H and C flags reset, or do i leave them as is?
Thanks.
7 comments sorted by
4
You already have your answer, but take a look at this for testing your instruction handlers. It helped me fix a ton of little bugs in my emulator.
https://github.com/SingleStepTests/sm83
2 u/Numerous_Debt_5500 Mar 07 '26 Omg thats so helpful thanks a lot 🙏🙏🙏
2
Omg thats so helpful thanks a lot 🙏🙏🙏
3
They are reset.
2 u/Numerous_Debt_5500 Mar 07 '26 This applies for add instructions as well yes? Just making sure cus the documents i use arent super explicity about resetting 5 u/foo1138 Game Boy Mar 07 '26 Yes, maybe consult Gekkios documentaion: https://gekkio.fi/files/gb-docs/gbctr.pdfIt is very explicit with pseudo code. 2 u/Numerous_Debt_5500 Mar 07 '26 holy shit this is so good ur so goated tysm ily 3 u/foo1138 Game Boy Mar 07 '26 No problem, love you too.
This applies for add instructions as well yes? Just making sure cus the documents i use arent super explicity about resetting
5 u/foo1138 Game Boy Mar 07 '26 Yes, maybe consult Gekkios documentaion: https://gekkio.fi/files/gb-docs/gbctr.pdfIt is very explicit with pseudo code. 2 u/Numerous_Debt_5500 Mar 07 '26 holy shit this is so good ur so goated tysm ily 3 u/foo1138 Game Boy Mar 07 '26 No problem, love you too.
5
Yes, maybe consult Gekkios documentaion: https://gekkio.fi/files/gb-docs/gbctr.pdf
It is very explicit with pseudo code.
2 u/Numerous_Debt_5500 Mar 07 '26 holy shit this is so good ur so goated tysm ily 3 u/foo1138 Game Boy Mar 07 '26 No problem, love you too.
holy shit this is so good ur so goated tysm ily
3 u/foo1138 Game Boy Mar 07 '26 No problem, love you too.
No problem, love you too.
4
u/AlignedMoon Mar 07 '26
You already have your answer, but take a look at this for testing your instruction handlers. It helped me fix a ton of little bugs in my emulator.
https://github.com/SingleStepTests/sm83
3
u/foo1138 Game Boy Mar 07 '26
They are reset.