mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-06-01 14:41:34 +00:00
ppcfpopcodes: Fix load float.
Type casting an int to a float assigns the value of the int to the float which is not what is needed here.
This commit is contained in:
parent
267a9448ea
commit
fd81d7b040
|
@ -681,18 +681,17 @@ void dppc_interpreter::ppc_lfs() {
|
||||||
ppc_grab_regsfpdia();
|
ppc_grab_regsfpdia();
|
||||||
ppc_effective_address = int32_t(int16_t(ppc_cur_instruction));
|
ppc_effective_address = int32_t(int16_t(ppc_cur_instruction));
|
||||||
ppc_effective_address += (reg_a) ? val_reg_a : 0;
|
ppc_effective_address += (reg_a) ? val_reg_a : 0;
|
||||||
float result = (float)mmu_read_vmem<uint32_t>(ppc_effective_address);
|
uint32_t result = mmu_read_vmem<uint32_t>(ppc_effective_address);
|
||||||
ppc_state.fpr[reg_d].dbl64_r = (double)result;
|
ppc_state.fpr[reg_d].dbl64_r = *(float*)(&result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void dppc_interpreter::ppc_lfsu() {
|
void dppc_interpreter::ppc_lfsu() {
|
||||||
ppc_grab_regsfpdia();
|
ppc_grab_regsfpdia();
|
||||||
if (reg_a) {
|
if (reg_a) {
|
||||||
ppc_effective_address = int32_t(int16_t(ppc_cur_instruction));
|
ppc_effective_address = int32_t(int16_t(ppc_cur_instruction));
|
||||||
ppc_effective_address += (reg_a) ? val_reg_a : 0;
|
ppc_effective_address += (reg_a) ? val_reg_a : 0;
|
||||||
float result = (float)mmu_read_vmem<uint32_t>(ppc_effective_address);
|
uint32_t result = mmu_read_vmem<uint32_t>(ppc_effective_address);
|
||||||
ppc_state.fpr[reg_d].dbl64_r = (double)result;
|
ppc_state.fpr[reg_d].dbl64_r = *(float*)(&result);
|
||||||
ppc_state.gpr[reg_a] = ppc_effective_address;
|
ppc_state.gpr[reg_a] = ppc_effective_address;
|
||||||
} else {
|
} else {
|
||||||
ppc_exception_handler(Except_Type::EXC_PROGRAM, Exc_Cause::ILLEGAL_OP);
|
ppc_exception_handler(Except_Type::EXC_PROGRAM, Exc_Cause::ILLEGAL_OP);
|
||||||
|
@ -702,16 +701,16 @@ void dppc_interpreter::ppc_lfsu() {
|
||||||
void dppc_interpreter::ppc_lfsx() {
|
void dppc_interpreter::ppc_lfsx() {
|
||||||
ppc_grab_regsfpdiab();
|
ppc_grab_regsfpdiab();
|
||||||
ppc_effective_address = (reg_a) ? val_reg_a + val_reg_b : val_reg_b;
|
ppc_effective_address = (reg_a) ? val_reg_a + val_reg_b : val_reg_b;
|
||||||
float result = (float)mmu_read_vmem<uint32_t>(ppc_effective_address);
|
uint32_t result = mmu_read_vmem<uint32_t>(ppc_effective_address);
|
||||||
ppc_state.fpr[reg_d].dbl64_r = (double)result;
|
ppc_state.fpr[reg_d].dbl64_r = *(float*)(&result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dppc_interpreter::ppc_lfsux() {
|
void dppc_interpreter::ppc_lfsux() {
|
||||||
ppc_grab_regsfpdiab();
|
ppc_grab_regsfpdiab();
|
||||||
if (reg_a) {
|
if (reg_a) {
|
||||||
ppc_effective_address = val_reg_a + val_reg_b;
|
ppc_effective_address = val_reg_a + val_reg_b;
|
||||||
float result = (float)mmu_read_vmem<uint32_t>(ppc_effective_address);
|
uint32_t result = mmu_read_vmem<uint32_t>(ppc_effective_address);
|
||||||
ppc_state.fpr[reg_d].dbl64_r = (double)result;
|
ppc_state.fpr[reg_d].dbl64_r = *(float*)(&result);
|
||||||
ppc_state.gpr[reg_a] = ppc_effective_address;
|
ppc_state.gpr[reg_a] = ppc_effective_address;
|
||||||
} else {
|
} else {
|
||||||
ppc_exception_handler(Except_Type::EXC_PROGRAM, Exc_Cause::ILLEGAL_OP);
|
ppc_exception_handler(Except_Type::EXC_PROGRAM, Exc_Cause::ILLEGAL_OP);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user