You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue specifically affects emulators using a byte-swapped memory layout.
For historical reasons, most of the current emulators for the SEGA Genesis swap odd and even bytes in the emulated memory, effectively swapping an internal big endian memory layout to a little endian one. The crate currently deals with this with an internal enum that reports whether the emulator is using an original, big endian, or a byte swapped layout.
This allows for easily reading single u8 and u16 values from memory, as well as [u16; N] arrays, but breaks completely when dealing with [u8; N] due to the fact no additional abstraction is performed other than checking the original memory address to start reading from.
The solution, which I plan on implementing eventually, is to swap odd and even bytes from the [u8; N] array after reading it and before returning it to the calling function. This would require a bit of unsafe but would be safely wrapped inside the read() function anyway.
The text was updated successfully, but these errors were encountered:
Jujstme
added a commit
to Jujstme/asr
that referenced
this issue
Jan 21, 2024
This issue specifically affects emulators using a byte-swapped memory layout.
For historical reasons, most of the current emulators for the SEGA Genesis swap odd and even bytes in the emulated memory, effectively swapping an internal big endian memory layout to a little endian one. The crate currently deals with this with an internal enum that reports whether the emulator is using an original, big endian, or a byte swapped layout.
This allows for easily reading single
u8
andu16
values from memory, as well as[u16; N]
arrays, but breaks completely when dealing with[u8; N]
due to the fact no additional abstraction is performed other than checking the original memory address to start reading from.The solution, which I plan on implementing eventually, is to swap odd and even bytes from the
[u8; N]
array after reading it and before returning it to the calling function. This would require a bit of unsafe but would be safely wrapped inside theread()
function anyway.The text was updated successfully, but these errors were encountered: