mirror of
https://github.com/holub/mame
synced 2025-05-22 21:58:57 +03:00
current 32x code
This commit is contained in:
parent
a769919540
commit
b11d133ccc
@ -98,6 +98,9 @@ static int sh2_are_running;
|
|||||||
static int _32x_adapter_enabled;
|
static int _32x_adapter_enabled;
|
||||||
static int _32x_access_auth;
|
static int _32x_access_auth;
|
||||||
static int _32x_screenshift;
|
static int _32x_screenshift;
|
||||||
|
static int _32x_videopriority;
|
||||||
|
static int _32x_displaymode;
|
||||||
|
static int _32x_240mode;
|
||||||
|
|
||||||
static int sh2_master_vint_enable, sh2_slave_vint_enable;
|
static int sh2_master_vint_enable, sh2_slave_vint_enable;
|
||||||
static int sh2_master_hint_enable, sh2_slave_hint_enable;
|
static int sh2_master_hint_enable, sh2_slave_hint_enable;
|
||||||
@ -2543,7 +2546,7 @@ static WRITE16_HANDLER( _32x_68k_palette_w )
|
|||||||
b = ((data >> 10) & 0x1f);
|
b = ((data >> 10) & 0x1f);
|
||||||
p = ((data >> 15) & 0x01); // priority 'through' bit
|
p = ((data >> 15) & 0x01); // priority 'through' bit
|
||||||
|
|
||||||
_32x_palette_lookup[offset] = (r << 10) | (g << 5) | (b << 0);
|
_32x_palette_lookup[offset] = (r << 10) | (g << 5) | (b << 0) | (p << 15);
|
||||||
|
|
||||||
palette_set_color_rgb(Machine,offset+0x40,pal5bit(r),pal5bit(g),pal5bit(b));
|
palette_set_color_rgb(Machine,offset+0x40,pal5bit(r),pal5bit(g),pal5bit(b));
|
||||||
|
|
||||||
@ -2728,9 +2731,36 @@ static WRITE32_HANDLER( sh2_4108_410a_w )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static READ16_HANDLER( _32x_4100_r )
|
|
||||||
|
|
||||||
|
static READ16_HANDLER( _32x_68k_bitmapmode_r )
|
||||||
{
|
{
|
||||||
return 0x0000;
|
// the flag is inverted compared to the megadrive
|
||||||
|
int ntsc;
|
||||||
|
if (megadrive_region_pal) ntsc = 0;
|
||||||
|
else ntsc = 1;
|
||||||
|
|
||||||
|
return (ntsc << 15) |
|
||||||
|
(_32x_videopriority << 7 ) |
|
||||||
|
( _32x_240mode << 6 ) |
|
||||||
|
( _32x_displaymode << 0 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static WRITE16_HANDLER( _32x_68k_bitmapmode_w )
|
||||||
|
{
|
||||||
|
// printf("_32x_68k_bitmapmode_w (a15180) %04x %04x\n",data,mem_mask);
|
||||||
|
if (ACCESSING_BITS_0_7)
|
||||||
|
{
|
||||||
|
_32x_videopriority = (data & 0x80) >> 7;
|
||||||
|
_32x_240mode = (data & 0x40) >> 6;
|
||||||
|
_32x_displaymode = (data & 0x03) >> 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ACCESSING_BITS_8_15)
|
||||||
|
{
|
||||||
|
// nothing? (pal flag is read only)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static READ16_HANDLER( _32x_4102_r )
|
static READ16_HANDLER( _32x_4102_r )
|
||||||
@ -2744,7 +2774,7 @@ static READ32_HANDLER( sh2_4100_4102_r )
|
|||||||
if (ACCESSING_BITS_16_31) // 4100
|
if (ACCESSING_BITS_16_31) // 4100
|
||||||
{
|
{
|
||||||
UINT16 ret = 0x0000;
|
UINT16 ret = 0x0000;
|
||||||
ret = _32x_4100_r(machine, offset*2, mem_mask>>16);
|
ret = _32x_68k_bitmapmode_r(machine, offset*2, mem_mask>>16);
|
||||||
retvalue |= (ret << 16);
|
retvalue |= (ret << 16);
|
||||||
}
|
}
|
||||||
if (ACCESSING_BITS_0_15) // 4102
|
if (ACCESSING_BITS_0_15) // 4102
|
||||||
@ -2758,10 +2788,12 @@ static READ32_HANDLER( sh2_4100_4102_r )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
static WRITE16_HANDLER( _32x_4100_w )
|
static WRITE16_HANDLER( _32x_4100_w )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static WRITE16_HANDLER( _32x_4102_w )
|
static WRITE16_HANDLER( _32x_4102_w )
|
||||||
{
|
{
|
||||||
@ -2773,7 +2805,7 @@ static WRITE32_HANDLER( sh2_4100_4102_w )
|
|||||||
{
|
{
|
||||||
if (ACCESSING_BITS_16_31) // 4100
|
if (ACCESSING_BITS_16_31) // 4100
|
||||||
{
|
{
|
||||||
_32x_4100_w(machine,offset*2,(data>>16)&0xffff,(mem_mask>>16)&0xffff);
|
_32x_68k_bitmapmode_w(machine,offset*2,(data>>16)&0xffff,(mem_mask>>16)&0xffff);
|
||||||
}
|
}
|
||||||
if (ACCESSING_BITS_0_15) // 4102
|
if (ACCESSING_BITS_0_15) // 4102
|
||||||
{
|
{
|
||||||
@ -4565,6 +4597,8 @@ static void genesis_render_videoline_to_videobuffer(int scanline)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static UINT32 _32x_linerender[512]; // tmp buffer
|
||||||
|
|
||||||
/* This converts our render buffer to real screen colours */
|
/* This converts our render buffer to real screen colours */
|
||||||
static void genesis_render_videobuffer_to_screenbuffer(running_machine *machine, int scanline)
|
static void genesis_render_videobuffer_to_screenbuffer(running_machine *machine, int scanline)
|
||||||
{
|
{
|
||||||
@ -4572,6 +4606,44 @@ static void genesis_render_videobuffer_to_screenbuffer(running_machine *machine,
|
|||||||
int x;
|
int x;
|
||||||
lineptr = BITMAP_ADDR16(render_bitmap, scanline, 0);
|
lineptr = BITMAP_ADDR16(render_bitmap, scanline, 0);
|
||||||
|
|
||||||
|
/* render 32x output to a buffer */
|
||||||
|
if (_32x_is_connected && (_32x_displaymode != 0))
|
||||||
|
{
|
||||||
|
UINT32 lineoffs;
|
||||||
|
int start;
|
||||||
|
|
||||||
|
lineoffs = _32x_display_dram[scanline];
|
||||||
|
|
||||||
|
if (_32x_screenshift == 0) start=0;
|
||||||
|
else start = -1;
|
||||||
|
|
||||||
|
for (x=start;x<320;x++)
|
||||||
|
{
|
||||||
|
UINT16 coldata;
|
||||||
|
coldata = _32x_display_dram[lineoffs];
|
||||||
|
|
||||||
|
{
|
||||||
|
if (x>=0)
|
||||||
|
{
|
||||||
|
//if ((_32x_palette[(coldata & 0xff00)>>8] & 0x8000)==0x8000)
|
||||||
|
_32x_linerender[x] = _32x_palette_lookup[(coldata & 0xff00)>>8];
|
||||||
|
}
|
||||||
|
|
||||||
|
x++;
|
||||||
|
|
||||||
|
if (x>=0)
|
||||||
|
{
|
||||||
|
//if ((_32x_palette[(coldata & 0x00ff)>>0] & 0x8000)==0x8000)
|
||||||
|
_32x_linerender[x] = _32x_palette_lookup[(coldata & 0x00ff)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lineoffs++;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!MEGADRIVE_REG0C_SHADOW_HIGLIGHT)
|
if (!MEGADRIVE_REG0C_SHADOW_HIGLIGHT)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -4579,11 +4651,40 @@ static void genesis_render_videobuffer_to_screenbuffer(running_machine *machine,
|
|||||||
{
|
{
|
||||||
UINT32 dat;
|
UINT32 dat;
|
||||||
dat = video_renderline[x];
|
dat = video_renderline[x];
|
||||||
|
if ((dat&0x20000) && (_32x_is_connected) && (_32x_displaymode != 0))
|
||||||
|
{
|
||||||
|
if (_32x_linerender[x]&0x8000)
|
||||||
|
{
|
||||||
|
if (_32x_videopriority)
|
||||||
|
{
|
||||||
|
lineptr[x] = _32x_linerender[x]&0x7fff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// display md bg?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_32x_videopriority)
|
||||||
|
{
|
||||||
|
// display md bg?
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lineptr[x] = _32x_linerender[x]&0x7fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (dat&0x10000)
|
if (dat&0x10000)
|
||||||
lineptr[x] = megadrive_vdp_palette_lookup_sprite[(dat&0x0f) | segac2_sp_pal_lookup[(dat&0x30)>>4]];
|
lineptr[x] = megadrive_vdp_palette_lookup_sprite[(dat&0x0f) | segac2_sp_pal_lookup[(dat&0x30)>>4]];
|
||||||
else
|
else
|
||||||
lineptr[x] = megadrive_vdp_palette_lookup[(dat&0x0f) | segac2_bg_pal_lookup[(dat&0x30)>>4]];
|
lineptr[x] = megadrive_vdp_palette_lookup[(dat&0x0f) | segac2_bg_pal_lookup[(dat&0x30)>>4]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4592,8 +4693,35 @@ static void genesis_render_videobuffer_to_screenbuffer(running_machine *machine,
|
|||||||
UINT32 dat;
|
UINT32 dat;
|
||||||
dat = video_renderline[x];
|
dat = video_renderline[x];
|
||||||
|
|
||||||
/* Verify my handling.. I'm not sure all cases are correct */
|
if ((dat&0x20000) && (_32x_is_connected) && (_32x_displaymode != 0))
|
||||||
|
{
|
||||||
|
if (_32x_linerender[x]&0x8000)
|
||||||
|
{
|
||||||
|
if (_32x_videopriority)
|
||||||
|
{
|
||||||
|
lineptr[x] = _32x_linerender[x]&0x7fff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// display md bg?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_32x_videopriority)
|
||||||
|
{
|
||||||
|
// display md bg?
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lineptr[x] = _32x_linerender[x]&0x7fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Verify my handling.. I'm not sure all cases are correct */
|
||||||
switch (dat&0x1e000)
|
switch (dat&0x1e000)
|
||||||
{
|
{
|
||||||
case 0x00000: // low priority, no shadow sprite, no highlight = shadow
|
case 0x00000: // low priority, no shadow sprite, no highlight = shadow
|
||||||
@ -4628,45 +4756,42 @@ static void genesis_render_videobuffer_to_screenbuffer(running_machine *machine,
|
|||||||
default:
|
default:
|
||||||
lineptr[x] = mame_rand(Machine)&0x3f;
|
lineptr[x] = mame_rand(Machine)&0x3f;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_32x_is_connected)
|
|
||||||
|
if (_32x_is_connected && ( _32x_displaymode != 0))
|
||||||
{
|
{
|
||||||
UINT32 lineoffs;
|
for (x=0;x<320;x++)
|
||||||
int start;
|
|
||||||
|
|
||||||
lineoffs = _32x_display_dram[scanline];
|
|
||||||
|
|
||||||
if (_32x_screenshift == 0) start=0;
|
|
||||||
else start = -1;
|
|
||||||
|
|
||||||
for (x=start;x<320;x++)
|
|
||||||
{
|
{
|
||||||
UINT16 coldata;
|
if (_32x_linerender[x]&0x8000)
|
||||||
coldata = _32x_display_dram[lineoffs];
|
|
||||||
|
|
||||||
{
|
{
|
||||||
if (x>=0)
|
if (_32x_videopriority)
|
||||||
if ((_32x_palette[(coldata & 0xff00)>>8] & 0x8000)==0x8000)
|
{
|
||||||
lineptr[x] = _32x_palette_lookup[(coldata & 0xff00)>>8];
|
// display md screen?
|
||||||
|
|
||||||
x++;
|
|
||||||
|
|
||||||
if (x>=0)
|
|
||||||
if ((_32x_palette[(coldata & 0x00ff)>>0] & 0x8000)==0x8000)
|
|
||||||
lineptr[x] = _32x_palette_lookup[(coldata & 0x00ff)];
|
|
||||||
}
|
|
||||||
|
|
||||||
lineoffs++;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lineptr[x] = _32x_linerender[x]&0x7fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_32x_videopriority)
|
||||||
|
{
|
||||||
|
lineptr[x] = _32x_linerender[x]&0x7fff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// display md screen?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void genesis_render_scanline(running_machine *machine, int scanline)
|
static void genesis_render_scanline(running_machine *machine, int scanline)
|
||||||
@ -6379,15 +6504,6 @@ static READ16_HANDLER( _32x_68k_a15100_r )
|
|||||||
return (_32x_access_auth<<15) | 0x0080;
|
return (_32x_access_auth<<15) | 0x0080;
|
||||||
}
|
}
|
||||||
|
|
||||||
static READ16_HANDLER( _32x_68k_bitmapmode_r )
|
|
||||||
{
|
|
||||||
return 0x8001;
|
|
||||||
}
|
|
||||||
|
|
||||||
static WRITE16_HANDLER( _32x_68k_bitmapmode_w )
|
|
||||||
{
|
|
||||||
printf("_32x_68k_bitmapmode_w (a15180) %04x %04x\n",data,mem_mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
static WRITE16_HANDLER( _32x_68k_a15100_w )
|
static WRITE16_HANDLER( _32x_68k_a15100_w )
|
||||||
{
|
{
|
||||||
@ -6550,6 +6666,9 @@ DRIVER_INIT( _32x )
|
|||||||
_32x_autofill_address = 0;
|
_32x_autofill_address = 0;
|
||||||
_32x_autofill_data = 0;
|
_32x_autofill_data = 0;
|
||||||
_32x_screenshift = 0;
|
_32x_screenshift = 0;
|
||||||
|
_32x_videopriority = 0; // MD priority
|
||||||
|
_32x_displaymode = 0;
|
||||||
|
_32x_240mode = 0;
|
||||||
|
|
||||||
DRIVER_INIT_CALL(megadriv);
|
DRIVER_INIT_CALL(megadriv);
|
||||||
}
|
}
|
||||||
@ -6568,7 +6687,7 @@ ROM_START( 32x_bios )
|
|||||||
// ROM_LOAD( "32x_rot.bin", 0x000000, 0x0001638, CRC(98c25033) SHA1(8d9ab3084bd29e60b8cdf4b9f1cb755eb4c88d29) )
|
// ROM_LOAD( "32x_rot.bin", 0x000000, 0x0001638, CRC(98c25033) SHA1(8d9ab3084bd29e60b8cdf4b9f1cb755eb4c88d29) )
|
||||||
// ROM_LOAD( "32x_3d.bin", 0x000000, 0x6568, CRC(0171743e) SHA1(bbe6fec182baae5e4d47d263fae6b419db5366ae) )
|
// ROM_LOAD( "32x_3d.bin", 0x000000, 0x6568, CRC(0171743e) SHA1(bbe6fec182baae5e4d47d263fae6b419db5366ae) )
|
||||||
// ROM_LOAD( "32x_spin.bin", 0x000000, 0x012c28, CRC(3d1d1191) SHA1(221a74408653e18cef8ce2f9b4d33ed93e4218b7) )
|
// ROM_LOAD( "32x_spin.bin", 0x000000, 0x012c28, CRC(3d1d1191) SHA1(221a74408653e18cef8ce2f9b4d33ed93e4218b7) )
|
||||||
// ROM_LOAD( "32x_doom.bin", 0x000000, 0x300000, CRC(208332fd) SHA1(b68e9c7af81853b8f05b8696033dfe4c80327e38) )
|
//ROM_LOAD( "32x_doom.bin", 0x000000, 0x300000, CRC(208332fd) SHA1(b68e9c7af81853b8f05b8696033dfe4c80327e38) )
|
||||||
ROM_LOAD( "32x_koli.bin", 0x000000, 0x300000, CRC(20ca53ef) SHA1(191ae0b525ecf32664086d8d748e0b35f776ddfe) ) // works but stutters.. probably flags
|
ROM_LOAD( "32x_koli.bin", 0x000000, 0x300000, CRC(20ca53ef) SHA1(191ae0b525ecf32664086d8d748e0b35f776ddfe) ) // works but stutters.. probably flags
|
||||||
// ROM_LOAD( "32x_head.bin", 0x000000, 0x300000, CRC(1) SHA1(1) ) // works but stutters.. probably flags
|
// ROM_LOAD( "32x_head.bin", 0x000000, 0x300000, CRC(1) SHA1(1) ) // works but stutters.. probably flags
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user