mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-23 06:29:38 +00:00
Minor code clean-up
This commit is contained in:
parent
226c097b81
commit
a95b06f703
@ -61,7 +61,7 @@ template void dppc_interpreter::power_abs<RC1, OV1>();
|
||||
|
||||
void dppc_interpreter::power_clcs() {
|
||||
uint32_t ppc_result_d;
|
||||
ppc_grab_regsda(ppc_cur_instruction);
|
||||
ppc_grab_da(ppc_cur_instruction);
|
||||
switch (reg_a) {
|
||||
case 12: //instruction cache line size
|
||||
case 13: //data cache line size
|
||||
|
@ -36,54 +36,68 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
uint32_t uimm = uint16_t(opcode); \
|
||||
uint32_t ppc_result_a = ppc_state.gpr[reg_a];
|
||||
|
||||
# define ppc_grab_regsasimm(opcode) \
|
||||
#define ppc_grab_regsasimm(opcode) \
|
||||
int reg_a = (opcode >> 16) & 31; \
|
||||
int32_t simm = int32_t(int16_t(opcode)); \
|
||||
uint32_t ppc_result_a = ppc_state.gpr[reg_a];
|
||||
|
||||
# define ppc_grab_regssauimm(opcode) \
|
||||
#define ppc_grab_regssauimm(opcode) \
|
||||
int reg_s = (opcode >> 21) & 31; \
|
||||
int reg_a = (opcode >> 16) & 31; \
|
||||
uint32_t uimm = uint16_t(opcode); \
|
||||
uint32_t ppc_result_d = ppc_state.gpr[reg_s]; \
|
||||
uint32_t ppc_result_a = ppc_state.gpr[reg_a];
|
||||
|
||||
#define ppc_grab_da(opcode)\
|
||||
int reg_d = (opcode >> 21) & 31;\
|
||||
int reg_a = (opcode >> 16) & 31;\
|
||||
|
||||
#define ppc_grab_dab(opcode) \
|
||||
int reg_d = (opcode >> 21) & 31; \
|
||||
int reg_a = (opcode >> 16) & 31; \
|
||||
int reg_b = (opcode >> 11) & 31;
|
||||
|
||||
#define ppc_grab_s(opcode) \
|
||||
int reg_s = (opcode >> 21) & 31; \
|
||||
uint32_t ppc_result_d = ppc_state.gpr[reg_s];
|
||||
|
||||
#define ppc_grab_regsdab(opcode) \
|
||||
int reg_d = (opcode >> 21) & 31; \
|
||||
uint32_t reg_a = (opcode >> 16) & 31; \
|
||||
uint32_t reg_b = (opcode >> 11) & 31; \
|
||||
int reg_a = (opcode >> 16) & 31; \
|
||||
int reg_b = (opcode >> 11) & 31; \
|
||||
uint32_t ppc_result_a = ppc_state.gpr[reg_a]; \
|
||||
uint32_t ppc_result_b = ppc_state.gpr[reg_b];
|
||||
|
||||
#define ppc_grab_regssab(opcode) \
|
||||
uint32_t reg_s = (opcode >> 21) & 31; \
|
||||
uint32_t reg_a = (opcode >> 16) & 31; \
|
||||
uint32_t reg_b = (opcode >> 11) & 31; \
|
||||
int reg_s = (opcode >> 21) & 31; \
|
||||
int reg_a = (opcode >> 16) & 31; \
|
||||
int reg_b = (opcode >> 11) & 31; \
|
||||
uint32_t ppc_result_d = ppc_state.gpr[reg_s]; \
|
||||
uint32_t ppc_result_a = ppc_state.gpr[reg_a]; \
|
||||
uint32_t ppc_result_b = ppc_state.gpr[reg_b]; \
|
||||
|
||||
#define ppc_grab_regssa(opcode) \
|
||||
uint32_t reg_s = (opcode >> 21) & 31; \
|
||||
uint32_t reg_a = (opcode >> 16) & 31; \
|
||||
#define ppc_grab_regsab(opcode) \
|
||||
int reg_a = (opcode >> 16) & 31;\
|
||||
int reg_b = (opcode >> 11) & 31;\
|
||||
uint32_t ppc_result_a = ppc_state.gpr[reg_a];\
|
||||
uint32_t ppc_result_b = ppc_state.gpr[reg_b];
|
||||
|
||||
#define ppc_grab_regssa(opcode) \
|
||||
int reg_s = (opcode >> 21) & 31; \
|
||||
int reg_a = (opcode >> 16) & 31; \
|
||||
uint32_t ppc_result_d = ppc_state.gpr[reg_s]; \
|
||||
uint32_t ppc_result_a = ppc_state.gpr[reg_a];
|
||||
|
||||
#define ppc_grab_regssash(opcode) \
|
||||
uint32_t reg_s = (opcode >> 21) & 31; \
|
||||
uint32_t reg_a = (opcode >> 16) & 31; \
|
||||
uint32_t rot_sh = (opcode >> 11) & 31; \
|
||||
int reg_s = (opcode >> 21) & 31; \
|
||||
int reg_a = (opcode >> 16) & 31; \
|
||||
int rot_sh = (opcode >> 11) & 31; \
|
||||
uint32_t ppc_result_d = ppc_state.gpr[reg_s]; \
|
||||
uint32_t ppc_result_a = ppc_state.gpr[reg_a];
|
||||
|
||||
#define ppc_grab_regssb(opcode) \
|
||||
uint32_t reg_s = (opcode >> 21) & 31; \
|
||||
uint32_t reg_b = (opcode >> 11) & 31; \
|
||||
int reg_s = (opcode >> 21) & 31; \
|
||||
int reg_b = (opcode >> 11) & 31; \
|
||||
uint32_t ppc_result_d = ppc_state.gpr[reg_s]; \
|
||||
uint32_t ppc_result_b = ppc_state.gpr[reg_b]; \
|
||||
|
||||
|
@ -1048,7 +1048,7 @@ void dppc_interpreter::ppc_mftb() {
|
||||
}
|
||||
|
||||
void dppc_interpreter::ppc_mtcrf() {
|
||||
ppc_grab_regssa(ppc_cur_instruction);
|
||||
ppc_grab_s(ppc_cur_instruction);
|
||||
uint8_t crm = (ppc_cur_instruction >> 12) & 0xFFU;
|
||||
|
||||
uint32_t cr_mask = 0;
|
||||
@ -1215,7 +1215,7 @@ void dppc_interpreter::ppc_cmp() {
|
||||
#endif
|
||||
|
||||
int crf_d = (ppc_cur_instruction >> 21) & 0x1C;
|
||||
ppc_grab_regssab(ppc_cur_instruction);
|
||||
ppc_grab_regsab(ppc_cur_instruction);
|
||||
uint32_t xercon = (ppc_state.spr[SPR::XER] & XER::SO) >> 3;
|
||||
uint32_t cmp_c = (int32_t(ppc_result_a) == int32_t(ppc_result_b)) ? 0x20000000UL : \
|
||||
(int32_t(ppc_result_a) > int32_t(ppc_result_b)) ? 0x40000000UL : 0x80000000UL;
|
||||
@ -1247,7 +1247,7 @@ void dppc_interpreter::ppc_cmpl() {
|
||||
#endif
|
||||
|
||||
int crf_d = (ppc_cur_instruction >> 21) & 0x1C;
|
||||
ppc_grab_regssab(ppc_cur_instruction);
|
||||
ppc_grab_regsab(ppc_cur_instruction);
|
||||
uint32_t xercon = (ppc_state.spr[SPR::XER] & XER::SO) >> 3;
|
||||
uint32_t cmp_c = (ppc_result_a == ppc_result_b) ? 0x20000000UL : \
|
||||
(ppc_result_a > ppc_result_b) ? 0x40000000UL : 0x80000000UL;
|
||||
@ -1261,7 +1261,6 @@ void dppc_interpreter::ppc_cmpli() {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
int crf_d = (ppc_cur_instruction >> 21) & 0x1C;
|
||||
ppc_grab_regssauimm(ppc_cur_instruction);
|
||||
uint32_t xercon = (ppc_state.spr[SPR::XER] & XER::SO) >> 3;
|
||||
|
@ -29,7 +29,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
|
||||
class AtapiCdrom : public AtapiBaseDevice, public CdromDrive {
|
||||
class AtapiCdrom : public CdromDrive, public AtapiBaseDevice {
|
||||
public:
|
||||
AtapiCdrom(std::string name);
|
||||
~AtapiCdrom() = default;
|
||||
|
@ -32,7 +32,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
class ScsiCdrom : public ScsiDevice, public CdromDrive {
|
||||
class ScsiCdrom : public CdromDrive, public ScsiDevice {
|
||||
public:
|
||||
ScsiCdrom(std::string name, int my_id);
|
||||
~ScsiCdrom() = default;
|
||||
|
4
main.cpp
4
main.cpp
@ -40,12 +40,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
using namespace std;
|
||||
|
||||
void sigint_handler(int signum) {
|
||||
static void sigint_handler(int signum) {
|
||||
power_on = false;
|
||||
power_off_reason = po_signal_interrupt;
|
||||
}
|
||||
|
||||
void sigabrt_handler(int signum) {
|
||||
static void sigabrt_handler(int signum) {
|
||||
LOG_F(INFO, "Shutting down...");
|
||||
|
||||
delete gMachineObj.release();
|
||||
|
Loading…
Reference in New Issue
Block a user