Allowed 32-bit pixel sizes for 34020 core.

Fixed 34020-only RPIX instruction.
Fixed btoads0102u5gre and btoads0103u1gre.
This commit is contained in:
Aaron Giles 2008-01-04 17:39:33 +00:00
parent 5c6ecd64b7
commit a814dc9ec5
3 changed files with 135 additions and 88 deletions

View File

@ -2357,11 +2357,11 @@ static void rmo_b(void) { RMO(B); }
UINT32 v = R##REG(DSTREG); \
switch (state.pixelshift) \
{ \
case 1: \
case 0: \
v = (v & 1) ? 0xffffffff : 0x00000000;\
COUNT_CYCLES(8); \
break; \
case 2: \
case 1: \
v &= 3; \
v |= v << 2; \
v |= v << 4; \
@ -2369,25 +2369,25 @@ static void rmo_b(void) { RMO(B); }
v |= v << 16; \
COUNT_CYCLES(7); \
break; \
case 4: \
case 2: \
v &= 0x0f; \
v |= v << 4; \
v |= v << 8; \
v |= v << 16; \
COUNT_CYCLES(6); \
break; \
case 8: \
case 3: \
v &= 0xff; \
v |= v << 8; \
v |= v << 16; \
COUNT_CYCLES(5); \
break; \
case 16: \
case 4: \
v &= 0xffff; \
v |= v << 16; \
COUNT_CYCLES(4); \
break; \
case 32: \
case 5: \
COUNT_CYCLES(2); \
break; \
} \

View File

@ -26,6 +26,8 @@
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
/***************************************************************************
CORE STATE
***************************************************************************/
@ -47,9 +49,9 @@ typedef struct tms34010_regs
UINT16 op;
UINT32 pc;
UINT32 st;
void (*pixel_write)(offs_t offset,UINT32 data);
void (*pixel_write)(offs_t offset, UINT32 data);
UINT32 (*pixel_read)(offs_t offset);
INT32 (*raster_op)(INT32 newpix, INT32 oldpix);
UINT32 (*raster_op)(UINT32 newpix, UINT32 oldpix);
UINT32 convsp;
UINT32 convdp;
UINT32 convmp;
@ -107,7 +109,7 @@ static void tms34010_state_postload(void);
FUNCTION TABLES
***************************************************************************/
extern void (*tms34010_wfield_functions[32])(offs_t offset,UINT32 data);
extern void (*tms34010_wfield_functions[32])(offs_t offset, UINT32 data);
extern UINT32 (*tms34010_rfield_functions[64])(offs_t offset);
@ -268,7 +270,7 @@ INLINE UINT32 RBYTE(offs_t offset)
}
/* write memory byte */
INLINE void WBYTE(offs_t offset,UINT32 data)
INLINE void WBYTE(offs_t offset, UINT32 data)
{
WFIELDMAC_8;
}
@ -280,7 +282,7 @@ INLINE UINT32 RLONG(offs_t offset)
}
/* write memory long */
INLINE void WLONG(offs_t offset,UINT32 data)
INLINE void WLONG(offs_t offset, UINT32 data)
{
WFIELDMAC_32;
}
@ -318,6 +320,11 @@ static UINT32 read_pixel_16(offs_t offset)
/* TODO: Plane masking */
return TMS34010_RDMEM_WORD(TOBYTE(offset & 0xfffffff0));
}
static UINT32 read_pixel_32(offs_t offset)
{
/* TODO: Plane masking */
return TMS34010_RDMEM_DWORD(TOBYTE(offset & 0xffffffe0));
}
/* Shift register read */
static UINT32 read_pixel_shiftreg(offs_t offset)
@ -388,46 +395,63 @@ static UINT32 read_pixel_shiftreg(offs_t offset)
/* No Raster Op + No Transparency */
static void write_pixel_1(offs_t offset,UINT32 data) { WP(0x0f, 0x01); }
static void write_pixel_2(offs_t offset,UINT32 data) { WP(0x0e, 0x03); }
static void write_pixel_4(offs_t offset,UINT32 data) { WP(0x0c, 0x0f); }
static void write_pixel_8(offs_t offset,UINT32 data) { WP(0x08, 0xff); }
static void write_pixel_16(offs_t offset,UINT32 data)
static void write_pixel_1(offs_t offset, UINT32 data) { WP(0x0f, 0x01); }
static void write_pixel_2(offs_t offset, UINT32 data) { WP(0x0e, 0x03); }
static void write_pixel_4(offs_t offset, UINT32 data) { WP(0x0c, 0x0f); }
static void write_pixel_8(offs_t offset, UINT32 data) { WP(0x08, 0xff); }
static void write_pixel_16(offs_t offset, UINT32 data)
{
/* TODO: plane masking */
TMS34010_WRMEM_WORD(TOBYTE(offset & 0xfffffff0), data);
}
static void write_pixel_32(offs_t offset, UINT32 data)
{
/* TODO: plane masking */
TMS34010_WRMEM_WORD(TOBYTE(offset & 0xffffffe0), data);
}
/* No Raster Op + Transparency */
static void write_pixel_t_1(offs_t offset,UINT32 data) { WP_T(0x0f, 0x01); }
static void write_pixel_t_2(offs_t offset,UINT32 data) { WP_T(0x0e, 0x03); }
static void write_pixel_t_4(offs_t offset,UINT32 data) { WP_T(0x0c, 0x0f); }
static void write_pixel_t_8(offs_t offset,UINT32 data) { WP_T(0x08, 0xff); }
static void write_pixel_t_16(offs_t offset,UINT32 data)
static void write_pixel_t_1(offs_t offset, UINT32 data) { WP_T(0x0f, 0x01); }
static void write_pixel_t_2(offs_t offset, UINT32 data) { WP_T(0x0e, 0x03); }
static void write_pixel_t_4(offs_t offset, UINT32 data) { WP_T(0x0c, 0x0f); }
static void write_pixel_t_8(offs_t offset, UINT32 data) { WP_T(0x08, 0xff); }
static void write_pixel_t_16(offs_t offset, UINT32 data)
{
/* TODO: plane masking */
if (data)
TMS34010_WRMEM_WORD(TOBYTE(offset & 0xfffffff0), data);
}
static void write_pixel_t_32(offs_t offset, UINT32 data)
{
/* TODO: plane masking */
if (data)
TMS34010_WRMEM_DWORD(TOBYTE(offset & 0xffffffe0), data);
}
/* Raster Op + No Transparency */
static void write_pixel_r_1(offs_t offset,UINT32 data) { WP_R(0x0f, 0x01); }
static void write_pixel_r_2(offs_t offset,UINT32 data) { WP_R(0x0e, 0x03); }
static void write_pixel_r_4(offs_t offset,UINT32 data) { WP_R(0x0c, 0x0f); }
static void write_pixel_r_8(offs_t offset,UINT32 data) { WP_R(0x08, 0xff); }
static void write_pixel_r_16(offs_t offset,UINT32 data)
static void write_pixel_r_1(offs_t offset, UINT32 data) { WP_R(0x0f, 0x01); }
static void write_pixel_r_2(offs_t offset, UINT32 data) { WP_R(0x0e, 0x03); }
static void write_pixel_r_4(offs_t offset, UINT32 data) { WP_R(0x0c, 0x0f); }
static void write_pixel_r_8(offs_t offset, UINT32 data) { WP_R(0x08, 0xff); }
static void write_pixel_r_16(offs_t offset, UINT32 data)
{
/* TODO: plane masking */
UINT32 a = TOBYTE(offset & 0xfffffff0);
TMS34010_WRMEM_WORD(a, state.raster_op(data, TMS34010_RDMEM_WORD(a)));
}
static void write_pixel_r_32(offs_t offset, UINT32 data)
{
/* TODO: plane masking */
UINT32 a = TOBYTE(offset & 0xffffffe0);
TMS34010_WRMEM_DWORD(a, state.raster_op(data, TMS34010_RDMEM_DWORD(a)));
}
/* Raster Op + Transparency */
static void write_pixel_r_t_1(offs_t offset,UINT32 data) { WP_R_T(0x0f,0x01); }
static void write_pixel_r_t_2(offs_t offset,UINT32 data) { WP_R_T(0x0e,0x03); }
static void write_pixel_r_t_4(offs_t offset,UINT32 data) { WP_R_T(0x0c,0x0f); }
static void write_pixel_r_t_8(offs_t offset,UINT32 data) { WP_R_T(0x08,0xff); }
static void write_pixel_r_t_16(offs_t offset,UINT32 data)
static void write_pixel_r_t_1(offs_t offset, UINT32 data) { WP_R_T(0x0f,0x01); }
static void write_pixel_r_t_2(offs_t offset, UINT32 data) { WP_R_T(0x0e,0x03); }
static void write_pixel_r_t_4(offs_t offset, UINT32 data) { WP_R_T(0x0c,0x0f); }
static void write_pixel_r_t_8(offs_t offset, UINT32 data) { WP_R_T(0x08,0xff); }
static void write_pixel_r_t_16(offs_t offset, UINT32 data)
{
/* TODO: plane masking */
UINT32 a = TOBYTE(offset & 0xfffffff0);
@ -436,9 +460,18 @@ static void write_pixel_r_t_16(offs_t offset,UINT32 data)
if (data)
TMS34010_WRMEM_WORD(a, data);
}
static void write_pixel_r_t_32(offs_t offset, UINT32 data)
{
/* TODO: plane masking */
UINT32 a = TOBYTE(offset & 0xffffffe0);
data = state.raster_op(data, TMS34010_RDMEM_DWORD(a));
if (data)
TMS34010_WRMEM_DWORD(a, data);
}
/* Shift register write */
static void write_pixel_shiftreg(offs_t offset,UINT32 data)
static void write_pixel_shiftreg(offs_t offset, UINT32 data)
{
if (state.config->from_shiftreg)
state.config->from_shiftreg(offset, &state.shiftreg[0]);
@ -453,32 +486,32 @@ static void write_pixel_shiftreg(offs_t offset,UINT32 data)
***************************************************************************/
/* Raster operations */
static INT32 raster_op_1(INT32 newpix, INT32 oldpix) { return newpix & oldpix; }
static INT32 raster_op_2(INT32 newpix, INT32 oldpix) { return newpix & ~oldpix; }
static INT32 raster_op_3(INT32 newpix, INT32 oldpix) { return 0; }
static INT32 raster_op_4(INT32 newpix, INT32 oldpix) { return newpix | ~oldpix; }
static INT32 raster_op_5(INT32 newpix, INT32 oldpix) { return ~(newpix ^ oldpix); }
static INT32 raster_op_6(INT32 newpix, INT32 oldpix) { return ~oldpix; }
static INT32 raster_op_7(INT32 newpix, INT32 oldpix) { return ~(newpix | oldpix); }
static INT32 raster_op_8(INT32 newpix, INT32 oldpix) { return newpix | oldpix; }
static INT32 raster_op_9(INT32 newpix, INT32 oldpix) { return oldpix; }
static INT32 raster_op_10(INT32 newpix, INT32 oldpix) { return newpix ^ oldpix; }
static INT32 raster_op_11(INT32 newpix, INT32 oldpix) { return ~newpix & oldpix; }
static INT32 raster_op_12(INT32 newpix, INT32 oldpix) { return 0xffff; }
static INT32 raster_op_13(INT32 newpix, INT32 oldpix) { return ~newpix | oldpix; }
static INT32 raster_op_14(INT32 newpix, INT32 oldpix) { return ~(newpix & oldpix); }
static INT32 raster_op_15(INT32 newpix, INT32 oldpix) { return ~newpix; }
static INT32 raster_op_16(INT32 newpix, INT32 oldpix) { return newpix + oldpix; }
static INT32 raster_op_17(INT32 newpix, INT32 oldpix)
static UINT32 raster_op_1(UINT32 newpix, UINT32 oldpix) { return newpix & oldpix; }
static UINT32 raster_op_2(UINT32 newpix, UINT32 oldpix) { return newpix & ~oldpix; }
static UINT32 raster_op_3(UINT32 newpix, UINT32 oldpix) { return 0; }
static UINT32 raster_op_4(UINT32 newpix, UINT32 oldpix) { return newpix | ~oldpix; }
static UINT32 raster_op_5(UINT32 newpix, UINT32 oldpix) { return ~(newpix ^ oldpix); }
static UINT32 raster_op_6(UINT32 newpix, UINT32 oldpix) { return ~oldpix; }
static UINT32 raster_op_7(UINT32 newpix, UINT32 oldpix) { return ~(newpix | oldpix); }
static UINT32 raster_op_8(UINT32 newpix, UINT32 oldpix) { return newpix | oldpix; }
static UINT32 raster_op_9(UINT32 newpix, UINT32 oldpix) { return oldpix; }
static UINT32 raster_op_10(UINT32 newpix, UINT32 oldpix) { return newpix ^ oldpix; }
static UINT32 raster_op_11(UINT32 newpix, UINT32 oldpix) { return ~newpix & oldpix; }
static UINT32 raster_op_12(UINT32 newpix, UINT32 oldpix) { return 0xffff; }
static UINT32 raster_op_13(UINT32 newpix, UINT32 oldpix) { return ~newpix | oldpix; }
static UINT32 raster_op_14(UINT32 newpix, UINT32 oldpix) { return ~(newpix & oldpix); }
static UINT32 raster_op_15(UINT32 newpix, UINT32 oldpix) { return ~newpix; }
static UINT32 raster_op_16(UINT32 newpix, UINT32 oldpix) { return newpix + oldpix; }
static UINT32 raster_op_17(UINT32 newpix, UINT32 oldpix)
{
INT32 max = (UINT32)0xffffffff >> (32 - IOREG(REG_PSIZE));
INT32 res = newpix + oldpix;
UINT32 max = (UINT32)0xffffffff >> (32 - IOREG(REG_PSIZE));
UINT32 res = newpix + oldpix;
return (res > max) ? max : res;
}
static INT32 raster_op_18(INT32 newpix, INT32 oldpix) { return oldpix - newpix; }
static INT32 raster_op_19(INT32 newpix, INT32 oldpix) { return (oldpix > newpix) ? oldpix - newpix : 0; }
static INT32 raster_op_20(INT32 newpix, INT32 oldpix) { return (oldpix > newpix) ? oldpix : newpix; }
static INT32 raster_op_21(INT32 newpix, INT32 oldpix) { return (oldpix > newpix) ? newpix : oldpix; }
static UINT32 raster_op_18(UINT32 newpix, UINT32 oldpix) { return oldpix - newpix; }
static UINT32 raster_op_19(UINT32 newpix, UINT32 oldpix) { return (oldpix > newpix) ? oldpix - newpix : 0; }
static UINT32 raster_op_20(UINT32 newpix, UINT32 oldpix) { return (oldpix > newpix) ? oldpix : newpix; }
static UINT32 raster_op_21(UINT32 newpix, UINT32 oldpix) { return (oldpix > newpix) ? newpix : oldpix; }
@ -820,17 +853,17 @@ static int tms34010_execute(int cycles)
PIXEL OPS
***************************************************************************/
static void (*const pixel_write_ops[4][5])(offs_t offset,UINT32 data) =
static void (*const pixel_write_ops[4][6])(offs_t offset, UINT32 data) =
{
{ write_pixel_1, write_pixel_2, write_pixel_4, write_pixel_8, write_pixel_16 },
{ write_pixel_r_1, write_pixel_r_2, write_pixel_r_4, write_pixel_r_8, write_pixel_r_16 },
{ write_pixel_t_1, write_pixel_t_2, write_pixel_t_4, write_pixel_t_8, write_pixel_t_16 },
{ write_pixel_r_t_1, write_pixel_r_t_2, write_pixel_r_t_4, write_pixel_r_t_8, write_pixel_r_t_16 }
{ write_pixel_1, write_pixel_2, write_pixel_4, write_pixel_8, write_pixel_16, write_pixel_32 },
{ write_pixel_r_1, write_pixel_r_2, write_pixel_r_4, write_pixel_r_8, write_pixel_r_16, write_pixel_r_32 },
{ write_pixel_t_1, write_pixel_t_2, write_pixel_t_4, write_pixel_t_8, write_pixel_t_16, write_pixel_t_32 },
{ write_pixel_r_t_1, write_pixel_r_t_2, write_pixel_r_t_4, write_pixel_r_t_8, write_pixel_r_t_16, write_pixel_r_t_32 }
};
static UINT32 (*const pixel_read_ops[5])(offs_t offset) =
static UINT32 (*const pixel_read_ops[6])(offs_t offset) =
{
read_pixel_1, read_pixel_2, read_pixel_4, read_pixel_8, read_pixel_16
read_pixel_1, read_pixel_2, read_pixel_4, read_pixel_8, read_pixel_16, read_pixel_32
};
@ -854,6 +887,7 @@ static void set_pixel_function(void)
case 0x04: i2 = 2; break;
case 0x08: i2 = 3; break;
case 0x10: i2 = 4; break;
case 0x20: i2 = 5; break;
}
if (IOREG(REG_CONTROL) & 0x20)
@ -871,7 +905,7 @@ static void set_pixel_function(void)
RASTER OPS
***************************************************************************/
static INT32 (*const raster_ops[32]) (INT32 newpix, INT32 oldpix) =
static UINT32 (*const raster_ops[32]) (UINT32 newpix, UINT32 oldpix) =
{
0, raster_op_1 , raster_op_2 , raster_op_3,
raster_op_4 , raster_op_5 , raster_op_6 , raster_op_7,
@ -1298,6 +1332,7 @@ WRITE16_HANDLER( tms34020_io_register_w )
case 0x04: state.pixelshift = 2; break;
case 0x08: state.pixelshift = 3; break;
case 0x10: state.pixelshift = 4; break;
case 0x20: state.pixelshift = 5; break;
}
break;

View File

@ -294,7 +294,7 @@ void btoads_to_shiftreg(UINT32 address, UINT16 *shiftreg)
else if (address >= 0xa4000000 && address <= 0xa7ffffff)
{
sprite_dest_base = &vram_fg_draw[TOWORD(address & 0x3fc000)];
sprite_dest_offs = (INT16)((address & 0x3ff) << 2) >> 2;
sprite_dest_offs = (address & 0x003fff) >> 5;
}
/* reads from this region set the sprite source address */
@ -351,43 +351,51 @@ void btoads_scanline_update(running_machine *machine, int screen, mame_bitmap *b
int coladdr = fulladdr & 0x3ff;
int x;
if (BT_DEBUG)
popmessage("screen_control = %02X", screen_control);
/* for each scanline, switch off the render mode */
switch (screen_control & 3)
{
/* mode 0: used in ship level, snake boss, title screen (free play) */
/* priority is:
1. BG1 pixels with the high bit set
2. Sprites
3. BG1
4. BG0
1. Sprite pixels with high bit clear
2. BG1 pixels with the high bit set
3. Sprites
4. BG1
5. BG0
*/
case 0:
for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++)
{
UINT16 bg0pix = bg0_base[(coladdr + xscroll0) & 0xff];
UINT16 bg1pix = bg1_base[(coladdr + xscroll1) & 0xff];
UINT8 sprpix = spr_base[coladdr & 0xff];
if (bg1pix & 0x80)
dst[x + 0] = bg1pix & 0xff;
else if (sprpix)
if (sprpix && !(sprpix & 0x80))
{
dst[x + 0] = sprpix;
else if (bg1pix & 0xff)
dst[x + 0] = bg1pix & 0xff;
else
dst[x + 0] = bg0pix & 0xff;
if (bg1pix & 0x8000)
dst[x + 1] = bg1pix >> 8;
else if (sprpix)
dst[x + 1] = sprpix;
else if (bg1pix >> 8)
dst[x + 1] = bg1pix >> 8;
}
else
dst[x + 1] = bg0pix >> 8;
{
UINT16 bg0pix = bg0_base[(coladdr + xscroll0) & 0xff];
UINT16 bg1pix = bg1_base[(coladdr + xscroll1) & 0xff];
UINT8 sprpix = spr_base[coladdr & 0xff];
if (bg1pix & 0x80)
dst[x + 0] = bg1pix & 0xff;
else if (sprpix)
dst[x + 0] = sprpix;
else if (bg1pix & 0xff)
dst[x + 0] = bg1pix & 0xff;
else
dst[x + 0] = bg0pix & 0xff;
if (bg1pix & 0x8000)
dst[x + 1] = bg1pix >> 8;
else if (sprpix)
dst[x + 1] = sprpix;
else if (bg1pix >> 8)
dst[x + 1] = bg1pix >> 8;
else
dst[x + 1] = bg0pix >> 8;
}
}
break;
@ -396,7 +404,7 @@ void btoads_scanline_update(running_machine *machine, int screen, mame_bitmap *b
1. Sprite pixels with high bit clear
2. BG0
3. BG1 pixels with high bit set
4. Sprite pixels with high bit set
4. Sprites
5. BG1
*/
case 1:
@ -511,12 +519,16 @@ void btoads_scanline_update(running_machine *machine, int screen, mame_bitmap *b
/* debugging - dump the screen contents to a file */
#if BT_DEBUG
popmessage("screen_control = %02X", screen_control & 0x7f);
if (input_code_pressed(KEYCODE_X))
{
static int count = 0;
char name[10];
FILE *f;
int i;
while (input_code_pressed(KEYCODE_X)) ;
sprintf(name, "disp%d.log", count++);
f = fopen(name, "w");