pret / pokecrystal

Disassembly of Pokémon Crystal
https://pret.github.io/pokecrystal/
2.07k stars 778 forks source link

Bad comment in RTC-checking code #1059

Open aaaaaa123456789 opened 1 year ago

aaaaaa123456789 commented 1 year ago

https://github.com/pret/pokecrystal/blob/1d64befdb7caf0db43f30810fb19fe5b1fba7786/engine/menus/main_menu.asm#L284

This code here checks for the RTC overflow bit, which gets set when the RTC day count exceeds 512. However, since it is bit 6 of the control register, which also contains the upper portion of the day count, someone accidentally documented it as an actual check for $4000. (In actuality, bits 1-5 of that register are unmapped.)

This should just say it is checking whether the RTC overflow bit is set.

mid-kid commented 1 year ago

please consider making a PR instead also, the RTC overflow bit may want to be defined in constants/hardware_constants.asm

aaaaaa123456789 commented 1 year ago

please consider making a PR instead

This is my "I don't want to fork the repo while I'm doing 200 other things, but I don't want to forget about the issue" contribution :P

By the way, if you're going to define bit 6 for overflow, you might also want to define bit 7 for on/off.

mid-kid commented 1 year ago

I don't want to fork the repo while I'm doing 200 other things

Maybe you'll find some use in the Github CLI. I find that the git clone → make changes → git commitgh pr create workflow is quite comfortable, it even forks the repo for you. It's so good that I literally only use gh for that command. Alternatively, sometimes the web interface works for simple things.