summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/video/315_5124.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/video/315_5124.cpp')
-rw-r--r--src/devices/video/315_5124.cpp196
1 files changed, 94 insertions, 102 deletions
diff --git a/src/devices/video/315_5124.cpp b/src/devices/video/315_5124.cpp
index 90b94577376..ef3b07d1f4f 100644
--- a/src/devices/video/315_5124.cpp
+++ b/src/devices/video/315_5124.cpp
@@ -88,12 +88,12 @@ PAL frame timing
#define BOTTOM_BORDER 4
#define BOTTOM_BLANKING 5
-static constexpr u8 ntsc_192[6] = { 3, 13, 27, 192, 24, 3 };
-static constexpr u8 ntsc_224[6] = { 3, 13, 11, 224, 8, 3 };
-static constexpr u8 ntsc_240[6] = { 3, 13, 3, 240, 0, 3 };
-static constexpr u8 pal_192[6] = { 3, 13, 54, 192, 48, 3 };
-static constexpr u8 pal_224[6] = { 3, 13, 38, 224, 32, 3 };
-static constexpr u8 pal_240[6] = { 3, 13, 30, 240, 24, 3 };
+static constexpr uint8_t ntsc_192[6] = { 3, 13, 27, 192, 24, 3 };
+static constexpr uint8_t ntsc_224[6] = { 3, 13, 11, 224, 8, 3 };
+static constexpr uint8_t ntsc_240[6] = { 3, 13, 3, 240, 0, 3 };
+static constexpr uint8_t pal_192[6] = { 3, 13, 54, 192, 48, 3 };
+static constexpr uint8_t pal_224[6] = { 3, 13, 38, 224, 32, 3 };
+static constexpr uint8_t pal_240[6] = { 3, 13, 30, 240, 24, 3 };
#define VINT_HPOS 0
#define VINT_FLAG_HPOS 1
@@ -104,8 +104,8 @@ static constexpr u8 pal_240[6] = { 3, 13, 30, 240, 24, 3 };
#define SPROVR_HPOS 6
#define SPRCOL_BASEHPOS 7
-static constexpr u8 line_315_5124[8] = { 24, 24, 26, 28 /* not verified */, 21, 23, 24, 59 };
-static constexpr u8 line_315_5377[8] = { 26, 26, 27, 28 /* not verified */, 24, 28, 26, 62 };
+static constexpr uint8_t line_315_5124[8] = { 24, 24, 26, 28 /* not verified */, 21, 23, 24, 59 };
+static constexpr uint8_t line_315_5377[8] = { 26, 26, 27, 28 /* not verified */, 24, 28, 26, 62 };
#define DISPLAY_DISABLED_HPOS 24 /* not verified, works if above 18 (for 'pstrike2') and below 25 (for 'fantdizzy') */
#define DISPLAY_CB_HPOS 2 /* fixes 'roadrash' (SMS game) title scrolling, due to line counter reload timing */
@@ -164,22 +164,20 @@ void sega315_5377_device::sega315_5377_palette(palette_device &palette) const
// default address map
void sega315_5124_device::sega315_5124(address_map &map)
{
- if (!has_configured_map(0))
- map(0x0000, VRAM_SIZE-1).ram();
+ map(0x0000, VRAM_SIZE-1).ram();
}
-sega315_5124_device::sega315_5124_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+sega315_5124_device::sega315_5124_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: sega315_5124_device(mconfig, SEGA315_5124, tag, owner, clock, SEGA315_5124_CRAM_SIZE, 0x00, 0x0f, 4, 8, line_315_5124)
{
}
-sega315_5124_device::sega315_5124_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 cram_size, u8 palette_offset, u8 reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const u8 *line_timing)
+sega315_5124_device::sega315_5124_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t cram_size, uint8_t palette_offset, uint8_t reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const uint8_t *line_timing)
: device_t(mconfig, type, tag, owner, clock)
, device_memory_interface(mconfig, *this)
, device_video_interface(mconfig, *this)
- , device_mixer_interface(mconfig, *this, 2)
, m_cram_size(cram_size)
, m_line_timing(line_timing)
, m_palette_offset(palette_offset)
@@ -190,33 +188,32 @@ sega315_5124_device::sega315_5124_device(const machine_config &mconfig, device_t
, m_int_cb(*this)
, m_csync_cb(*this)
, m_pause_cb(*this)
- , m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, address_map_constructor(FUNC(sega315_5124_device::sega315_5124), this))
+ , m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, address_map_constructor(), address_map_constructor(FUNC(sega315_5124_device::sega315_5124), this))
, m_palette(*this, "palette")
- , m_snsnd(*this, "snsnd")
{
}
-sega315_5246_device::sega315_5246_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+sega315_5246_device::sega315_5246_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: sega315_5124_device(mconfig, SEGA315_5246, tag, owner, clock, SEGA315_5124_CRAM_SIZE, 0x00, 0x0f, 8, 8, line_315_5124)
{
}
-sega315_5246_device::sega315_5246_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 cram_size, u8 palette_offset, u8 reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const u8 *line_timing)
+sega315_5246_device::sega315_5246_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t cram_size, uint8_t palette_offset, uint8_t reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const uint8_t *line_timing)
: sega315_5124_device(mconfig, type, tag, owner, clock, cram_size, palette_offset, reg_num_mask, max_sprite_zoom_hcount, max_sprite_zoom_vcount, line_timing)
{
}
// Embedded mode 4 support of the 315-5313 VDP (see 315_5313.cpp), used by Sega Genesis/Mega Drive
-sega315_5313_mode4_device::sega315_5313_mode4_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u8 cram_size, u8 palette_offset, u8 reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const u8 *line_timing)
+sega315_5313_mode4_device::sega315_5313_mode4_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint8_t cram_size, uint8_t palette_offset, uint8_t reg_num_mask, int max_sprite_zoom_hcount, int max_sprite_zoom_vcount, const uint8_t *line_timing)
: sega315_5246_device(mconfig, type, tag, owner, clock, cram_size, palette_offset, reg_num_mask, max_sprite_zoom_hcount, max_sprite_zoom_vcount, line_timing)
{
}
-sega315_5377_device::sega315_5377_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+sega315_5377_device::sega315_5377_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: sega315_5246_device(mconfig, SEGA315_5377, tag, owner, clock, SEGA315_5377_CRAM_SIZE, 0x10, 0x0f, 8, 8, line_315_5377)
{
}
@@ -331,7 +328,7 @@ void sega315_5124_device::set_frame_timing()
}
-u8 sega315_5124_device::vcount_read()
+READ8_MEMBER( sega315_5124_device::vcount_read )
{
const int active_scr_start = m_frame_timing[VERTICAL_SYNC] + m_frame_timing[TOP_BLANKING] + m_frame_timing[TOP_BORDER];
int vpos = screen().vpos();
@@ -347,7 +344,7 @@ u8 sega315_5124_device::vcount_read()
}
-u8 sega315_5124_device::hcount_read()
+READ8_MEMBER( sega315_5124_device::hcount_read )
{
return m_hcounter;
}
@@ -595,10 +592,10 @@ void sega315_5124_device::process_line_timer()
}
-u8 sega315_5124_device::data_read()
+READ8_MEMBER( sega315_5124_device::data_read )
{
/* Return data buffer contents */
- const u8 temp = m_buffer;
+ const uint8_t temp = m_buffer;
/* Clear pending write flag */
m_pending_control_write = false;
@@ -656,9 +653,9 @@ void sega315_5124_device::check_pending_flags()
}
-u8 sega315_5124_device::control_read()
+READ8_MEMBER( sega315_5124_device::control_read )
{
- u8 temp;
+ uint8_t temp;
check_pending_flags();
temp = m_status;
@@ -670,7 +667,7 @@ u8 sega315_5124_device::control_read()
/* Clear status flags */
m_hint_occurred = false;
- m_status = u8(~(STATUS_VINT | STATUS_SPROVR | STATUS_SPRCOL));
+ m_status = uint8_t(~(STATUS_VINT | STATUS_SPROVR | STATUS_SPRCOL));
if (m_irq_state == 1)
{
@@ -685,7 +682,7 @@ u8 sega315_5124_device::control_read()
}
-void sega315_5124_device::write_memory(u8 data)
+void sega315_5124_device::write_memory(uint8_t data)
{
switch (m_addrmode)
{
@@ -705,7 +702,7 @@ void sega315_5124_device::write_memory(u8 data)
}
-void sega315_5313_mode4_device::write_memory(u8 data)
+void sega315_5313_mode4_device::write_memory(uint8_t data)
{
switch (m_addrmode)
{
@@ -723,7 +720,7 @@ void sega315_5313_mode4_device::write_memory(u8 data)
}
-void sega315_5124_device::data_write(u8 data)
+WRITE8_MEMBER( sega315_5124_device::data_write )
{
/* Clear pending write flag */
m_pending_control_write = false;
@@ -733,7 +730,7 @@ void sega315_5124_device::data_write(u8 data)
}
-void sega315_5124_device::load_vram_addr(u8 data)
+void sega315_5124_device::load_vram_addr(uint8_t data)
{
// Seems like the latched data is passed straight through
// to the address register when in the middle of doing a command.
@@ -745,7 +742,7 @@ void sega315_5124_device::load_vram_addr(u8 data)
}
-void sega315_5313_mode4_device::load_vram_addr(u8 data)
+void sega315_5313_mode4_device::load_vram_addr(uint8_t data)
{
if (m_pending_control_write)
m_control_write_data_latch = data;
@@ -754,7 +751,7 @@ void sega315_5313_mode4_device::load_vram_addr(u8 data)
}
-void sega315_5124_device::control_write(u8 data)
+WRITE8_MEMBER( sega315_5124_device::control_write )
{
if (!m_pending_control_write)
{
@@ -862,13 +859,13 @@ void sega315_5124_device::control_write(u8 data)
}
-u16 sega315_5124_device::name_table_row_mode4(int row)
+uint16_t sega315_5124_device::name_table_row_mode4(int row)
{
return ((row >> 3) << 6) & (((m_reg[0x02] & 0x01) << 10) | ((m_reg[0x04] & 0x03) << 11) | 0x23ff);
}
-u16 sega315_5246_device::name_table_row_mode4(int row)
+uint16_t sega315_5246_device::name_table_row_mode4(int row)
{
return (row >> 3) << 6;
}
@@ -900,7 +897,7 @@ void sega315_5124_device::draw_leftmost_pixels_mode4(int *line_buffer, int *prio
// Load data of bit plane 1 for the selected tile.
const int tmp_bit_plane_1 = space().read_byte((tile_selected << 5) + ((parse_line & 0x07) << 2) + 0x01);
- const u8 pen_bit_1 = BIT(tmp_bit_plane_1, 7 - pixel_x);
+ const uint8_t pen_bit_1 = BIT(tmp_bit_plane_1, 7 - pixel_x);
for (int pixel_plot_x = 0; pixel_plot_x < fine_x_scroll; pixel_plot_x++)
{
@@ -934,7 +931,7 @@ void sega315_5124_device::draw_scanline_mode4(int *line_buffer, int *priority_se
const int fine_x_scroll = (x_scroll & 0x07);
int scroll_mod;
- u16 name_table_address;
+ uint16_t name_table_address;
if (m_y_pixels != 192)
{
name_table_address = ((m_reg[0x02] & 0x0c) << 10) | 0x0700;
@@ -956,7 +953,7 @@ void sega315_5124_device::draw_scanline_mode4(int *line_buffer, int *priority_se
/* vertical scrolling when bit 7 of reg[0x00] is set */
const int y_scroll = (BIT(m_reg[0x00], 7) && (tile_column > 23)) ? 0 : m_reg9copy;
- const u16 tile_data = space().read_word(name_table_address + name_table_row_mode4((line + y_scroll) % scroll_mod) + table_column);
+ const uint16_t tile_data = space().read_word(name_table_address + name_table_row_mode4((line + y_scroll) % scroll_mod) + table_column);
const int tile_selected = (tile_data & 0x01ff);
const int priority_select = tile_data & PRIORITY_BIT;
@@ -981,12 +978,12 @@ void sega315_5124_device::draw_scanline_mode4(int *line_buffer, int *priority_se
for (int pixel_x = 0; pixel_x < 8; pixel_x++)
{
- const u8 pen_bit_0 = BIT(bit_plane_0, 7 - pixel_x);
- const u8 pen_bit_1 = BIT(bit_plane_1, 7 - pixel_x);
- const u8 pen_bit_2 = BIT(bit_plane_2, 7 - pixel_x);
- const u8 pen_bit_3 = BIT(bit_plane_3, 7 - pixel_x);
+ const uint8_t pen_bit_0 = BIT(bit_plane_0, 7 - pixel_x);
+ const uint8_t pen_bit_1 = BIT(bit_plane_1, 7 - pixel_x);
+ const uint8_t pen_bit_2 = BIT(bit_plane_2, 7 - pixel_x);
+ const uint8_t pen_bit_3 = BIT(bit_plane_3, 7 - pixel_x);
- u8 pen_selected = (pen_bit_3 << 3 | pen_bit_2 << 2 | pen_bit_1 << 1 | pen_bit_0);
+ uint8_t pen_selected = (pen_bit_3 << 3 | pen_bit_2 << 2 | pen_bit_1 << 1 | pen_bit_0);
if (palette_selected)
pen_selected |= 0x10;
@@ -1003,25 +1000,25 @@ void sega315_5124_device::draw_scanline_mode4(int *line_buffer, int *priority_se
}
-u16 sega315_5124_device::sprite_attributes_addr_mode4(u16 base)
+uint16_t sega315_5124_device::sprite_attributes_addr_mode4(uint16_t base)
{
return base & ((BIT(m_reg[0x05], 0) << 7) | 0x3f7f);
}
-u16 sega315_5246_device::sprite_attributes_addr_mode4(u16 base)
+uint16_t sega315_5246_device::sprite_attributes_addr_mode4(uint16_t base)
{
return base;
}
-u8 sega315_5124_device::sprite_tile_mask_mode4(u8 tile_number)
+uint8_t sega315_5124_device::sprite_tile_mask_mode4(uint8_t tile_number)
{
return tile_number & (((m_reg[0x06] & 0x03) << 6) | 0x3f);
}
-u8 sega315_5246_device::sprite_tile_mask_mode4(u8 tile_number)
+uint8_t sega315_5246_device::sprite_tile_mask_mode4(uint8_t tile_number)
{
return tile_number;
}
@@ -1032,7 +1029,7 @@ void sega315_5124_device::sprite_count_overflow(int line, int sprite_index)
/* Overflow is flagged only on active display and when VINT isn't active */
if (!(m_status & STATUS_VINT) && line >= 0 && line < m_frame_timing[ACTIVE_DISPLAY_V])
{
- u8 sprite_number_bits;
+ uint8_t sprite_number_bits;
m_pending_status |= STATUS_SPROVR;
if (sprite_index < 14)
sprite_number_bits = (sprite_index + 1) / 2;
@@ -1099,7 +1096,7 @@ void sega315_5124_device::select_sprites(int line)
{
const int sprite_x = space().read_byte(m_sprite_base + sprite_index + 1);
int sprite_tile_selected = space().read_byte(m_sprite_base + sprite_index + 2);
- const u8 flags = space().read_byte(m_sprite_base + sprite_index + 3);
+ const uint8_t flags = space().read_byte(m_sprite_base + sprite_index + 3);
int sprite_line = parse_line - sprite_y;
@@ -1268,28 +1265,28 @@ void sega315_5124_device::draw_sprites_mode4(int *line_buffer, int *priority_sel
bool sprite_col_occurred = false;
int sprite_col_x = 255;
- u8 collision_buffer[256] = { 0 };
+ uint8_t collision_buffer[256] = { 0 };
// Draw sprite layer
for (int sprite_buffer_index = m_sprite_count - 1; sprite_buffer_index >= 0; sprite_buffer_index--)
{
const int sprite_x = m_sprite_x[sprite_buffer_index];
const int sprite_tile_selected = m_sprite_tile_selected[sprite_buffer_index];
- const u16 sprite_pattern_line = m_sprite_pattern_line[sprite_buffer_index];
+ const uint16_t sprite_pattern_line = m_sprite_pattern_line[sprite_buffer_index];
const int zoom_scale = sprite_buffer_index < m_max_sprite_zoom_hcount ? m_sprite_zoom_scale : 1;
- const u8 bit_plane_0 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x00);
- const u8 bit_plane_1 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x01);
- const u8 bit_plane_2 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x02);
- const u8 bit_plane_3 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x03);
+ const uint8_t bit_plane_0 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x00);
+ const uint8_t bit_plane_1 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x01);
+ const uint8_t bit_plane_2 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x02);
+ const uint8_t bit_plane_3 = space().read_byte((sprite_tile_selected << 5) + sprite_pattern_line + 0x03);
for (int pixel_x = 0; pixel_x < 8; pixel_x++)
{
- const u8 pen_bit_0 = BIT(bit_plane_0, 7 - pixel_x);
- const u8 pen_bit_1 = BIT(bit_plane_1, 7 - pixel_x);
- const u8 pen_bit_2 = BIT(bit_plane_2, 7 - pixel_x);
- const u8 pen_bit_3 = BIT(bit_plane_3, 7 - pixel_x);
- const u8 pen_selected = (pen_bit_3 << 3 | pen_bit_2 << 2 | pen_bit_1 << 1 | pen_bit_0) | 0x10;
+ const uint8_t pen_bit_0 = BIT(bit_plane_0, 7 - pixel_x);
+ const uint8_t pen_bit_1 = BIT(bit_plane_1, 7 - pixel_x);
+ const uint8_t pen_bit_2 = BIT(bit_plane_2, 7 - pixel_x);
+ const uint8_t pen_bit_3 = BIT(bit_plane_3, 7 - pixel_x);
+ const uint8_t pen_selected = (pen_bit_3 << 3 | pen_bit_2 << 2 | pen_bit_1 << 1 | pen_bit_0) | 0x10;
if (pen_selected == 0x10) // Transparent palette so skip draw
continue;
@@ -1355,15 +1352,15 @@ void sega315_5124_device::draw_sprites_tms9918_mode(int *line_buffer, int line)
bool sprite_col_occurred = false;
int sprite_col_x = 255;
- u8 collision_buffer[256] = { 0 };
+ uint8_t collision_buffer[256] = { 0 };
/* Draw sprite layer */
for (int sprite_buffer_index = m_sprite_count - 1; sprite_buffer_index >= 0; sprite_buffer_index--)
{
int sprite_x = m_sprite_x[sprite_buffer_index];
int sprite_tile_selected = m_sprite_tile_selected[sprite_buffer_index];
- const u16 sprite_pattern_line = m_sprite_pattern_line[sprite_buffer_index];
- const u8 flags = m_sprite_flags[sprite_buffer_index];
+ const uint16_t sprite_pattern_line = m_sprite_pattern_line[sprite_buffer_index];
+ const uint8_t flags = m_sprite_flags[sprite_buffer_index];
const int pen_selected = m_palette_offset + (flags & 0x0f);
const int zoom_scale = sprite_buffer_index < m_max_sprite_zoom_hcount ? m_sprite_zoom_scale : 1;
@@ -1378,7 +1375,7 @@ void sega315_5124_device::draw_sprites_tms9918_mode(int *line_buffer, int line)
sprite_x += (zoom_scale > 1 ? 16 : 8);
}
- u8 pattern = space().read_byte(sprite_pattern_line + sprite_tile_selected * 8);
+ uint8_t pattern = space().read_byte(sprite_pattern_line + sprite_tile_selected * 8);
for (int pixel_x = 0; pixel_x < 8; pixel_x++)
{
@@ -1424,23 +1421,23 @@ void sega315_5124_device::draw_sprites_tms9918_mode(int *line_buffer, int line)
// Display mode 2 (Graphics II Mode)
void sega315_5124_device::draw_scanline_mode2(int *line_buffer, int line)
{
- const u16 name_table_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
- const u16 color_base = ((m_reg[0x03] & 0x80) << 6);
+ const uint16_t name_table_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
+ const uint16_t color_base = ((m_reg[0x03] & 0x80) << 6);
const int color_mask = ((m_reg[0x03] & 0x7f) << 3) | 0x07;
- const u16 pattern_base = ((m_reg[0x04] & 0x04) << 11);
+ const uint16_t pattern_base = ((m_reg[0x04] & 0x04) << 11);
const int pattern_mask = ((m_reg[0x04] & 0x03) << 8) | 0xff;
const int pattern_offset = (line & 0xc0) << 2;
/* Draw background layer */
for (int tile_column = 0; tile_column < 32; tile_column++)
{
- const u8 name = space().read_byte(name_table_base + tile_column);
- const u8 pattern = space().read_byte(pattern_base + (((pattern_offset + name) & pattern_mask) * 8) + (line & 0x07) );
- const u8 colors = space().read_byte(color_base + (((pattern_offset + name) & color_mask) * 8) + (line & 0x07) );
+ const uint8_t name = space().read_byte(name_table_base + tile_column);
+ const uint8_t pattern = space().read_byte(pattern_base + (((pattern_offset + name) & pattern_mask) * 8) + (line & 0x07) );
+ const uint8_t colors = space().read_byte(color_base + (((pattern_offset + name) & color_mask) * 8) + (line & 0x07) );
for (int pixel_x = 0; pixel_x < 8; pixel_x++)
{
- u8 pen_selected;
+ uint8_t pen_selected;
const int pixel_plot_x = (tile_column << 3) + pixel_x;
if (BIT(pattern, 7 - pixel_x))
@@ -1465,16 +1462,16 @@ void sega315_5124_device::draw_scanline_mode2(int *line_buffer, int line)
// Display mode 0 (Graphics I Mode)
void sega315_5124_device::draw_scanline_mode0(int *line_buffer, int line)
{
- const u16 name_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
- const u16 color_base = ((m_reg[0x03] << 6) & (VRAM_SIZE - 1));
- const u16 pattern_base = ((m_reg[0x04] << 11) & (VRAM_SIZE - 1));
+ const uint16_t name_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
+ const uint16_t color_base = ((m_reg[0x03] << 6) & (VRAM_SIZE - 1));
+ const uint16_t pattern_base = ((m_reg[0x04] << 11) & (VRAM_SIZE - 1));
/* Draw background layer */
for (int tile_column = 0; tile_column < 32; tile_column++)
{
- const u8 name = space().read_byte(name_base + tile_column);
- const u8 pattern = space().read_byte(pattern_base + (name << 3) + (line & 0x07));
- const u8 colors = space().read_byte(color_base + (name >> 3));
+ const uint8_t name = space().read_byte(name_base + tile_column);
+ const uint8_t pattern = space().read_byte(pattern_base + (name << 3) + (line & 0x07));
+ const uint8_t colors = space().read_byte(color_base + (name >> 3));
for (int pixel_x = 0; pixel_x < 8; pixel_x++)
{
@@ -1499,8 +1496,8 @@ void sega315_5124_device::draw_scanline_mode0(int *line_buffer, int line)
// Display mode 1 (Text Mode)
void sega315_5124_device::draw_scanline_mode1(int *line_buffer, int line)
{
- const u16 name_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
- const u16 pattern_base = ((m_reg[0x04] << 11) & (VRAM_SIZE - 1));
+ const uint16_t name_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
+ const uint16_t pattern_base = ((m_reg[0x04] << 11) & (VRAM_SIZE - 1));
for (int pixel_plot_x = 0; pixel_plot_x < 8; pixel_plot_x++)
{
@@ -1510,8 +1507,8 @@ void sega315_5124_device::draw_scanline_mode1(int *line_buffer, int line)
/* Draw background layer */
for (int tile_column = 0; tile_column < 40; tile_column++)
{
- const u8 name = space().read_byte(name_base + tile_column);
- const u8 pattern = space().read_byte(pattern_base + (name << 3) + (line & 0x07));
+ const uint8_t name = space().read_byte(name_base + tile_column);
+ const uint8_t pattern = space().read_byte(pattern_base + (name << 3) + (line & 0x07));
for (int pixel_x = 0; pixel_x < 6; pixel_x++)
{
@@ -1539,14 +1536,14 @@ void sega315_5124_device::draw_scanline_mode1(int *line_buffer, int line)
// Display mode 3 (Multicolor Mode)
void sega315_5124_device::draw_scanline_mode3(int *line_buffer, int line)
{
- const u16 name_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
- const u16 pattern_base = ((m_reg[0x04] << 11) & (VRAM_SIZE - 1));
+ const uint16_t name_base = ((m_reg[0x02] & 0x0f) << 10) + ((line >> 3) * 32);
+ const uint16_t pattern_base = ((m_reg[0x04] << 11) & (VRAM_SIZE - 1));
/* Draw background layer */
for (int tile_column = 0; tile_column < 32; tile_column++)
{
- const u8 name = space().read_byte(name_base + tile_column);
- const u8 pattern = space().read_byte(pattern_base + (name << 3) + (((line >> 3) & 3) << 1) + ((line & 4) >> 2));
+ const uint8_t name = space().read_byte(name_base + tile_column);
+ const uint8_t pattern = space().read_byte(pattern_base + (name << 3) + (((line >> 3) & 3) << 1) + ((line & 4) >> 2));
for (int pixel_x = 0; pixel_x < 8; pixel_x++)
{
@@ -1638,8 +1635,8 @@ void sega315_5124_device::draw_scanline(int pixel_offset_x, int pixel_plot_y, in
void sega315_5124_device::blit_scanline(int *line_buffer, int *priority_selected, int pixel_offset_x, int pixel_plot_y, int line)
{
- u32 *p_bitmap = &m_tmpbitmap.pix32(pixel_plot_y + line, pixel_offset_x);
- u8 *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x);
+ uint32_t *p_bitmap = &m_tmpbitmap.pix32(pixel_plot_y + line, pixel_offset_x);
+ uint8_t *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x);
int x = 0;
if (m_vdp_mode == 4 && BIT(m_reg[0x00], 5))
@@ -1670,8 +1667,8 @@ void sega315_5377_device::blit_scanline(int *line_buffer, int *priority_selected
}
else
{
- u32 *p_bitmap = &m_tmpbitmap.pix32(pixel_plot_y + line, pixel_offset_x);
- u8 *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x);
+ uint32_t *p_bitmap = &m_tmpbitmap.pix32(pixel_plot_y + line, pixel_offset_x);
+ uint8_t *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x);
int x = 0;
/* border on left side of the GG active screen */
@@ -1759,9 +1756,9 @@ void sega315_5377_device::update_palette()
}
-void sega315_5124_device::cram_write(u8 data)
+void sega315_5124_device::cram_write(uint8_t data)
{
- u16 address = m_addr & m_cram_mask;
+ uint16_t address = m_addr & m_cram_mask;
if (data != m_CRAM[address])
{
m_CRAM[address] = data;
@@ -1770,7 +1767,7 @@ void sega315_5124_device::cram_write(u8 data)
}
-void sega315_5377_device::cram_write(u8 data)
+void sega315_5377_device::cram_write(uint8_t data)
{
if (m_sega315_5124_compatibility_mode)
{
@@ -1780,7 +1777,7 @@ void sega315_5377_device::cram_write(u8 data)
{
if (m_addr & 1)
{
- u16 address = (m_addr & m_cram_mask) & ~1;
+ uint16_t address = (m_addr & m_cram_mask) & ~1;
if (m_buffer != m_CRAM[address] || data != m_CRAM[address + 1])
{
m_CRAM[address] = m_buffer;
@@ -1792,7 +1789,7 @@ void sega315_5377_device::cram_write(u8 data)
}
-u32 sega315_5124_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+uint32_t sega315_5124_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
copybitmap(bitmap, m_tmpbitmap, 0, 0, 0, 0, cliprect);
return 0;
@@ -1822,7 +1819,7 @@ void sega315_5313_mode4_device::stop_timers()
DEVICE INTERFACE
*****************************************************************************/
-void sega315_5124_device::device_post_load()
+void sega315_5124_device::vdp_postload()
{
set_frame_timing();
}
@@ -1889,6 +1886,8 @@ void sega315_5124_device::device_start()
save_item(NAME(m_max_sprite_zoom_hcount));
save_item(NAME(m_max_sprite_zoom_vcount));
save_item(NAME(m_CRAM));
+
+ machine().save().register_postload(save_prepost_delegate(FUNC(sega315_5124_device::vdp_postload), this));
}
@@ -1900,7 +1899,7 @@ void sega315_5124_device::device_reset()
m_reg[0x02] = 0x0e;
m_reg[0x0a] = 0xff;
- m_status = m_pending_status = u8(~(STATUS_VINT | STATUS_SPROVR | STATUS_SPRCOL));
+ m_status = m_pending_status = uint8_t(~(STATUS_VINT | STATUS_SPROVR | STATUS_SPRCOL));
m_pending_sprcol_x = 0;
m_pending_control_write = false;
m_pending_hint = false;
@@ -1935,8 +1934,6 @@ void sega315_5124_device::device_reset()
void sega315_5124_device::device_add_mconfig(machine_config &config)
{
PALETTE(config, m_palette, FUNC(sega315_5124_device::sega315_5124_palette), SEGA315_5124_PALETTE_SIZE);
-
- SEGAPSG(config, m_snsnd, DERIVED_CLOCK(1, 3)).add_route(ALL_OUTPUTS, *this, 1.0, AUTO_ALLOC_INPUT, 0);
}
void sega315_5377_device::device_reset()
@@ -1952,11 +1949,6 @@ void sega315_5377_device::device_reset()
void sega315_5377_device::device_add_mconfig(machine_config &config)
{
sega315_5246_device::device_add_mconfig(config);
-
m_palette->set_entries(SEGA315_5377_PALETTE_SIZE);
m_palette->set_init(FUNC(sega315_5377_device::sega315_5377_palette));
-
- GAMEGEAR(config.replace(), m_snsnd, DERIVED_CLOCK(1, 3));
- m_snsnd->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
- m_snsnd->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
}