mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-06 15:48:05 -04:00
32x: new SH2 memory handling, hopefully faster
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@817 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
6add7875b5
commit
bcf65fd674
7 changed files with 377 additions and 221 deletions
|
@ -8,12 +8,12 @@ typedef unsigned int UINT32;
|
|||
typedef unsigned short UINT16;
|
||||
typedef unsigned char UINT8;
|
||||
|
||||
#define RB(a) p32x_sh2_read8(a,sh2->is_slave)
|
||||
#define RW(a) p32x_sh2_read16(a,sh2->is_slave)
|
||||
#define RL(a) p32x_sh2_read32(a,sh2->is_slave)
|
||||
#define WB(a,d) p32x_sh2_write8(a,d,sh2->is_slave)
|
||||
#define WW(a,d) p32x_sh2_write16(a,d,sh2->is_slave)
|
||||
#define WL(a,d) p32x_sh2_write32(a,d,sh2->is_slave)
|
||||
#define RB(a) p32x_sh2_read8(a,sh2)
|
||||
#define RW(a) p32x_sh2_read16(a,sh2)
|
||||
#define RL(a) p32x_sh2_read32(a,sh2)
|
||||
#define WB(a,d) p32x_sh2_write8(a,d,sh2)
|
||||
#define WW(a,d) p32x_sh2_write16(a,d,sh2)
|
||||
#define WL(a,d) p32x_sh2_write32(a,d,sh2)
|
||||
|
||||
// some stuff from sh2comn.h
|
||||
#define T 0x00000001
|
||||
|
|
|
@ -25,8 +25,8 @@ void sh2_finish(SH2 *sh2)
|
|||
|
||||
void sh2_reset(SH2 *sh2)
|
||||
{
|
||||
sh2->pc = p32x_sh2_read32(0, sh2->is_slave);
|
||||
sh2->r[15] = p32x_sh2_read32(4, sh2->is_slave);
|
||||
sh2->pc = p32x_sh2_read32(0, sh2);
|
||||
sh2->r[15] = p32x_sh2_read32(4, sh2);
|
||||
sh2->sr = I;
|
||||
sh2->vbr = 0;
|
||||
sh2->pending_int_irq = 0;
|
||||
|
@ -37,15 +37,15 @@ void sh2_do_irq(SH2 *sh2, int level, int vector)
|
|||
sh2->irq_callback(sh2->is_slave, level);
|
||||
|
||||
sh2->r[15] -= 4;
|
||||
p32x_sh2_write32(sh2->r[15], sh2->sr, sh2->is_slave); /* push SR onto stack */
|
||||
p32x_sh2_write32(sh2->r[15], sh2->sr, sh2); /* push SR onto stack */
|
||||
sh2->r[15] -= 4;
|
||||
p32x_sh2_write32(sh2->r[15], sh2->pc, sh2->is_slave); /* push PC onto stack */
|
||||
p32x_sh2_write32(sh2->r[15], sh2->pc, sh2); /* push PC onto stack */
|
||||
|
||||
/* set I flags in SR */
|
||||
sh2->sr = (sh2->sr & ~I) | (level << 4);
|
||||
|
||||
/* fetch PC */
|
||||
sh2->pc = p32x_sh2_read32(sh2->vbr + vector * 4, sh2->is_slave);
|
||||
sh2->pc = p32x_sh2_read32(sh2->vbr + vector * 4, sh2);
|
||||
|
||||
/* 13 cycles at best */
|
||||
sh2->cycles_done += 13;
|
||||
|
|
|
@ -1,16 +1,6 @@
|
|||
#ifndef __SH2_H__
|
||||
#define __SH2_H__
|
||||
|
||||
// pico memhandlers
|
||||
// XXX: move somewhere else
|
||||
unsigned int p32x_sh2_read8(unsigned int a, int id);
|
||||
unsigned int p32x_sh2_read16(unsigned int a, int id);
|
||||
unsigned int p32x_sh2_read32(unsigned int a, int id);
|
||||
void p32x_sh2_write8(unsigned int a, unsigned int d, int id);
|
||||
void p32x_sh2_write16(unsigned int a, unsigned int d, int id);
|
||||
void p32x_sh2_write32(unsigned int a, unsigned int d, int id);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int r[16]; // 00
|
||||
|
@ -27,10 +17,15 @@ typedef struct
|
|||
unsigned int delay;
|
||||
unsigned int test_irq;
|
||||
|
||||
// drc stuff
|
||||
void **pc_hashtab; // 70
|
||||
|
||||
// common
|
||||
void *read8_map; // 70
|
||||
void *read16_map;
|
||||
void *write8_map;
|
||||
void *write16_map;
|
||||
|
||||
// drc stuff
|
||||
void **pc_hashtab; // 80
|
||||
|
||||
int pending_level; // MAX(pending_irl, pending_int_irq)
|
||||
int pending_irl;
|
||||
int pending_int_irq; // internal irq
|
||||
|
@ -53,4 +48,13 @@ void sh2_do_irq(SH2 *sh2, int level, int vector);
|
|||
|
||||
void sh2_execute(SH2 *sh2, int cycles);
|
||||
|
||||
// pico memhandlers
|
||||
// XXX: move somewhere else
|
||||
unsigned int p32x_sh2_read8(unsigned int a, SH2 *sh2);
|
||||
unsigned int p32x_sh2_read16(unsigned int a, SH2 *sh2);
|
||||
unsigned int p32x_sh2_read32(unsigned int a, SH2 *sh2);
|
||||
void p32x_sh2_write8(unsigned int a, unsigned int d, SH2 *sh2);
|
||||
void p32x_sh2_write16(unsigned int a, unsigned int d, SH2 *sh2);
|
||||
void p32x_sh2_write32(unsigned int a, unsigned int d, SH2 *sh2);
|
||||
|
||||
#endif /* __SH2_H__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue