Add function to get memory address from opcode
This commit is contained in:
@@ -28,6 +28,13 @@ uint8_t* Memory::GetOffsetFromOpcode(uint8_t* opcode, int extraOffset)
|
||||
return opcode + 4 + disp + extraOffset; // +4 car disp32 fait 4 octets
|
||||
}
|
||||
|
||||
uint8_t* Memory::GetAddressFromOpcode(uint8_t* opcode, uint32_t dispOffset, uint32_t instructionLen)
|
||||
{
|
||||
int32_t disp = 0;
|
||||
std::memcpy(&disp, opcode + dispOffset, sizeof(disp)); // lit le disp32 de manière safe
|
||||
return opcode + instructionLen + disp; // gère automatiquement disp négatif
|
||||
}
|
||||
|
||||
const char* Memory::Float32ToHexBytes(float value) {
|
||||
static char bytes[4]; // buffer persistant (évite les problèmes de scope)
|
||||
std::memcpy(bytes, &value, sizeof(float));
|
||||
|
||||
Reference in New Issue
Block a user