mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-23 21:29:28 +00:00
Refactor usage of the memory access functions.
Memory access function have better names now. Global variable return_value has been removed. lhbrx emulation has been fixed.
This commit is contained in:
parent
cdd7f228a4
commit
7ae87e39c1
@ -202,6 +202,7 @@ void power_lscbx() {
|
||||
uint32_t bytes_copied = 0;
|
||||
bool match_found = false;
|
||||
uint32_t shift_amount = 0;
|
||||
uint8_t return_value;
|
||||
uint8_t byte_compared = (uint8_t)((ppc_state.ppc_spr[1] & 0xFF00) >> 8);
|
||||
if ((ppc_state.ppc_spr[1] & 0x7f) == 0) {
|
||||
return;
|
||||
@ -214,35 +215,33 @@ void power_lscbx() {
|
||||
if (match_found == false) {
|
||||
switch (shift_amount) {
|
||||
case 0:
|
||||
address_grab8bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (ppc_result_d & 0x00FFFFFF) | ((uint32_t)return_value << 24);
|
||||
return_value = mem_grab_byte(ppc_effective_address);
|
||||
ppc_result_d = (ppc_result_d & 0x00FFFFFF) | (return_value << 24);
|
||||
ppc_store_result_regd();
|
||||
break;
|
||||
case 1:
|
||||
address_grab8bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (ppc_result_d & 0xFF00FFFF) | ((uint32_t)return_value << 16);
|
||||
return_value = mem_grab_byte(ppc_effective_address);
|
||||
ppc_result_d = (ppc_result_d & 0xFF00FFFF) | (return_value << 16);
|
||||
ppc_store_result_regd();
|
||||
break;
|
||||
case 2:
|
||||
address_grab8bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (ppc_result_d & 0xFFFF00FF) | ((uint32_t)return_value << 8);
|
||||
return_value = mem_grab_byte(ppc_effective_address);
|
||||
ppc_result_d = (ppc_result_d & 0xFFFF00FF) | (return_value << 8);
|
||||
ppc_store_result_regd();
|
||||
break;
|
||||
case 3:
|
||||
address_grab8bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (ppc_result_d & 0xFFFFFF00) | (uint32_t)return_value;
|
||||
return_value = mem_grab_byte(ppc_effective_address);
|
||||
ppc_result_d = (ppc_result_d & 0xFFFFFF00) | return_value;
|
||||
ppc_store_result_regd();
|
||||
break;
|
||||
}
|
||||
|
||||
bytes_copied++;
|
||||
}
|
||||
if (((uint8_t)return_value) == byte_compared) {
|
||||
if (return_value == byte_compared) {
|
||||
break;
|
||||
}
|
||||
|
||||
return_value = 0;
|
||||
|
||||
if (shift_amount == 3) {
|
||||
shift_amount = 0;
|
||||
reg_d = (reg_d + 1) & 0x1F;
|
||||
@ -792,4 +791,4 @@ void power_srq() {
|
||||
|
||||
void power_srqdot() {
|
||||
printf("OOPS! Placeholder!!! \n");
|
||||
}
|
||||
}
|
||||
|
@ -101,8 +101,6 @@ SUPERVISOR MODEL
|
||||
536 - 543 are the Data BAT registers
|
||||
**/
|
||||
|
||||
extern uint64_t return_value; //used for loading from memory
|
||||
|
||||
extern uint32_t opcode_value; //used for interpreting opcodes
|
||||
extern uint32_t ram_size_set;
|
||||
|
||||
|
@ -879,8 +879,7 @@ void ppc_lfs() {
|
||||
ppc_grab_regsfpdia(true);
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += (reg_a > 0) ? ppc_result_a : 0;
|
||||
address_grab32bit_translate(ppc_effective_address);
|
||||
ppc_result64_d = (uint64_t)return_value;
|
||||
ppc_result64_d = mem_grab_dword(ppc_effective_address);
|
||||
ppc_store_dfpresult(true);
|
||||
}
|
||||
|
||||
@ -890,8 +889,7 @@ void ppc_lfsu() {
|
||||
if (reg_a == 0) {
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += (reg_a > 0) ? ppc_result_a : 0;
|
||||
address_grab32bit_translate(ppc_effective_address);
|
||||
ppc_result64_d = (uint64_t)return_value;
|
||||
ppc_result64_d = mem_grab_dword(ppc_effective_address);
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_dfpresult(true);
|
||||
ppc_store_result_rega();
|
||||
@ -904,8 +902,7 @@ void ppc_lfsu() {
|
||||
void ppc_lfsx() {
|
||||
ppc_grab_regsfpdiab(true);
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : ppc_result_a + ppc_result_b;
|
||||
address_grab32bit_translate(ppc_effective_address);
|
||||
ppc_result64_d = (uint64_t)return_value;
|
||||
ppc_result64_d = mem_grab_dword(ppc_effective_address);
|
||||
ppc_store_dfpresult(true);
|
||||
}
|
||||
|
||||
@ -913,8 +910,7 @@ void ppc_lfsux() {
|
||||
ppc_grab_regsfpdiab(true);
|
||||
if (reg_a == 0) {
|
||||
ppc_effective_address = ppc_result_a + ppc_result_b;
|
||||
address_grab32bit_translate(ppc_effective_address);
|
||||
ppc_result64_d = (uint64_t)return_value;
|
||||
ppc_result64_d = mem_grab_dword(ppc_effective_address);
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_dfpresult(true);
|
||||
ppc_store_result_rega();
|
||||
@ -928,8 +924,7 @@ void ppc_lfd() {
|
||||
ppc_grab_regsfpdia(true);
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += (reg_a > 0) ? ppc_result_a : 0;
|
||||
address_grab64bit_translate(ppc_effective_address);
|
||||
ppc_result64_d = return_value;
|
||||
ppc_result64_d = mem_grab_qword(ppc_effective_address);
|
||||
ppc_store_dfpresult(true);
|
||||
}
|
||||
|
||||
@ -938,8 +933,7 @@ void ppc_lfdu() {
|
||||
if (reg_a == 0) {
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += ppc_result_a;
|
||||
address_grab64bit_translate(ppc_effective_address);
|
||||
ppc_result64_d = return_value;
|
||||
ppc_result64_d = mem_grab_qword(ppc_effective_address);
|
||||
ppc_store_dfpresult(true);
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_result_rega();
|
||||
@ -952,8 +946,7 @@ void ppc_lfdu() {
|
||||
void ppc_lfdx() {
|
||||
ppc_grab_regsfpdia(true);
|
||||
ppc_effective_address += (reg_a > 0) ? ppc_result_a + ppc_result_b : ppc_result_b;
|
||||
address_grab64bit_translate(ppc_effective_address);
|
||||
ppc_result64_d = return_value;
|
||||
ppc_result64_d = mem_grab_qword(ppc_effective_address);
|
||||
ppc_store_dfpresult(true);
|
||||
}
|
||||
|
||||
@ -961,8 +954,7 @@ void ppc_lfdux() {
|
||||
ppc_grab_regsfpdiab(true);
|
||||
if (reg_a == 0) {
|
||||
ppc_effective_address = ppc_result_a + ppc_result_b;
|
||||
address_grab64bit_translate(ppc_effective_address);
|
||||
ppc_result64_d = return_value;
|
||||
ppc_result64_d = mem_grab_qword(ppc_effective_address);
|
||||
ppc_store_dfpresult(true);
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_result_rega();
|
||||
@ -976,7 +968,7 @@ void ppc_stfs() {
|
||||
ppc_grab_regsfpsia(true);
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += (reg_a > 0) ? ppc_result_a : 0;
|
||||
address_insert32bit_translate(uint32_t(ppc_state.ppc_fpr[reg_s].int64_r), ppc_effective_address);
|
||||
mem_write_dword(ppc_effective_address, uint32_t(ppc_state.ppc_fpr[reg_s].int64_r));
|
||||
}
|
||||
|
||||
void ppc_stfsu() {
|
||||
@ -984,7 +976,7 @@ void ppc_stfsu() {
|
||||
if (reg_a == 0) {
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += ppc_result_a;
|
||||
address_insert32bit_translate(uint32_t(ppc_state.ppc_fpr[reg_s].int64_r), ppc_effective_address);
|
||||
mem_write_dword(ppc_effective_address, uint32_t(ppc_state.ppc_fpr[reg_s].int64_r));
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_result_rega();
|
||||
}
|
||||
@ -996,14 +988,14 @@ void ppc_stfsu() {
|
||||
void ppc_stfsx() {
|
||||
ppc_grab_regsfpsiab(true);
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : ppc_result_a + ppc_result_b;
|
||||
address_insert32bit_translate(uint32_t(ppc_state.ppc_fpr[reg_s].int64_r), ppc_effective_address);
|
||||
mem_write_dword(ppc_effective_address, uint32_t(ppc_state.ppc_fpr[reg_s].int64_r));
|
||||
}
|
||||
|
||||
void ppc_stfsux() {
|
||||
ppc_grab_regsfpsiab(true);
|
||||
if (reg_a == 0) {
|
||||
ppc_effective_address = ppc_result_a + ppc_result_b;
|
||||
address_insert32bit_translate(uint32_t(ppc_state.ppc_fpr[reg_s].int64_r), ppc_effective_address);
|
||||
mem_write_dword(ppc_effective_address, uint32_t(ppc_state.ppc_fpr[reg_s].int64_r));
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_result_rega();
|
||||
}
|
||||
@ -1016,7 +1008,7 @@ void ppc_stfd() {
|
||||
ppc_grab_regsfpsia(true);
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += (reg_a > 0) ? ppc_result_a : 0;
|
||||
address_insert64bit_translate(ppc_state.ppc_fpr[reg_s].int64_r, ppc_effective_address);
|
||||
mem_write_qword(ppc_effective_address, ppc_state.ppc_fpr[reg_s].int64_r);
|
||||
}
|
||||
|
||||
void ppc_stfdu() {
|
||||
@ -1024,7 +1016,7 @@ void ppc_stfdu() {
|
||||
if (reg_a == 0) {
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += ppc_result_a;
|
||||
address_insert64bit_translate(ppc_state.ppc_fpr[reg_s].int64_r, ppc_effective_address);
|
||||
mem_write_qword(ppc_effective_address, ppc_state.ppc_fpr[reg_s].int64_r);
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_result_rega();
|
||||
}
|
||||
@ -1036,14 +1028,14 @@ void ppc_stfdu() {
|
||||
void ppc_stfdx() {
|
||||
ppc_grab_regsfpsiab(true);
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : ppc_result_a + ppc_result_b;
|
||||
address_insert64bit_translate(ppc_state.ppc_fpr[reg_s].int64_r, ppc_effective_address);
|
||||
mem_write_qword(ppc_effective_address, ppc_state.ppc_fpr[reg_s].int64_r);
|
||||
}
|
||||
|
||||
void ppc_stfdux() {
|
||||
ppc_grab_regsfpsiab(true);
|
||||
if (reg_a == 0) {
|
||||
ppc_effective_address = ppc_result_a + ppc_result_b;
|
||||
address_insert64bit_translate(ppc_state.ppc_fpr[reg_s].int64_r, ppc_effective_address);
|
||||
mem_write_qword(ppc_effective_address, ppc_state.ppc_fpr[reg_s].int64_r);
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_result_rega();
|
||||
}
|
||||
@ -1055,7 +1047,7 @@ void ppc_stfdux() {
|
||||
void ppc_stfiwx() {
|
||||
ppc_grab_regsfpsiab(true);
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : ppc_result_a + ppc_result_b;
|
||||
address_insert32bit_translate((uint32_t)(ppc_state.ppc_fpr[reg_s].int64_r), ppc_effective_address);
|
||||
mem_write_dword(ppc_effective_address, (uint32_t)(ppc_state.ppc_fpr[reg_s].int64_r));
|
||||
}
|
||||
|
||||
//Floating Point Register Transfer
|
||||
@ -1239,4 +1231,4 @@ void ppc_fcmpu() {
|
||||
if ((db_test_a == snan) || (db_test_b == snan)) {
|
||||
ppc_state.ppc_fpscr |= 0x1000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ static uint32_t ppc_mmu_addr_translate(uint32_t la, int is_write)
|
||||
return pa;
|
||||
}
|
||||
|
||||
void address_insert8bit_translate(uint8_t value, uint32_t addr)
|
||||
void mem_write_byte(uint32_t addr, uint8_t value)
|
||||
{
|
||||
/* data address translation if enabled */
|
||||
if (ppc_state.ppc_msr & 0x10) {
|
||||
@ -416,7 +416,7 @@ void address_insert8bit_translate(uint8_t value, uint32_t addr)
|
||||
WRITE_PHYS_MEM(last_write_area, addr, WRITE_BYTE, value, 1);
|
||||
}
|
||||
|
||||
void address_insert16bit_translate(uint16_t value, uint32_t addr)
|
||||
void mem_write_word(uint32_t addr, uint16_t value)
|
||||
{
|
||||
/* data address translation if enabled */
|
||||
if (ppc_state.ppc_msr & 0x10) {
|
||||
@ -426,7 +426,7 @@ void address_insert16bit_translate(uint16_t value, uint32_t addr)
|
||||
WRITE_PHYS_MEM(last_write_area, addr, WRITE_WORD_BE_A, value, 2);
|
||||
}
|
||||
|
||||
void address_insert32bit_translate(uint32_t value, uint32_t addr)
|
||||
void mem_write_dword(uint32_t addr, uint32_t value)
|
||||
{
|
||||
/* data address translation if enabled */
|
||||
if (ppc_state.ppc_msr & 0x10) {
|
||||
@ -436,7 +436,7 @@ void address_insert32bit_translate(uint32_t value, uint32_t addr)
|
||||
WRITE_PHYS_MEM(last_write_area, addr, WRITE_DWORD_BE_A, value, 4);
|
||||
}
|
||||
|
||||
void address_insert64bit_translate(uint64_t value, uint32_t addr)
|
||||
void mem_write_qword(uint32_t addr, uint64_t value)
|
||||
{
|
||||
/* data address translation if enabled */
|
||||
if (ppc_state.ppc_msr & 0x10) {
|
||||
@ -447,7 +447,7 @@ void address_insert64bit_translate(uint64_t value, uint32_t addr)
|
||||
}
|
||||
|
||||
/** Grab a value from memory into a register */
|
||||
void address_grab8bit_translate(uint32_t addr)
|
||||
uint8_t mem_grab_byte(uint32_t addr)
|
||||
{
|
||||
uint8_t ret;
|
||||
|
||||
@ -457,10 +457,10 @@ void address_grab8bit_translate(uint32_t addr)
|
||||
}
|
||||
|
||||
READ_PHYS_MEM(last_read_area, addr, *, 1, 0xFFU);
|
||||
return_value = ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void address_grab16bit_translate(uint32_t addr)
|
||||
uint16_t mem_grab_word(uint32_t addr)
|
||||
{
|
||||
uint16_t ret;
|
||||
|
||||
@ -470,10 +470,10 @@ void address_grab16bit_translate(uint32_t addr)
|
||||
}
|
||||
|
||||
READ_PHYS_MEM(last_read_area, addr, READ_WORD_BE_A, 2, 0xFFFFU);
|
||||
return_value = ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void address_grab32bit_translate(uint32_t addr)
|
||||
uint32_t mem_grab_dword(uint32_t addr)
|
||||
{
|
||||
uint32_t ret;
|
||||
|
||||
@ -483,10 +483,10 @@ void address_grab32bit_translate(uint32_t addr)
|
||||
}
|
||||
|
||||
READ_PHYS_MEM(last_read_area, addr, READ_DWORD_BE_A, 4, 0xFFFFFFFFUL);
|
||||
return_value = ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void address_grab64bit_translate(uint32_t addr)
|
||||
uint64_t mem_grab_qword(uint32_t addr)
|
||||
{
|
||||
uint64_t ret;
|
||||
|
||||
@ -496,7 +496,7 @@ void address_grab64bit_translate(uint32_t addr)
|
||||
}
|
||||
|
||||
READ_PHYS_MEM(last_read_area, addr, READ_QWORD_BE_A, 8, 0xFFFFFFFFFFFFFFFFULL);
|
||||
return_value = ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint8_t* quickinstruction_translate(uint32_t addr)
|
||||
|
@ -10,6 +10,7 @@
|
||||
#ifndef PPCMEMORY_H
|
||||
#define PPCMEMORY_H
|
||||
|
||||
#include <cinttypes>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
|
||||
@ -30,14 +31,14 @@ extern void ibat_update(uint32_t bat_reg);
|
||||
extern void dbat_update(uint32_t bat_reg);
|
||||
|
||||
extern void ppc_set_cur_instruction(const uint8_t* ptr);
|
||||
extern void address_insert8bit_translate(uint8_t value, uint32_t addr);
|
||||
extern void address_insert16bit_translate(uint16_t value, uint32_t addr);
|
||||
extern void address_insert32bit_translate(uint32_t value, uint32_t addr);
|
||||
extern void address_insert64bit_translate(uint64_t value, uint32_t addr);
|
||||
extern void address_grab8bit_translate(uint32_t addr);
|
||||
extern void address_grab16bit_translate(uint32_t addr);
|
||||
extern void address_grab32bit_translate(uint32_t addr);
|
||||
extern void address_grab64bit_translate(uint32_t addr);
|
||||
extern void mem_write_byte(uint32_t addr, uint8_t value);
|
||||
extern void mem_write_word(uint32_t addr, uint16_t value);
|
||||
extern void mem_write_dword(uint32_t addr, uint32_t value);
|
||||
extern void mem_write_qword(uint32_t addr, uint64_t value);
|
||||
extern uint8_t mem_grab_byte(uint32_t addr);
|
||||
extern uint16_t mem_grab_word(uint32_t addr);
|
||||
extern uint32_t mem_grab_dword(uint32_t addr);
|
||||
extern uint64_t mem_grab_qword(uint32_t addr);
|
||||
extern uint8_t* quickinstruction_translate(uint32_t address_grab);
|
||||
|
||||
#endif // PPCMEMORY_H
|
||||
#endif // PPCMEMORY_H
|
||||
|
@ -1308,7 +1308,7 @@ void ppc_mtmsr() {
|
||||
void ppc_mfspr() {
|
||||
uint32_t ref_spr = (((ppc_cur_instruction >> 11) & 31) << 5) | ((ppc_cur_instruction >> 16) & 31);
|
||||
|
||||
#ifdef PROFILER
|
||||
#ifdef PROFILER
|
||||
if (ref_spr > 31) {
|
||||
supervisor_inst_num++;
|
||||
}
|
||||
@ -1321,7 +1321,7 @@ void ppc_mtspr() {
|
||||
uint32_t ref_spr = (((ppc_cur_instruction >> 11) & 31) << 5) | ((ppc_cur_instruction >> 16) & 31);
|
||||
reg_s = (ppc_cur_instruction >> 21) & 31;
|
||||
|
||||
#ifdef PROFILER
|
||||
#ifdef PROFILER
|
||||
if (ref_spr > 31) {
|
||||
supervisor_inst_num++;
|
||||
}
|
||||
@ -1852,10 +1852,10 @@ void ppc_dcbz() {
|
||||
if (!(ppc_state.ppc_pc & 32) && (ppc_state.ppc_pc < 0xFFFFFFE0UL)) {
|
||||
ppc_grab_regsdab();
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
|
||||
address_insert64bit_translate(0, ppc_effective_address);
|
||||
address_insert64bit_translate(0, (ppc_effective_address + 8));
|
||||
address_insert64bit_translate(0, (ppc_effective_address + 16));
|
||||
address_insert64bit_translate(0, (ppc_effective_address + 24));
|
||||
mem_write_qword(ppc_effective_address, 0);
|
||||
mem_write_qword((ppc_effective_address + 8), 0);
|
||||
mem_write_qword((ppc_effective_address + 16), 0);
|
||||
mem_write_qword((ppc_effective_address + 24), 0);
|
||||
}
|
||||
else {
|
||||
ppc_exception_handler(Except_Type::EXC_ALIGNMENT, 0x00000);
|
||||
@ -1869,13 +1869,13 @@ void ppc_stb() {
|
||||
ppc_grab_regssa();
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += (reg_a > 0) ? ppc_result_a : 0;
|
||||
address_insert8bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_byte(ppc_effective_address, ppc_result_d);
|
||||
}
|
||||
|
||||
void ppc_stbx() {
|
||||
ppc_grab_regssab();
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
|
||||
address_insert8bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_byte(ppc_effective_address, ppc_result_d);
|
||||
}
|
||||
|
||||
void ppc_stbu() {
|
||||
@ -1883,7 +1883,7 @@ void ppc_stbu() {
|
||||
if (reg_a != 0) {
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += ppc_result_a;
|
||||
address_insert8bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_byte(ppc_effective_address, ppc_result_d);
|
||||
ppc_state.ppc_gpr[reg_a] = ppc_effective_address;
|
||||
}
|
||||
else {
|
||||
@ -1895,7 +1895,7 @@ void ppc_stbux() {
|
||||
ppc_grab_regssab();
|
||||
if (reg_a != 0) {
|
||||
ppc_effective_address = ppc_result_a + ppc_result_b;
|
||||
address_insert8bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_byte(ppc_effective_address, ppc_result_d);
|
||||
ppc_state.ppc_gpr[reg_a] = ppc_effective_address;
|
||||
}
|
||||
else {
|
||||
@ -1907,7 +1907,7 @@ void ppc_sth() {
|
||||
ppc_grab_regssa();
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += (reg_a > 0) ? ppc_result_a : 0;
|
||||
address_insert16bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_word(ppc_effective_address, ppc_result_d);
|
||||
}
|
||||
|
||||
void ppc_sthu() {
|
||||
@ -1915,7 +1915,7 @@ void ppc_sthu() {
|
||||
if (reg_a != 0) {
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += ppc_result_a;
|
||||
address_insert16bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_word(ppc_effective_address, ppc_result_d);
|
||||
ppc_state.ppc_gpr[reg_a] = ppc_effective_address;
|
||||
}
|
||||
else {
|
||||
@ -1927,7 +1927,7 @@ void ppc_sthux() {
|
||||
ppc_grab_regssab();
|
||||
if (reg_a != 0) {
|
||||
ppc_effective_address = ppc_result_a + ppc_result_b;
|
||||
address_insert16bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_word(ppc_effective_address, ppc_result_d);
|
||||
ppc_state.ppc_gpr[reg_a] = ppc_effective_address;
|
||||
}
|
||||
else {
|
||||
@ -1938,27 +1938,27 @@ void ppc_sthux() {
|
||||
void ppc_sthx() {
|
||||
ppc_grab_regssab();
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
|
||||
address_insert16bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_word(ppc_effective_address, ppc_result_d);
|
||||
}
|
||||
|
||||
void ppc_sthbrx() {
|
||||
ppc_grab_regssab();
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
|
||||
ppc_result_d = (uint32_t)(BYTESWAP_16((uint16_t)ppc_result_d));
|
||||
address_insert16bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_word(ppc_effective_address, ppc_result_d);
|
||||
|
||||
}
|
||||
void ppc_stw() {
|
||||
ppc_grab_regssa();
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += (reg_a > 0) ? ppc_result_a : 0;
|
||||
address_insert32bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_dword(ppc_effective_address, ppc_result_d);
|
||||
}
|
||||
|
||||
void ppc_stwx() {
|
||||
ppc_grab_regssab();
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
|
||||
address_insert32bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_dword(ppc_effective_address, ppc_result_d);
|
||||
}
|
||||
|
||||
void ppc_stwcx() {
|
||||
@ -1966,7 +1966,7 @@ void ppc_stwcx() {
|
||||
ppc_grab_regssab();
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
|
||||
if (ppc_state.ppc_reserve) {
|
||||
address_insert32bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_dword(ppc_effective_address, ppc_result_d);
|
||||
ppc_state.ppc_cr |= (ppc_state.ppc_spr[1] & 0x80000000) ? 0x30000000 : 0x20000000;
|
||||
ppc_state.ppc_reserve = false;
|
||||
}
|
||||
@ -1980,7 +1980,7 @@ void ppc_stwu() {
|
||||
if (reg_a != 0) {
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += ppc_result_a;
|
||||
address_insert32bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_dword(ppc_effective_address, ppc_result_d);
|
||||
ppc_state.ppc_gpr[reg_a] = ppc_effective_address;
|
||||
}
|
||||
else {
|
||||
@ -1992,7 +1992,7 @@ void ppc_stwux() {
|
||||
ppc_grab_regssab();
|
||||
if (reg_a != 0) {
|
||||
ppc_effective_address = ppc_result_a + ppc_result_b;
|
||||
address_insert32bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_dword(ppc_effective_address, ppc_result_d);
|
||||
ppc_state.ppc_gpr[reg_a] = ppc_effective_address;
|
||||
}
|
||||
else {
|
||||
@ -2004,7 +2004,7 @@ void ppc_stwbrx() {
|
||||
ppc_grab_regssab();
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
|
||||
ppc_result_d = BYTESWAP_32(ppc_result_d);
|
||||
address_insert32bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_dword(ppc_effective_address, ppc_result_d);
|
||||
}
|
||||
|
||||
void ppc_stmw() {
|
||||
@ -2013,7 +2013,7 @@ void ppc_stmw() {
|
||||
ppc_effective_address += (reg_a > 0) ? ppc_result_a : 0;
|
||||
//How many words to store in memory - using a do-while for this
|
||||
do {
|
||||
address_insert32bit_translate(ppc_result_d, ppc_effective_address);
|
||||
mem_write_dword(ppc_effective_address, ppc_result_d);
|
||||
ppc_effective_address += 4;
|
||||
reg_d++;
|
||||
} while (reg_d < 32);
|
||||
@ -2023,9 +2023,7 @@ void ppc_lbz() {
|
||||
ppc_grab_regsda();
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += (reg_a > 0) ? ppc_result_a : 0;
|
||||
address_grab8bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
return_value = 0;
|
||||
ppc_result_d = mem_grab_byte(ppc_effective_address);
|
||||
ppc_store_result_regd();
|
||||
}
|
||||
|
||||
@ -2034,9 +2032,7 @@ void ppc_lbzu() {
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
if ((reg_a != reg_d) || reg_a != 0) {
|
||||
ppc_effective_address += ppc_result_a;
|
||||
address_grab8bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
return_value = 0;
|
||||
ppc_result_d = mem_grab_byte(ppc_effective_address);
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_result_regd();
|
||||
ppc_store_result_rega();
|
||||
@ -2049,9 +2045,7 @@ void ppc_lbzu() {
|
||||
void ppc_lbzx() {
|
||||
ppc_grab_regsdab();
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
|
||||
address_grab8bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
return_value = 0;
|
||||
ppc_result_d = mem_grab_byte(ppc_effective_address);
|
||||
ppc_store_result_regd();
|
||||
}
|
||||
|
||||
@ -2059,9 +2053,7 @@ void ppc_lbzux() {
|
||||
ppc_grab_regsdab();
|
||||
if ((reg_a != reg_d) || reg_a != 0) {
|
||||
ppc_effective_address = ppc_result_a + ppc_result_b;
|
||||
address_grab8bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
return_value = 0;
|
||||
ppc_result_d = mem_grab_byte(ppc_effective_address);
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_result_regd();
|
||||
ppc_store_result_rega();
|
||||
@ -2076,9 +2068,7 @@ void ppc_lhz() {
|
||||
ppc_grab_regsda();
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += (reg_a > 0) ? ppc_result_a : 0;
|
||||
address_grab16bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
return_value = 0;
|
||||
ppc_result_d = mem_grab_word(ppc_effective_address);
|
||||
ppc_store_result_regd();
|
||||
}
|
||||
|
||||
@ -2087,9 +2077,7 @@ void ppc_lhzu() {
|
||||
if ((reg_a != reg_d) || reg_a != 0) {
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += ppc_result_a;
|
||||
address_grab16bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
return_value = 0;
|
||||
ppc_result_d = mem_grab_word(ppc_effective_address);
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_result_regd();
|
||||
ppc_store_result_rega();
|
||||
@ -2102,9 +2090,7 @@ void ppc_lhzu() {
|
||||
void ppc_lhzx() {
|
||||
ppc_grab_regsdab();
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
|
||||
address_grab16bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
return_value = 0;
|
||||
ppc_result_d = mem_grab_word(ppc_effective_address);
|
||||
ppc_store_result_regd();
|
||||
}
|
||||
|
||||
@ -2112,9 +2098,7 @@ void ppc_lhzux() {
|
||||
ppc_grab_regsdab();
|
||||
if ((reg_a != reg_d) || reg_a != 0) {
|
||||
ppc_effective_address = ppc_result_a + ppc_result_b;
|
||||
address_grab16bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
return_value = 0;
|
||||
ppc_result_d = mem_grab_word(ppc_effective_address);
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_result_regd();
|
||||
ppc_store_result_rega();
|
||||
@ -2128,17 +2112,14 @@ void ppc_lha() {
|
||||
ppc_grab_regsda();
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += (reg_a > 0) ? ppc_result_a : 0;
|
||||
address_grab16bit_translate(ppc_effective_address);
|
||||
uint16_t go_this = (uint16_t)return_value;
|
||||
if (go_this & 0x8000) {
|
||||
ppc_result_d = 0xFFFF0000UL | (uint32_t)return_value;
|
||||
ppc_store_result_regd();
|
||||
uint16_t val = mem_grab_word(ppc_effective_address);
|
||||
if (val & 0x8000) {
|
||||
ppc_result_d = 0xFFFF0000UL | (uint32_t)val;
|
||||
}
|
||||
else {
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
ppc_store_result_regd();
|
||||
ppc_result_d = (uint32_t)val;
|
||||
}
|
||||
return_value = 0;
|
||||
ppc_store_result_regd();
|
||||
}
|
||||
|
||||
void ppc_lhau() {
|
||||
@ -2146,17 +2127,14 @@ void ppc_lhau() {
|
||||
if ((reg_a != reg_d) || reg_a != 0) {
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += ppc_result_a;
|
||||
address_grab16bit_translate(ppc_effective_address);
|
||||
uint16_t go_this = (uint16_t)return_value;
|
||||
if (go_this & 0x8000) {
|
||||
ppc_result_d = 0xFFFF0000UL | (uint32_t)return_value;
|
||||
ppc_store_result_regd();
|
||||
uint16_t val = mem_grab_word(ppc_effective_address);
|
||||
if (val & 0x8000) {
|
||||
ppc_result_d = 0xFFFF0000UL | (uint32_t)val;
|
||||
}
|
||||
else {
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
ppc_store_result_regd();
|
||||
ppc_result_d = (uint32_t)val;
|
||||
}
|
||||
return_value = 0;
|
||||
ppc_store_result_regd();
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_result_rega();
|
||||
}
|
||||
@ -2168,17 +2146,14 @@ void ppc_lhau() {
|
||||
void ppc_lhaux() {
|
||||
ppc_grab_regsdab();
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
|
||||
address_grab16bit_translate(ppc_effective_address);
|
||||
uint16_t go_this = (uint16_t)return_value;
|
||||
if (go_this & 0x8000) {
|
||||
ppc_result_d = 0xFFFF0000UL | (uint32_t)return_value;
|
||||
ppc_store_result_regd();
|
||||
uint16_t val = mem_grab_word(ppc_effective_address);
|
||||
if (val & 0x8000) {
|
||||
ppc_result_d = 0xFFFF0000UL | (uint32_t)val;
|
||||
}
|
||||
else {
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
ppc_store_result_regd();
|
||||
ppc_result_d = (uint32_t)val;
|
||||
}
|
||||
return_value = 0;
|
||||
ppc_store_result_regd();
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_result_rega();
|
||||
}
|
||||
@ -2186,25 +2161,20 @@ void ppc_lhaux() {
|
||||
void ppc_lhax() {
|
||||
ppc_grab_regsdab();
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
|
||||
address_grab16bit_translate(ppc_effective_address);
|
||||
uint16_t go_this = (uint16_t)return_value;
|
||||
if (go_this & 0x8000) {
|
||||
ppc_result_d = 0xFFFF0000UL | (uint32_t)return_value;
|
||||
ppc_store_result_regd();
|
||||
uint16_t val = mem_grab_word(ppc_effective_address);
|
||||
if (val & 0x8000) {
|
||||
ppc_result_d = 0xFFFF0000UL | (uint32_t)val;
|
||||
}
|
||||
else {
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
ppc_store_result_regd();
|
||||
ppc_result_d = (uint32_t)val;
|
||||
}
|
||||
return_value = 0;
|
||||
ppc_store_result_regd();
|
||||
}
|
||||
|
||||
void ppc_lhbrx() {
|
||||
ppc_grab_regsdab();
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
|
||||
address_grab16bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (uint32_t)(BYTESWAP_16((uint16_t)ppc_result_d));
|
||||
return_value = 0;
|
||||
ppc_result_d = (uint32_t)(BYTESWAP_16(mem_grab_word(ppc_effective_address)));
|
||||
ppc_store_result_regd();
|
||||
}
|
||||
|
||||
@ -2212,18 +2182,14 @@ void ppc_lwz() {
|
||||
ppc_grab_regsda();
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
ppc_effective_address += (reg_a > 0) ? ppc_result_a : 0;
|
||||
address_grab32bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
return_value = 0;
|
||||
ppc_result_d = mem_grab_dword(ppc_effective_address);
|
||||
ppc_store_result_regd();
|
||||
}
|
||||
|
||||
void ppc_lwbrx() {
|
||||
ppc_grab_regsdab();
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
|
||||
address_grab32bit_translate(ppc_effective_address);
|
||||
ppc_result_d = BYTESWAP_32((uint32_t)return_value);
|
||||
return_value = 0;
|
||||
ppc_result_d = BYTESWAP_32(mem_grab_dword(ppc_effective_address));
|
||||
ppc_store_result_regd();
|
||||
}
|
||||
|
||||
@ -2232,9 +2198,7 @@ void ppc_lwzu() {
|
||||
ppc_effective_address = (int32_t)((int16_t)(ppc_cur_instruction & 0xFFFF));
|
||||
if ((reg_a != reg_d) || reg_a != 0) {
|
||||
ppc_effective_address += ppc_result_a;
|
||||
address_grab32bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
return_value = 0;
|
||||
ppc_result_d = mem_grab_dword(ppc_effective_address);
|
||||
ppc_store_result_regd();
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_result_rega();
|
||||
@ -2247,9 +2211,7 @@ void ppc_lwzu() {
|
||||
void ppc_lwzx() {
|
||||
ppc_grab_regsdab();
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
|
||||
address_grab32bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
return_value = 0;
|
||||
ppc_result_d = mem_grab_dword(ppc_effective_address);
|
||||
ppc_store_result_regd();
|
||||
}
|
||||
|
||||
@ -2261,9 +2223,7 @@ void ppc_lwzux() {
|
||||
else {
|
||||
ppc_exception_handler(Except_Type::EXC_PROGRAM, 0x20000);
|
||||
}
|
||||
address_grab32bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
return_value = 0;
|
||||
ppc_result_d = mem_grab_dword(ppc_effective_address);
|
||||
ppc_result_a = ppc_effective_address;
|
||||
ppc_store_result_regd();
|
||||
ppc_store_result_rega();
|
||||
@ -2274,9 +2234,7 @@ void ppc_lwarx() {
|
||||
ppc_grab_regsdab();
|
||||
ppc_effective_address = (reg_a == 0) ? ppc_result_b : (ppc_result_a + ppc_result_b);
|
||||
ppc_state.ppc_reserve = true;
|
||||
address_grab32bit_translate(ppc_effective_address);
|
||||
ppc_result_d = (uint32_t)return_value;
|
||||
return_value = 0;
|
||||
ppc_result_d = mem_grab_dword(ppc_effective_address);
|
||||
ppc_store_result_regd();
|
||||
}
|
||||
|
||||
@ -2286,9 +2244,7 @@ void ppc_lmw() {
|
||||
ppc_effective_address += (reg_a > 0) ? ppc_result_a : 0;
|
||||
//How many words to load in memory - using a do-while for this
|
||||
do {
|
||||
address_grab32bit_translate(ppc_effective_address);
|
||||
ppc_state.ppc_gpr[reg_d] = (uint32_t)return_value;
|
||||
return_value = 0;
|
||||
ppc_state.ppc_gpr[reg_d] = mem_grab_dword(ppc_effective_address);
|
||||
ppc_effective_address += 4;
|
||||
reg_d++;
|
||||
} while (reg_d < 32);
|
||||
@ -2305,28 +2261,24 @@ void ppc_lswi() {
|
||||
while (grab_inb > 0) {
|
||||
switch (shift_times) {
|
||||
case 0:
|
||||
address_grab8bit_translate(ppc_effective_address);;
|
||||
ppc_state.ppc_gpr[reg_d] = (ppc_result_d & 0x00FFFFFFUL) | ((uint32_t)return_value << 24);
|
||||
ppc_state.ppc_gpr[reg_d] = (ppc_result_d & 0x00FFFFFFUL) |
|
||||
(mem_grab_byte(ppc_effective_address) << 24);
|
||||
ppc_store_result_regd();
|
||||
return_value = 0;
|
||||
break;
|
||||
case 1:
|
||||
address_grab8bit_translate(ppc_effective_address);;
|
||||
ppc_result_d = (ppc_result_d & 0xFF00FFFFUL) | ((uint32_t)return_value << 16);
|
||||
ppc_result_d = (ppc_result_d & 0xFF00FFFFUL) |
|
||||
(mem_grab_byte(ppc_effective_address) << 16);
|
||||
ppc_store_result_regd();
|
||||
return_value = 0;
|
||||
break;
|
||||
case 2:
|
||||
address_grab8bit_translate(ppc_effective_address);;
|
||||
ppc_result_d = (ppc_result_d & 0xFFFF00FFUL) | ((uint32_t)return_value << 8);
|
||||
ppc_result_d = (ppc_result_d & 0xFFFF00FFUL) |
|
||||
(mem_grab_byte(ppc_effective_address) << 8);
|
||||
ppc_store_result_regd();
|
||||
return_value = 0;
|
||||
break;
|
||||
case 3:
|
||||
address_grab8bit_translate(ppc_effective_address);;
|
||||
ppc_result_d = (ppc_result_d & 0xFFFFFF00UL) | (uint32_t)return_value;
|
||||
ppc_result_d = (ppc_result_d & 0xFFFFFF00UL) |
|
||||
mem_grab_byte(ppc_effective_address);
|
||||
ppc_store_result_regd();
|
||||
return_value = 0;
|
||||
break;
|
||||
default:
|
||||
printf("Something really horrible happened with lswi.");
|
||||
@ -2338,7 +2290,6 @@ void ppc_lswi() {
|
||||
else {
|
||||
shift_times++;
|
||||
}
|
||||
return_value = 0;
|
||||
ppc_effective_address++;
|
||||
grab_inb--;
|
||||
}
|
||||
@ -2359,28 +2310,24 @@ void ppc_lswx() {
|
||||
while (grab_inb > 0) {
|
||||
switch (shift_times) {
|
||||
case 0:
|
||||
address_grab8bit_translate(ppc_effective_address);;
|
||||
ppc_result_d = (ppc_result_d & 0x00FFFFFFUL) | ((uint32_t)return_value << 24);
|
||||
ppc_result_d = (ppc_result_d & 0x00FFFFFFUL) |
|
||||
(mem_grab_byte(ppc_effective_address) << 24);
|
||||
ppc_store_result_regd();
|
||||
return_value = 0;
|
||||
break;
|
||||
case 1:
|
||||
address_grab8bit_translate(ppc_effective_address);;
|
||||
ppc_result_d = (ppc_result_d & 0xFF00FFFFUL) | ((uint32_t)return_value << 16);
|
||||
ppc_result_d = (ppc_result_d & 0xFF00FFFFUL) |
|
||||
(mem_grab_byte(ppc_effective_address) << 16);
|
||||
ppc_store_result_regd();
|
||||
return_value = 0;
|
||||
break;
|
||||
case 2:
|
||||
address_grab8bit_translate(ppc_effective_address);;
|
||||
ppc_result_d = (ppc_result_d & 0xFFFF00FFUL) | ((uint32_t)return_value << 8);
|
||||
ppc_result_d = (ppc_result_d & 0xFFFF00FFUL) |
|
||||
(mem_grab_byte(ppc_effective_address) << 8);
|
||||
ppc_store_result_regd();
|
||||
return_value = 0;
|
||||
break;
|
||||
case 3:
|
||||
address_grab8bit_translate(ppc_effective_address);;
|
||||
ppc_result_d = (ppc_result_d & 0xFFFFFF00UL) | (uint32_t)return_value;
|
||||
ppc_result_d = (ppc_result_d & 0xFFFFFF00UL) |
|
||||
mem_grab_byte(ppc_effective_address);
|
||||
ppc_store_result_regd();
|
||||
return_value = 0;
|
||||
break;
|
||||
default:
|
||||
printf("Something really horrible happened with lswx.");
|
||||
@ -2392,7 +2339,6 @@ void ppc_lswx() {
|
||||
else {
|
||||
shift_times++;
|
||||
}
|
||||
return_value = 0;
|
||||
ppc_effective_address++;
|
||||
grab_inb--;
|
||||
}
|
||||
@ -2409,19 +2355,19 @@ void ppc_stswi() {
|
||||
switch (shift_times) {
|
||||
case 0:
|
||||
strwrd_replace_value = (ppc_result_d >> 24);
|
||||
address_insert8bit_translate(strwrd_replace_value, ppc_effective_address);
|
||||
mem_write_byte(ppc_effective_address, strwrd_replace_value);
|
||||
break;
|
||||
case 1:
|
||||
strwrd_replace_value = (ppc_result_d >> 16);
|
||||
address_insert8bit_translate(strwrd_replace_value, ppc_effective_address);
|
||||
mem_write_byte(ppc_effective_address, strwrd_replace_value);
|
||||
break;
|
||||
case 2:
|
||||
strwrd_replace_value = (ppc_result_d >> 8);
|
||||
address_insert8bit_translate(strwrd_replace_value, ppc_effective_address);
|
||||
mem_write_byte(ppc_effective_address, strwrd_replace_value);
|
||||
break;
|
||||
case 3:
|
||||
strwrd_replace_value = (ppc_result_d);
|
||||
address_insert8bit_translate(strwrd_replace_value, ppc_effective_address);
|
||||
mem_write_byte(ppc_effective_address, strwrd_replace_value);
|
||||
break;
|
||||
default:
|
||||
printf("Something really horrible happened with stswi.");
|
||||
@ -2433,7 +2379,6 @@ void ppc_stswi() {
|
||||
else {
|
||||
shift_times++;
|
||||
}
|
||||
return_value = 0;
|
||||
ppc_effective_address++;
|
||||
grab_inb--;
|
||||
}
|
||||
@ -2448,19 +2393,19 @@ void ppc_stswx() {
|
||||
switch (shift_times) {
|
||||
case 0:
|
||||
strwrd_replace_value = (ppc_result_d >> 24);
|
||||
address_insert8bit_translate(strwrd_replace_value, ppc_effective_address);
|
||||
mem_write_byte(ppc_effective_address, strwrd_replace_value);
|
||||
break;
|
||||
case 1:
|
||||
strwrd_replace_value = (ppc_result_d >> 16);
|
||||
address_insert8bit_translate(strwrd_replace_value, ppc_effective_address);
|
||||
mem_write_byte(ppc_effective_address, strwrd_replace_value);
|
||||
break;
|
||||
case 2:
|
||||
strwrd_replace_value = (ppc_result_d >> 8);
|
||||
address_insert8bit_translate(strwrd_replace_value, ppc_effective_address);
|
||||
mem_write_byte(ppc_effective_address, strwrd_replace_value);
|
||||
break;
|
||||
case 3:
|
||||
strwrd_replace_value = (ppc_result_d);
|
||||
address_insert8bit_translate(strwrd_replace_value, ppc_effective_address);
|
||||
mem_write_byte(ppc_effective_address, strwrd_replace_value);
|
||||
break;
|
||||
default:
|
||||
printf("Something really horrible happened with stswx.");
|
||||
@ -2472,7 +2417,6 @@ void ppc_stswx() {
|
||||
else {
|
||||
shift_times++;
|
||||
}
|
||||
return_value = 0;
|
||||
ppc_effective_address++;
|
||||
grab_inb--;
|
||||
}
|
||||
@ -2517,4 +2461,4 @@ void ppc_tlbsync() {
|
||||
supervisor_inst_num++;
|
||||
#endif
|
||||
printf("Placeholder for tlbsync \n");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user