Skip to content

Commit

Permalink
More fixes, plus a temp icon
Browse files Browse the repository at this point in the history
  • Loading branch information
dingusdev authored Jul 19, 2019
1 parent f89c548 commit c9854b3
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 19 deletions.
8 changes: 6 additions & 2 deletions dingusppc.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-std=c++14" />
<Add option="-Weffc++" />
<Add option="-Wall" />
<Add option="-std=c++11" />
<Add option="-m32" />
<Add option="-g" />
</Compiler>
Expand All @@ -27,11 +29,13 @@
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-march=core2" />
<Add option="-Os" />
<Add option="-std=c++14" />
<Add option="-m32" />
</Compiler>
<Linker>
<Add option="-O3" />
<Add option="-s" />
<Add option="-m32" />
</Linker>
</Target>
Expand Down
Binary file added dppcicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions icon.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAINICON ICON "dppcicon.ico"
8 changes: 7 additions & 1 deletion ppcemumain.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@

#include <map>

//Uncomment this to help debug the emulator further
//#define EXHAUSTIVE_DEBUG 1

//Uncomment this to have a more graceful approach to illegal opcodes
//#define ILLEGAL_OP_SAFE 1

enum endian_switch {big_end = 0, little_end = 1};

typedef void (*PPCOpcode)(void);
Expand Down Expand Up @@ -616,7 +622,7 @@ static std::map<uint8_t, PPCOpcode> OpcodeGrabber =
{44, &ppc_sth}, {45, &ppc_sthu}, {46, &ppc_lmw}, {47, &ppc_stmw},
{48, &ppc_lfs}, {49, &ppc_lfsu}, {50, &ppc_lfd}, {51, &ppc_lfdu},
{52, &ppc_stfs}, {53, &ppc_stfsu}, {54, &ppc_stfd}, {55, &ppc_stfdu},
{56, &ppc_psq_l}, {57, &ppc_psq_lu}, {58, &ppc_illegalop}, {59, &ppc_illegalop},
{56, &ppc_psq_l}, {57, &ppc_psq_lu}, {58, &ppc_illegalop}, {59, &ppc_opcode59},
{60, &ppc_psq_st}, {61, &ppc_psq_stu}, {62, &ppc_illegalop}, {63, &ppc_opcode63}};

//All of the opcodes possible are generated from the first 6 bits
Expand Down
4 changes: 2 additions & 2 deletions ppcmemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ void address_quickinsert_translate(uint32_t value_insert, uint32_t address_grab,
void address_quickgrab_translate(uint32_t address_grab, uint8_t bit_num){
//Grab a value from memory into a register

printf("Grabbing from address %x \n", address_grab);
//printf("Grabbing from address %x \n", address_grab);

uint32_t storage_area = 0;
uint32_t grab_batl = 537;
Expand Down Expand Up @@ -782,7 +782,7 @@ void address_quickgrab_translate(uint32_t address_grab, uint8_t bit_num){
}

if (address_grab >= 0xFFC00000){
printf("Charting ROM Area: %x \n", address_grab);
//printf("Charting ROM Area: %x \n", address_grab);
storage_area = address_grab % rom_file_setsize;
grab_macmem_ptr = machine_sysrom_mem;
ppc_set_return_val(storage_area, bit_num);
Expand Down
60 changes: 46 additions & 14 deletions ppcopcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,61 +224,91 @@ void ppc_opcode4(){
}

void ppc_opcode16(){
//printf("Reading from Opcode 16 table \n");
uint8_t subop_grab = ppc_cur_instruction & 3;
//uint32_t regrab = (uint32_t)subop_grab;
//printf("Executing subopcode entry %d \n", regrab);

#ifdef EXHAUSTIVE_DEBUG
uint32_t regrab = (uint32_t)subop_grab;
printf("Executing Opcode 16 table subopcode entry %d \n", regrab);
SubOpcode16Grabber[subop_grab]();
#else
SubOpcode16Grabber[subop_grab]();
#endif // EXHAUSTIVE_DEBUG
}

void ppc_opcode18(){
//printf("Reading from Opcode 18 table \n");
uint8_t subop_grab = ppc_cur_instruction & 3;
//printf("Reading from Opcode 18 table \n");
//uint32_t regrab = (uint32_t)subop_grab;
//printf("Executing subopcode entry %d \n", regrab);
SubOpcode18Grabber[subop_grab]();
}

void ppc_opcode19(){
//printf("Reading from Opcode 19 table \n");
uint16_t subop_grab = ppc_cur_instruction & 2047;
//uint32_t regrab = (uint32_t)subop_grab;
//printf("Executing subopcode entry %d \n", regrab);
#ifdef EXHAUSTIVE_DEBUG
uint32_t regrab = (uint32_t)subop_grab;
printf("Executing Opcode 19 table supopcode entry %d \n", regrab);
if (SubOpcode19Grabber.count(subop_grab) == 1){
SubOpcode19Grabber[subop_grab]();
}
else{
std::cout << "ILLEGAL SUBOPCODE: " << subop_grab << std::endl;
ppc_expection_handler(0x0700, 0x80000);
}
#else
SubOpcode19Grabber[subop_grab]();
#endif // EXHAUSTIVE_DEBUG
}

void ppc_opcode31(){
//printf("Reading from Opcode 31 table \n");
uint16_t subop_grab = ppc_cur_instruction & 2047;
//uint32_t regrab = (uint32_t)subop_grab;
//printf("Executing subopcode entry %d \n", regrab);
#ifdef EXHAUSTIVE_DEBUG
uint32_t regrab = (uint32_t)subop_grab;
printf("Executing Opcode 31 table supopcode entry %d \n", regrab);
if (SubOpcode31Grabber.count(subop_grab) == 1){
SubOpcode31Grabber[subop_grab]();
}
else{
std::cout << "ILLEGAL SUBOPCODE: " << subop_grab << std::endl;
ppc_expection_handler(0x0700, 0x80000);
}
#else
SubOpcode31Grabber[subop_grab]();
#endif // EXHAUSTIVE_DEBUG
}

void ppc_opcode59(){
uint16_t subop_grab = ppc_cur_instruction & 2047;
#ifdef EXHAUSTIVE_DEBUG
uint32_t regrab = (uint32_t)subop_grab;
printf("Executing Opcode 59 table supopcode entry %d \n", regrab);
if (SubOpcode59Grabber.count(subop_grab) == 1){
SubOpcode59Grabber[subop_grab]();
}
else{
std::cout << "ILLEGAL SUBOPCODE: " << subop_grab << std::endl;
ppc_expection_handler(0x0700, 0x80000);
}
#else
SubOpcode59Grabber[subop_grab]();
#endif // EXHAUSTIVE_DEBUG
}

void ppc_opcode63(){
//printf("Reading from Opcode 63 table \n");
uint16_t subop_grab = ppc_cur_instruction & 2047;
//uint32_t regrab = (uint32_t)subop_grab;
//std::cout << "Executing subopcode entry " << regrab << std::endl;
#ifdef EXHAUSTIVE_DEBUG
uint32_t regrab = (uint32_t)subop_grab;
std::cout << "Executing Opcode 63 table subopcode entry " << regrab << std::endl;
if (SubOpcode63Grabber.count(subop_grab) == 1){
SubOpcode63Grabber[subop_grab]();
}
else{
//std::cout << "ILLEGAL SUBOPCODE: " << subop_grab << std::endl;
std::cout << "ILLEGAL SUBOPCODE: " << subop_grab << std::endl;
ppc_expection_handler(0x0700, 0x80000);
}
#else
SubOpcode63Grabber[subop_grab]();
#endif // EXHAUSTIVE_DEBUG
}

void ppc_main_opcode(){
Expand Down Expand Up @@ -1906,7 +1936,9 @@ void ppc_stb(){
ppc_grab_regssa();
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);
#ifdef EXHAUSTIVE_DEBUG
printf("STB Storage Area: %x \n",ppc_effective_address);
#endif // EXHAUSTIVE_DEBUG
address_quickinsert_translate(ppc_result_d, ppc_effective_address, 1);
}

Expand Down

1 comment on commit c9854b3

@dingusdev
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also now an EXHAUSTIVE_DEBUG option for compiling, which allows one to look at all the debug info they could want. This also cuts down a little on size if needed. It's in ppcemumain.h.

Please sign in to comment.