mirror of
https://github.com/libretro/Mu.git
synced 2026-07-08 17:57:01 +00:00
Fix addr_cache stuff, now executing
Also tried to fix compiling with dynarec off, dont know it works yet though.
This commit is contained in:
@@ -55,9 +55,11 @@ MakePalmBitmap:
|
||||
Other:
|
||||
Support for Silkyboard 2 silkscreen:https://archive.org/details/tucows_228076_SILKYBOARD_II
|
||||
Qt port dosent support Windows touchscreen input
|
||||
Qt GUI dosent resize properly with 320x320 framebuffer
|
||||
|
||||
|
||||
Fixed:
|
||||
ARM dynarec SIGSEGVs on exit(pushing play in the debugger still lets it continue, dont think this is a bug)
|
||||
(Feature)need to add FEATURE_DURABLE which will ignore CPU errors, increasing stability at the cost of bugginess
|
||||
(RetroArch port)set the alarm LED using retro_set_led_state_t on RetroArch
|
||||
(CPU I/O)SPI1 SPISPC register(this is just a clock divider used to slow transfers to allow the voltages to settle, since the emu has no voltages all transfers are just instant)
|
||||
|
||||
@@ -88,22 +88,33 @@ CONFIG(debug, debug|release){
|
||||
support_palm_os5{
|
||||
DEFINES += EMU_SUPPORT_PALM_OS5 # the Qt build will not be supporting anything too slow to run OS 5
|
||||
|
||||
windows{
|
||||
SOURCES += \
|
||||
../../src/armv5te/os/os-win32.c
|
||||
}
|
||||
!no_dynarec{
|
||||
# Windows is only supported in 32 bit mode right now(this is a limitation of the dynarec)
|
||||
# iOS needs IS_IOS_BUILD set, but the Qt port does not support iOS currently
|
||||
|
||||
macx|linux-g++|android{
|
||||
SOURCES += \
|
||||
../../src/armv5te/os/os-linux.c
|
||||
}
|
||||
cpu_x86_32{
|
||||
SOURCES += \
|
||||
../../src/armv5te/translate_x86.c
|
||||
}
|
||||
|
||||
# Windows is only supported in 32 bit mode right now(this is a limitation of the dynarec)
|
||||
# iOS needs IS_IOS_BUILD set, but the Qt port does not support iOS currently
|
||||
cpu_x86_64{
|
||||
SOURCES += \
|
||||
../../src/armv5te/translate_x86_64.c
|
||||
}
|
||||
|
||||
cpu_armv7{
|
||||
SOURCES += \
|
||||
../../src/armv5te/translate_arm.cpp
|
||||
}
|
||||
|
||||
cpu_armv8{
|
||||
SOURCES += \
|
||||
../../src/armv5te/translate_aarch64.cpp
|
||||
}
|
||||
}
|
||||
|
||||
cpu_x86_32{
|
||||
SOURCES += \
|
||||
../../src/armv5te/translate_x86.c \
|
||||
../../src/armv5te/asmcode_x86.S
|
||||
}
|
||||
else{
|
||||
@@ -114,22 +125,29 @@ support_palm_os5{
|
||||
|
||||
cpu_x86_64{
|
||||
SOURCES += \
|
||||
../../src/armv5te/translate_x86_64.c \
|
||||
../../src/armv5te/asmcode_x86_64.S
|
||||
}
|
||||
|
||||
cpu_armv7{
|
||||
SOURCES += \
|
||||
../../src/armv5te/translate_arm.cpp \
|
||||
../../src/armv5te/asmcode_arm.S
|
||||
}
|
||||
|
||||
cpu_armv8{
|
||||
SOURCES += \
|
||||
../../src/armv5te/translate_aarch64.cpp \
|
||||
../../src/armv5te/asmcode_aarch64.S
|
||||
}
|
||||
|
||||
windows{
|
||||
SOURCES += \
|
||||
../../src/armv5te/os/os-win32.c
|
||||
}
|
||||
|
||||
macx|linux-g++|android{
|
||||
SOURCES += \
|
||||
../../src/armv5te/os/os-linux.c
|
||||
}
|
||||
|
||||
SOURCES += \
|
||||
../../src/pxa255/pxa255_mem.c \
|
||||
../../src/pxa255/pxa255_DMA.c \
|
||||
|
||||
@@ -44,24 +44,6 @@ int64_t DebugViewer::numberFromString(QString str, bool negativeAllowed){
|
||||
return value;
|
||||
}
|
||||
|
||||
QString DebugViewer::stringFromNumber(int64_t number, bool hex, uint32_t forcedZeros){
|
||||
QString numString;
|
||||
|
||||
if(hex){
|
||||
numString += QString::number(number, 16).toUpper();
|
||||
while(numString.length() < (int)forcedZeros)numString.push_front("0");
|
||||
numString.push_front("0x");
|
||||
}
|
||||
else{
|
||||
numString += QString::number(qAbs(number), 10);
|
||||
while(numString.length() < (int)forcedZeros)numString.push_front("0");
|
||||
if(number < 0)
|
||||
numString.push_front("-");
|
||||
}
|
||||
|
||||
return numString;
|
||||
}
|
||||
|
||||
void DebugViewer::debugRadioButtonHandler(){
|
||||
switch(bitsPerEntry){
|
||||
case 8:
|
||||
@@ -96,10 +78,10 @@ void DebugViewer::on_debugGetHexValues_clicked(){
|
||||
for(int64_t count = 0; count < length; count++){
|
||||
uint64_t data = emu.getEmulatorMemory(address, bits);
|
||||
QString value;
|
||||
value += stringFromNumber(address, true, 8);
|
||||
value += QString::asprintf("0x%08X", (uint32_t)address);
|
||||
value += ":";
|
||||
if(data != UINT64_MAX)
|
||||
value += stringFromNumber(data, true, bits / 8 * 2);
|
||||
value += QString::asprintf("0x%0*X", bits / 8 * 2, (uint32_t)data);
|
||||
else
|
||||
value += "Unsafe Access";
|
||||
ui->debugValueList->addItem(value);
|
||||
@@ -143,16 +125,10 @@ void DebugViewer::on_debugDump_clicked(){
|
||||
}
|
||||
|
||||
void DebugViewer::on_debugShowRegisters_clicked(){
|
||||
std::vector<uint32_t> registers = ((MainWindow*)parentWidget())->emu.getCpuRegisters();
|
||||
EmuWrapper& emu = ((MainWindow*)parentWidget())->emu;
|
||||
|
||||
ui->debugValueList->clear();
|
||||
for(uint8_t dRegs = 0; dRegs < 8; dRegs++)
|
||||
ui->debugValueList->addItem("D" + stringFromNumber(dRegs, false, 0) + ":" + stringFromNumber(registers[dRegs], true, 8));
|
||||
for(uint8_t aRegs = 0; aRegs < 8; aRegs++)
|
||||
ui->debugValueList->addItem("A" + stringFromNumber(aRegs, false, 0) + ":" + stringFromNumber(registers[8 + aRegs], true, 8));
|
||||
ui->debugValueList->addItem("SP:" + stringFromNumber(registers[15], true, 8));
|
||||
ui->debugValueList->addItem("PC:" + stringFromNumber(registers[16], true, 8));
|
||||
ui->debugValueList->addItem("SR:" + stringFromNumber(registers[17], true, 4));
|
||||
ui->debugValueList->addItems(emu.getCpuRegisterString().split('\n'));
|
||||
}
|
||||
|
||||
void DebugViewer::on_debugShowDebugLogs_clicked(){
|
||||
|
||||
@@ -18,7 +18,6 @@ public:
|
||||
|
||||
private:
|
||||
int64_t numberFromString(QString str, bool negativeAllowed);
|
||||
QString stringFromNumber(int64_t number, bool hex, uint32_t forcedZeros = 0);
|
||||
|
||||
private slots:
|
||||
void debugRadioButtonHandler();
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
extern "C"{
|
||||
#include "../../src/flx68000.h"
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
#include "../../src/pxa255/pxa255.h"
|
||||
#endif
|
||||
#include "../../src/debug/sandbox.h"
|
||||
}
|
||||
|
||||
@@ -400,12 +403,29 @@ std::vector<uint64_t>& EmuWrapper::getDuplicateCallCount(){
|
||||
return duplicateCallCount;
|
||||
}
|
||||
|
||||
std::vector<uint32_t> EmuWrapper::getCpuRegisters(){
|
||||
std::vector<uint32_t> registers;
|
||||
QString EmuWrapper::getCpuRegisterString(){
|
||||
QString regString = "";
|
||||
|
||||
for(uint8_t reg = 0; reg < 18; reg++)
|
||||
registers.push_back(flx68000GetRegister(reg));
|
||||
return registers;
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
if(palmEmulatingTungstenC){
|
||||
for(uint8_t regs = 0; regs < 16; regs++)
|
||||
regString += QString::asprintf("R%d:0x%08X\n", regs, pxa255GetRegister(regs));
|
||||
regString.resize(regString.size() - 1);//remove extra '\n'
|
||||
}
|
||||
else{
|
||||
#endif
|
||||
for(uint8_t dRegs = 0; dRegs < 8; dRegs++)
|
||||
regString += QString::asprintf("D%d:0x%08X\n", dRegs, flx68000GetRegister(dRegs));
|
||||
for(uint8_t aRegs = 0; aRegs < 8; aRegs++)
|
||||
regString += QString::asprintf("A%d:0x%08X\n", aRegs, flx68000GetRegister(8 + aRegs));
|
||||
regString += QString::asprintf("SP:0x%08X\n", flx68000GetRegister(15));
|
||||
regString += QString::asprintf("PC:0x%08X\n", flx68000GetRegister(16));
|
||||
regString += QString::asprintf("SR:0x%04X", flx68000GetRegister(17));
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
}
|
||||
#endif
|
||||
|
||||
return regString;
|
||||
}
|
||||
|
||||
uint64_t EmuWrapper::getEmulatorMemory(uint32_t address, uint8_t size){
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
|
||||
std::vector<QString>& getDebugStrings();
|
||||
std::vector<uint64_t>& getDuplicateCallCount();
|
||||
std::vector<uint32_t> getCpuRegisters();
|
||||
QString getCpuRegisterString();
|
||||
|
||||
uint16_t screenWidth() const{return palmFramebufferWidth;}
|
||||
uint16_t screenHeight() const{return palmFramebufferHeight;}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "cpu.h"
|
||||
#include "mem.h"
|
||||
@@ -52,7 +53,8 @@ void emuprintf(const char *format, ...);
|
||||
//void warn(const char *fmt, ...);
|
||||
#define warn(...) debugLog(__VA_ARGS__)
|
||||
//__attribute__((noreturn)) void error(const char *fmt, ...);
|
||||
static inline __attribute__((noreturn)) void error(const char *fmt, ...){while(true){};}
|
||||
//static inline __attribute__((noreturn)) void error(const char *fmt, ...){while(true){};}
|
||||
#define error(...) abort()
|
||||
void throttle_timer_on();
|
||||
void throttle_timer_off();
|
||||
void throttle_timer_wait();
|
||||
|
||||
@@ -789,7 +789,7 @@ void sandboxReset(void){
|
||||
sandboxWatchRegionsActive = 0;
|
||||
|
||||
//patch OS here if needed
|
||||
sandboxCommand(SANDBOX_CMD_PATCH_OS, NULL);
|
||||
//sandboxCommand(SANDBOX_CMD_PATCH_OS, NULL);
|
||||
|
||||
//log all register accesses
|
||||
//sandboxCommand(SANDBOX_CMD_REGISTER_WATCH_ENABLE, NULL);
|
||||
@@ -1098,9 +1098,11 @@ void sandboxOnFrameRun(void){
|
||||
//run at the end of every frame
|
||||
sandboxFramesRan++;
|
||||
|
||||
/*
|
||||
if(sandboxFramesRan == SANDBOX_SECONDS_TO_FRAMES(10)){
|
||||
sandboxCommand(SANDBOX_CMD_TEST_MEMORY_ALIGNMENT, NULL);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void sandboxOnOpcodeRun(void){
|
||||
|
||||
@@ -44,10 +44,10 @@
|
||||
|
||||
|
||||
static bool emulatorInitialized = false;
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
static bool emulatorEmulatingTungstenC;
|
||||
#endif
|
||||
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
bool palmEmulatingTungstenC;
|
||||
#endif
|
||||
uint8_t* palmRam;
|
||||
uint8_t* palmRom;
|
||||
uint8_t* palmReg;
|
||||
@@ -111,9 +111,9 @@ uint32_t emulatorInit(buffer_t palmRomDump, buffer_t palmBootDump, uint32_t enab
|
||||
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
//0x00000004 is boot program counter on 68k, its just 0x00000000 on ARM
|
||||
emulatorEmulatingTungstenC = !(palmRomDump.data[0x4] || palmRomDump.data[0x5] || palmRomDump.data[0x6] || palmRomDump.data[0x7]);
|
||||
palmEmulatingTungstenC = !(palmRomDump.data[0x4] || palmRomDump.data[0x5] || palmRomDump.data[0x6] || palmRomDump.data[0x7]);
|
||||
|
||||
if(emulatorEmulatingTungstenC){
|
||||
if(palmEmulatingTungstenC){
|
||||
//emulating Tungsten C
|
||||
bool dynarecInited = false;
|
||||
|
||||
@@ -132,6 +132,7 @@ uint32_t emulatorInit(buffer_t palmRomDump, buffer_t palmBootDump, uint32_t enab
|
||||
if(palmRomDump.size < TUNGSTEN_C_ROM_SIZE)
|
||||
memset(palmRom + palmRomDump.size, 0x00, TUNGSTEN_C_ROM_SIZE - palmRomDump.size);
|
||||
memset(palmRam, 0x00, TUNGSTEN_C_RAM_SIZE);
|
||||
memset(palmFramebuffer, 0x00, 320 * 320 * sizeof(uint16_t));//TODO:PXA255 code doesnt always output a picture like my SED1376 code
|
||||
memset(palmAudio, 0x00, AUDIO_SAMPLES_PER_FRAME * 2/*channels*/ * sizeof(int16_t));
|
||||
memset(&palmInput, 0x00, sizeof(palmInput));
|
||||
memset(&palmMisc, 0x00, sizeof(palmMisc));
|
||||
@@ -144,11 +145,13 @@ uint32_t emulatorInit(buffer_t palmRomDump, buffer_t palmBootDump, uint32_t enab
|
||||
palmEmuFeatures.info = enabledEmuFeatures;
|
||||
|
||||
//initialize components, I dont think theres much in a Tungsten C
|
||||
pxa255Framebuffer = palmFramebuffer;
|
||||
blip_set_rates(palmAudioResampler, AUDIO_CLOCK_RATE, AUDIO_SAMPLE_RATE);
|
||||
sandboxInit();
|
||||
|
||||
//reset everything
|
||||
emulatorSoftReset();
|
||||
pxa255SetRtc(0, 0, 0, 0);
|
||||
}
|
||||
else{
|
||||
#endif
|
||||
@@ -218,7 +221,7 @@ uint32_t emulatorInit(buffer_t palmRomDump, buffer_t palmBootDump, uint32_t enab
|
||||
void emulatorExit(void){
|
||||
if(emulatorInitialized){
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
if(!emulatorEmulatingTungstenC){
|
||||
if(!palmEmulatingTungstenC){
|
||||
#endif
|
||||
free(palmRom);
|
||||
free(palmRam);
|
||||
@@ -230,7 +233,7 @@ void emulatorExit(void){
|
||||
free(palmAudio);
|
||||
blip_delete(palmAudioResampler);
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
if(emulatorEmulatingTungstenC)
|
||||
if(palmEmulatingTungstenC)
|
||||
pxa255Deinit();
|
||||
#endif
|
||||
free(palmSdCard.flashChip.data);
|
||||
@@ -241,10 +244,11 @@ void emulatorExit(void){
|
||||
void emulatorHardReset(void){
|
||||
//equivalent to taking the battery out and putting it back in
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
if(emulatorEmulatingTungstenC){
|
||||
if(palmEmulatingTungstenC){
|
||||
memset(palmRam, 0x00, TUNGSTEN_C_RAM_SIZE);
|
||||
emulatorSoftReset();
|
||||
sdCardReset();
|
||||
pxa255SetRtc(0, 0, 0, 0);
|
||||
}
|
||||
else{
|
||||
#endif
|
||||
@@ -260,7 +264,7 @@ void emulatorHardReset(void){
|
||||
void emulatorSoftReset(void){
|
||||
//equivalent to pushing the reset button on the back of the device
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
if(emulatorEmulatingTungstenC){
|
||||
if(palmEmulatingTungstenC){
|
||||
palmEmuFeatures.value = 0x00000000;
|
||||
palmClockMultiplier = 1.00;
|
||||
pxa255Reset();
|
||||
@@ -284,7 +288,7 @@ void emulatorSoftReset(void){
|
||||
|
||||
void emulatorSetRtc(uint16_t days, uint8_t hours, uint8_t minutes, uint8_t seconds){
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
if(emulatorEmulatingTungstenC)
|
||||
if(palmEmulatingTungstenC)
|
||||
pxa255SetRtc(days, hours, minutes, seconds);
|
||||
else
|
||||
#endif
|
||||
@@ -839,7 +843,7 @@ void emulatorEjectSdCard(void){
|
||||
|
||||
void emulatorRunFrame(void){
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
if(emulatorEmulatingTungstenC)
|
||||
if(palmEmulatingTungstenC)
|
||||
emulatorTungstenCFrame();
|
||||
else
|
||||
emulatorM515Frame();
|
||||
|
||||
@@ -150,6 +150,9 @@ typedef struct{
|
||||
}emu_reg_t;
|
||||
|
||||
//emulator data, some are GUI interface variables, some should be left alone
|
||||
#if defined(EMU_SUPPORT_PALM_OS5)
|
||||
extern bool palmEmulatingTungstenC;//read allowed, but not advised
|
||||
#endif
|
||||
extern uint8_t* palmRom;//dont touch
|
||||
extern uint8_t* palmRam;//access allowed to read save RAM without allocating a giant buffer, but endianness must be taken into account
|
||||
extern uint8_t* palmReg;//dont touch
|
||||
|
||||
@@ -289,10 +289,6 @@ uint32_t flx68000GetRegister(uint8_t reg){
|
||||
return m68k_get_reg(NULL, reg);
|
||||
}
|
||||
|
||||
uint32_t flx68000GetPc(void){
|
||||
return m68k_get_reg(NULL, M68K_REG_PPC);
|
||||
}
|
||||
|
||||
uint64_t flx68000ReadArbitraryMemory(uint32_t address, uint8_t size){
|
||||
uint64_t data = UINT64_MAX;//invalid access
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ bool flx68000IsSupervisor(void);
|
||||
void flx68000BusError(uint32_t address, bool isWrite);
|
||||
|
||||
uint32_t flx68000GetRegister(uint8_t reg);//only for debugging
|
||||
uint32_t flx68000GetPc(void);//only for debugging
|
||||
#define flx68000GetPc() flx68000GetRegister(29/*M68K_REG_PPC*/)//only for debugging
|
||||
uint64_t flx68000ReadArbitraryMemory(uint32_t address, uint8_t size);//only for debugging
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,6 +23,7 @@ uint16_t* pxa255Framebuffer;
|
||||
static Pxa255ic tungstenCIc;
|
||||
static Pxa255lcd tungstenCLcd;
|
||||
|
||||
|
||||
//PXA255 register accessors
|
||||
static uint8_t pxa255_read_byte(uint32_t addr){
|
||||
|
||||
@@ -67,6 +68,8 @@ bool pxa255Init(uint8_t** returnRom, uint8_t** returnRam){
|
||||
if(!mem_and_flags)
|
||||
return false;
|
||||
|
||||
addr_cache_init();
|
||||
|
||||
//ROM
|
||||
mem_areas[0].base = PXA255_ROM_START_ADDRESS;
|
||||
mem_areas[0].size = TUNGSTEN_C_ROM_SIZE;
|
||||
@@ -122,6 +125,8 @@ void pxa255Deinit(void){
|
||||
os_free(mem_and_flags, MEM_MAXSIZE * 2);
|
||||
mem_and_flags = NULL;
|
||||
}
|
||||
|
||||
addr_cache_deinit();
|
||||
}
|
||||
|
||||
void pxa255Reset(void){
|
||||
@@ -218,3 +223,7 @@ void pxa255Execute(void){
|
||||
//render
|
||||
pxa255lcdFrame(&tungstenCLcd);
|
||||
}
|
||||
|
||||
uint32_t pxa255GetRegister(uint8_t reg){
|
||||
return reg_pc(reg);
|
||||
}
|
||||
|
||||
@@ -19,4 +19,6 @@ void pxa255LoadState(uint8_t* data);
|
||||
|
||||
void pxa255Execute(void);//runs the CPU for 1 frame
|
||||
|
||||
uint32_t pxa255GetRegister(uint8_t reg);//only for debugging
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user