mirror of
https://github.com/holub/mame
synced 2025-04-24 17:30:55 +03:00
Merge pull request #5078 from cam900/machine_segaic16_pal
machine/segaic16.cpp : Updates
This commit is contained in:
commit
ab164d1860
@ -183,7 +183,7 @@ READ16_MEMBER( segahang_state::hangon_io_r )
|
||||
}
|
||||
|
||||
//logerror("%06X:hangon_io_r - unknown read access to address %04X\n", m_maincpu->pc(), offset * 2);
|
||||
return open_bus_r(space, 0, mem_mask);
|
||||
return open_bus_r(space);
|
||||
}
|
||||
|
||||
|
||||
@ -241,7 +241,7 @@ READ16_MEMBER( segahang_state::sharrier_io_r )
|
||||
}
|
||||
|
||||
//logerror("%06X:sharrier_io_r - unknown read access to address %04X\n", m_maincpu->pc(), offset * 2);
|
||||
return open_bus_r(space, 0, mem_mask);
|
||||
return open_bus_r(space);
|
||||
}
|
||||
|
||||
|
||||
@ -404,7 +404,7 @@ void segahang_state::hangon_map(address_map &map)
|
||||
map(0x400000, 0x403fff).rw(m_segaic16vid, FUNC(segaic16_video_device::tileram_r), FUNC(segaic16_video_device::tileram_w)).share("tileram");
|
||||
map(0x410000, 0x410fff).rw(m_segaic16vid, FUNC(segaic16_video_device::textram_r), FUNC(segaic16_video_device::textram_w)).share("textram");
|
||||
map(0x600000, 0x6007ff).ram().share("sprites");
|
||||
map(0xa00000, 0xa00fff).ram().w(FUNC(segahang_state::paletteram_w)).share("paletteram");
|
||||
map(0xa00000, 0xa00fff).ram().w(FUNC(segahang_state::hangon_paletteram_w)).share("paletteram");
|
||||
map(0xc00000, 0xc3ffff).rom().region("subcpu", 0);
|
||||
map(0xc68000, 0xc68fff).ram().share("segaic16road:roadram");
|
||||
map(0xc7c000, 0xc7ffff).ram().share("subram");
|
||||
@ -812,6 +812,7 @@ void segahang_state::sharrier_base(machine_config &config)
|
||||
|
||||
// video hardware
|
||||
SEGA_SHARRIER_SPRITES(config, m_sprites, 0);
|
||||
m_palette->set_entries(2048*2);
|
||||
}
|
||||
|
||||
void segahang_state::enduror_base(machine_config &config)
|
||||
|
@ -487,7 +487,7 @@ READ16_MEMBER( segaorun_state::misc_io_r )
|
||||
return m_custom_io_r(space, offset, mem_mask);
|
||||
|
||||
logerror("%06X:misc_io_r - unknown read access to address %04X\n", m_maincpu->pc(), offset * 2);
|
||||
return open_bus_r(space, 0, mem_mask);
|
||||
return open_bus_r(space);
|
||||
}
|
||||
|
||||
|
||||
@ -662,7 +662,7 @@ READ16_MEMBER( segaorun_state::outrun_custom_io_r )
|
||||
}
|
||||
|
||||
logerror("%06X:outrun_custom_io_r - unknown read access to address %04X\n", m_maincpu->pc(), offset * 2);
|
||||
return open_bus_r(space, 0, mem_mask);
|
||||
return open_bus_r(space);
|
||||
}
|
||||
|
||||
|
||||
@ -745,7 +745,7 @@ READ16_MEMBER( segaorun_state::shangon_custom_io_r )
|
||||
}
|
||||
|
||||
logerror("%06X:misc_io_r - unknown read access to address %04X\n", m_maincpu->pc(), offset * 2);
|
||||
return open_bus_r(space,0,mem_mask);
|
||||
return open_bus_r(space);
|
||||
}
|
||||
|
||||
|
||||
@ -1175,7 +1175,7 @@ void segaorun_state::outrun_base(machine_config &config)
|
||||
|
||||
// video hardware
|
||||
GFXDECODE(config, "gfxdecode", m_palette, gfx_segaorun);
|
||||
PALETTE(config, m_palette).set_entries(4096*3);
|
||||
PALETTE(config, m_palette).set_entries(4096*2);
|
||||
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
m_screen->set_raw(MASTER_CLOCK_25MHz/4, 400, 0, 320, 262, 0, 224);
|
||||
|
@ -2009,7 +2009,7 @@ void segas16a_state::system16a(machine_config &config)
|
||||
SEGAIC16VID(config, m_segaic16vid, 0, "gfxdecode");
|
||||
|
||||
GFXDECODE(config, "gfxdecode", m_palette, gfx_segas16a);
|
||||
PALETTE(config, m_palette).set_entries(2048*3);
|
||||
PALETTE(config, m_palette).set_entries(2048*2);
|
||||
|
||||
// sound hardware
|
||||
SPEAKER(config, "speaker").front_center();
|
||||
|
@ -999,13 +999,13 @@ READ16_MEMBER( segas16b_state::rom_5797_bank_math_r )
|
||||
{
|
||||
case 0x0000/2:
|
||||
// multiply registers
|
||||
return m_multiplier->read(space, offset, mem_mask);
|
||||
return m_multiplier->read(offset);
|
||||
|
||||
case 0x1000/2:
|
||||
// compare registers
|
||||
return m_cmptimer_1->read(space, offset, mem_mask);
|
||||
return m_cmptimer_1->read(offset);
|
||||
}
|
||||
return open_bus_r(space, 0, mem_mask);
|
||||
return open_bus_r(space);
|
||||
}
|
||||
|
||||
|
||||
@ -1021,12 +1021,12 @@ WRITE16_MEMBER( segas16b_state::rom_5797_bank_math_w )
|
||||
{
|
||||
case 0x0000/2:
|
||||
// multiply registers
|
||||
m_multiplier->write(space, offset, data, mem_mask);
|
||||
m_multiplier->write(offset, data, mem_mask);
|
||||
break;
|
||||
|
||||
case 0x1000/2:
|
||||
// compare registers
|
||||
m_cmptimer_1->write(space, offset, data, mem_mask);
|
||||
m_cmptimer_1->write(offset, data, mem_mask);
|
||||
break;
|
||||
|
||||
case 0x2000/2:
|
||||
@ -1045,7 +1045,7 @@ WRITE16_MEMBER( segas16b_state::rom_5797_bank_math_w )
|
||||
READ16_MEMBER( segas16b_state::unknown_rgn2_r )
|
||||
{
|
||||
logerror("Region 2: read from %04X\n", offset * 2);
|
||||
return m_cmptimer_2->read(space, offset, mem_mask);
|
||||
return m_cmptimer_2->read(offset);
|
||||
}
|
||||
|
||||
|
||||
@ -1057,7 +1057,7 @@ READ16_MEMBER( segas16b_state::unknown_rgn2_r )
|
||||
WRITE16_MEMBER( segas16b_state::unknown_rgn2_w )
|
||||
{
|
||||
logerror("Region 2: write to %04X = %04X & %04X\n", offset * 2, data, mem_mask);
|
||||
m_cmptimer_2->write(space, offset, data, mem_mask);
|
||||
m_cmptimer_2->write(offset, data, mem_mask);
|
||||
}
|
||||
|
||||
|
||||
@ -1080,7 +1080,7 @@ READ16_MEMBER( segas16b_state::standard_io_r )
|
||||
return ioport((offset & 1) ? "DSW1" : "DSW2")->read();
|
||||
}
|
||||
logerror("%06X:standard_io_r - unknown read access to address %04X\n", m_maincpu->pc(), offset * 2);
|
||||
return open_bus_r(space, 0, mem_mask);
|
||||
return open_bus_r(space);
|
||||
}
|
||||
|
||||
|
||||
@ -3743,7 +3743,7 @@ void segas16b_state::system16b(machine_config &config)
|
||||
|
||||
// video hardware
|
||||
GFXDECODE(config, m_gfxdecode, m_palette, gfx_segas16b);
|
||||
PALETTE(config, m_palette).set_entries(2048*3);
|
||||
PALETTE(config, m_palette).set_entries(2048*2);
|
||||
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
m_screen->set_raw(MASTER_CLOCK_25MHz/4, 400, 0, 320, 262, 0, 224);
|
||||
@ -3942,7 +3942,7 @@ void segas16b_state::lockonph(machine_config &config)
|
||||
|
||||
// video hardware
|
||||
GFXDECODE(config, m_gfxdecode, m_palette, gfx_lockonph);
|
||||
PALETTE(config, m_palette).set_entries(0x2000*4);
|
||||
PALETTE(config, m_palette).set_entries(4096*2);
|
||||
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
m_screen->set_raw(MASTER_CLOCK_25MHz/4, 400, 0, 320, 262, 0, 224); // wrong, other XTAL seems to be 17Mhz?
|
||||
|
@ -211,7 +211,7 @@ READ16_MEMBER( segas18_state::misc_io_r )
|
||||
// I/O chip
|
||||
case 0x0000/2:
|
||||
case 0x1000/2:
|
||||
return m_io->read(space, offset) | (open_bus_r(space, 0, mem_mask) & 0xff00);
|
||||
return m_io->read(space, offset) | (open_bus_r(space) & 0xff00);
|
||||
|
||||
// video control latch
|
||||
case 0x2000/2:
|
||||
@ -224,7 +224,7 @@ READ16_MEMBER( segas18_state::misc_io_r )
|
||||
if (!m_custom_io_r.isnull())
|
||||
return m_custom_io_r(space, offset, mem_mask);
|
||||
logerror("%06X:misc_io_r - unknown read access to address %04X\n", m_maincpu->pc(), offset * 2);
|
||||
return open_bus_r(space, 0, mem_mask);
|
||||
return open_bus_r(space);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER( segas18_state::misc_io_w )
|
||||
@ -356,7 +356,7 @@ READ16_MEMBER( segas18_state::ddcrew_custom_io_r )
|
||||
case 0x3024/2:
|
||||
return ioport("EXSERVICE")->read();
|
||||
}
|
||||
return open_bus_r(space, 0, mem_mask);
|
||||
return open_bus_r(space);
|
||||
}
|
||||
|
||||
|
||||
@ -380,7 +380,7 @@ READ16_MEMBER( segas18_state::lghost_custom_io_r )
|
||||
m_lghost_value <<= 1;
|
||||
return result;
|
||||
}
|
||||
return open_bus_r(space, 0, mem_mask);
|
||||
return open_bus_r(space);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER( segas18_state::lghost_custom_io_w )
|
||||
@ -584,7 +584,7 @@ READ16_MEMBER( segas18_state::wwally_custom_io_r )
|
||||
if (offset >= 0x3000/2 && offset < 0x3018/2)
|
||||
return m_upd4701[(offset & 0x0018/2) >> 2]->read_xy(space, offset & 0x0006/2);
|
||||
|
||||
return open_bus_r(space, 0, mem_mask);
|
||||
return open_bus_r(space);
|
||||
}
|
||||
|
||||
|
||||
@ -1342,7 +1342,7 @@ void segas18_state::system18(machine_config &config)
|
||||
m_vdp->lv6_irq().set(FUNC(segas18_state::vdp_lv6irqline_callback_s18));
|
||||
m_vdp->lv4_irq().set(FUNC(segas18_state::vdp_lv4irqline_callback_s18));
|
||||
m_vdp->set_alt_timing(1);
|
||||
m_vdp->set_pal_write_base(0x2000);
|
||||
m_vdp->set_pal_write_base(0x1000);
|
||||
m_vdp->set_palette(m_palette);
|
||||
m_vdp->add_route(ALL_OUTPUTS, "mono", 0.0);
|
||||
|
||||
@ -1357,7 +1357,7 @@ void segas18_state::system18(machine_config &config)
|
||||
m_screen->set_palette(m_palette);
|
||||
|
||||
GFXDECODE(config, m_gfxdecode, m_palette, gfx_segas18);
|
||||
PALETTE(config, m_palette).set_entries(2048*3+2048 + 64*3);
|
||||
PALETTE(config, m_palette).set_entries(2048*2 + 64*3);
|
||||
|
||||
SEGA_SYS16B_SPRITES(config, m_sprites, 0);
|
||||
SEGAIC16VID(config, m_segaic16vid, 0, m_gfxdecode);
|
||||
|
@ -913,10 +913,12 @@ WRITE16_MEMBER( segaxbd_state::paletteram_w )
|
||||
int g = ((newval >> 13) & 0x01) | ((newval >> 3) & 0x1e);
|
||||
int b = ((newval >> 14) & 0x01) | ((newval >> 7) & 0x1e);
|
||||
|
||||
// normal colors
|
||||
// shadow / hilight toggle bit in palette RAM
|
||||
rgb_t effects = (newval & 0x8000) ?
|
||||
rgb_t(m_palette_hilight[r], m_palette_hilight[g], m_palette_hilight[b]) :
|
||||
rgb_t(m_palette_shadow[r], m_palette_shadow[g], m_palette_shadow[b]);
|
||||
m_palette->set_pen_color(offset + 0 * m_palette_entries, m_palette_normal[r], m_palette_normal[g], m_palette_normal[b]);
|
||||
m_palette->set_pen_color(offset + 1 * m_palette_entries, m_palette_shadow[r], m_palette_shadow[g], m_palette_shadow[b]);
|
||||
m_palette->set_pen_color(offset + 2 * m_palette_entries, m_palette_hilight[r], m_palette_hilight[g], m_palette_hilight[b]);
|
||||
m_palette->set_pen_color(offset + 1 * m_palette_entries, effects);
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@ -1713,7 +1715,7 @@ void segaxbd_state::xboard_base_mconfig(machine_config &config)
|
||||
|
||||
// video hardware
|
||||
GFXDECODE(config, "gfxdecode", m_palette, gfx_segaxbd);
|
||||
PALETTE(config, m_palette).set_entries(8192*3);
|
||||
PALETTE(config, m_palette).set_entries(8192*2);
|
||||
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
m_screen->set_raw(MASTER_CLOCK/8, 400, 0, 320, 262, 0, 224);
|
||||
|
@ -1330,7 +1330,7 @@ void segaybd_state::yboard(machine_config &config)
|
||||
SEGA_YBOARD_SPRITES(config, m_ysprites, 0);
|
||||
SEGAIC16VID(config, m_segaic16vid, 0, "gfxdecode");
|
||||
|
||||
PALETTE(config, m_palette).set_entries(8192*3);
|
||||
PALETTE(config, m_palette).set_entries(8192*2);
|
||||
|
||||
// sound hardware
|
||||
SPEAKER(config, "lspeaker").front_left();
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "segaic16.h"
|
||||
#include "video/resnet.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
//**************************************************************************
|
||||
// DEBUGGING
|
||||
@ -43,12 +44,12 @@ DEFINE_DEVICE_TYPE(SEGA_315_5250_COMPARE_TIMER, sega_315_5250_compare_timer_devi
|
||||
//-------------------------------------------------
|
||||
|
||||
sega_16bit_common_base::sega_16bit_common_base(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_paletteram(*this, "paletteram"),
|
||||
m_open_bus_recurse(false),
|
||||
m_palette_entries(0),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette")
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_paletteram(*this, "paletteram")
|
||||
, m_open_bus_recurse(false)
|
||||
, m_palette_entries(0)
|
||||
, m_screen(*this, "screen")
|
||||
, m_palette(*this, "palette")
|
||||
{
|
||||
palette_init();
|
||||
}
|
||||
@ -59,7 +60,7 @@ sega_16bit_common_base::sega_16bit_common_base(const machine_config &mconfig, de
|
||||
// unmapped address
|
||||
//-------------------------------------------------
|
||||
|
||||
READ16_MEMBER( sega_16bit_common_base::open_bus_r )
|
||||
u16 sega_16bit_common_base::open_bus_r(address_space &space)
|
||||
{
|
||||
// Unmapped memory returns the last word on the data bus, which is almost always the opcode
|
||||
// of the next instruction due to prefetch; however, since we may be encrypted, we actually
|
||||
@ -70,14 +71,18 @@ READ16_MEMBER( sega_16bit_common_base::open_bus_r )
|
||||
// return the prefetched value.
|
||||
|
||||
// prevent recursion
|
||||
if (m_open_bus_recurse)
|
||||
return 0xffff;
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
if (m_open_bus_recurse)
|
||||
return 0xffff;
|
||||
|
||||
// read original encrypted memory at that address
|
||||
m_open_bus_recurse = true;
|
||||
uint16_t result = space.read_word(space.device().state().pc());
|
||||
m_open_bus_recurse = false;
|
||||
return result;
|
||||
// read original encrypted memory at that address
|
||||
m_open_bus_recurse = true;
|
||||
const u16 result = space.read_word(space.device().state().pc());
|
||||
m_open_bus_recurse = false;
|
||||
return result;
|
||||
}
|
||||
return 0xffff;
|
||||
}
|
||||
|
||||
|
||||
@ -124,11 +129,11 @@ void sega_16bit_common_base::palette_init()
|
||||
// compute R, G, B for each weight
|
||||
for (int value = 0; value < 32; value++)
|
||||
{
|
||||
int i4 = (value >> 4) & 1;
|
||||
int i3 = (value >> 3) & 1;
|
||||
int i2 = (value >> 2) & 1;
|
||||
int i1 = (value >> 1) & 1;
|
||||
int i0 = (value >> 0) & 1;
|
||||
const u8 i4 = (value >> 4) & 1;
|
||||
const u8 i3 = (value >> 3) & 1;
|
||||
const u8 i2 = (value >> 2) & 1;
|
||||
const u8 i1 = (value >> 1) & 1;
|
||||
const u8 i0 = (value >> 0) & 1;
|
||||
m_palette_normal[value] = combine_weights(weights_normal, i0, i1, i2, i3, i4, 0);
|
||||
m_palette_shadow[value] = combine_weights(weights_sh, i0, i1, i2, i3, i4, 0);
|
||||
m_palette_hilight[value] = combine_weights(weights_sh, i0, i1, i2, i3, i4, 1);
|
||||
@ -147,18 +152,44 @@ WRITE16_MEMBER( sega_16bit_common_base::paletteram_w )
|
||||
m_palette_entries = memshare("paletteram")->bytes() / 2;
|
||||
|
||||
// get the new value
|
||||
uint16_t newval = m_paletteram[offset];
|
||||
u16 newval = m_paletteram[offset];
|
||||
COMBINE_DATA(&newval);
|
||||
m_paletteram[offset] = newval;
|
||||
|
||||
// byte 0 byte 1
|
||||
// sBGR BBBB GGGG RRRR
|
||||
// x000 4321 4321 4321
|
||||
int r = ((newval >> 12) & 0x01) | ((newval << 1) & 0x1e);
|
||||
int g = ((newval >> 13) & 0x01) | ((newval >> 3) & 0x1e);
|
||||
int b = ((newval >> 14) & 0x01) | ((newval >> 7) & 0x1e);
|
||||
const u8 r = ((newval >> 12) & 0x01) | ((newval << 1) & 0x1e);
|
||||
const u8 g = ((newval >> 13) & 0x01) | ((newval >> 3) & 0x1e);
|
||||
const u8 b = ((newval >> 14) & 0x01) | ((newval >> 7) & 0x1e);
|
||||
|
||||
// normal colors
|
||||
// shadow / hilight toggle bit in palette RAM
|
||||
rgb_t effects = (newval & 0x8000) ?
|
||||
rgb_t(m_palette_hilight[r], m_palette_hilight[g], m_palette_hilight[b]) :
|
||||
rgb_t(m_palette_shadow[r], m_palette_shadow[g], m_palette_shadow[b]);
|
||||
m_palette->set_pen_color(offset + 0 * m_palette_entries, m_palette_normal[r], m_palette_normal[g], m_palette_normal[b]);
|
||||
m_palette->set_pen_color(offset + 1 * m_palette_entries, effects);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER( sega_16bit_common_base::hangon_paletteram_w )
|
||||
{
|
||||
// compute the number of entries
|
||||
if (m_palette_entries == 0)
|
||||
m_palette_entries = memshare("paletteram")->bytes() / 2;
|
||||
|
||||
// get the new value
|
||||
u16 newval = m_paletteram[offset];
|
||||
COMBINE_DATA(&newval);
|
||||
m_paletteram[offset] = newval;
|
||||
|
||||
// byte 0 byte 1
|
||||
// xBGR BBBB GGGG RRRR
|
||||
// x000 4321 4321 4321
|
||||
const u8 r = ((newval >> 12) & 0x01) | ((newval << 1) & 0x1e);
|
||||
const u8 g = ((newval >> 13) & 0x01) | ((newval >> 3) & 0x1e);
|
||||
const u8 b = ((newval >> 14) & 0x01) | ((newval >> 7) & 0x1e);
|
||||
|
||||
// hangon has external shadow / hilight toggle bit
|
||||
m_palette->set_pen_color(offset + 0 * m_palette_entries, m_palette_normal[r], m_palette_normal[g], m_palette_normal[b]);
|
||||
m_palette->set_pen_color(offset + 1 * m_palette_entries, m_palette_shadow[r], m_palette_shadow[g], m_palette_shadow[b]);
|
||||
m_palette->set_pen_color(offset + 2 * m_palette_entries, m_palette_hilight[r], m_palette_hilight[g], m_palette_hilight[b]);
|
||||
@ -171,21 +202,23 @@ WRITE16_MEMBER( sega_16bit_common_base::philko_paletteram_w )
|
||||
m_palette_entries = memshare("paletteram")->bytes() / 2;
|
||||
|
||||
// get the new value
|
||||
uint16_t newval = m_paletteram[offset];
|
||||
u16 newval = m_paletteram[offset];
|
||||
COMBINE_DATA(&newval);
|
||||
m_paletteram[offset] = newval;
|
||||
|
||||
// byte 0 byte 1
|
||||
// sRRR RRGG GGGB BBBB
|
||||
// x432 1043 2104 3210
|
||||
int b = (newval >> 0) & 0x1f;
|
||||
int g = (newval >> 5) & 0x1f;
|
||||
int r = (newval >> 10) & 0x1f;
|
||||
const u8 b = (newval >> 0) & 0x1f;
|
||||
const u8 g = (newval >> 5) & 0x1f;
|
||||
const u8 r = (newval >> 10) & 0x1f;
|
||||
|
||||
// normal colors
|
||||
// shadow / hilight toggle bit in palette RAM
|
||||
rgb_t effects = (newval & 0x8000) ?
|
||||
rgb_t(m_palette_hilight[r], m_palette_hilight[g], m_palette_hilight[b]) :
|
||||
rgb_t(m_palette_shadow[r], m_palette_shadow[g], m_palette_shadow[b]);
|
||||
m_palette->set_pen_color(offset + 0 * m_palette_entries, m_palette_normal[r], m_palette_normal[g], m_palette_normal[b]);
|
||||
m_palette->set_pen_color(offset + 1 * m_palette_entries, m_palette_shadow[r], m_palette_shadow[g], m_palette_shadow[b]);
|
||||
m_palette->set_pen_color(offset + 2 * m_palette_entries, m_palette_hilight[r], m_palette_hilight[g], m_palette_hilight[b]);
|
||||
m_palette->set_pen_color(offset + 1 * m_palette_entries, effects);
|
||||
}
|
||||
|
||||
|
||||
@ -198,7 +231,7 @@ WRITE16_MEMBER( sega_16bit_common_base::philko_paletteram_w )
|
||||
// sega_315_5195_mapper_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
sega_315_5195_mapper_device::sega_315_5195_mapper_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
sega_315_5195_mapper_device::sega_315_5195_mapper_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||
: device_t(mconfig, SEGA_315_5195_MEM_MAPPER, tag, owner, clock)
|
||||
, m_cpu(*this, finder_base::DUMMY_TAG)
|
||||
, m_cpuregion(*this, finder_base::DUMMY_TAG)
|
||||
@ -225,7 +258,7 @@ WRITE8_MEMBER( sega_315_5195_mapper_device::write )
|
||||
if (LOG_MEMORY_MAP) osd_printf_debug("(Write %02X = %02X)\n", offset, data);
|
||||
|
||||
// remember the previous value and swap in the new one
|
||||
uint8_t oldval = m_regs[offset];
|
||||
const u8 oldval = m_regs[offset];
|
||||
m_regs[offset] = data;
|
||||
|
||||
// switch off the offset
|
||||
@ -260,13 +293,13 @@ if (LOG_MEMORY_MAP) osd_printf_debug("(Write %02X = %02X)\n", offset, data);
|
||||
// 02 - read data into latches 00,01 from 2 * (address in 07,08,09)
|
||||
if (data == 0x01)
|
||||
{
|
||||
offs_t addr = (m_regs[0x0a] << 17) | (m_regs[0x0b] << 9) | (m_regs[0x0c] << 1);
|
||||
const offs_t addr = (m_regs[0x0a] << 17) | (m_regs[0x0b] << 9) | (m_regs[0x0c] << 1);
|
||||
m_space->write_word(addr, (m_regs[0x00] << 8) | m_regs[0x01]);
|
||||
}
|
||||
else if (data == 0x02)
|
||||
{
|
||||
offs_t addr = (m_regs[0x07] << 17) | (m_regs[0x08] << 9) | (m_regs[0x09] << 1);
|
||||
uint16_t result = m_space->read_word(addr);
|
||||
const offs_t addr = (m_regs[0x07] << 17) | (m_regs[0x08] << 9) | (m_regs[0x09] << 1);
|
||||
const u16 result = m_space->read_word(addr);
|
||||
m_regs[0x00] = result >> 8;
|
||||
m_regs[0x01] = result;
|
||||
}
|
||||
@ -337,7 +370,7 @@ READ8_MEMBER( sega_315_5195_mapper_device::read )
|
||||
logerror("Unknown memory_mapper_r from address %02X\n", offset);
|
||||
break;
|
||||
}
|
||||
return (space.data_width() == 8) ? 0xff : machine().driver_data<sega_16bit_common_base>()->open_bus_r(space, 0, 0xffff);
|
||||
return (space.data_width() == 8) ? 0xff : machine().driver_data<sega_16bit_common_base>()->open_bus_r(space);
|
||||
}
|
||||
|
||||
|
||||
@ -345,7 +378,7 @@ READ8_MEMBER( sega_315_5195_mapper_device::read )
|
||||
// map_as_rom - map a region as ROM data
|
||||
//-------------------------------------------------
|
||||
|
||||
void sega_315_5195_mapper_device::map_as_rom(uint32_t offset, uint32_t length, offs_t mirror, const char *bank_name, const char *decrypted_bank_name, offs_t rgnoffset, write16_delegate whandler)
|
||||
void sega_315_5195_mapper_device::map_as_rom(u32 offset, u32 length, offs_t mirror, const char *bank_name, const char *decrypted_bank_name, offs_t rgnoffset, write16_delegate whandler)
|
||||
{
|
||||
// determine parameters
|
||||
region_info info;
|
||||
@ -358,7 +391,7 @@ void sega_315_5195_mapper_device::map_as_rom(uint32_t offset, uint32_t length, o
|
||||
}
|
||||
|
||||
// don't map if the start is past the end of the ROM region
|
||||
offs_t romsize = m_cpuregion->bytes();
|
||||
const offs_t romsize = m_cpuregion->bytes();
|
||||
if (rgnoffset < romsize)
|
||||
{
|
||||
// clamp the end to the ROM size
|
||||
@ -374,7 +407,7 @@ void sega_315_5195_mapper_device::map_as_rom(uint32_t offset, uint32_t length, o
|
||||
// configure the bank
|
||||
memory_bank *bank = owner()->membank(bank_name);
|
||||
memory_bank *decrypted_bank = owner()->membank(decrypted_bank_name);
|
||||
uint8_t *memptr = m_cpuregion->base() + rgnoffset;
|
||||
u8 *memptr = m_cpuregion->base() + rgnoffset;
|
||||
bank->set_base(memptr);
|
||||
|
||||
// remember this bank, and decrypt if necessary
|
||||
@ -398,7 +431,7 @@ void sega_315_5195_mapper_device::map_as_rom(uint32_t offset, uint32_t length, o
|
||||
// optional write handler
|
||||
//-------------------------------------------------
|
||||
|
||||
void sega_315_5195_mapper_device::map_as_ram(uint32_t offset, uint32_t length, offs_t mirror, const char *bank_share_name, write16_delegate whandler)
|
||||
void sega_315_5195_mapper_device::map_as_ram(u32 offset, u32 length, offs_t mirror, const char *bank_share_name, write16_delegate whandler)
|
||||
{
|
||||
// determine parameters
|
||||
region_info info;
|
||||
@ -433,7 +466,7 @@ void sega_315_5195_mapper_device::map_as_ram(uint32_t offset, uint32_t length, o
|
||||
// read write handlers
|
||||
//-------------------------------------------------
|
||||
|
||||
void sega_315_5195_mapper_device::map_as_handler(uint32_t offset, uint32_t length, offs_t mirror, read16_delegate rhandler, write16_delegate whandler)
|
||||
void sega_315_5195_mapper_device::map_as_handler(u32 offset, u32 length, offs_t mirror, read16_delegate rhandler, write16_delegate whandler)
|
||||
{
|
||||
// determine parameters
|
||||
region_info info;
|
||||
@ -462,7 +495,7 @@ void sega_315_5195_mapper_device::map_as_handler(uint32_t offset, uint32_t lengt
|
||||
// memory map
|
||||
//-------------------------------------------------
|
||||
|
||||
void sega_315_5195_mapper_device::configure_explicit(const uint8_t *map_data)
|
||||
void sega_315_5195_mapper_device::configure_explicit(const u8 *map_data)
|
||||
{
|
||||
memcpy(&m_regs[0x10], map_data, 0x10);
|
||||
update_mapping();
|
||||
@ -474,7 +507,7 @@ void sega_315_5195_mapper_device::configure_explicit(const uint8_t *map_data)
|
||||
// of state changes
|
||||
//-------------------------------------------------
|
||||
|
||||
void sega_315_5195_mapper_device::fd1094_state_change(uint8_t state)
|
||||
void sega_315_5195_mapper_device::fd1094_state_change(u8 state)
|
||||
{
|
||||
// iterate over regions and set the decrypted address of any ROM banks
|
||||
for (auto & elem : m_banks)
|
||||
@ -579,7 +612,7 @@ void sega_315_5195_mapper_device::device_reset()
|
||||
m_cpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
|
||||
|
||||
// clear registers and recompute the memory mapping
|
||||
memset(m_regs, 0, sizeof(m_regs));
|
||||
std::fill(std::begin(m_regs), std::end(m_regs), 0);
|
||||
update_mapping();
|
||||
|
||||
// release the CPU
|
||||
@ -600,7 +633,7 @@ void sega_315_5195_mapper_device::device_reset()
|
||||
// actual underlying bus connections
|
||||
//-------------------------------------------------
|
||||
|
||||
void sega_315_5195_mapper_device::compute_region(region_info &info, uint8_t index, uint32_t length, uint32_t mirror, uint32_t offset)
|
||||
void sega_315_5195_mapper_device::compute_region(region_info &info, u8 index, u32 length, u32 mirror, u32 offset)
|
||||
{
|
||||
static const offs_t region_size_map[4] = { 0x00ffff, 0x01ffff, 0x07ffff, 0x1fffff };
|
||||
info.size_mask = region_size_map[m_regs[0x10 + 2 * index] & 3];
|
||||
@ -634,7 +667,6 @@ void sega_315_5195_mapper_device::update_mapping()
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// DECRYPT BANK HELPER CLASS
|
||||
//**************************************************************************
|
||||
@ -644,13 +676,13 @@ void sega_315_5195_mapper_device::update_mapping()
|
||||
//-------------------------------------------------
|
||||
|
||||
sega_315_5195_mapper_device::decrypt_bank::decrypt_bank()
|
||||
: m_bank(nullptr),
|
||||
m_decrypted_bank(nullptr),
|
||||
m_start(0),
|
||||
m_end(0),
|
||||
m_rgnoffs(~0),
|
||||
m_srcptr(nullptr),
|
||||
m_fd1089(nullptr)
|
||||
: m_bank(nullptr)
|
||||
, m_decrypted_bank(nullptr)
|
||||
, m_start(0)
|
||||
, m_end(0)
|
||||
, m_rgnoffs(~0)
|
||||
, m_srcptr(nullptr)
|
||||
, m_fd1089(nullptr)
|
||||
{
|
||||
// invalidate all states
|
||||
reset();
|
||||
@ -696,7 +728,7 @@ void sega_315_5195_mapper_device::decrypt_bank::set_decrypt(fd1094_device *fd109
|
||||
// a change
|
||||
//-------------------------------------------------
|
||||
|
||||
void sega_315_5195_mapper_device::decrypt_bank::set(memory_bank *bank, memory_bank *decrypted_bank, offs_t start, offs_t end, offs_t rgnoffs, uint8_t *src)
|
||||
void sega_315_5195_mapper_device::decrypt_bank::set(memory_bank *bank, memory_bank *decrypted_bank, offs_t start, offs_t end, offs_t rgnoffs, u8 *src)
|
||||
{
|
||||
// ignore if not encrypted
|
||||
if (m_fd1089 == nullptr && m_fd1094_cache == nullptr)
|
||||
@ -741,7 +773,7 @@ void sega_315_5195_mapper_device::decrypt_bank::update()
|
||||
if (m_fd1089 != nullptr)
|
||||
{
|
||||
m_fd1089_decrypted.resize((m_end + 1 - m_start) / 2);
|
||||
m_fd1089->decrypt(m_start, m_end + 1 - m_start, m_rgnoffs, &m_fd1089_decrypted[0], reinterpret_cast<uint16_t *>(m_srcptr));
|
||||
m_fd1089->decrypt(m_start, m_end + 1 - m_start, m_rgnoffs, &m_fd1089_decrypted[0], reinterpret_cast<u16 *>(m_srcptr));
|
||||
m_decrypted_bank->set_base(&m_fd1089_decrypted[0]);
|
||||
}
|
||||
|
||||
@ -760,7 +792,7 @@ void sega_315_5195_mapper_device::decrypt_bank::update()
|
||||
// sega_315_5248_multiplier_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
sega_315_5248_multiplier_device::sega_315_5248_multiplier_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
sega_315_5248_multiplier_device::sega_315_5248_multiplier_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||
: device_t(mconfig, SEGA_315_5248_MULTIPLIER, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
@ -770,7 +802,7 @@ sega_315_5248_multiplier_device::sega_315_5248_multiplier_device(const machine_c
|
||||
// read - read the registers
|
||||
//-------------------------------------------------
|
||||
|
||||
READ16_MEMBER( sega_315_5248_multiplier_device::read )
|
||||
u16 sega_315_5248_multiplier_device::read(offs_t offset)
|
||||
{
|
||||
switch (offset & 3)
|
||||
{
|
||||
@ -779,8 +811,8 @@ READ16_MEMBER( sega_315_5248_multiplier_device::read )
|
||||
case 1: return m_regs[1];
|
||||
|
||||
// if bit 1 is 1, return ther results
|
||||
case 2: return (int16_t(m_regs[0]) * int16_t(m_regs[1])) >> 16;
|
||||
case 3: return (int16_t(m_regs[0]) * int16_t(m_regs[1])) & 0xffff;
|
||||
case 2: return (s16(m_regs[0]) * s16(m_regs[1])) >> 16;
|
||||
case 3: return (s16(m_regs[0]) * s16(m_regs[1])) & 0xffff;
|
||||
}
|
||||
|
||||
// should never get here
|
||||
@ -792,7 +824,7 @@ READ16_MEMBER( sega_315_5248_multiplier_device::read )
|
||||
// write - write to the registers
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE16_MEMBER( sega_315_5248_multiplier_device::write )
|
||||
void sega_315_5248_multiplier_device::write(offs_t offset, u16 data, u16 mem_mask)
|
||||
{
|
||||
// only low bit matters
|
||||
COMBINE_DATA(&m_regs[offset & 1]);
|
||||
@ -815,11 +847,10 @@ void sega_315_5248_multiplier_device::device_start()
|
||||
|
||||
void sega_315_5248_multiplier_device::device_reset()
|
||||
{
|
||||
memset(m_regs, 0, sizeof(m_regs));
|
||||
std::fill(std::begin(m_regs), std::end(m_regs), 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// 315-5249 DIVIDER
|
||||
//**************************************************************************
|
||||
@ -828,7 +859,7 @@ void sega_315_5248_multiplier_device::device_reset()
|
||||
// sega_315_5249_divider_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
sega_315_5249_divider_device::sega_315_5249_divider_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
sega_315_5249_divider_device::sega_315_5249_divider_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||
: device_t(mconfig, SEGA_315_5249_DIVIDER, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
@ -838,7 +869,7 @@ sega_315_5249_divider_device::sega_315_5249_divider_device(const machine_config
|
||||
// read - read the registers
|
||||
//-------------------------------------------------
|
||||
|
||||
READ16_MEMBER( sega_315_5249_divider_device::read )
|
||||
u16 sega_315_5249_divider_device::read(offs_t offset)
|
||||
{
|
||||
// 8 effective read registers
|
||||
switch (offset & 7)
|
||||
@ -858,7 +889,7 @@ READ16_MEMBER( sega_315_5249_divider_device::read )
|
||||
// write - write to the registers
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE16_MEMBER( sega_315_5249_divider_device::write )
|
||||
void sega_315_5249_divider_device::write(offs_t offset, u16 data, u16 mem_mask)
|
||||
{
|
||||
if (LOG_DIVIDE) logerror("divide_w(%X) = %04X\n", offset, data);
|
||||
|
||||
@ -893,7 +924,7 @@ void sega_315_5249_divider_device::device_start()
|
||||
|
||||
void sega_315_5249_divider_device::device_reset()
|
||||
{
|
||||
memset(m_regs, 0, sizeof(m_regs));
|
||||
std::fill(std::begin(m_regs), std::end(m_regs), 0);
|
||||
}
|
||||
|
||||
|
||||
@ -910,14 +941,14 @@ void sega_315_5249_divider_device::execute(int mode)
|
||||
if (mode == 0)
|
||||
{
|
||||
// perform signed divide
|
||||
int32_t dividend = int32_t((m_regs[0] << 16) | m_regs[1]);
|
||||
int32_t divisor = int16_t(m_regs[2]);
|
||||
int32_t quotient;
|
||||
const s32 dividend = s32((m_regs[0] << 16) | m_regs[1]);
|
||||
const s32 divisor = s16(m_regs[2]);
|
||||
s32 quotient;
|
||||
|
||||
// check for divide by 0, signal if we did
|
||||
if (divisor == 0)
|
||||
{
|
||||
quotient = dividend;//((int32_t)(dividend ^ divisor) < 0) ? 0x8000 : 0x7fff;
|
||||
quotient = dividend;//((s32)(dividend ^ divisor) < 0) ? 0x8000 : 0x7fff;
|
||||
m_regs[6] |= 0x4000;
|
||||
}
|
||||
else
|
||||
@ -936,17 +967,17 @@ void sega_315_5249_divider_device::execute(int mode)
|
||||
}
|
||||
|
||||
// store quotient and remainder
|
||||
m_regs[4] = int16_t(quotient);
|
||||
m_regs[5] = int16_t(dividend - quotient * divisor);
|
||||
m_regs[4] = s16(quotient);
|
||||
m_regs[5] = s16(dividend - quotient * divisor);
|
||||
}
|
||||
|
||||
// mode 1: unsigned divide, 32-bit quotient only
|
||||
else
|
||||
{
|
||||
// perform unsigned divide
|
||||
uint32_t dividend = uint32_t((m_regs[0] << 16) | m_regs[1]);
|
||||
uint32_t divisor = uint16_t(m_regs[2]);
|
||||
uint32_t quotient;
|
||||
const u32 dividend = u32((m_regs[0] << 16) | m_regs[1]);
|
||||
const u32 divisor = u16(m_regs[2]);
|
||||
u32 quotient;
|
||||
|
||||
// check for divide by 0, signal if we did
|
||||
if (divisor == 0)
|
||||
@ -973,7 +1004,7 @@ void sega_315_5249_divider_device::execute(int mode)
|
||||
// constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
sega_315_5250_compare_timer_device::sega_315_5250_compare_timer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
sega_315_5250_compare_timer_device::sega_315_5250_compare_timer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||
: device_t(mconfig, SEGA_315_5250_COMPARE_TIMER, tag, owner, clock)
|
||||
, m_68kint_callback(*this)
|
||||
, m_zint_callback(*this)
|
||||
@ -997,7 +1028,7 @@ WRITE_LINE_MEMBER(sega_315_5250_compare_timer_device::exck_w)
|
||||
return;
|
||||
|
||||
// if we're enabled, clock the upcounter
|
||||
int old_counter = m_counter;
|
||||
const int old_counter = m_counter;
|
||||
if (m_regs[10] & 1)
|
||||
m_counter++;
|
||||
|
||||
@ -1026,7 +1057,7 @@ void sega_315_5250_compare_timer_device::interrupt_ack()
|
||||
// read - read the registers
|
||||
//-------------------------------------------------
|
||||
|
||||
READ16_MEMBER(sega_315_5250_compare_timer_device::read)
|
||||
u16 sega_315_5250_compare_timer_device::read(offs_t offset)
|
||||
{
|
||||
if (LOG_COMPARE) logerror("compare_r(%X) = %04X\n", offset, m_regs[offset]);
|
||||
switch (offset & 15)
|
||||
@ -1050,7 +1081,7 @@ READ16_MEMBER(sega_315_5250_compare_timer_device::read)
|
||||
// write - write to the registers
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE16_MEMBER(sega_315_5250_compare_timer_device::write)
|
||||
void sega_315_5250_compare_timer_device::write(offs_t offset, u16 data, u16 mem_mask)
|
||||
{
|
||||
if (LOG_COMPARE) logerror("compare_w(%X) = %04X\n", offset, data);
|
||||
switch (offset & 15)
|
||||
@ -1098,7 +1129,7 @@ void sega_315_5250_compare_timer_device::device_start()
|
||||
|
||||
void sega_315_5250_compare_timer_device::device_reset()
|
||||
{
|
||||
memset(m_regs, 0, sizeof(m_regs));
|
||||
std::fill(std::begin(m_regs), std::end(m_regs), 0);
|
||||
m_counter = 0;
|
||||
m_bit = 0;
|
||||
|
||||
@ -1124,7 +1155,7 @@ TIMER_CALLBACK_MEMBER(sega_315_5250_compare_timer_device::write_to_sound)
|
||||
// zread - read data from sound CPU bus
|
||||
//-------------------------------------------------
|
||||
|
||||
READ8_MEMBER(sega_315_5250_compare_timer_device::zread)
|
||||
u8 sega_315_5250_compare_timer_device::zread()
|
||||
{
|
||||
if (!m_zint_callback.isnull() && !machine().side_effects_disabled())
|
||||
m_zint_callback(CLEAR_LINE);
|
||||
@ -1139,12 +1170,12 @@ READ8_MEMBER(sega_315_5250_compare_timer_device::zread)
|
||||
|
||||
void sega_315_5250_compare_timer_device::execute(bool update_history)
|
||||
{
|
||||
int16_t bound1 = int16_t(m_regs[0]);
|
||||
int16_t bound2 = int16_t(m_regs[1]);
|
||||
int16_t value = int16_t(m_regs[2]);
|
||||
const s16 bound1 = s16(m_regs[0]);
|
||||
const s16 bound2 = s16(m_regs[1]);
|
||||
const s16 value = s16(m_regs[2]);
|
||||
|
||||
int16_t min = (bound1 < bound2) ? bound1 : bound2;
|
||||
int16_t max = (bound1 > bound2) ? bound1 : bound2;
|
||||
const s16 min = (bound1 < bound2) ? bound1 : bound2;
|
||||
const s16 max = (bound1 > bound2) ? bound1 : bound2;
|
||||
|
||||
if (value < min)
|
||||
{
|
||||
|
@ -29,10 +29,11 @@ class sega_16bit_common_base : public driver_device
|
||||
{
|
||||
public:
|
||||
// open bus read helpers
|
||||
DECLARE_READ16_MEMBER( open_bus_r );
|
||||
u16 open_bus_r(address_space &space);
|
||||
|
||||
// palette helpers
|
||||
DECLARE_WRITE16_MEMBER( paletteram_w );
|
||||
DECLARE_WRITE16_MEMBER( hangon_paletteram_w );
|
||||
DECLARE_WRITE16_MEMBER( philko_paletteram_w );
|
||||
|
||||
protected:
|
||||
@ -44,15 +45,15 @@ protected:
|
||||
|
||||
public: // -- stupid system16.cpp
|
||||
// memory pointers
|
||||
required_shared_ptr<uint16_t> m_paletteram;
|
||||
required_shared_ptr<u16> m_paletteram;
|
||||
protected:
|
||||
|
||||
// internal state
|
||||
bool m_open_bus_recurse; // flag to track recursion through open_bus_r
|
||||
uint32_t m_palette_entries; // number of palette entries
|
||||
uint8_t m_palette_normal[32]; // RGB translations for normal pixels
|
||||
uint8_t m_palette_shadow[32]; // RGB translations for shadowed pixels
|
||||
uint8_t m_palette_hilight[32]; // RGB translations for hilighted pixels
|
||||
bool m_open_bus_recurse; // flag to track recursion through open_bus_r
|
||||
u32 m_palette_entries; // number of palette entries
|
||||
u8 m_palette_normal[32]; // RGB translations for normal pixels
|
||||
u8 m_palette_shadow[32]; // RGB translations for shadowed pixels
|
||||
u8 m_palette_hilight[32]; // RGB translations for hilighted pixels
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
};
|
||||
@ -63,18 +64,18 @@ protected:
|
||||
class sega_315_5195_mapper_device : public device_t
|
||||
{
|
||||
public:
|
||||
typedef device_delegate<void (sega_315_5195_mapper_device &, uint8_t)> mapper_delegate;
|
||||
typedef device_delegate<void (sega_315_5195_mapper_device &, u8)> mapper_delegate;
|
||||
|
||||
// construction/destruction
|
||||
template <typename T>
|
||||
sega_315_5195_mapper_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu_tag)
|
||||
sega_315_5195_mapper_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, T &&cpu_tag)
|
||||
: sega_315_5195_mapper_device(mconfig, tag, owner, clock)
|
||||
{
|
||||
m_cpu.set_tag(std::forward<T>(cpu_tag));
|
||||
m_cpuregion.set_tag(std::forward<T>(cpu_tag));
|
||||
}
|
||||
|
||||
sega_315_5195_mapper_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
sega_315_5195_mapper_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||
|
||||
// configuration helpers
|
||||
template <typename... T> void set_mapper(T &&... args) { m_mapper = mapper_delegate(std::forward<T>(args)...); }
|
||||
@ -89,12 +90,12 @@ public:
|
||||
DECLARE_WRITE8_MEMBER( pwrite );
|
||||
|
||||
// mapping helpers
|
||||
void map_as_rom(uint32_t offset, uint32_t length, offs_t mirror, const char *bank_name, const char *decrypted_bank_name, offs_t rgnoffset, write16_delegate whandler);
|
||||
void map_as_ram(uint32_t offset, uint32_t length, offs_t mirror, const char *bank_share_name, write16_delegate whandler);
|
||||
void map_as_handler(uint32_t offset, uint32_t length, offs_t mirror, read16_delegate rhandler, write16_delegate whandler);
|
||||
void map_as_rom(u32 offset, u32 length, offs_t mirror, const char *bank_name, const char *decrypted_bank_name, offs_t rgnoffset, write16_delegate whandler);
|
||||
void map_as_ram(u32 offset, u32 length, offs_t mirror, const char *bank_share_name, write16_delegate whandler);
|
||||
void map_as_handler(u32 offset, u32 length, offs_t mirror, read16_delegate rhandler, write16_delegate whandler);
|
||||
|
||||
// perform an explicit configuration (for bootlegs with hard-coded mappings)
|
||||
void configure_explicit(const uint8_t *map_data);
|
||||
void configure_explicit(const u8 *map_data);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@ -127,7 +128,7 @@ private:
|
||||
void set_decrypt(fd1089_base_device *fd1089);
|
||||
void set_decrypt(fd1094_device *fd1094);
|
||||
void clear() { set(nullptr, nullptr, 0, 0, ~0, nullptr); }
|
||||
void set(memory_bank *bank, memory_bank *decrypted_bank, offs_t start, offs_t end, offs_t rgnoffs, uint8_t *src);
|
||||
void set(memory_bank *bank, memory_bank *decrypted_bank, offs_t start, offs_t end, offs_t rgnoffs, u8 *src);
|
||||
|
||||
// updating
|
||||
void update();
|
||||
@ -135,21 +136,21 @@ private:
|
||||
|
||||
private:
|
||||
// internal state
|
||||
memory_bank * m_bank;
|
||||
memory_bank * m_decrypted_bank;
|
||||
offs_t m_start;
|
||||
offs_t m_end;
|
||||
offs_t m_rgnoffs;
|
||||
uint8_t * m_srcptr;
|
||||
fd1089_base_device * m_fd1089;
|
||||
std::vector<uint16_t> m_fd1089_decrypted;
|
||||
memory_bank * m_bank;
|
||||
memory_bank * m_decrypted_bank;
|
||||
offs_t m_start;
|
||||
offs_t m_end;
|
||||
offs_t m_rgnoffs;
|
||||
u8 * m_srcptr;
|
||||
fd1089_base_device *m_fd1089;
|
||||
std::vector<u16> m_fd1089_decrypted;
|
||||
std::unique_ptr<fd1094_decryption_cache> m_fd1094_cache;
|
||||
};
|
||||
|
||||
// internal helpers
|
||||
void compute_region(region_info &info, uint8_t index, uint32_t length, uint32_t mirror, uint32_t offset = 0);
|
||||
void compute_region(region_info &info, u8 index, u32 length, u32 mirror, u32 offset = 0);
|
||||
void update_mapping();
|
||||
void fd1094_state_change(uint8_t state);
|
||||
void fd1094_state_change(u8 state);
|
||||
|
||||
// configuration
|
||||
required_device<m68000_device> m_cpu;
|
||||
@ -159,15 +160,15 @@ private:
|
||||
devcb_write_line m_mcu_int_callback;
|
||||
|
||||
// internal state
|
||||
address_space * m_space;
|
||||
address_space * m_decrypted_space;
|
||||
uint8_t m_regs[0x20];
|
||||
uint8_t m_curregion;
|
||||
decrypt_bank m_banks[8];
|
||||
address_space * m_space;
|
||||
address_space * m_decrypted_space;
|
||||
u8 m_regs[0x20];
|
||||
u8 m_curregion;
|
||||
decrypt_bank m_banks[8];
|
||||
|
||||
// communication registers
|
||||
uint8_t m_to_sound;
|
||||
uint8_t m_from_sound;
|
||||
u8 m_to_sound;
|
||||
u8 m_from_sound;
|
||||
};
|
||||
|
||||
|
||||
@ -177,11 +178,11 @@ class sega_315_5248_multiplier_device : public device_t
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
sega_315_5248_multiplier_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
sega_315_5248_multiplier_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||
|
||||
// public interface
|
||||
DECLARE_READ16_MEMBER( read );
|
||||
DECLARE_WRITE16_MEMBER( write );
|
||||
u16 read(offs_t offset);
|
||||
void write(offs_t offset, u16 data, u16 mem_mask = ~0);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@ -190,7 +191,7 @@ protected:
|
||||
|
||||
private:
|
||||
// internal state
|
||||
uint16_t m_regs[4];
|
||||
u16 m_regs[4];
|
||||
};
|
||||
|
||||
|
||||
@ -200,11 +201,11 @@ class sega_315_5249_divider_device : public device_t
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
sega_315_5249_divider_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
sega_315_5249_divider_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||
|
||||
// public interface
|
||||
DECLARE_READ16_MEMBER( read );
|
||||
DECLARE_WRITE16_MEMBER( write );
|
||||
u16 read(offs_t offset);
|
||||
void write(offs_t offset, u16 data, u16 mem_mask = ~0);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@ -216,7 +217,7 @@ private:
|
||||
void execute(int mode);
|
||||
|
||||
// internal state
|
||||
uint16_t m_regs[8];
|
||||
u16 m_regs[8];
|
||||
};
|
||||
|
||||
|
||||
@ -226,7 +227,7 @@ class sega_315_5250_compare_timer_device : public device_t
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
sega_315_5250_compare_timer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
sega_315_5250_compare_timer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||
|
||||
// configuration helpers
|
||||
auto m68kint_callback() { return m_68kint_callback.bind(); }
|
||||
@ -234,9 +235,9 @@ public:
|
||||
|
||||
// public interface
|
||||
DECLARE_WRITE_LINE_MEMBER(exck_w);
|
||||
DECLARE_READ16_MEMBER(read);
|
||||
DECLARE_WRITE16_MEMBER(write);
|
||||
DECLARE_READ8_MEMBER(zread);
|
||||
u16 read(offs_t offset);
|
||||
void write(offs_t offset, u16 data, u16 mem_mask = ~0);
|
||||
u8 zread();
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@ -250,14 +251,14 @@ private:
|
||||
TIMER_CALLBACK_MEMBER(write_to_sound);
|
||||
|
||||
// configuration
|
||||
devcb_write_line m_68kint_callback;
|
||||
devcb_write_line m_zint_callback;
|
||||
devcb_write_line m_68kint_callback;
|
||||
devcb_write_line m_zint_callback;
|
||||
|
||||
// internal state
|
||||
uint16_t m_regs[16];
|
||||
uint16_t m_counter;
|
||||
uint8_t m_bit;
|
||||
bool m_exck;
|
||||
u16 m_regs[16];
|
||||
u16 m_counter;
|
||||
u8 m_bit;
|
||||
bool m_exck;
|
||||
};
|
||||
|
||||
|
||||
|
@ -113,7 +113,7 @@ uint32_t segahang_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
|
||||
{
|
||||
// if shadow bit is 0 and pix data is 0xa, this triggers shadow/hilight
|
||||
if ((pix & 0x80f) == 0x00a)
|
||||
dest[x] += (m_paletteram[dest[x]] & 0x8000) ? m_palette_entries*2 : m_palette_entries;
|
||||
dest[x] += m_palette_entries;
|
||||
|
||||
// otherwise, just add in sprite palette base
|
||||
else
|
||||
|
@ -89,7 +89,7 @@ uint32_t segaorun_state::screen_update_shangon(screen_device &screen, bitmap_ind
|
||||
{
|
||||
// if the color is set to maximum, shadow pixels underneath us
|
||||
if ((pix & 0x03f0) == 0x03f0)
|
||||
dest[x] += (m_paletteram[dest[x]] & 0x8000) ? m_palette_entries*2 : m_palette_entries;
|
||||
dest[x] += m_palette_entries;
|
||||
|
||||
// otherwise, just add in sprite palette base
|
||||
else
|
||||
@ -156,7 +156,7 @@ uint32_t segaorun_state::screen_update_outrun(screen_device &screen, bitmap_ind1
|
||||
{
|
||||
// if the shadow flag is set, this triggers shadow/hilight for pen 0xa
|
||||
if ((pix & 0x400f) == 0x400a)
|
||||
dest[x] += (m_paletteram[dest[x]] & 0x8000) ? m_palette_entries*2 : m_palette_entries;
|
||||
dest[x] += m_palette_entries;
|
||||
|
||||
// otherwise, just add in sprite palette base
|
||||
else
|
||||
|
@ -78,7 +78,7 @@ uint32_t segas16a_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
|
||||
{
|
||||
// if color bits are all 1, this triggers shadow/hilight
|
||||
if ((pix & 0x3f0) == 0x3f0)
|
||||
dest[x] += (m_paletteram[dest[x]] & 0x8000) ? m_palette_entries*2 : m_palette_entries;
|
||||
dest[x] += m_palette_entries;
|
||||
|
||||
// otherwise, just add in sprite palette base
|
||||
else
|
||||
|
@ -80,7 +80,7 @@ uint32_t segas16b_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
|
||||
{
|
||||
// if the color is set to maximum, shadow pixels underneath us
|
||||
if ((pix & 0x03f0) == 0x03f0)
|
||||
dest[x] += (m_paletteram[dest[x]] & 0x8000) ? m_palette_entries*2 : m_palette_entries;
|
||||
dest[x] += m_palette_entries;
|
||||
|
||||
// otherwise, just add in sprite palette base
|
||||
else
|
||||
|
@ -114,14 +114,14 @@ void segas18_state::draw_vdp(screen_device &screen, bitmap_ind16 &bitmap, const
|
||||
switch (pix & 0xc0)
|
||||
{
|
||||
case 0x00:
|
||||
dst[x] = pix + 0x2000; /* 0x2040 - would be shadow? */
|
||||
dst[x] = pix + 0x1000; /* 0x1040 - would be shadow? */
|
||||
break;
|
||||
case 0x40:
|
||||
case 0x80:
|
||||
dst[x] = pix + 0x2000;
|
||||
dst[x] = pix + 0x1000;
|
||||
break;
|
||||
case 0xc0:
|
||||
dst[x] = pix + 0x2000; /* 0x2080 - would be higlight? */
|
||||
dst[x] = pix + 0x1000; /* 0x1080 - would be higlight? */
|
||||
break;
|
||||
}
|
||||
pri[x] |= priority;
|
||||
@ -240,7 +240,7 @@ uint32_t segas18_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
|
||||
{
|
||||
// if the color is set to maximum, shadow pixels underneath us
|
||||
if ((pix & 0x03f0) == 0x03f0)
|
||||
dest[x] += (m_paletteram[dest[x]] & 0x8000) ? m_palette_entries*2 : m_palette_entries;
|
||||
dest[x] += m_palette_entries;
|
||||
|
||||
// otherwise, just add in sprite palette base
|
||||
else
|
||||
|
@ -91,7 +91,7 @@ uint32_t segaxbd_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
|
||||
{
|
||||
// if the shadow flag is set, this triggers shadow/hilight for pen 0xa
|
||||
if ((pix & 0x400f) == 0x400a)
|
||||
dest[x] += (m_paletteram[dest[x]] & 0x8000) ? m_palette_entries*2 : m_palette_entries;
|
||||
dest[x] += m_palette_entries;
|
||||
|
||||
// otherwise, just add in sprite palette base
|
||||
else
|
||||
|
@ -79,7 +79,7 @@ uint32_t segaybd_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
|
||||
{
|
||||
// if the color is set to maximum, shadow pixels underneath us
|
||||
if ((pix & 0xf) == 0xe)
|
||||
dest[x] += (m_paletteram[dest[x]] & 0x8000) ? m_palette_entries*2 : m_palette_entries;
|
||||
dest[x] += m_palette_entries;
|
||||
|
||||
// otherwise, just add in sprite palette base
|
||||
else
|
||||
|
@ -659,7 +659,7 @@ uint32_t segas1x_bootleg_state::screen_update_s16a_bootleg(screen_device &screen
|
||||
{
|
||||
// if the color is set to maximum, shadow pixels underneath us
|
||||
if ((pix & 0x03f0) == 0x03f0)
|
||||
dest[x] += (m_paletteram[dest[x]] & 0x8000) ? m_palette_entries*2 : m_palette_entries;
|
||||
dest[x] += m_palette_entries;
|
||||
|
||||
// otherwise, just add in sprite palette base
|
||||
else
|
||||
@ -729,7 +729,7 @@ uint32_t segas1x_bootleg_state::screen_update_s16a_bootleg_passht4b(screen_devic
|
||||
{
|
||||
// if the color is set to maximum, shadow pixels underneath us
|
||||
if ((pix & 0x03f0) == 0x03f0)
|
||||
dest[x] += (m_paletteram[dest[x]] & 0x8000) ? m_palette_entries*2 : m_palette_entries;
|
||||
dest[x] += m_palette_entries;
|
||||
|
||||
// otherwise, just add in sprite palette base
|
||||
else
|
||||
@ -811,7 +811,7 @@ uint32_t segas1x_bootleg_state::screen_update_system16(screen_device &screen, bi
|
||||
{
|
||||
// if the color is set to maximum, shadow pixels underneath us
|
||||
if ((pix & 0x03f0) == 0x03f0)
|
||||
dest[x] += (m_paletteram[dest[x]] & 0x8000) ? m_palette_entries*2 : m_palette_entries;
|
||||
dest[x] += m_palette_entries;
|
||||
|
||||
// otherwise, just add in sprite palette base
|
||||
else
|
||||
@ -874,7 +874,7 @@ uint32_t segas1x_bootleg_state::screen_update_system18old(screen_device &screen,
|
||||
{
|
||||
// if the color is set to maximum, shadow pixels underneath us
|
||||
if ((pix & 0x03f0) == 0x03f0)
|
||||
dest[x] += (m_paletteram[dest[x]] & 0x8000) ? m_palette_entries*2 : m_palette_entries;
|
||||
dest[x] += m_palette_entries;
|
||||
|
||||
// otherwise, just add in sprite palette base
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user