Merge pull request #3 from maximumspatium/master

More CPU emulation fixes.
This commit is contained in:
dingusdev 2019-07-19 14:40:30 -07:00 committed by GitHub
commit 8560a540c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 14 deletions

View File

@ -54,7 +54,6 @@ void execute_single_instr()
ppc_state.ppc_pc += 4; ppc_state.ppc_pc += 4;
ppc_tbr_update(); ppc_tbr_update();
} }
ppc_cur_instruction = 0;
} }
void execute_until(uint32_t goal_addr) void execute_until(uint32_t goal_addr)

View File

@ -358,7 +358,6 @@ void execute_interpreter(){
ppc_state.ppc_pc += 4; ppc_state.ppc_pc += 4;
ppc_tbr_update(); ppc_tbr_update();
} }
ppc_cur_instruction = 0;
} }
} }
@ -775,7 +774,6 @@ int main(int argc, char **argv)
ppc_state.ppc_pc += 4; ppc_state.ppc_pc += 4;
ppc_tbr_update(); ppc_tbr_update();
} }
ppc_cur_instruction = 0;
} }
} }
else if ((checker=="stepp")|(checker=="/stepp")|(checker=="-stepp")){ else if ((checker=="stepp")|(checker=="/stepp")|(checker=="-stepp")){
@ -790,7 +788,7 @@ int main(int argc, char **argv)
quickinstruction_translate(ppc_state.ppc_pc); quickinstruction_translate(ppc_state.ppc_pc);
ppc_main_opcode(); ppc_main_opcode();
if (grab_branch & !grab_exception){ if (grab_branch & !grab_exception){
ppc_state.ppc_pc = ppc_effective_address; ppc_state.ppc_pc = ppc_next_instruction_address;
grab_branch = 0; grab_branch = 0;
ppc_tbr_update(); ppc_tbr_update();
} }
@ -804,7 +802,6 @@ int main(int argc, char **argv)
ppc_state.ppc_pc += 4; ppc_state.ppc_pc += 4;
ppc_tbr_update(); ppc_tbr_update();
} }
ppc_cur_instruction = 0;
} }
} }
} }
@ -833,7 +830,7 @@ int main(int argc, char **argv)
quickinstruction_translate(ppc_state.ppc_pc); quickinstruction_translate(ppc_state.ppc_pc);
ppc_main_opcode(); ppc_main_opcode();
if (grab_branch & !grab_exception){ if (grab_branch & !grab_exception){
ppc_state.ppc_pc = ppc_effective_address; ppc_state.ppc_pc = ppc_next_instruction_address;
grab_branch = 0; grab_branch = 0;
ppc_tbr_update(); ppc_tbr_update();
} }
@ -847,7 +844,6 @@ int main(int argc, char **argv)
ppc_state.ppc_pc += 4; ppc_state.ppc_pc += 4;
ppc_tbr_update(); ppc_tbr_update();
} }
ppc_cur_instruction = 0;
} }
} }
} else if (checker == "debugger") { } else if (checker == "debugger") {

View File

@ -109,7 +109,7 @@ void msr_status_update(){
} }
void ppc_set_cur_instruction(uint32_t mem_index){ void ppc_set_cur_instruction(uint32_t mem_index){
ppc_cur_instruction += (grab_macmem_ptr[mem_index]) << 24; ppc_cur_instruction = (grab_macmem_ptr[mem_index]) << 24;
++mem_index; ++mem_index;
ppc_cur_instruction += (grab_macmem_ptr[mem_index]) << 16; ppc_cur_instruction += (grab_macmem_ptr[mem_index]) << 16;
++mem_index; ++mem_index;

View File

@ -129,7 +129,7 @@ void ppc_grab_regssa(){
void ppc_grab_regssb(){ void ppc_grab_regssb(){
reg_s = (ppc_cur_instruction >> 21) & 31; reg_s = (ppc_cur_instruction >> 21) & 31;
reg_b = (ppc_cur_instruction >> 16) & 31; reg_b = (ppc_cur_instruction >> 11) & 31;
ppc_result_d = ppc_state.ppc_gpr[reg_s]; ppc_result_d = ppc_state.ppc_gpr[reg_s];
ppc_result_b = ppc_state.ppc_gpr[reg_b]; ppc_result_b = ppc_state.ppc_gpr[reg_b];
} }
@ -1358,7 +1358,7 @@ void ppc_mtsr(){
void ppc_mtsrin(){ void ppc_mtsrin(){
if ((ppc_state.ppc_msr & 0x4000) == 0){ if ((ppc_state.ppc_msr & 0x4000) == 0){
ppc_grab_regssb(); ppc_grab_regssb();
grab_sr = ppc_result_b & 15; grab_sr = ppc_result_b >> 28;
ppc_state.ppc_sr[grab_sr] = ppc_result_d; ppc_state.ppc_sr[grab_sr] = ppc_result_d;
} }
} }
@ -1368,16 +1368,14 @@ void ppc_mfsr(){
reg_d = (ppc_cur_instruction >> 21) & 31; reg_d = (ppc_cur_instruction >> 21) & 31;
grab_sr = (ppc_cur_instruction >> 16) & 15; grab_sr = (ppc_cur_instruction >> 16) & 15;
ppc_state.ppc_gpr[reg_d] = ppc_state.ppc_sr[grab_sr]; ppc_state.ppc_gpr[reg_d] = ppc_state.ppc_sr[grab_sr];
ppc_store_result_regd();
} }
} }
void ppc_mfsrin(){ void ppc_mfsrin(){
if ((ppc_state.ppc_msr & 0x4000) == 0){ if ((ppc_state.ppc_msr & 0x4000) == 0){
ppc_grab_regssb(); ppc_grab_regssb();
grab_sr = ppc_result_b & 15; grab_sr = ppc_result_b >> 28;
ppc_state.ppc_gpr[reg_d] = ppc_state.ppc_sr[grab_sr]; ppc_state.ppc_gpr[reg_d] = ppc_state.ppc_sr[grab_sr];
ppc_store_result_regd();
} }
} }
@ -1391,7 +1389,7 @@ void ppc_mfmsr(){
void ppc_mtmsr(){ void ppc_mtmsr(){
//if ((ppc_state.ppc_msr && 0x4000) == 0){ //if ((ppc_state.ppc_msr && 0x4000) == 0){
reg_s = (ppc_cur_instruction >> 21) & 31; reg_s = (ppc_cur_instruction >> 21) & 31;
ppc_state.ppc_msr = ppc_state.ppc_spr[reg_s]; ppc_state.ppc_msr = ppc_state.ppc_gpr[reg_s];
msr_status_update(); msr_status_update();
//} //}
} }