diff options
Diffstat (limited to 'src/devices/machine/s2636.cpp')
-rw-r--r-- | src/devices/machine/s2636.cpp | 63 |
1 files changed, 27 insertions, 36 deletions
diff --git a/src/devices/machine/s2636.cpp b/src/devices/machine/s2636.cpp index c5663d2ccb1..d2576b07f1f 100644 --- a/src/devices/machine/s2636.cpp +++ b/src/devices/machine/s2636.cpp @@ -119,7 +119,7 @@ *************************************************************/ #include "emu.h" -#include "machine/s2636.h" +#include "s2636.h" #include "screen.h" @@ -180,6 +180,10 @@ s2636_device::s2636_device(const machine_config &mconfig, const char *tag, devic for (auto &elem : m_obj_dup) elem = false; } +s2636_device::~s2636_device() +{ +} + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- @@ -225,17 +229,6 @@ bitmap_ind16 const &s2636_device::update(const rectangle &cliprect) //------------------------------------------------- -// render the first line into the bitmap -//------------------------------------------------- - -void s2636_device::render_first_line() -{ - m_screen_line = 0; - render_next_line(); -} - - -//------------------------------------------------- // render next line into the bitmap //------------------------------------------------- @@ -245,7 +238,7 @@ void s2636_device::render_next_line() // pre-clear the line for convenience rectangle const &vis_area = screen().visible_area(); - uint16_t *const row = &m_bitmap.pix(m_screen_line); + uint16_t *const row = &m_bitmap.pix(m_screen_line); m_bitmap.plot_box(0, m_screen_line, m_bitmap.width(), 1, 0); if ((vis_area.min_y > m_screen_line) || (vis_area.max_y < m_screen_line)) @@ -296,8 +289,8 @@ void s2636_device::render_next_line() m_obj_cnt[i] -= obj_inc; // fetch appropriate line from object - uint8_t const obj_bits = m_registers[OFFS_OBJ[i] + OBJ_HEIGHT - 1 - (m_obj_cnt[i] >> 3)]; - uint16_t const obj_clr = object_color(i) | 0x08 | (0x10 << i); + uint8_t const obj_bits = m_registers[OFFS_OBJ[i] + OBJ_HEIGHT - 1 - (m_obj_cnt[i] >> 3)]; + uint16_t const obj_clr = object_color(i) | 0x08 | (0x10 << i); // blit it to the line ignoring intermediate pixels int const obj_h_cnt = m_registers[OFFS_OBJ[i] + (m_obj_dup[i] ? OFFS_HCB : OFFS_HC)] + m_x_offset; @@ -327,15 +320,15 @@ void s2636_device::render_next_line() } // let's take a look at the score display - uint16_t const bg_clr = m_registers[REG_BG_ENB_CLR] & 0x07; - int const score_row = m_vis_line - m_y_offset - SCORE_START_Y[m_registers[REG_SCORE_FMT] & 0x01]; + uint16_t const bg_clr = m_registers[REG_BG_ENB_CLR] & 0x07; + int const score_row = m_vis_line - m_y_offset - SCORE_START_Y[m_registers[REG_SCORE_FMT] & 0x01]; if ((0 <= score_row) && (SCORE_HEIGHT > score_row)) { int const (&score_start_x)[SCORE_DIGITS] = SCORE_START_X[(m_registers[REG_SCORE_FMT] >> 1) & 0x01]; for (int i = 0; i < SCORE_DIGITS; i++) { - uint16_t score_bits = SCORE_FONT[score_digit(i)][score_row >> 2]; - int screen_col = vis_area.min_x + ((score_start_x[i] + m_x_offset) * m_divider); + uint16_t score_bits = SCORE_FONT[score_digit(i)][score_row >> 2]; + int screen_col = vis_area.min_x + ((score_start_x[i] + m_x_offset) * m_divider); while (score_bits && (vis_area.max_x >= screen_col)) { if (score_bits & 0x0001) row[screen_col] |= bg_clr | 0x08; @@ -346,16 +339,16 @@ void s2636_device::render_next_line() } // work out how the background pattern will be drawn - bool const bg_enable = bool(m_registers[REG_BG_ENB_CLR] & 0x08); - int const bg_row = m_vis_line - m_y_offset - BG_START_Y; - bool const bg_draw = bg_enable && (0 <= bg_row) && (BG_HEIGHT > bg_row); - int const bg_vbar_offs = OFFS_VBAR_DEF + ((bg_row / 20) << 2) + (((bg_row % 20) >= 2) ? 2 : 0); - int const bg_hbar_offs = OFFS_HBAR_DEF + (bg_row / 40); - uint16_t const bg_vbar_bits = (uint16_t(m_registers[bg_vbar_offs]) << 8) | uint16_t(m_registers[bg_vbar_offs + 1]); - uint8_t const bg_hbar_bits = m_registers[bg_hbar_offs]; - bool const bg_hbar_stretch = bool(bg_hbar_bits & (1 << ((((bg_row % 40) >= 20) ? 3 : 0) + (((bg_row % 20) >= 11) ? 2 : ((bg_row % 20) >= 2) ? 1 : 0)))); - int const bg_hbar_width = bg_hbar_stretch ? 8 : (0xc0 == (bg_hbar_bits & 0xc0)) ? 4 : (0x40 == (bg_hbar_bits & 0xc0)) ? 2 : 1; - uint16_t const scrn_clr = bg_enable ? ((m_registers[REG_BG_ENB_CLR] >> 4) & 0x07) : 0x00; + bool const bg_enable = bool(m_registers[REG_BG_ENB_CLR] & 0x08); + int const bg_row = m_vis_line - m_y_offset - BG_START_Y; + bool const bg_draw = bg_enable && (0 <= bg_row) && (BG_HEIGHT > bg_row); + int const bg_vbar_offs = OFFS_VBAR_DEF + ((bg_row / 20) << 2) + (((bg_row % 20) >= 2) ? 2 : 0); + int const bg_hbar_offs = OFFS_HBAR_DEF + (bg_row / 40); + uint16_t const bg_vbar_bits = (uint16_t(m_registers[bg_vbar_offs]) << 8) | uint16_t(m_registers[bg_vbar_offs + 1]); + uint8_t const bg_hbar_bits = m_registers[bg_hbar_offs]; + bool const bg_hbar_stretch = bool(bg_hbar_bits & (1 << ((((bg_row % 40) >= 20) ? 3 : 0) + (((bg_row % 20) >= 11) ? 2 : ((bg_row % 20) >= 2) ? 1 : 0)))); + int const bg_hbar_width = bg_hbar_stretch ? 8 : (0xc0 == (bg_hbar_bits & 0xc0)) ? 4 : (0x40 == (bg_hbar_bits & 0xc0)) ? 2 : 1; + uint16_t const scrn_clr = bg_enable ? ((m_registers[REG_BG_ENB_CLR] >> 4) & 0x07) : 0x00; for (int screen_col = vis_area.min_x, x = 0; vis_area.max_x >= screen_col; x++) { @@ -368,8 +361,8 @@ void s2636_device::render_next_line() if ((row[screen_col] & 0x40) && (row[screen_col] & 0x80)) m_registers[REG_VBL_COL_OBJ] |= 0x01; // work out if the background hits this pixel - int const bg_col = x - m_x_offset - BG_START_X; - bool const bg = bool(bg_vbar_bits & (1U << (15 - (bg_col >> 3)))); + int const bg_col = x - m_x_offset - BG_START_X; + bool const bg = bool(bg_vbar_bits & (1U << (15 - (bg_col >> 3)))); if (bg_draw && (0 <= bg_col) && (BG_WIDTH > bg_col) && bg && (bg_hbar_width > (bg_col & 0x07))) { // do object-background collisions @@ -448,11 +441,9 @@ void s2636_device::write_intack(int state) // sound_stream_update - generate audio output //------------------------------------------------- - -void s2636_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) +void s2636_device::sound_stream_update(sound_stream &stream) { - auto &buffer = outputs[0]; - for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) + for (int sampindex = 0; sampindex < stream.samples(); sampindex++) { if (!m_sample_cnt) { @@ -468,7 +459,7 @@ void s2636_device::sound_stream_update(sound_stream &stream, std::vector<read_st } } - buffer.put(sampindex, m_sound_lvl ? 1.0 : 0.0); + stream.put(0, sampindex, m_sound_lvl ? 1.0 : 0.0); m_sample_cnt--; } } |