mirror of
https://github.com/libretro/Mu.git
synced 2026-09-22 22:56:12 +00:00
More ARM stuff, allow read/write safety check disableing
This commit is contained in:
@@ -16,6 +16,8 @@ extern "C" {
|
||||
|
||||
//DEFINE INFO!!!
|
||||
//define EMU_MULTITHREADED to speed up long loops
|
||||
//define EMU_OPTIMIZE_FOR_ARM to use ASM CPU core
|
||||
//define EMU_NO_SAFETY to remove all safety checks
|
||||
//to enable degguging define EMU_DEBUG, all options below do nothing unless EMU_DEBUG is defined
|
||||
//to enable sandbox debugging define EMU_SANDBOX
|
||||
//to enable opcode level debugging define EMU_SANDBOX_OPCODE_LEVEL_DEBUG
|
||||
|
||||
@@ -27,13 +27,17 @@ extern void m68k_write_memory_32(unsigned int address, unsigned int value);
|
||||
unsigned int checkPc(unsigned int pc){
|
||||
pc -= cycloneCpu.membase;//Get the real program counter
|
||||
|
||||
if(chips[CHIP_A0_ROM].inBootMode || pc >= chips[CHIP_A0_ROM].start && pc < chips[CHIP_A0_ROM].start + chips[CHIP_A0_ROM].lineSize)cycloneCpu.membase = (int)palmRom;
|
||||
else if(pc >= chips[CHIP_DX_RAM].start && pc < chips[CHIP_DX_RAM].start + chips[CHIP_DX_RAM].lineSize)cycloneCpu.membase = (int)palmRam;
|
||||
if(chips[CHIP_A0_ROM].inBootMode || pc >= chips[CHIP_A0_ROM].start && pc < chips[CHIP_A0_ROM].start + chips[CHIP_A0_ROM].lineSize)
|
||||
cycloneCpu.membase = (int)palmRom - (pc & ~chips[CHIP_A0_ROM].mask);
|
||||
else if(pc >= chips[CHIP_DX_RAM].start && pc < chips[CHIP_DX_RAM].start + chips[CHIP_DX_RAM].lineSize)
|
||||
cycloneCpu.membase = (int)palmRam - (pc & ~chips[CHIP_DX_RAM].mask);
|
||||
else{
|
||||
//really shouldnt be executing from anywhere else
|
||||
bool breakpoint = true;
|
||||
}
|
||||
|
||||
//unsigned int membse = cycloneCpu.membase;
|
||||
|
||||
return cycloneCpu.membase + pc;//New program counter
|
||||
}
|
||||
#endif
|
||||
@@ -54,6 +58,8 @@ void flx68000Init(){
|
||||
cycloneCpu.write16 = m68k_write_memory_16;
|
||||
cycloneCpu.write32 = m68k_write_memory_32;
|
||||
cycloneCpu.checkpc = checkPc;
|
||||
cycloneCpu.IrqCallback = interruptAcknowledge;
|
||||
cycloneCpu.ResetCallback = emulatorReset;
|
||||
#else
|
||||
m68k_init();
|
||||
m68k_set_cpu_type(M68K_CPU_TYPE_68000);
|
||||
@@ -146,6 +152,14 @@ void flx68000SetIrq(uint8_t irqLevel){
|
||||
#endif
|
||||
}
|
||||
|
||||
void flx68000RefreshAddressing(){
|
||||
#if defined(EMU_OPTIMIZE_FOR_ARM)
|
||||
cycloneCpu.pc = cycloneCpu.checkpc(cycloneCpu.pc);
|
||||
#else
|
||||
//C implimentation doesnt cache address information
|
||||
#endif
|
||||
}
|
||||
|
||||
bool flx68000IsSupervisor(){
|
||||
#if defined(EMU_OPTIMIZE_FOR_ARM)
|
||||
return CycloneGetSr(&cycloneCpu) & 0x2000;
|
||||
|
||||
@@ -11,6 +11,7 @@ void flx68000LoadState(uint8_t* data);
|
||||
|
||||
void flx68000Execute();//runs the CPU for 1 CLK32 pulse
|
||||
void flx68000SetIrq(uint8_t irqLevel);
|
||||
void flx68000RefreshAddressing();
|
||||
bool flx68000IsSupervisor();
|
||||
void flx68000BusError(uint32_t address, bool isWrite);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -105,8 +105,10 @@ static inline bool probeWrite(uint8_t bank, uint32_t address){
|
||||
unsigned int m68k_read_memory_8(unsigned int address){
|
||||
uint8_t addressType = bankType[START_BANK(address)];
|
||||
|
||||
#if !defined(EMU_NO_SAFETY)
|
||||
if(!probeRead(addressType, address))
|
||||
return 0x00;
|
||||
#endif
|
||||
|
||||
switch(addressType){
|
||||
case CHIP_A0_ROM:
|
||||
@@ -142,8 +144,10 @@ unsigned int m68k_read_memory_8(unsigned int address){
|
||||
unsigned int m68k_read_memory_16(unsigned int address){
|
||||
uint8_t addressType = bankType[START_BANK(address)];
|
||||
|
||||
#if !defined(EMU_NO_SAFETY)
|
||||
if(!probeRead(addressType, address))
|
||||
return 0x0000;
|
||||
#endif
|
||||
|
||||
switch(addressType){
|
||||
case CHIP_A0_ROM:
|
||||
@@ -179,8 +183,10 @@ unsigned int m68k_read_memory_16(unsigned int address){
|
||||
unsigned int m68k_read_memory_32(unsigned int address){
|
||||
uint8_t addressType = bankType[START_BANK(address)];
|
||||
|
||||
#if !defined(EMU_NO_SAFETY)
|
||||
if(!probeRead(addressType, address))
|
||||
return 0x00000000;
|
||||
#endif
|
||||
|
||||
switch(addressType){
|
||||
case CHIP_A0_ROM:
|
||||
@@ -216,8 +222,10 @@ unsigned int m68k_read_memory_32(unsigned int address){
|
||||
void m68k_write_memory_8(unsigned int address, unsigned char value){
|
||||
uint8_t addressType = bankType[START_BANK(address)];
|
||||
|
||||
#if !defined(EMU_NO_SAFETY)
|
||||
if(!probeWrite(addressType, address))
|
||||
return;
|
||||
#endif
|
||||
|
||||
switch(addressType){
|
||||
case CHIP_A0_ROM:
|
||||
@@ -257,8 +265,10 @@ void m68k_write_memory_8(unsigned int address, unsigned char value){
|
||||
void m68k_write_memory_16(unsigned int address, unsigned short value){
|
||||
uint8_t addressType = bankType[START_BANK(address)];
|
||||
|
||||
#if !defined(EMU_NO_SAFETY)
|
||||
if(!probeWrite(addressType, address))
|
||||
return;
|
||||
#endif
|
||||
|
||||
switch(addressType){
|
||||
case CHIP_A0_ROM:
|
||||
@@ -298,8 +308,10 @@ void m68k_write_memory_16(unsigned int address, unsigned short value){
|
||||
void m68k_write_memory_32(unsigned int address, unsigned int value){
|
||||
uint8_t addressType = bankType[START_BANK(address)];
|
||||
|
||||
#if !defined(EMU_NO_SAFETY)
|
||||
if(!probeWrite(addressType, address))
|
||||
return;
|
||||
#endif
|
||||
|
||||
switch(addressType){
|
||||
case CHIP_A0_ROM:
|
||||
@@ -382,4 +394,5 @@ void setSed1376Attached(bool attached){
|
||||
void resetAddressSpace(){
|
||||
MULTITHREAD_LOOP for(uint32_t bank = 0; bank < TOTAL_MEMORY_BANKS; bank++)
|
||||
bankType[bank] = getProperBankType(bank);
|
||||
flx68000RefreshAddressing();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user