ares-emulator / ares

ares is a cross-platform, open source, multi-system emulator, focusing on accuracy and preservation.
https://ares-emu.net
Other
939 stars 114 forks source link

SM83 instruction decode bug #861

Closed raddad772 closed 1 year ago

raddad772 commented 1 year ago

SM83 instruction.cpp

switch(opcode.bit(6,7) << 3 | opcode.bit(0,2)) {

should be

switch(opcode.bit(6,7) >> 3 | opcode.bit(0,2)) {

invertego commented 1 year ago

The extracted bits are right shifted automatically. See here: https://github.com/ares-emulator/ares/blob/c756ae6ea3fc8a953ca83c8fcafa2b6b98d65483/nall/primitives/bit-range.hpp#L162

LukeUsher commented 1 year ago

Correct, not a bug, just a misunderstanding on how ares' custom data types function.

raddad772 commented 1 year ago

Ok, I hear that. However I think this kind of defeats the idea of clear code that is its own documentation. maybe put in a comment there saying the effect is the opposite of what is written?On Oct 26, 2022, at 4:08 AM, Luke Usher @.***> wrote: Correct, not a bug, just a misunderstanding on how ares' custom data types function.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>