On an emulator, the receive buffer is filled with the correct/expected data for 'device status'. I found this experiment useful: - it revealed a bug in my register struct generator code (the maple_if-related registers were not at the correct offsets) - it validates my understanding about endianness-swapping between the maple bus and the SH4
22 lines
318 B
C++
22 lines
318 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
namespace string {
|
|
template <typename T>
|
|
inline void hex(T * c, uint32_t len, uint32_t n)
|
|
{
|
|
while (len > 0) {
|
|
uint32_t nib = n & 0xf;
|
|
n = n >> 4;
|
|
if (nib > 9) {
|
|
nib += (97 - 10);
|
|
} else {
|
|
nib += (48 - 0);
|
|
}
|
|
|
|
c[--len] = nib;
|
|
}
|
|
}
|
|
}
|