mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-06 07:38:05 -04:00
fixes and improvements for type issues, part 3
This commit is contained in:
parent
832faed320
commit
4cc0fcaf15
15 changed files with 149 additions and 147 deletions
|
@ -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
|
||||
{
|
||||
|
|
|
@ -1165,12 +1165,12 @@ PICO_INTERNAL void PicoMemSetupCD(void)
|
|||
#endif
|
||||
#ifdef EMU_F68K
|
||||
// s68k
|
||||
PicoCpuFS68k.read_byte = s68k_read8;
|
||||
PicoCpuFS68k.read_word = s68k_read16;
|
||||
PicoCpuFS68k.read_long = s68k_read32;
|
||||
PicoCpuFS68k.write_byte = s68k_write8;
|
||||
PicoCpuFS68k.write_word = s68k_write16;
|
||||
PicoCpuFS68k.write_long = s68k_write32;
|
||||
PicoCpuFS68k.read_byte = (void *)s68k_read8;
|
||||
PicoCpuFS68k.read_word = (void *)s68k_read16;
|
||||
PicoCpuFS68k.read_long = (void *)s68k_read32;
|
||||
PicoCpuFS68k.write_byte = (void *)s68k_write8;
|
||||
PicoCpuFS68k.write_word = (void *)s68k_write16;
|
||||
PicoCpuFS68k.write_long = (void *)s68k_write32;
|
||||
|
||||
// setup FAME fetchmap
|
||||
{
|
||||
|
|
12
pico/debug.c
12
pico/debug.c
|
@ -50,9 +50,9 @@ char *PDebugMain(void)
|
|||
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, "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++) {
|
||||
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;
|
||||
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;
|
||||
|
||||
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++) {
|
||||
sprintf(dstrp, "R%d,%2d %08x,%08x %08x,%08x\n", i, i + 8,
|
||||
sh2_reg(0,i), sh2_reg(0,i+8), sh2_reg(1,i), sh2_reg(1,i+8)); MVP;
|
||||
sprintf(dstrp, "R%d,%2d %08lx,%08lx %08lx,%08lx\n", i, i + 8,
|
||||
(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",
|
||||
Pico32x.sh2irqi[0], Pico32x.sh2irq_mask[0], Pico32x.sh2irqi[1], Pico32x.sh2irq_mask[1]); MVP;
|
||||
#else
|
||||
|
|
50
pico/draw.c
50
pico/draw.c
|
@ -299,8 +299,8 @@ static void DrawStrip(struct TileStrip *ts, int lflags, int cellskip)
|
|||
unsigned char *pd = Pico.est.HighCol;
|
||||
u32 *hc = ts->hc;
|
||||
int tilex, dx, ty, cells;
|
||||
int oldcode = -1, blank = -1; // The tile we know is blank
|
||||
unsigned int pal = 0, pack = 0, sh;
|
||||
u32 pack = 0, oldcode = -1, blank = -1; // The tile we know is blank
|
||||
unsigned int pal = 0, sh;
|
||||
|
||||
// Draw tiles across screen:
|
||||
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
|
||||
int cval = code | (dx<<16) | (ty<<25);
|
||||
if (code & 0x1000) cval ^= 0xe<<25;
|
||||
*hc++ = cval, *hc++ = pack; // cache it
|
||||
code |= (dx<<16) | (ty<<25);
|
||||
if (code & 0x1000) code ^= 0xe<<25;
|
||||
*hc++ = code, *hc++ = pack; // cache it
|
||||
} else if (code != blank) {
|
||||
if (code & 0x0800) TileFlip(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;
|
||||
u32 *hc = ts->hc;
|
||||
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;
|
||||
|
||||
// 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 &= ~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))
|
||||
continue;
|
||||
|
@ -425,9 +425,9 @@ static void DrawStripVSRam(struct TileStrip *ts, int plane_sh, int cellskip)
|
|||
blank = code;
|
||||
|
||||
if (code & 0x8000) { // (un-forced) high priority tile
|
||||
int cval = (u16)code | (dx<<16) | (ty<<25);
|
||||
if (code & 0x1000) cval ^= 0xe<<25;
|
||||
*hc++ = cval, *hc++ = pack; // cache it
|
||||
code |= (dx<<16);
|
||||
if (code & 0x1000) code ^= 0xe<<25;
|
||||
*hc++ = code, *hc++ = pack; // cache it
|
||||
} else if (code != blank) {
|
||||
if (code & 0x0800) TileFlip(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;
|
||||
u32 *hc = ts->hc;
|
||||
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;
|
||||
|
||||
// Draw tiles across screen:
|
||||
|
@ -488,9 +488,9 @@ void DrawStripInterlace(struct TileStrip *ts, int plane_sh)
|
|||
|
||||
if (code & 0x8000) { // high priority tile
|
||||
if ((plane_sh&LF_SH) | (code!=blank)) {
|
||||
int cval = (code&0xfc00) | ((code&0x3ff)<<1) | (dx<<16) | (ty<<25);
|
||||
if (code & 0x1000) cval ^= 0x1e<<25;
|
||||
*hc++ = cval, *hc++ = pack; // cache it
|
||||
code = (code&0xfc00) | ((code&0x3ff)<<1) | (dx<<16) | (ty<<25);
|
||||
if (code & 0x1000) code ^= 0x1e<<25;
|
||||
*hc++ = code, *hc++ = pack; // cache it
|
||||
}
|
||||
continue;
|
||||
} else if (code != blank) {
|
||||
|
@ -704,8 +704,8 @@ static void DrawTilesFromCacheShPrep(void)
|
|||
static void DrawTilesFromCache(u32 *hc, int sh, int rlim, struct PicoEState *est)
|
||||
{
|
||||
unsigned char *pd = Pico.est.HighCol;
|
||||
int code, dx;
|
||||
unsigned int pack;
|
||||
u32 code, dx;
|
||||
u32 pack;
|
||||
int pal;
|
||||
|
||||
// *ts->hc++ = code | (dx<<16) | (ty<<25); // cache it
|
||||
|
@ -857,7 +857,7 @@ static void DrawSprite(u32 *sprite, int sh, int w)
|
|||
}
|
||||
#endif
|
||||
|
||||
static void DrawSpriteInterlace(unsigned int *sprite)
|
||||
static void DrawSpriteInterlace(u32 *sprite)
|
||||
{
|
||||
unsigned char *pd = Pico.est.HighCol;
|
||||
int width=0,height=0;
|
||||
|
@ -908,7 +908,7 @@ static NOINLINE void DrawAllSpritesInterlace(int pri, int sh)
|
|||
{
|
||||
struct PicoVideo *pvid=&Pico.video;
|
||||
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;
|
||||
|
||||
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++)
|
||||
{
|
||||
unsigned int *sprite;
|
||||
u32 *sprite;
|
||||
int code, sx, sy, height;
|
||||
|
||||
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)
|
||||
{
|
||||
unsigned char *pd = Pico.est.HighCol;
|
||||
int tilex, dx, ty, code=0, addr=0, cells;
|
||||
int oldcode = -1;
|
||||
int tilex, dx, ty, addr=0, cells;
|
||||
u32 code = 0, oldcode = -1;
|
||||
int pal = 0;
|
||||
|
||||
// Draw tiles across screen:
|
||||
|
@ -1119,7 +1119,7 @@ static void DrawStripForced(struct TileStrip *ts, int cellskip)
|
|||
|
||||
for (; cells > 0; dx+=8, tilex++, cells--)
|
||||
{
|
||||
unsigned int pack;
|
||||
u32 pack;
|
||||
|
||||
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)
|
||||
{
|
||||
unsigned char *pd = Pico.est.HighCol;
|
||||
int tilex, dx, ty=0, code=0, addr=0, cell=0, nametabadd=0;
|
||||
int oldcode=-1;
|
||||
int tilex, dx, ty=0, addr=0, cell=0, nametabadd=0;
|
||||
u32 code=0, oldcode=-1;
|
||||
int pal=0, scan=Pico.est.DrawScanline, plane;
|
||||
|
||||
// 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++)
|
||||
{
|
||||
unsigned int *sprite;
|
||||
u32 *sprite;
|
||||
int code, code2, sx, sy, hv, height, width;
|
||||
|
||||
sprite=(u32 *)(PicoMem.vram+((table+(link<<2))&0x7ffc)); // Find sprite
|
||||
|
|
|
@ -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
|
||||
static void DrawSpriteFull(unsigned int *sprite, struct PicoEState *est)
|
||||
static void DrawSpriteFull(u32 *sprite, struct PicoEState *est)
|
||||
{
|
||||
int width=0,height=0;
|
||||
// unsigned short *pal=NULL;
|
||||
|
@ -487,7 +487,7 @@ static void DrawAllSpritesFull(int prio, int maxwidth, struct PicoEState *est)
|
|||
struct PicoVideo *pvid=&est->Pico->video;
|
||||
int table=0,maskrange=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 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++)
|
||||
{
|
||||
unsigned int *sprite=NULL;
|
||||
u32 *sprite=NULL;
|
||||
int code, code2, sx, sy, height;
|
||||
|
||||
sprite=(u32 *)(est->PicoMem_vram+((table+(link<<2))&0x7ffc)); // Find sprite
|
||||
|
|
|
@ -832,12 +832,12 @@ PICO_INTERNAL void PicoMemSetup(void)
|
|||
PicoCpuCM68k.fetch32 = NULL;
|
||||
#endif
|
||||
#ifdef EMU_F68K
|
||||
PicoCpuFM68k.read_byte = m68k_read8;
|
||||
PicoCpuFM68k.read_word = m68k_read16;
|
||||
PicoCpuFM68k.read_long = m68k_read32;
|
||||
PicoCpuFM68k.write_byte = m68k_write8;
|
||||
PicoCpuFM68k.write_word = m68k_write16;
|
||||
PicoCpuFM68k.write_long = m68k_write32;
|
||||
PicoCpuFM68k.read_byte = (void *)m68k_read8;
|
||||
PicoCpuFM68k.read_word = (void *)m68k_read16;
|
||||
PicoCpuFM68k.read_long = (void *)m68k_read32;
|
||||
PicoCpuFM68k.write_byte = (void *)m68k_write8;
|
||||
PicoCpuFM68k.write_word = (void *)m68k_write16;
|
||||
PicoCpuFM68k.write_long = (void *)m68k_write32;
|
||||
|
||||
// setup FAME fetchmap
|
||||
{
|
||||
|
|
|
@ -243,10 +243,10 @@ extern SH2 sh2s[2];
|
|||
#define sh2_cycles_done_m68k(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_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) & 0xfff)
|
||||
#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) & 0xfff)
|
||||
|
||||
#define sh2_set_gbr(c, 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 PicoVideoRead8HV_H(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);
|
||||
int PicoVideoFIFOHint(void);
|
||||
void PicoVideoFIFOMode(int active, int h40);
|
||||
|
|
|
@ -16,4 +16,6 @@ typedef int32_t s32;
|
|||
|
||||
typedef uintptr_t uptr; /* unsigned pointer-sized int */
|
||||
|
||||
typedef unsigned int uint; /* printf casts */
|
||||
typedef unsigned long ulong;
|
||||
#endif
|
||||
|
|
|
@ -22,7 +22,7 @@ static int blankline; // display disabled for this line
|
|||
|
||||
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
|
||||
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue