Corrected several loading instructions

This commit is contained in:
dingusdev 2020-01-17 21:06:26 -07:00 committed by GitHub
parent b414c68d81
commit add1ac7a3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1888,6 +1888,10 @@ void ppc_stbu(){
if (reg_a != 0){ if (reg_a != 0){
ppc_effective_address = (reg_a == 0)?grab_d:(ppc_result_a + grab_d); ppc_effective_address = (reg_a == 0)?grab_d:(ppc_result_a + grab_d);
address_quickinsert_translate(ppc_result_d, ppc_effective_address, 1); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 1);
ppc_state.ppc_gpr[reg_a] = ppc_effective_address;
}
else{
ppc_exception_handler(Except_Type::EXC_PROGRAM, 0x20000);
} }
} }
@ -1896,12 +1900,12 @@ void ppc_stbux(){
if (reg_a != 0){ if (reg_a != 0){
ppc_effective_address = ppc_result_a + reg_b; ppc_effective_address = ppc_result_a + reg_b;
address_quickinsert_translate(ppc_result_d, ppc_effective_address, 1); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 1);
ppc_result_a = ppc_effective_address;
ppc_state.ppc_gpr[reg_a] = ppc_effective_address;
} }
else{ else{
ppc_exception_handler(Except_Type::EXC_PROGRAM, 0x20000); ppc_exception_handler(Except_Type::EXC_PROGRAM, 0x20000);
} }
ppc_result_a = ppc_effective_address;
ppc_store_result_rega();
} }
void ppc_sth(){ void ppc_sth(){
@ -1913,24 +1917,32 @@ void ppc_sth(){
void ppc_sthu(){ void ppc_sthu(){
ppc_grab_regssa(); ppc_grab_regssa();
grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF))); if (reg_a != 0) {
ppc_effective_address = (reg_a == 0)?grab_d:(ppc_result_a + grab_d); grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF)));
address_quickinsert_translate(ppc_result_d, ppc_effective_address, 2); ppc_effective_address = (reg_a == 0)?grab_d:(ppc_result_a + grab_d);
address_quickinsert_translate(ppc_result_d, ppc_effective_address, 2);
ppc_state.ppc_gpr[reg_a] = ppc_effective_address;
}
else {
ppc_exception_handler(Except_Type::EXC_PROGRAM, 0x20000);
}
} }
void ppc_sthux(){ void ppc_sthux(){
ppc_grab_regssab(); ppc_grab_regssab();
ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b); if (reg_a != 0) {
address_quickinsert_translate(ppc_result_d, ppc_effective_address, 2); ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b);
ppc_result_a = ppc_effective_address; address_quickinsert_translate(ppc_result_d, ppc_effective_address, 2);
ppc_store_result_rega(); ppc_state.ppc_gpr[reg_a] = ppc_effective_address;
}
else {
ppc_exception_handler(Except_Type::EXC_PROGRAM, 0x20000);
}
} }
void ppc_sthx(){ void ppc_sthx(){
ppc_grab_regssab(); ppc_grab_regssab();
if (reg_a != 0){ ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
ppc_effective_address = ppc_result_a + ppc_result_b;
}
address_quickinsert_translate(ppc_result_d, ppc_effective_address, 2); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 2);
} }
@ -1970,19 +1982,27 @@ void ppc_stwcx(){
void ppc_stwu(){ void ppc_stwu(){
ppc_grab_regssa(); ppc_grab_regssa();
grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF))); if (reg_a != 0) {
ppc_effective_address = (reg_a == 0)?grab_d:(ppc_result_a + grab_d); grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF)));
address_quickinsert_translate(ppc_result_d, ppc_effective_address, 4); ppc_effective_address = ppc_result_a + grab_d;
ppc_result_a = ppc_effective_address; address_quickinsert_translate(ppc_result_d, ppc_effective_address, 4);
ppc_store_result_rega(); ppc_state.ppc_gpr[reg_a] = ppc_effective_address;
}
else {
ppc_exception_handler(Except_Type::EXC_PROGRAM, 0x20000);
}
} }
void ppc_stwux(){ void ppc_stwux(){
ppc_grab_regssab(); ppc_grab_regssab();
ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b); if (reg_a != 0) {
address_quickinsert_translate(ppc_result_d, ppc_effective_address, 4); ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b);
ppc_result_a = ppc_effective_address; address_quickinsert_translate(ppc_result_d, ppc_effective_address, 4);
ppc_store_result_rega(); ppc_state.ppc_gpr[reg_a] = ppc_effective_address;
}
else {
ppc_exception_handler(Except_Type::EXC_PROGRAM, 0x20000);
}
} }
void ppc_stwbrx(){ void ppc_stwbrx(){