add ideas-style debug console printing commands
This commit is contained in:
parent
a57fd04002
commit
5a0f4d989a
|
@ -7726,8 +7726,16 @@ TEMPLATE static u32 FASTCALL OP_MRC()
|
|||
//--------------SWI-------------------------------
|
||||
TEMPLATE static u32 FASTCALL OP_SWI()
|
||||
{
|
||||
u32 swinum = (cpu->instruction>>16)&0xFF;
|
||||
|
||||
//ideas-style debug prints
|
||||
if(swinum==0xFC) {
|
||||
IdeasLog(cpu);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(cpu->swi_tab) {
|
||||
u32 swinum = (cpu->instruction>>16)&0x1F;
|
||||
swinum &= 0x1F;
|
||||
return cpu->swi_tab[swinum]() + 3;
|
||||
} else {
|
||||
/* TODO (#1#): translocated SWI vectors */
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include "MMU.h"
|
||||
#include "armcpu.h"
|
||||
|
||||
std::vector<Logger *> Logger::channels;
|
||||
|
||||
|
@ -99,3 +101,17 @@ void Logger::log(unsigned int channel, const char * file, unsigned int line, voi
|
|||
|
||||
channels[channel]->setCallback(callback);
|
||||
}
|
||||
|
||||
void IdeasLog(armcpu_t* cpu)
|
||||
{
|
||||
u32 adr = cpu->R[0];
|
||||
printf("EMULOG%c: ",cpu->proc_ID==0?'9':'7');
|
||||
for(;;) {
|
||||
u8 c = MMU_read8(cpu->proc_ID,adr);
|
||||
adr++;
|
||||
if(!c) break;
|
||||
printf("%c",c);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <iostream>
|
||||
#include <cstdarg>
|
||||
|
||||
struct armcpu_t;
|
||||
|
||||
class Logger {
|
||||
protected:
|
||||
void (*callback)(const Logger& logger, const char * format);
|
||||
|
@ -112,4 +114,6 @@ public:
|
|||
#define INFOC(channel, ...) Logger::log(channel, __FILE__, __LINE__, __VA_ARGS__)
|
||||
#define INFO(...) INFOC(10, __VA_ARGS__)
|
||||
|
||||
void IdeasLog(armcpu_t* cpu);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -893,11 +893,20 @@ TEMPLATE static u32 FASTCALL OP_B_COND()
|
|||
|
||||
TEMPLATE static u32 FASTCALL OP_SWI_THUMB()
|
||||
{
|
||||
u32 swinum = cpu->instruction & 0xFF;
|
||||
|
||||
//ideas-style debug prints
|
||||
if(swinum==0xFC) {
|
||||
IdeasLog(cpu);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(cpu->swi_tab) {
|
||||
//zero 25-dec-2008 - in arm, we were masking to 0x1F.
|
||||
//this is probably safer since an invalid opcode could crash the emu
|
||||
//zero 30-jun-2009 - but they say that the ideas 0xFF should crash the device...
|
||||
//u32 swinum = cpu->instruction & 0xFF;
|
||||
u32 swinum = cpu->instruction & 0x1F;
|
||||
swinum &= 0x1F;
|
||||
return cpu->swi_tab[swinum]() + 3;
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue