fixes and improvements for type issues, part 3

This commit is contained in:
kub 2021-02-05 23:01:25 +01:00
parent 832faed320
commit 4cc0fcaf15
15 changed files with 149 additions and 147 deletions

View file

@ -98,14 +98,62 @@ extern "C" {
/* Data definition */ /* Data definition */
/*******************/ /*******************/
#include <pico/pico_types.h>
/*
#ifdef u8
#undef u8
#endif
#ifdef s8
#undef s8
#endif
#ifdef u16
#undef u16
#endif
#ifdef s16
#undef s16
#endif
#ifdef u32
#undef u32
#endif
#ifdef s32
#undef s32
#endif
#ifdef uptr
#undef uptr
#endif
#define u8 unsigned char
#define s8 signed char
#define u16 unsigned short
#define s16 signed short
#define u32 unsigned int
#define s32 signed int
#define uptr uintptr_t
*/
/*
typedef unsigned char u8;
typedef signed char s8;
typedef unsigned short u16;
typedef signed short s16;
typedef unsigned int u32;
typedef signed int s32;
*/
typedef union typedef union
{ {
unsigned char B; u8 B;
signed char SB; s8 SB;
unsigned short W; u16 W;
signed short SW; s16 SW;
unsigned int D; u32 D;
signed int SD; s32 SD;
} famec_union32; } famec_union32;
/* M68K CPU CONTEXT */ /* M68K CPU CONTEXT */
@ -167,7 +215,7 @@ int fm68k_reset(M68K_CONTEXT *ctx);
int fm68k_emulate(M68K_CONTEXT *ctx, int n, fm68k_call_reason reason); int fm68k_emulate(M68K_CONTEXT *ctx, int n, fm68k_call_reason reason);
int fm68k_would_interrupt(M68K_CONTEXT *ctx); // to be called from fm68k_emulate() int fm68k_would_interrupt(M68K_CONTEXT *ctx); // to be called from fm68k_emulate()
unsigned int fm68k_get_pc(const M68K_CONTEXT *ctx); u32 fm68k_get_pc(const M68K_CONTEXT *ctx);
// PICODRIVE_HACK // PICODRIVE_HACK
int fm68k_idle_install(void); int fm68k_idle_install(void);

View file

@ -60,54 +60,6 @@
#define FAMEC_EXTRA_INLINE INLINE #define FAMEC_EXTRA_INLINE INLINE
#endif #endif
#include <pico/pico_types.h>
/*
#ifdef u8
#undef u8
#endif
#ifdef s8
#undef s8
#endif
#ifdef u16
#undef u16
#endif
#ifdef s16
#undef s16
#endif
#ifdef u32
#undef u32
#endif
#ifdef s32
#undef s32
#endif
#ifdef uptr
#undef uptr
#endif
#define u8 unsigned char
#define s8 signed char
#define u16 unsigned short
#define s16 signed short
#define u32 unsigned int
#define s32 signed int
#define uptr uintptr_t
*/
/*
typedef unsigned char u8;
typedef signed char s8;
typedef unsigned short u16;
typedef signed short s16;
typedef unsigned int u32;
typedef signed int s32;
*/
#ifndef M68K_OK #ifndef M68K_OK
#define M68K_OK 0 #define M68K_OK 0
#endif #endif
@ -807,7 +759,7 @@ static FAMEC_EXTRA_INLINE u32 execute_exception_group_0(M68K_CONTEXT *ctx, s32 v
// main exec function // main exec function
////////////////////// //////////////////////
int fm68k_emulate(M68K_CONTEXT *ctx, s32 cycles, fm68k_call_reason reason) int fm68k_emulate(M68K_CONTEXT *ctx, int cycles, fm68k_call_reason reason)
{ {
#ifndef FAMEC_NO_GOTOS #ifndef FAMEC_NO_GOTOS
u32 Opcode; u32 Opcode;

View file

@ -187,20 +187,20 @@ static char sh2dasm_buff[64];
#define SH2_DUMP(sh2, reason) { \ #define SH2_DUMP(sh2, reason) { \
char ms = (sh2)->is_slave ? 's' : 'm'; \ char ms = (sh2)->is_slave ? 's' : 'm'; \
printf("%csh2 %s %08x\n", ms, reason, (sh2)->pc); \ printf("%csh2 %s %08lx\n", ms, reason, (ulong)(sh2)->pc); \
printf("%csh2 r0-7 %08x %08x %08x %08x %08x %08x %08x %08x\n", ms, \ printf("%csh2 r0-7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", ms, \
(sh2)->r[0], (sh2)->r[1], (sh2)->r[2], (sh2)->r[3], \ (ulong)(sh2)->r[0], (ulong)(sh2)->r[1], (ulong)(sh2)->r[2], (ulong)(sh2)->r[3], \
(sh2)->r[4], (sh2)->r[5], (sh2)->r[6], (sh2)->r[7]); \ (ulong)(sh2)->r[4], (ulong)(sh2)->r[5], (ulong)(sh2)->r[6], (ulong)(sh2)->r[7]); \
printf("%csh2 r8-15 %08x %08x %08x %08x %08x %08x %08x %08x\n", ms, \ printf("%csh2 r8-15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", ms, \
(sh2)->r[8], (sh2)->r[9], (sh2)->r[10], (sh2)->r[11], \ (ulong)(sh2)->r[8], (ulong)(sh2)->r[9], (ulong)(sh2)->r[10], (ulong)(sh2)->r[11], \
(sh2)->r[12], (sh2)->r[13], (sh2)->r[14], (sh2)->r[15]); \ (ulong)(sh2)->r[12], (ulong)(sh2)->r[13], (ulong)(sh2)->r[14], (ulong)(sh2)->r[15]); \
printf("%csh2 pc-ml %08x %08x %08x %08x %08x %08x %08x %08x\n", ms, \ printf("%csh2 pc-ml %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", ms, \
(sh2)->pc, (sh2)->ppc, (sh2)->pr, (sh2)->sr&0xfff, \ (ulong)(sh2)->pc, (ulong)(sh2)->ppc, (ulong)(sh2)->pr, (ulong)(sh2)->sr&0xfff, \
(sh2)->gbr, (sh2)->vbr, (sh2)->mach, (sh2)->macl); \ (ulong)(sh2)->gbr, (ulong)(sh2)->vbr, (ulong)(sh2)->mach, (ulong)(sh2)->macl); \
printf("%csh2 tmp-p %08x %08x %08x %08x %08x %08x %08x %08x\n", ms, \ printf("%csh2 tmp-p %08x %08x %08x %08x %08x %08lx %08x %08x\n", ms, \
(sh2)->drc_tmp, (sh2)->irq_cycles, \ (sh2)->drc_tmp, (sh2)->irq_cycles, \
(sh2)->pdb_io_csum[0], (sh2)->pdb_io_csum[1], (sh2)->state, \ (sh2)->pdb_io_csum[0], (sh2)->pdb_io_csum[1], (sh2)->state, \
(sh2)->poll_addr, (sh2)->poll_cycles, (sh2)->poll_cnt); \ (ulong)(sh2)->poll_addr, (sh2)->poll_cycles, (sh2)->poll_cnt); \
} }
#if (DRC_DEBUG & (8|256|512|1024)) || defined(PDB) #if (DRC_DEBUG & (8|256|512|1024)) || defined(PDB)
@ -255,7 +255,7 @@ static void REGPARM(3) *sh2_drc_log_entry(void *block, SH2 *sh2, u32 sr)
char *ps = (char *)sh2, *pf = (char *)&fsh2; char *ps = (char *)sh2, *pf = (char *)&fsh2;
for (idx = 0; idx < offsetof(SH2, read8_map); idx += sizeof(u32)) for (idx = 0; idx < offsetof(SH2, read8_map); idx += sizeof(u32))
if (*(u32 *)(ps+idx) != *(u32 *)(pf+idx)) if (*(u32 *)(ps+idx) != *(u32 *)(pf+idx))
printf("diff reg %ld\n",idx/sizeof(u32)); printf("diff reg %ld\n",(long)idx/sizeof(u32));
exit(1); exit(1);
} }
csh2[idx][0] = fsh2; csh2[idx][0] = fsh2;
@ -716,8 +716,8 @@ static void add_to_hashlist(struct block_entry *be, int tcache_id)
#if (DRC_DEBUG & 2) #if (DRC_DEBUG & 2)
if (be->next != NULL) { if (be->next != NULL) {
printf(" %08x@%p: entry hash collision with %08x@%p\n", printf(" %08lx@%p: entry hash collision with %08lx@%p\n",
be->pc, be->tcache_ptr, be->next->pc, be->next->tcache_ptr); (ulong)be->pc, be->tcache_ptr, (ulong)be->next->pc, be->next->tcache_ptr);
hash_collisions++; hash_collisions++;
} }
#endif #endif
@ -1378,7 +1378,7 @@ static int rcache_is_u16(int hr)
for (i = 0; i < ARRAY_SIZE(cache_regs); i++) { \ for (i = 0; i < ARRAY_SIZE(cache_regs); i++) { \
cp = &cache_regs[i]; \ cp = &cache_regs[i]; \
if (cp->type != HR_FREE || cp->gregs || cp->locked || cp->flags) \ if (cp->type != HR_FREE || cp->gregs || cp->locked || cp->flags) \
printf(" %d: hr=%d t=%d f=%x c=%d m=%x\n", i, cp->hreg, cp->type, cp->flags, cp->locked, cp->gregs); \ printf(" %d: hr=%d t=%d f=%x c=%d m=%lx\n", i, cp->hreg, cp->type, cp->flags, cp->locked, (ulong)cp->gregs); \
} \ } \
printf(" guest_regs:\n"); \ printf(" guest_regs:\n"); \
for (i = 0; i < ARRAY_SIZE(guest_regs); i++) { \ for (i = 0; i < ARRAY_SIZE(guest_regs); i++) { \
@ -1389,7 +1389,7 @@ static int rcache_is_u16(int hr)
printf(" gconsts:\n"); \ printf(" gconsts:\n"); \
for (i = 0; i < ARRAY_SIZE(gconsts); i++) { \ for (i = 0; i < ARRAY_SIZE(gconsts); i++) { \
if (gconsts[i].gregs) \ if (gconsts[i].gregs) \
printf(" %d: m=%x v=%x\n", i, gconsts[i].gregs, gconsts[i].val); \ printf(" %d: m=%lx v=%lx\n", i, (ulong)gconsts[i].gregs, (ulong)gconsts[i].val); \
} \ } \
} }
@ -3587,7 +3587,7 @@ static void REGPARM(2) *sh2_translate(SH2 *sh2, int tcache_id)
else tmp3 = '*'; else tmp3 = '*';
} else if (drcf.loop_type) tmp3 = '.'; } else if (drcf.loop_type) tmp3 = '.';
else tmp3 = ' '; else tmp3 = ' ';
printf("%c%08x %04x %s\n", tmp3, pc, op, sh2dasm_buff); printf("%c%08lx %04x %s\n", tmp3, (ulong)pc, op, sh2dasm_buff);
#endif #endif
pc += 2; pc += 2;
@ -5641,7 +5641,7 @@ static void block_stats(void)
} }
if (maxb == NULL) if (maxb == NULL)
break; break;
printf("%08x %p %9d %2.3f%%\n", maxb->addr, maxb->tcache_ptr, maxb->refcount, printf("%08lx %p %9d %2.3f%%\n", (ulong)maxb->addr, maxb->tcache_ptr, maxb->refcount,
(double)maxb->refcount / total * 100.0); (double)maxb->refcount / total * 100.0);
maxb->refcount = 0; maxb->refcount = 0;
} }
@ -5682,7 +5682,7 @@ void entry_stats(void)
} }
if (maxb == NULL) if (maxb == NULL)
break; break;
printf("%08x %p %9d %2.3f%%\n", maxb->pc, maxb->tcache_ptr, maxb->entry_count, printf("%08lx %p %9d %2.3f%%\n", (ulong)maxb->pc, maxb->tcache_ptr, maxb->entry_count,
(double)100 * maxb->entry_count / total); (double)100 * maxb->entry_count / total);
maxb->entry_count = 0; maxb->entry_count = 0;
} }
@ -5714,25 +5714,25 @@ static void state_dump(void)
int i; int i;
SH2_DUMP(&sh2s[0], "master"); SH2_DUMP(&sh2s[0], "master");
printf("VBR msh2: %x\n", sh2s[0].vbr); printf("VBR msh2: %lx\n", (ulong)sh2s[0].vbr);
for (i = 0; i < 0x60; i++) { for (i = 0; i < 0x60; i++) {
printf("%08x ",p32x_sh2_read32(sh2s[0].vbr + i*4, &sh2s[0])); printf("%08lx ",(ulong)p32x_sh2_read32(sh2s[0].vbr + i*4, &sh2s[0]));
if ((i+1) % 8 == 0) printf("\n"); if ((i+1) % 8 == 0) printf("\n");
} }
printf("stack msh2: %x\n", sh2s[0].r[15]); printf("stack msh2: %lx\n", (ulong)sh2s[0].r[15]);
for (i = -0x30; i < 0x30; i++) { for (i = -0x30; i < 0x30; i++) {
printf("%08x ",p32x_sh2_read32(sh2s[0].r[15] + i*4, &sh2s[0])); printf("%08lx ",(ulong)p32x_sh2_read32(sh2s[0].r[15] + i*4, &sh2s[0]));
if ((i+1) % 8 == 0) printf("\n"); if ((i+1) % 8 == 0) printf("\n");
} }
SH2_DUMP(&sh2s[1], "slave"); SH2_DUMP(&sh2s[1], "slave");
printf("VBR ssh2: %x\n", sh2s[1].vbr); printf("VBR ssh2: %lx\n", (ulong)sh2s[1].vbr);
for (i = 0; i < 0x60; i++) { for (i = 0; i < 0x60; i++) {
printf("%08x ",p32x_sh2_read32(sh2s[1].vbr + i*4, &sh2s[1])); printf("%08lx ",(ulong)p32x_sh2_read32(sh2s[1].vbr + i*4, &sh2s[1]));
if ((i+1) % 8 == 0) printf("\n"); if ((i+1) % 8 == 0) printf("\n");
} }
printf("stack ssh2: %x\n", sh2s[1].r[15]); printf("stack ssh2: %lx\n", (ulong)sh2s[1].r[15]);
for (i = -0x30; i < 0x30; i++) { for (i = -0x30; i < 0x30; i++) {
printf("%08x ",p32x_sh2_read32(sh2s[1].r[15] + i*4, &sh2s[1])); printf("%08lx ",(ulong)p32x_sh2_read32(sh2s[1].r[15] + i*4, &sh2s[1]));
if ((i+1) % 8 == 0) printf("\n"); if ((i+1) % 8 == 0) printf("\n");
} }
#endif #endif
@ -5748,11 +5748,11 @@ static void bcache_stats(void)
printf("return cache hits:%d misses:%d depth: %d index: %d/%d\n", rchit, rcmiss, i,sh2s[0].rts_cache_idx,sh2s[1].rts_cache_idx); printf("return cache hits:%d misses:%d depth: %d index: %d/%d\n", rchit, rcmiss, i,sh2s[0].rts_cache_idx,sh2s[1].rts_cache_idx);
for (i = 0; i < ARRAY_SIZE(sh2s[0].rts_cache); i++) { for (i = 0; i < ARRAY_SIZE(sh2s[0].rts_cache); i++) {
printf("%08x ",sh2s[0].rts_cache[i].pc); printf("%08lx ",(ulong)sh2s[0].rts_cache[i].pc);
if ((i+1) % 8 == 0) printf("\n"); if ((i+1) % 8 == 0) printf("\n");
} }
for (i = 0; i < ARRAY_SIZE(sh2s[1].rts_cache); i++) { for (i = 0; i < ARRAY_SIZE(sh2s[1].rts_cache); i++) {
printf("%08x ",sh2s[1].rts_cache[i].pc); printf("%08lx ",(ulong)sh2s[1].rts_cache[i].pc);
if ((i+1) % 8 == 0) printf("\n"); if ((i+1) % 8 == 0) printf("\n");
} }
#endif #endif
@ -5760,12 +5760,12 @@ static void bcache_stats(void)
printf("branch cache hits:%d misses:%d\n", bchit, bcmiss); printf("branch cache hits:%d misses:%d\n", bchit, bcmiss);
printf("branch cache master:\n"); printf("branch cache master:\n");
for (i = 0; i < ARRAY_SIZE(sh2s[0].branch_cache); i++) { for (i = 0; i < ARRAY_SIZE(sh2s[0].branch_cache); i++) {
printf("%08x ",sh2s[0].branch_cache[i].pc); printf("%08lx ",(ulong)sh2s[0].branch_cache[i].pc);
if ((i+1) % 8 == 0) printf("\n"); if ((i+1) % 8 == 0) printf("\n");
} }
printf("branch cache slave:\n"); printf("branch cache slave:\n");
for (i = 0; i < ARRAY_SIZE(sh2s[1].branch_cache); i++) { for (i = 0; i < ARRAY_SIZE(sh2s[1].branch_cache); i++) {
printf("%08x ",sh2s[1].branch_cache[i].pc); printf("%08lx ",(ulong)sh2s[1].branch_cache[i].pc);
if ((i+1) % 8 == 0) printf("\n"); if ((i+1) % 8 == 0) printf("\n");
} }
#endif #endif

View file

@ -92,7 +92,7 @@ static void PicoSVPLine(void)
} }
static int PicoSVPDma(u32 source, int len, unsigned short **base, unsigned int *mask) static int PicoSVPDma(u32 source, int len, unsigned short **base, u32 *mask)
{ {
if (source < Pico.romsize) // Rom if (source < Pico.romsize) // Rom
{ {

View file

@ -1165,12 +1165,12 @@ PICO_INTERNAL void PicoMemSetupCD(void)
#endif #endif
#ifdef EMU_F68K #ifdef EMU_F68K
// s68k // s68k
PicoCpuFS68k.read_byte = s68k_read8; PicoCpuFS68k.read_byte = (void *)s68k_read8;
PicoCpuFS68k.read_word = s68k_read16; PicoCpuFS68k.read_word = (void *)s68k_read16;
PicoCpuFS68k.read_long = s68k_read32; PicoCpuFS68k.read_long = (void *)s68k_read32;
PicoCpuFS68k.write_byte = s68k_write8; PicoCpuFS68k.write_byte = (void *)s68k_write8;
PicoCpuFS68k.write_word = s68k_write16; PicoCpuFS68k.write_word = (void *)s68k_write16;
PicoCpuFS68k.write_long = s68k_write32; PicoCpuFS68k.write_long = (void *)s68k_write32;
// setup FAME fetchmap // setup FAME fetchmap
{ {

View file

@ -50,9 +50,9 @@ char *PDebugMain(void)
r = (reg[5]<<9)+(reg[6]<<11); r = (reg[5]<<9)+(reg[6]<<11);
sprintf(dstrp, "sprite #0: %04x %04x %04x %04x\n",PicoMem.vram[r/2],PicoMem.vram[r/2+1],PicoMem.vram[r/2+2],PicoMem.vram[r/2+3]); MVP; sprintf(dstrp, "sprite #0: %04x %04x %04x %04x\n",PicoMem.vram[r/2],PicoMem.vram[r/2+1],PicoMem.vram[r/2+2],PicoMem.vram[r/2+3]); MVP;
sprintf(dstrp, "pal: %i, hw: %02x, frame#: %i, cycles: %u\n", Pico.m.pal, Pico.m.hardware, Pico.m.frame_count, SekCyclesDone()); MVP; sprintf(dstrp, "pal: %i, hw: %02x, frame#: %i, cycles: %u\n", Pico.m.pal, Pico.m.hardware, Pico.m.frame_count, SekCyclesDone()); MVP;
sprintf(dstrp, "M68k: PC: %06x, SR: %04x, irql: %i\n", SekPc, SekSr, SekIrqLevel); MVP; sprintf(dstrp, "M68k: PC: %06lx, SR: %04x, irql: %i\n", (ulong)SekPc, SekSr, SekIrqLevel); MVP;
for (r = 0; r < 8; r++) { for (r = 0; r < 8; r++) {
sprintf(dstrp, "d%i=%08x, a%i=%08x\n", r, SekDar(r), r, SekDar(r+8)); MVP; sprintf(dstrp, "d%i=%08lx, a%i=%08lx\n", r, (ulong)SekDar(r), r, (ulong)SekDar(r+8)); MVP;
} }
sprintf(dstrp, "z80Run: %i, z80_reset: %i, z80_bnk: %06x\n", Pico.m.z80Run, Pico.m.z80_reset, Pico.m.z80_bank68k<<15); MVP; sprintf(dstrp, "z80Run: %i, z80_reset: %i, z80_bnk: %06x\n", Pico.m.z80Run, Pico.m.z80_reset, Pico.m.z80_bank68k<<15); MVP;
z80_debug(dstrp); MVP; z80_debug(dstrp); MVP;
@ -86,12 +86,12 @@ char *PDebug32x(void)
i*2, r[i+0], r[i+1], r[i+2], r[i+3], r[i+4], r[i+5], r[i+6], r[i+7]); MVP; i*2, r[i+0], r[i+1], r[i+2], r[i+3], r[i+4], r[i+5], r[i+6], r[i+7]); MVP;
sprintf(dstrp, " mSH2 sSH2\n"); MVP; sprintf(dstrp, " mSH2 sSH2\n"); MVP;
sprintf(dstrp, "PC,SR %08x, %03x %08x, %03x\n", sh2_pc(&msh2), sh2_sr(0), sh2_pc(&ssh2), sh2_sr(1)); MVP; sprintf(dstrp, "PC,SR %08lx, %03x %08lx, %03x\n", (ulong)sh2_pc(&msh2), (uint)sh2_sr(0), (ulong)sh2_pc(&ssh2), (uint)sh2_sr(1)); MVP;
for (i = 0; i < 16/2; i++) { for (i = 0; i < 16/2; i++) {
sprintf(dstrp, "R%d,%2d %08x,%08x %08x,%08x\n", i, i + 8, sprintf(dstrp, "R%d,%2d %08lx,%08lx %08lx,%08lx\n", i, i + 8,
sh2_reg(0,i), sh2_reg(0,i+8), sh2_reg(1,i), sh2_reg(1,i+8)); MVP; (ulong)sh2_reg(0,i), (ulong)sh2_reg(0,i+8), (ulong)sh2_reg(1,i), (ulong)sh2_reg(1,i+8)); MVP;
} }
sprintf(dstrp, "gb,vb %08x,%08x %08x,%08x\n", sh2_gbr(0), sh2_vbr(0), sh2_gbr(1), sh2_vbr(1)); MVP; sprintf(dstrp, "gb,vb %08lx,%08lx %08lx,%08lx\n", (ulong)sh2_gbr(0), (ulong)sh2_vbr(0), (ulong)sh2_gbr(1), (ulong)sh2_vbr(1)); MVP;
sprintf(dstrp, "IRQs/mask: %02x/%02x %02x/%02x\n", sprintf(dstrp, "IRQs/mask: %02x/%02x %02x/%02x\n",
Pico32x.sh2irqi[0], Pico32x.sh2irq_mask[0], Pico32x.sh2irqi[1], Pico32x.sh2irq_mask[1]); MVP; Pico32x.sh2irqi[0], Pico32x.sh2irq_mask[0], Pico32x.sh2irqi[1], Pico32x.sh2irq_mask[1]); MVP;
#else #else

View file

@ -299,8 +299,8 @@ static void DrawStrip(struct TileStrip *ts, int lflags, int cellskip)
unsigned char *pd = Pico.est.HighCol; unsigned char *pd = Pico.est.HighCol;
u32 *hc = ts->hc; u32 *hc = ts->hc;
int tilex, dx, ty, cells; int tilex, dx, ty, cells;
int oldcode = -1, blank = -1; // The tile we know is blank u32 pack = 0, oldcode = -1, blank = -1; // The tile we know is blank
unsigned int pal = 0, pack = 0, sh; unsigned int pal = 0, sh;
// Draw tiles across screen: // Draw tiles across screen:
sh = (lflags & LF_SH) << 6; // shadow sh = (lflags & LF_SH) << 6; // shadow
@ -338,9 +338,9 @@ static void DrawStrip(struct TileStrip *ts, int lflags, int cellskip)
} }
if (code & 0x8000) { // (un-forced) high priority tile if (code & 0x8000) { // (un-forced) high priority tile
int cval = code | (dx<<16) | (ty<<25); code |= (dx<<16) | (ty<<25);
if (code & 0x1000) cval ^= 0xe<<25; if (code & 0x1000) code ^= 0xe<<25;
*hc++ = cval, *hc++ = pack; // cache it *hc++ = code, *hc++ = pack; // cache it
} else if (code != blank) { } else if (code != blank) {
if (code & 0x0800) TileFlip(pd + dx, pack, pal); if (code & 0x0800) TileFlip(pd + dx, pack, pal);
else TileNorm(pd + dx, pack, pal); else TileNorm(pd + dx, pack, pal);
@ -360,7 +360,7 @@ static void DrawStripVSRam(struct TileStrip *ts, int plane_sh, int cellskip)
unsigned char *pd = Pico.est.HighCol; unsigned char *pd = Pico.est.HighCol;
u32 *hc = ts->hc; u32 *hc = ts->hc;
int tilex, dx, ty = 0, addr = 0, cell = 0, nametabadd = 0; int tilex, dx, ty = 0, addr = 0, cell = 0, nametabadd = 0;
int oldcode = -1, blank = -1; // The tile we know is blank u32 oldcode = -1, blank = -1; // The tile we know is blank
unsigned int pal = 0, scan = Pico.est.DrawScanline, sh, plane; unsigned int pal = 0, scan = Pico.est.DrawScanline, sh, plane;
// Draw tiles across screen: // Draw tiles across screen:
@ -406,7 +406,7 @@ static void DrawStripVSRam(struct TileStrip *ts, int plane_sh, int cellskip)
code= PicoMem.vram[ts->nametab + nametabadd + (tilex & ts->xmask)]; code= PicoMem.vram[ts->nametab + nametabadd + (tilex & ts->xmask)];
// code &= ~force; // forced always draw everything // code &= ~force; // forced always draw everything
code |= ty<<16; // add ty since that can change pixel row for every 2nd tile code |= ty<<25; // add ty since that can change pixel row for every 2nd tile
if (code == blank && !((code & 0x8000) && sh)) if (code == blank && !((code & 0x8000) && sh))
continue; continue;
@ -425,9 +425,9 @@ static void DrawStripVSRam(struct TileStrip *ts, int plane_sh, int cellskip)
blank = code; blank = code;
if (code & 0x8000) { // (un-forced) high priority tile if (code & 0x8000) { // (un-forced) high priority tile
int cval = (u16)code | (dx<<16) | (ty<<25); code |= (dx<<16);
if (code & 0x1000) cval ^= 0xe<<25; if (code & 0x1000) code ^= 0xe<<25;
*hc++ = cval, *hc++ = pack; // cache it *hc++ = code, *hc++ = pack; // cache it
} else if (code != blank) { } else if (code != blank) {
if (code & 0x0800) TileFlip(pd + dx, pack, pal); if (code & 0x0800) TileFlip(pd + dx, pack, pal);
else TileNorm(pd + dx, pack, pal); else TileNorm(pd + dx, pack, pal);
@ -449,7 +449,7 @@ void DrawStripInterlace(struct TileStrip *ts, int plane_sh)
unsigned char *pd = Pico.est.HighCol; unsigned char *pd = Pico.est.HighCol;
u32 *hc = ts->hc; u32 *hc = ts->hc;
int tilex = 0, dx = 0, ty = 0, cells; int tilex = 0, dx = 0, ty = 0, cells;
int oldcode = -1, blank = -1; // The tile we know is blank u32 oldcode = -1, blank = -1; // The tile we know is blank
unsigned int pal = 0, pack = 0, sh; unsigned int pal = 0, pack = 0, sh;
// Draw tiles across screen: // Draw tiles across screen:
@ -488,9 +488,9 @@ void DrawStripInterlace(struct TileStrip *ts, int plane_sh)
if (code & 0x8000) { // high priority tile if (code & 0x8000) { // high priority tile
if ((plane_sh&LF_SH) | (code!=blank)) { if ((plane_sh&LF_SH) | (code!=blank)) {
int cval = (code&0xfc00) | ((code&0x3ff)<<1) | (dx<<16) | (ty<<25); code = (code&0xfc00) | ((code&0x3ff)<<1) | (dx<<16) | (ty<<25);
if (code & 0x1000) cval ^= 0x1e<<25; if (code & 0x1000) code ^= 0x1e<<25;
*hc++ = cval, *hc++ = pack; // cache it *hc++ = code, *hc++ = pack; // cache it
} }
continue; continue;
} else if (code != blank) { } else if (code != blank) {
@ -704,8 +704,8 @@ static void DrawTilesFromCacheShPrep(void)
static void DrawTilesFromCache(u32 *hc, int sh, int rlim, struct PicoEState *est) static void DrawTilesFromCache(u32 *hc, int sh, int rlim, struct PicoEState *est)
{ {
unsigned char *pd = Pico.est.HighCol; unsigned char *pd = Pico.est.HighCol;
int code, dx; u32 code, dx;
unsigned int pack; u32 pack;
int pal; int pal;
// *ts->hc++ = code | (dx<<16) | (ty<<25); // cache it // *ts->hc++ = code | (dx<<16) | (ty<<25); // cache it
@ -857,7 +857,7 @@ static void DrawSprite(u32 *sprite, int sh, int w)
} }
#endif #endif
static void DrawSpriteInterlace(unsigned int *sprite) static void DrawSpriteInterlace(u32 *sprite)
{ {
unsigned char *pd = Pico.est.HighCol; unsigned char *pd = Pico.est.HighCol;
int width=0,height=0; int width=0,height=0;
@ -908,7 +908,7 @@ static NOINLINE void DrawAllSpritesInterlace(int pri, int sh)
{ {
struct PicoVideo *pvid=&Pico.video; struct PicoVideo *pvid=&Pico.video;
int i,u,table,link=0,sline=Pico.est.DrawScanline<<1; int i,u,table,link=0,sline=Pico.est.DrawScanline<<1;
unsigned int *sprites[80]; // Sprite index u32 *sprites[80]; // Sprite index
int max_sprites = Pico.video.reg[12]&1 ? 80 : 64; int max_sprites = Pico.video.reg[12]&1 ? 80 : 64;
table=pvid->reg[5]&0x7f; table=pvid->reg[5]&0x7f;
@ -917,7 +917,7 @@ static NOINLINE void DrawAllSpritesInterlace(int pri, int sh)
for (i = u = 0; u < max_sprites && link < max_sprites; u++) for (i = u = 0; u < max_sprites && link < max_sprites; u++)
{ {
unsigned int *sprite; u32 *sprite;
int code, sx, sy, height; int code, sx, sy, height;
sprite=(u32 *)(PicoMem.vram+((table+(link<<2))&0x7ffc)); // Find sprite sprite=(u32 *)(PicoMem.vram+((table+(link<<2))&0x7ffc)); // Find sprite
@ -1105,8 +1105,8 @@ static void DrawSpritesHiAS(unsigned char *sprited, int sh)
static void DrawStripForced(struct TileStrip *ts, int cellskip) static void DrawStripForced(struct TileStrip *ts, int cellskip)
{ {
unsigned char *pd = Pico.est.HighCol; unsigned char *pd = Pico.est.HighCol;
int tilex, dx, ty, code=0, addr=0, cells; int tilex, dx, ty, addr=0, cells;
int oldcode = -1; u32 code = 0, oldcode = -1;
int pal = 0; int pal = 0;
// Draw tiles across screen: // Draw tiles across screen:
@ -1119,7 +1119,7 @@ static void DrawStripForced(struct TileStrip *ts, int cellskip)
for (; cells > 0; dx+=8, tilex++, cells--) for (; cells > 0; dx+=8, tilex++, cells--)
{ {
unsigned int pack; u32 pack;
code = PicoMem.vram[ts->nametab + (tilex & ts->xmask)]; code = PicoMem.vram[ts->nametab + (tilex & ts->xmask)];
@ -1142,8 +1142,8 @@ static void DrawStripForced(struct TileStrip *ts, int cellskip)
static void DrawStripVSRamForced(struct TileStrip *ts, int plane_sh, int cellskip) static void DrawStripVSRamForced(struct TileStrip *ts, int plane_sh, int cellskip)
{ {
unsigned char *pd = Pico.est.HighCol; unsigned char *pd = Pico.est.HighCol;
int tilex, dx, ty=0, code=0, addr=0, cell=0, nametabadd=0; int tilex, dx, ty=0, addr=0, cell=0, nametabadd=0;
int oldcode=-1; u32 code=0, oldcode=-1;
int pal=0, scan=Pico.est.DrawScanline, plane; int pal=0, scan=Pico.est.DrawScanline, plane;
// Draw tiles across screen: // Draw tiles across screen:
@ -1421,7 +1421,7 @@ static NOINLINE void PrepareSprites(int max_lines)
for (u = 0; u < max_sprites && link < max_sprites; u++) for (u = 0; u < max_sprites && link < max_sprites; u++)
{ {
unsigned int *sprite; u32 *sprite;
int code, code2, sx, sy, hv, height, width; int code, code2, sx, sy, hv, height, width;
sprite=(u32 *)(PicoMem.vram+((table+(link<<2))&0x7ffc)); // Find sprite sprite=(u32 *)(PicoMem.vram+((table+(link<<2))&0x7ffc)); // Find sprite

View file

@ -407,7 +407,7 @@ static void DrawTilesFromCacheF(u32 *hc, struct PicoEState *est)
// sx and sy are coords of virtual screen with 8pix borders on top and on left // sx and sy are coords of virtual screen with 8pix borders on top and on left
static void DrawSpriteFull(unsigned int *sprite, struct PicoEState *est) static void DrawSpriteFull(u32 *sprite, struct PicoEState *est)
{ {
int width=0,height=0; int width=0,height=0;
// unsigned short *pal=NULL; // unsigned short *pal=NULL;
@ -487,7 +487,7 @@ static void DrawAllSpritesFull(int prio, int maxwidth, struct PicoEState *est)
struct PicoVideo *pvid=&est->Pico->video; struct PicoVideo *pvid=&est->Pico->video;
int table=0,maskrange=0; int table=0,maskrange=0;
int i,u,link=0; int i,u,link=0;
unsigned int *sprites[80]; // Sprites u32 *sprites[80]; // Sprites
int y_min=START_ROW*8, y_max=END_ROW*8; // for a simple sprite masking int y_min=START_ROW*8, y_max=END_ROW*8; // for a simple sprite masking
int max_sprites = pvid->reg[12]&1 ? 80 : 64; int max_sprites = pvid->reg[12]&1 ? 80 : 64;
@ -500,7 +500,7 @@ static void DrawAllSpritesFull(int prio, int maxwidth, struct PicoEState *est)
for (i = u = 0; u < max_sprites && link < max_sprites; u++) for (i = u = 0; u < max_sprites && link < max_sprites; u++)
{ {
unsigned int *sprite=NULL; u32 *sprite=NULL;
int code, code2, sx, sy, height; int code, code2, sx, sy, height;
sprite=(u32 *)(est->PicoMem_vram+((table+(link<<2))&0x7ffc)); // Find sprite sprite=(u32 *)(est->PicoMem_vram+((table+(link<<2))&0x7ffc)); // Find sprite

View file

@ -832,12 +832,12 @@ PICO_INTERNAL void PicoMemSetup(void)
PicoCpuCM68k.fetch32 = NULL; PicoCpuCM68k.fetch32 = NULL;
#endif #endif
#ifdef EMU_F68K #ifdef EMU_F68K
PicoCpuFM68k.read_byte = m68k_read8; PicoCpuFM68k.read_byte = (void *)m68k_read8;
PicoCpuFM68k.read_word = m68k_read16; PicoCpuFM68k.read_word = (void *)m68k_read16;
PicoCpuFM68k.read_long = m68k_read32; PicoCpuFM68k.read_long = (void *)m68k_read32;
PicoCpuFM68k.write_byte = m68k_write8; PicoCpuFM68k.write_byte = (void *)m68k_write8;
PicoCpuFM68k.write_word = m68k_write16; PicoCpuFM68k.write_word = (void *)m68k_write16;
PicoCpuFM68k.write_long = m68k_write32; PicoCpuFM68k.write_long = (void *)m68k_write32;
// setup FAME fetchmap // setup FAME fetchmap
{ {

View file

@ -243,10 +243,10 @@ extern SH2 sh2s[2];
#define sh2_cycles_done_m68k(sh2) \ #define sh2_cycles_done_m68k(sh2) \
(unsigned)((sh2)->m68krcycles_done + C_SH2_TO_M68K(sh2, sh2_cycles_done(sh2))) (unsigned)((sh2)->m68krcycles_done + C_SH2_TO_M68K(sh2, sh2_cycles_done(sh2)))
#define sh2_reg(c, x) (c) ? ssh2.r[x] : msh2.r[x] #define sh2_reg(c, x) ((c) ? ssh2.r[x] : msh2.r[x])
#define sh2_gbr(c) (c) ? ssh2.gbr : msh2.gbr #define sh2_gbr(c) ((c) ? ssh2.gbr : msh2.gbr)
#define sh2_vbr(c) (c) ? ssh2.vbr : msh2.vbr #define sh2_vbr(c) ((c) ? ssh2.vbr : msh2.vbr)
#define sh2_sr(c) (((c) ? ssh2.sr : msh2.sr) & 0xfff) #define sh2_sr(c) (((c) ? ssh2.sr : msh2.sr) & 0xfff)
#define sh2_set_gbr(c, v) \ #define sh2_set_gbr(c, v) \
{ if (c) ssh2.gbr = v; else msh2.gbr = v; } { if (c) ssh2.gbr = v; else msh2.gbr = v; }
@ -871,7 +871,7 @@ unsigned char PicoVideoRead8CtlH(int is_from_z80);
unsigned char PicoVideoRead8CtlL(int is_from_z80); unsigned char PicoVideoRead8CtlL(int is_from_z80);
unsigned char PicoVideoRead8HV_H(int is_from_z80); unsigned char PicoVideoRead8HV_H(int is_from_z80);
unsigned char PicoVideoRead8HV_L(int is_from_z80); unsigned char PicoVideoRead8HV_L(int is_from_z80);
extern int (*PicoDmaHook)(u32 source, int len, unsigned short **base, unsigned int *mask); extern int (*PicoDmaHook)(u32 source, int len, unsigned short **base, u32 *mask);
void PicoVideoFIFOSync(int cycles); void PicoVideoFIFOSync(int cycles);
int PicoVideoFIFOHint(void); int PicoVideoFIFOHint(void);
void PicoVideoFIFOMode(int active, int h40); void PicoVideoFIFOMode(int active, int h40);

View file

@ -16,4 +16,6 @@ typedef int32_t s32;
typedef uintptr_t uptr; /* unsigned pointer-sized int */ typedef uintptr_t uptr; /* unsigned pointer-sized int */
typedef unsigned int uint; /* printf casts */
typedef unsigned long ulong;
#endif #endif

View file

@ -22,7 +22,7 @@ static int blankline; // display disabled for this line
u32 SATaddr, SATmask; // VRAM addr of sprite attribute table u32 SATaddr, SATmask; // VRAM addr of sprite attribute table
int (*PicoDmaHook)(u32 source, int len, unsigned short **base, unsigned int *mask) = NULL; int (*PicoDmaHook)(u32 source, int len, unsigned short **base, u32 *mask) = NULL;
/* VDP FIFO implementation /* VDP FIFO implementation
@ -709,7 +709,7 @@ static void DrawSync(int skip)
} }
} }
PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d) PICO_INTERNAL_ASM void PicoVideoWrite(u32 a,unsigned short d)
{ {
struct PicoVideo *pvid=&Pico.video; struct PicoVideo *pvid=&Pico.video;

View file

@ -401,7 +401,7 @@ static int parse_bind_val(const char *val, int *type)
static void keys_parse_all(FILE *f) static void keys_parse_all(FILE *f)
{ {
char line[256], *var, *val; char line[640], *var, *val;
int dev_id = -1; int dev_id = -1;
int acts, type; int acts, type;
int ret; int ret;

View file

@ -333,7 +333,7 @@ int dismips(uintptr_t pc, uint32_t insn, char *buf, size_t buflen, unsigned long
*sym = 0; *sym = 0;
if (pi == NULL) { if (pi == NULL) {
snprintf(buf, buflen, "0x%x", insn); snprintf(buf, buflen, "0x%08lx", (unsigned long)insn);
return 0; return 0;
} }
@ -348,7 +348,7 @@ int dismips(uintptr_t pc, uint32_t insn, char *buf, size_t buflen, unsigned long
break; break;
case REG_ST: case REG_ST:
if ((insn & 0x38) == 0x30 /*T..*/) if ((insn & 0x38) == 0x30 /*T..*/)
snprintf(buf, buflen, "%s %s, %s (code %d)", pi->name, rs, rt, (insn>>6) & 0x3ff); snprintf(buf, buflen, "%s %s, %s (code %d)", pi->name, rs, rt, (int)(insn>>6) & 0x3ff);
else else
snprintf(buf, buflen, "%s %s, %s", pi->name, rs, rt); snprintf(buf, buflen, "%s %s, %s", pi->name, rs, rt);
break; break;
@ -420,7 +420,7 @@ int dismips(uintptr_t pc, uint32_t insn, char *buf, size_t buflen, unsigned long
snprintf(buf, buflen, "%s %s, %d", pi->name, rs, imm); snprintf(buf, buflen, "%s %s, %d", pi->name, rs, imm);
break; break;
case SB_CODE: case SB_CODE:
snprintf(buf, buflen, "%s %d", pi->name, (insn>>6) & 0xfffff); snprintf(buf, buflen, "%s %ld", pi->name, (unsigned long)(insn>>6) & 0xfffff);
break; break;
} }
return 1; return 1;

View file

@ -249,7 +249,7 @@ void plat_init(void)
if (ret != 0) if (ret != 0)
exit(1); exit(1);
SDL_ShowCursor(0); SDL_ShowCursor(0);
#if defined(__RG350__) || defined(__GCW0__) #if defined(__RG350__) || defined(__GCW0__) || defined(__OPENDINGUX__)
// opendingux on JZ47x0 may falsely report a HW overlay, fix to window // opendingux on JZ47x0 may falsely report a HW overlay, fix to window
plat_target.vout_method = 0; plat_target.vout_method = 0;
#endif #endif