Fixed storage opcodes after last night's commit.

This commit is contained in:
dingusdev 2019-07-19 09:10:41 -07:00 committed by GitHub
parent e091fedb38
commit f89c54848b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 44 deletions

View File

@ -917,7 +917,7 @@ void ppc_stfs(){
ppc_grab_regsfpsia(); ppc_grab_regsfpsia();
grab_d = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF)); grab_d = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
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_effective_address, ppc_state.ppc_fpr[reg_s], 4); address_quickinsert_translate(ppc_state.ppc_fpr[reg_s], ppc_effective_address, 4);
} }
void ppc_stfsu(){ void ppc_stfsu(){
@ -925,7 +925,7 @@ void ppc_stfsu(){
grab_d = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF)); grab_d = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
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;
uint32_t split_result1 = (uint32_t)((float)(ppc_state.ppc_fpr[reg_s])); uint32_t split_result1 = (uint32_t)((float)(ppc_state.ppc_fpr[reg_s]));
address_quickinsert_translate(ppc_effective_address, split_result1, 4); address_quickinsert_translate(split_result1, ppc_effective_address, 4);
ppc_result_a = ppc_effective_address; ppc_result_a = ppc_effective_address;
ppc_store_result_rega(); ppc_store_result_rega();
} }
@ -934,7 +934,7 @@ void ppc_stfsux(){
ppc_grab_regsfpsiab(); ppc_grab_regsfpsiab();
ppc_effective_address = (reg_a == 0)?ppc_result_b:ppc_result_a + ppc_result_b; ppc_effective_address = (reg_a == 0)?ppc_result_b:ppc_result_a + ppc_result_b;
uint32_t split_result1 = (uint32_t)((float)(ppc_state.ppc_fpr[reg_s])); uint32_t split_result1 = (uint32_t)((float)(ppc_state.ppc_fpr[reg_s]));
address_quickinsert_translate(ppc_effective_address, split_result1, 4); address_quickinsert_translate(split_result1, ppc_effective_address, 4);
ppc_result_a = ppc_effective_address; ppc_result_a = ppc_effective_address;
ppc_store_result_rega(); ppc_store_result_rega();
} }
@ -944,9 +944,9 @@ void ppc_stfd(){
grab_d = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF)); grab_d = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
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;
uint32_t split_result1 = (uint32_t)(ppc_state.ppc_fpr[reg_s] >> 32); uint32_t split_result1 = (uint32_t)(ppc_state.ppc_fpr[reg_s] >> 32);
address_quickinsert_translate(ppc_effective_address, split_result1, 4); address_quickinsert_translate(split_result1, ppc_effective_address, 4);
uint32_t split_result2 = (uint32_t)(ppc_state.ppc_fpr[reg_s]); uint32_t split_result2 = (uint32_t)(ppc_state.ppc_fpr[reg_s]);
address_quickinsert_translate(ppc_effective_address, split_result2, 4); address_quickinsert_translate(split_result2, ppc_effective_address, 4);
} }
void ppc_stfdu(){ void ppc_stfdu(){
@ -954,9 +954,9 @@ void ppc_stfdu(){
grab_d = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF)); grab_d = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
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;
uint32_t split_result1 = (uint32_t)(ppc_state.ppc_fpr[reg_s] >> 32); uint32_t split_result1 = (uint32_t)(ppc_state.ppc_fpr[reg_s] >> 32);
address_quickinsert_translate(ppc_effective_address, split_result1, 4); address_quickinsert_translate(split_result1, ppc_effective_address, 4);
uint32_t split_result2 = (uint32_t)(ppc_state.ppc_fpr[reg_s]); uint32_t split_result2 = (uint32_t)(ppc_state.ppc_fpr[reg_s]);
address_quickinsert_translate(ppc_effective_address, split_result2, 4); address_quickinsert_translate(split_result2, ppc_effective_address, 4);
ppc_result_a = ppc_effective_address; ppc_result_a = ppc_effective_address;
ppc_store_result_rega(); ppc_store_result_rega();
} }
@ -965,18 +965,18 @@ void ppc_stfdx(){
ppc_grab_regsfpsiab(); ppc_grab_regsfpsiab();
ppc_effective_address = (reg_a == 0)?ppc_result_b:ppc_result_a + ppc_result_b; ppc_effective_address = (reg_a == 0)?ppc_result_b:ppc_result_a + ppc_result_b;
uint32_t split_result1 = (uint32_t)(ppc_state.ppc_fpr[reg_s] >> 32); uint32_t split_result1 = (uint32_t)(ppc_state.ppc_fpr[reg_s] >> 32);
address_quickinsert_translate(ppc_effective_address, split_result1, 4); address_quickinsert_translate(split_result1, ppc_effective_address, 4);
uint32_t split_result2 = (uint32_t)(ppc_state.ppc_fpr[reg_s]); uint32_t split_result2 = (uint32_t)(ppc_state.ppc_fpr[reg_s]);
address_quickinsert_translate(ppc_effective_address, split_result2, 4); address_quickinsert_translate(split_result2, ppc_effective_address, 4);
} }
void ppc_stfdux(){ void ppc_stfdux(){
ppc_grab_regsfpsiab(); ppc_grab_regsfpsiab();
ppc_effective_address = (reg_a == 0)?ppc_result_b:ppc_result_a + ppc_result_b; ppc_effective_address = (reg_a == 0)?ppc_result_b:ppc_result_a + ppc_result_b;
uint32_t split_result1 = (uint32_t)(ppc_state.ppc_fpr[reg_s] >> 32); uint32_t split_result1 = (uint32_t)(ppc_state.ppc_fpr[reg_s] >> 32);
address_quickinsert_translate(ppc_effective_address, split_result1, 4); address_quickinsert_translate(split_result1, ppc_effective_address, 4);
uint32_t split_result2 = (uint32_t)(ppc_state.ppc_fpr[reg_s]); uint32_t split_result2 = (uint32_t)(ppc_state.ppc_fpr[reg_s]);
address_quickinsert_translate(ppc_effective_address, split_result2, 4); address_quickinsert_translate(split_result2, ppc_effective_address, 4);
ppc_result_a = ppc_effective_address; ppc_result_a = ppc_effective_address;
ppc_store_result_rega(); ppc_store_result_rega();
} }
@ -985,7 +985,7 @@ void ppc_stfiwx(){
ppc_grab_regsfpsiab(); ppc_grab_regsfpsiab();
ppc_effective_address = (reg_a == 0)?ppc_result_b:ppc_result_a + ppc_result_b; ppc_effective_address = (reg_a == 0)?ppc_result_b:ppc_result_a + ppc_result_b;
uint32_t split_result1 = (uint32_t)(ppc_state.ppc_fpr[reg_s] & 0xFFFFFFFF); uint32_t split_result1 = (uint32_t)(ppc_state.ppc_fpr[reg_s] & 0xFFFFFFFF);
address_quickinsert_translate(ppc_effective_address, split_result1, 4); address_quickinsert_translate(split_result1, ppc_effective_address, 4);
} }
//Floating Point Register Transfer //Floating Point Register Transfer

View File

@ -1886,14 +1886,14 @@ void ppc_dcbz(){
if (!(ppc_state.ppc_pc % 32) && (ppc_state.ppc_pc < 0xFFFFFFE0)){ if (!(ppc_state.ppc_pc % 32) && (ppc_state.ppc_pc < 0xFFFFFFE0)){
ppc_grab_regsdab(); ppc_grab_regsdab();
ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b); ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b);
address_quickinsert_translate(ppc_effective_address, 0, 4); address_quickinsert_translate(0, ppc_effective_address, 4);
address_quickinsert_translate((ppc_effective_address + 4), 0, 4); address_quickinsert_translate(0, (ppc_effective_address + 4), 4);
address_quickinsert_translate((ppc_effective_address + 8), 0, 4); address_quickinsert_translate(0, (ppc_effective_address + 8), 4);
address_quickinsert_translate((ppc_effective_address + 12), 0, 4); address_quickinsert_translate(0, (ppc_effective_address + 12), 4);
address_quickinsert_translate((ppc_effective_address + 16), 0, 4); address_quickinsert_translate(0, (ppc_effective_address + 16), 4);
address_quickinsert_translate((ppc_effective_address + 20), 0, 4); address_quickinsert_translate(0, (ppc_effective_address + 20), 4);
address_quickinsert_translate((ppc_effective_address + 24), 0, 4); address_quickinsert_translate(0, (ppc_effective_address + 24), 4);
address_quickinsert_translate((ppc_effective_address + 28), 0, 4); address_quickinsert_translate(0, (ppc_effective_address + 28), 4);
} }
else{ else{
ppc_expection_handler(0x0600, 0x00000); ppc_expection_handler(0x0600, 0x00000);
@ -1907,13 +1907,13 @@ void ppc_stb(){
grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF))); grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF)));
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);
printf("STB Storage Area: %x \n",ppc_effective_address); printf("STB Storage Area: %x \n",ppc_effective_address);
address_quickinsert_translate(ppc_effective_address, ppc_result_d, 1); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 1);
} }
void ppc_stbx(){ void ppc_stbx(){
ppc_grab_regssab(); ppc_grab_regssab();
ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b); ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b);
address_quickinsert_translate(ppc_effective_address, ppc_result_d, 1); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 1);
} }
void ppc_stbu(){ void ppc_stbu(){
@ -1921,7 +1921,7 @@ void ppc_stbu(){
grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF))); grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF)));
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_effective_address, ppc_result_d, 1); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 1);
} }
} }
@ -1929,7 +1929,7 @@ void ppc_stbux(){
ppc_grab_regssab(); ppc_grab_regssab();
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_effective_address, ppc_result_d, 1); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 1);
} }
else{ else{
ppc_expection_handler(0x07000, 0x20000); ppc_expection_handler(0x07000, 0x20000);
@ -1942,20 +1942,20 @@ void ppc_sth(){
ppc_grab_regssa(); ppc_grab_regssa();
grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF))); grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF)));
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_effective_address, ppc_result_d, 2); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 2);
} }
void ppc_sthu(){ void ppc_sthu(){
ppc_grab_regssa(); ppc_grab_regssa();
grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF))); grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF)));
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_effective_address, ppc_result_d, 2); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 2);
} }
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); ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b);
address_quickinsert_translate(ppc_effective_address, ppc_result_d, 2); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 2);
ppc_result_a = ppc_effective_address; ppc_result_a = ppc_effective_address;
ppc_store_result_rega(); ppc_store_result_rega();
} }
@ -1965,27 +1965,27 @@ void ppc_sthx(){
if (reg_a != 0){ if (reg_a != 0){
ppc_effective_address = ppc_result_a + ppc_result_b; ppc_effective_address = ppc_result_a + ppc_result_b;
} }
address_quickinsert_translate(ppc_effective_address, ppc_result_d, 2); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 2);
} }
void ppc_sthbrx(){ void ppc_sthbrx(){
ppc_grab_regssab(); ppc_grab_regssab();
ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b); ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b);
ppc_result_d = (uint32_t)(rev_endian16((uint16_t)ppc_result_d)); ppc_result_d = (uint32_t)(rev_endian16((uint16_t)ppc_result_d));
address_quickinsert_translate(ppc_effective_address, ppc_result_d, 2); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 2);
} }
void ppc_stw(){ void ppc_stw(){
ppc_grab_regssa(); ppc_grab_regssa();
grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF))); grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF)));
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_effective_address, ppc_result_d, 4); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 4);
} }
void ppc_stwx(){ void ppc_stwx(){
ppc_grab_regssab(); ppc_grab_regssab();
ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b); ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b);
address_quickinsert_translate(ppc_effective_address, ppc_result_d, 4); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 4);
} }
void ppc_stwcx(){ void ppc_stwcx(){
@ -1993,7 +1993,7 @@ void ppc_stwcx(){
ppc_grab_regssab(); ppc_grab_regssab();
ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b); ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b);
if (ppc_state.ppc_reserve){ if (ppc_state.ppc_reserve){
address_quickinsert_translate(ppc_effective_address, ppc_result_d, 4); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 4);
ppc_state.ppc_cr |= (ppc_state.ppc_spr[1] & 0x80000000) ? 0x30000000 : 0x20000000; ppc_state.ppc_cr |= (ppc_state.ppc_spr[1] & 0x80000000) ? 0x30000000 : 0x20000000;
ppc_state.ppc_reserve = false; ppc_state.ppc_reserve = false;
} }
@ -2006,7 +2006,7 @@ void ppc_stwu(){
ppc_grab_regssa(); ppc_grab_regssa();
grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF))); grab_d = (uint32_t)((int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF)));
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_effective_address, ppc_result_d, 4); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 4);
ppc_result_a = ppc_effective_address; ppc_result_a = ppc_effective_address;
ppc_store_result_rega(); ppc_store_result_rega();
} }
@ -2014,7 +2014,7 @@ void ppc_stwu(){
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); ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b);
address_quickinsert_translate(ppc_effective_address, ppc_result_d, 4); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 4);
ppc_result_a = ppc_effective_address; ppc_result_a = ppc_effective_address;
ppc_store_result_rega(); ppc_store_result_rega();
} }
@ -2024,7 +2024,7 @@ void ppc_stwbrx(){
ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b); ppc_effective_address = (reg_a == 0)?ppc_result_b:(ppc_result_a + ppc_result_b);
printf("STWBRX Storage Area: %x \n",ppc_effective_address); printf("STWBRX Storage Area: %x \n",ppc_effective_address);
ppc_result_d = rev_endian32(ppc_result_d); ppc_result_d = rev_endian32(ppc_result_d);
address_quickinsert_translate(ppc_effective_address, ppc_result_d, 4); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 4);
} }
void ppc_stmw(){ void ppc_stmw(){
@ -2033,7 +2033,7 @@ void ppc_stmw(){
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);
//How many words to store in memory - using a do-while for this //How many words to store in memory - using a do-while for this
do{ do{
address_quickinsert_translate(ppc_effective_address, ppc_result_d, 4); address_quickinsert_translate(ppc_result_d, ppc_effective_address, 4);
ppc_effective_address +=4; ppc_effective_address +=4;
reg_d++; reg_d++;
}while (reg_d < 32); }while (reg_d < 32);
@ -2416,19 +2416,19 @@ void ppc_stswi(){
switch(shift_times){ switch(shift_times){
case 0: case 0:
strwrd_replace_value = (ppc_result_d >> 24); strwrd_replace_value = (ppc_result_d >> 24);
address_quickinsert_translate(ppc_effective_address, strwrd_replace_value, 1); address_quickinsert_translate(strwrd_replace_value, ppc_effective_address, 1);
break; break;
case 1: case 1:
strwrd_replace_value = (ppc_result_d >> 16); strwrd_replace_value = (ppc_result_d >> 16);
address_quickinsert_translate(ppc_effective_address, strwrd_replace_value, 1); address_quickinsert_translate(strwrd_replace_value, ppc_effective_address, 1);
break; break;
case 2: case 2:
strwrd_replace_value = (ppc_result_d >> 8); strwrd_replace_value = (ppc_result_d >> 8);
address_quickinsert_translate(ppc_effective_address, strwrd_replace_value, 1); address_quickinsert_translate(strwrd_replace_value, ppc_effective_address, 1);
break; break;
case 3: case 3:
strwrd_replace_value = (ppc_result_d); strwrd_replace_value = (ppc_result_d);
address_quickinsert_translate(ppc_effective_address, strwrd_replace_value, 1); address_quickinsert_translate(strwrd_replace_value, ppc_effective_address, 1);
break; break;
default: default:
printf("Something really horrible happened with stswi."); printf("Something really horrible happened with stswi.");
@ -2455,19 +2455,19 @@ void ppc_stswx(){
switch(shift_times){ switch(shift_times){
case 0: case 0:
strwrd_replace_value = (ppc_result_d >> 24); strwrd_replace_value = (ppc_result_d >> 24);
address_quickinsert_translate(ppc_effective_address, strwrd_replace_value, 1); address_quickinsert_translate(strwrd_replace_value, ppc_effective_address, 1);
break; break;
case 1: case 1:
strwrd_replace_value = (ppc_result_d >> 16); strwrd_replace_value = (ppc_result_d >> 16);
address_quickinsert_translate(ppc_effective_address, strwrd_replace_value, 1); address_quickinsert_translate(strwrd_replace_value, ppc_effective_address, 1);
break; break;
case 2: case 2:
strwrd_replace_value = (ppc_result_d >> 8); strwrd_replace_value = (ppc_result_d >> 8);
address_quickinsert_translate(ppc_effective_address, strwrd_replace_value, 1); address_quickinsert_translate(strwrd_replace_value, ppc_effective_address, 1);
break; break;
case 3: case 3:
strwrd_replace_value = (ppc_result_d); strwrd_replace_value = (ppc_result_d);
address_quickinsert_translate(ppc_effective_address, strwrd_replace_value, 1); address_quickinsert_translate(strwrd_replace_value, ppc_effective_address, 1);
break; break;
default: default:
printf("Something really horrible happened with stswx."); printf("Something really horrible happened with stswx.");