mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-10 13:29:38 +00:00
poweropcodes: improve lscbx emulation.
This commit is contained in:
parent
d71a213c4b
commit
45ccabb11d
@ -136,30 +136,28 @@ void dppc_interpreter::power_dozi() {
|
||||
|
||||
void dppc_interpreter::power_lscbx() {
|
||||
ppc_grab_regsdab();
|
||||
ppc_effective_address = reg_a ? (ppc_result_a + ppc_result_b) : ppc_result_b;
|
||||
//ppc_result_d = 0xFFFFFFFF;
|
||||
ppc_effective_address = reg_a ? ppc_result_a + ppc_result_b : ppc_result_b;
|
||||
|
||||
uint8_t return_value = 0;
|
||||
uint32_t bytes_to_load = (ppc_state.spr[SPR::XER] & 0x7f);
|
||||
uint8_t return_value = 0;
|
||||
uint32_t bytes_to_load = (ppc_state.spr[SPR::XER] & 0x7F);
|
||||
uint32_t bytes_copied = 0;
|
||||
uint8_t matching_byte = (uint8_t)((ppc_state.spr[SPR::XER] & 0xFF00) >> 8);
|
||||
uint8_t matching_byte = (uint8_t)(ppc_state.spr[SPR::XER] >> 8);
|
||||
|
||||
// for storing each byte
|
||||
uint32_t bitmask = 0xFF000000;
|
||||
uint8_t shift_amount = 24;
|
||||
uint32_t bitmask = 0xFF000000;
|
||||
uint8_t shift_amount = 24;
|
||||
|
||||
while (bytes_to_load > 0) {
|
||||
return_value = mmu_read_vmem<uint8_t>(ppc_effective_address);
|
||||
// return_value = mem_grab_byte(ppc_effective_address);
|
||||
ppc_result_d = (ppc_result_d & ~(bitmask)) | (return_value << shift_amount);
|
||||
ppc_store_result_regd();
|
||||
if (bitmask == 0x000000FF) {
|
||||
|
||||
ppc_result_d = (ppc_result_d & ~bitmask) | (return_value << shift_amount);
|
||||
if (!shift_amount) {
|
||||
if (reg_d != reg_a && reg_d != reg_b)
|
||||
ppc_store_result_regd();
|
||||
reg_d = (reg_d + 1) & 31;
|
||||
//ppc_result_d = 0xFFFFFFFF;
|
||||
bitmask = 0xFF000000;
|
||||
shift_amount = 24;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
bitmask >>= 8;
|
||||
shift_amount -= 8;
|
||||
}
|
||||
@ -172,8 +170,11 @@ void dppc_interpreter::power_lscbx() {
|
||||
break;
|
||||
}
|
||||
|
||||
ppc_state.spr[SPR::XER] = (ppc_state.spr[SPR::XER] & 0xFFFFFF80) | bytes_copied;
|
||||
// store partiallly loaded register if any
|
||||
if (shift_amount != 24 && reg_d != reg_a && reg_d != reg_b)
|
||||
ppc_store_result_regd();
|
||||
|
||||
ppc_state.spr[SPR::XER] = (ppc_state.spr[SPR::XER] & ~0x7F) | bytes_copied;
|
||||
|
||||
if (rc_flag)
|
||||
ppc_changecrf0(ppc_result_d);
|
||||
|
Loading…
x
Reference in New Issue
Block a user