Virtual Boy MPYHW patch [message #7000] |
Sun, 07 January 2024 14:56 |
|
Hi! I've got a patch for a bug I found while making clang target the Virtual Boy.
The VB's CPU supports an "mpyhw reg1, reg2" instruction to multiply reg2 by the 16-bit value stored in reg1. The official VB development manual says that both reg2 and reg1 must be halfwords (i.e. hold 16-bit values) for correct results, but GuyPerfect has discovered that on real hardware, only reg1 is treated as a halfword, and reg2 can use the full 32 bits.
Mednafen is following the behavior described in the manual (treating reg2 as 16-bit), but the undocumented real behavior is more useful. So here's a patch to make Mednafen work like hardware, so we can take advantage of it.
|
|