X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fpico_int.h;h=838af54bc61f1841de47f0d57b5361b966eac2d4;hb=553c3eaa3a4bda6ba99d925ecab518fe82530cd6;hp=0617397cd555e5d51c8d853ef28aaf5b91e25684;hpb=41397701210c08b9d25ca66cbe372c7ed86d6927;p=picodrive.git diff --git a/pico/pico_int.h b/pico/pico_int.h index 0617397..838af54 100644 --- a/pico/pico_int.h +++ b/pico/pico_int.h @@ -243,14 +243,23 @@ extern SH2 sh2s[2]; #define msh2 sh2s[0] #define ssh2 sh2s[1] -#define ash2_end_run(after) if (sh2->icount > (after)) sh2->icount = after -#define ash2_cycles_done() (sh2->cycles_aim - sh2->icount) +#ifndef DRC_SH2 +# define ash2_end_run(after) if (sh2->icount > (after)) sh2->icount = after +# define ash2_cycles_done() (sh2->cycles_aim - sh2->icount) +#else +# define ash2_end_run(after) { \ + if ((sh2->sr >> 12) > (after)) \ + { sh2->sr &= 0xfff; sh2->sr |= (after) << 12; } \ +} +# define ash2_cycles_done() (sh2->cycles_aim - (sh2->sr >> 12)) +#endif -#define sh2_pc(c) (c) ? ssh2.ppc : msh2.ppc +//#define sh2_pc(c) (c) ? ssh2.ppc : msh2.ppc +#define sh2_pc(c) (c) ? ssh2.pc : msh2.pc #define sh2_reg(c, x) (c) ? ssh2.r[x] : msh2.r[x] #define sh2_gbr(c) (c) ? ssh2.gbr : msh2.gbr #define sh2_vbr(c) (c) ? ssh2.vbr : msh2.vbr -#define sh2_sr(c) (c) ? ssh2.sr : msh2.sr +#define sh2_sr(c) (((c) ? ssh2.sr : msh2.sr) & 0xfff) #define sh2_set_gbr(c, v) \ { if (c) ssh2.gbr = v; else msh2.gbr = v; } @@ -463,6 +472,9 @@ typedef struct #define DMAC_FIFO_LEN (4*4) #define PWM_BUFF_LEN 1024 // in one channel samples +#define SH2_DRCBLK_RAM_SHIFT 1 +#define SH2_DRCBLK_DA_SHIFT 1 + struct Pico32x { unsigned short regs[0x20]; @@ -482,9 +494,15 @@ struct Pico32x struct Pico32xMem { unsigned char sdram[0x40000]; +#ifdef DRC_SH2 + unsigned short drcblk_ram[1 << (18 - SH2_DRCBLK_RAM_SHIFT)]; +#endif unsigned short dram[2][0x20000/2]; // AKA fb unsigned char m68k_rom[0x10000]; // 0x100; using M68K_BANK_SIZE unsigned char data_array[2][0x1000]; // cache in SH2s (can be used as RAM) +#ifdef DRC_SH2 + unsigned short drcblk_da[2][1 << (12 - SH2_DRCBLK_DA_SHIFT)]; +#endif unsigned char sh2_rom_m[0x800]; unsigned char sh2_rom_s[0x400]; unsigned short pal[0x100]; @@ -718,6 +736,10 @@ static __inline int isspace_(int c) return (0x09 <= c && c <= 0x0d) || c == ' '; } +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) +#endif + // emulation event logging #ifndef EL_LOGMASK #define EL_LOGMASK 0 @@ -767,10 +789,10 @@ extern void lprintf(const char *fmt, ...); #define cdprintf(x...) #endif -#if defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 -#define MEMH_FUNC __attribute__((aligned(4))) +#ifdef __i386__ +#define REGPARM(x) __attribute__((regparm(x))) #else -#define MEMH_FUNC +#define REGPARM(x) #endif #ifdef __GNUC__