Alpha2
Heroic Autobot
there's always a margin for error but getting close as humanly possible is still a great achveiment. I hope the new version gets a quick and thurough testing!
notaz posted on Aug 26 2005 at 12:33 AM said:This is probably because the Stop opcode was unfinished (it was not stopping the CPU). It is now fixed, I also missed the fact that Cyclone didn't compile with armasm (Microsoft assembler), so I released another version which fixes that.Reesy posted on Aug 25 2005 at 08:57 AM said:Thunderforce 4 now has problems
I don't think this is 100% core though, it still has some timing and flag problems, but it's moving that direction.
The new version can be found at the same location. Please report any problems if you mess with it.
Nice, but because of this change Cyclone started crashing under Symbian platform. It appears that CycloneIrqCallback pointer, which you defined in the middle of code, cannot be changed under Symbian, because it marks program code section as read-only. To fix that, I moved that pointer to CPU context, this will also allow different handlers for different CPUs (if more than 1 CPU is emulated).Reesy posted on Aug 26 2005 at 08:42 PM said:I've also added irq call back functionality, I've noticed that you just clear the Irq flag but this can interupt problems in emulators. So its best to call back the emulator and let it decide to clear the interupts or not.
notaz posted on Aug 27 2005 at 12:27 AM said:Nice, but because of this change Cyclone started crashing under Symbian platform. It appears that CycloneIrqCallback pointer, which you defined in the middle of code, cannot be changed under Symbian, because it marks program code section as read-only. To fix that, I moved that pointer to CPU context, this will also allow different handlers for different CPUs (if more than 1 CPU is emulated).Reesy posted on Aug 26 2005 at 08:42 PM said:I've also added irq call back functionality, I've noticed that you just clear the Irq flag but this can interupt problems in emulators. So its best to call back the emulator and let it decide to clear the interupts or not.
Also, you were strangely passing SR high as the first parameter for that handler, instead of IRQ level. You probably missed the orr statement above..
So I modified your changes and posted to my site.
struct Cyclone
{
unsigned int d[8]; // [r7,#0x00]
unsigned int a[8]; // [r7,#0x20]
unsigned int pc; // [r7,#0x40] Memory Base+PC
unsigned char srh; // [r7,#0x44] Status Register high (T_S__III)
unsigned char xc; // [r7,#0x45] Extend flag (____??X?)
unsigned char flags; // [r7,#0x46] Flags (ARM order: ____NZCV) [68k order is XNZVC]
unsigned char irq; // [r7,#0x47] IRQ level
unsigned int osp; // [r7,#0x48] Other Stack Pointer (USP/SSP)
unsigned int vector; // [r7,#0x4c] IRQ vector (temporary)
int pad[2];
int stopped; // [r7,#0x58] 1 == processor is in stopped state
int cycles; // [r7,#0x5c]
int membase; // [r7,#0x60] Memory Base (ARM address minus 68000 address)
unsigned int (*checkpc)(unsigned int pc); // [r7,#0x64] - Called to recalc Memory Base+pc
unsigned char (*read8 )(unsigned int a); // [r7,#0x68]
unsigned short (*read16 )(unsigned int a); // [r7,#0x6c]
unsigned int (*read32 )(unsigned int a); // [r7,#0x70]
void (*write8 )(unsigned int a,unsigned char d); // [r7,#0x74]
void (*write16)(unsigned int a,unsigned short d); // [r7,#0x78]
void (*write32)(unsigned int a,unsigned int d); // [r7,#0x7c]
unsigned char (*fetch8 )(unsigned int a); // [r7,#0x80]
unsigned short (*fetch16)(unsigned int a); // [r7,#0x84]
unsigned int (*fetch32)(unsigned int a); // [r7,#0x88]
int (*IrqCallback)(int int_level); // [r7,#0x8c] - optional irq callback function
};
struct Cyclone
{
unsigned int d[8]; // [r7,#0x00]
unsigned int a[8]; // [r7,#0x20]
unsigned int pc; // [r7,#0x40] Memory Base+PC
unsigned char srh; // [r7,#0x44] Status Register high (T_S__III)
unsigned char xc; // [r7,#0x45] Extend flag (____??X?)
unsigned char flags; // [r7,#0x46] Flags (ARM order: ____NZCV) [68k order is XNZVC]
unsigned char irq; // [r7,#0x47] IRQ level
unsigned int osp; // [r7,#0x48] Other Stack Pointer (USP/SSP)
unsigned int vector; // [r7,#0x4c] IRQ vector (temporary)
int pad1;
int (*IrqCallback)(int int_level); // [r7,#0x54] - optional irq callback function
int stopped; // [r7,#0x58] 1 == processor is in stopped state
int cycles; // [r7,#0x5c]
int membase; // [r7,#0x60] Memory Base (ARM address minus 68000 address)
unsigned int (*checkpc)(unsigned int pc); // [r7,#0x64] - Called to recalc Memory Base+pc
unsigned char (*read8 )(unsigned int a); // [r7,#0x68]
unsigned short (*read16 )(unsigned int a); // [r7,#0x6c]
unsigned int (*read32 )(unsigned int a); // [r7,#0x70]
void (*write8 )(unsigned int a,unsigned char d); // [r7,#0x74]
void (*write16)(unsigned int a,unsigned short d); // [r7,#0x78]
void (*write32)(unsigned int a,unsigned int d); // [r7,#0x7c]
unsigned char (*fetch8 )(unsigned int a); // [r7,#0x80]
unsigned short (*fetch16)(unsigned int a); // [r7,#0x84]
unsigned int (*fetch32)(unsigned int a); // [r7,#0x88]
};