summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2017-03-31 18:01:58 +0200
committer Ivan Vangelista <mesgnet@yahoo.it>2017-03-31 18:01:58 +0200
commit6dd15ad2a87c5736445de929c352d6ba5792a37f (patch)
tree6de1d4326eeaba97467d47e45024762c1ddac2da
parentb4262ecb46ab43ac60f06d96d6dafc338d95474a (diff)
astinvad.cpp, boxer.cpp, destroyr.cpp: more timer_alloc, added save state support to boxer (nw)
-rw-r--r--src/mame/drivers/astinvad.cpp38
-rw-r--r--src/mame/drivers/boxer.cpp73
-rw-r--r--src/mame/drivers/destroyr.cpp2
3 files changed, 58 insertions, 55 deletions
diff --git a/src/mame/drivers/astinvad.cpp b/src/mame/drivers/astinvad.cpp
index 5c1dc027068..8b76d1288a1 100644
--- a/src/mame/drivers/astinvad.cpp
+++ b/src/mame/drivers/astinvad.cpp
@@ -64,6 +64,7 @@ public:
, m_videoram(*this, "videoram")
, m_samples(*this, "samples")
, m_screen(*this, "screen")
+ , m_color_prom(*this, "proms")
{ }
DECLARE_WRITE8_MEMBER(color_latch_w);
@@ -97,6 +98,7 @@ private:
std::unique_ptr<uint8_t[]> m_colorram;
emu_timer *m_int_timer;
+ emu_timer *m_int_off_timer;
uint8_t m_sound_state[2];
uint8_t m_screen_flip;
uint8_t m_screen_red;
@@ -111,6 +113,7 @@ private:
required_shared_ptr<uint8_t> m_videoram;
required_device<samples_device> m_samples;
required_device<screen_device> m_screen;
+ required_region_ptr<uint8_t> m_color_prom;
};
@@ -166,15 +169,13 @@ void astinvad_state::plot_byte( bitmap_rgb32 &bitmap, uint8_t y, uint8_t x, uint
uint32_t astinvad_state::screen_update_astinvad(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- const uint8_t *color_prom = memregion("proms")->base();
uint8_t yoffs = m_flip_yoffs & m_screen_flip;
- int x, y;
/* render the visible pixels */
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
- for (x = cliprect.min_x & ~7; x <= cliprect.max_x; x += 8)
+ for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (int x = cliprect.min_x & ~7; x <= cliprect.max_x; x += 8)
{
- uint8_t color = color_prom[((y & 0xf8) << 2) | (x >> 3)] >> (m_screen_flip ? 0 : 4);
+ uint8_t color = m_color_prom[((y & 0xf8) << 2) | (x >> 3)] >> (m_screen_flip ? 0 : 4);
uint8_t data = m_videoram[(((y ^ m_screen_flip) + yoffs) << 5) | ((x ^ m_screen_flip) >> 3)];
plot_byte(bitmap, y, x, data, m_screen_red ? 1 : color & 0x07);
}
@@ -185,15 +186,13 @@ uint32_t astinvad_state::screen_update_astinvad(screen_device &screen, bitmap_rg
uint32_t astinvad_state::screen_update_spcking2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- const uint8_t *color_prom = memregion("proms")->base();
uint8_t yoffs = m_flip_yoffs & m_screen_flip;
- int x, y;
/* render the visible pixels */
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
- for (x = cliprect.min_x & ~7; x <= cliprect.max_x; x += 8)
+ for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (int x = cliprect.min_x & ~7; x <= cliprect.max_x; x += 8)
{
- uint8_t color = color_prom[(((y & 0xf8) << 2) | (x >> 3)) ^ (m_screen_flip ? 0x3ff : m_player ? 0 : 0x3ff)] >> (m_player ? 4 : 0);
+ uint8_t color = m_color_prom[(((y & 0xf8) << 2) | (x >> 3)) ^ (m_screen_flip ? 0x3ff : m_player ? 0 : 0x3ff)] >> (m_player ? 4 : 0);
uint8_t data = m_videoram[(((y ^ m_screen_flip) + yoffs) << 5) | ((x ^ m_screen_flip) >> 3)];
plot_byte(bitmap, y, x, data, m_screen_red ? 1 : color & 0x07);
}
@@ -204,14 +203,12 @@ uint32_t astinvad_state::screen_update_spcking2(screen_device &screen, bitmap_rg
uint32_t astinvad_state::screen_update_spaceint(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- const uint8_t *color_prom = memregion("proms")->base();
- offs_t offs,n;
- uint8_t x,y,data,color;
-
- for (offs = 0; offs < m_videoram.bytes(); offs++)
+ uint8_t x,y;
+
+ for (offs_t offs = 0; offs < m_videoram.bytes(); offs++)
{
- data = m_videoram[offs];
- color = m_colorram[offs];
+ uint8_t data = m_videoram[offs];
+ uint8_t color = m_colorram[offs];
if (m_screen_flip)
{
@@ -225,8 +222,8 @@ uint32_t astinvad_state::screen_update_spaceint(screen_device &screen, bitmap_rg
}
/* this is almost certainly wrong */
- n = ((offs >> 5) & 0xf0) | color;
- color = color_prom[n] & 0x07;
+ offs_t n = ((offs >> 5) & 0xf0) | color;
+ color = m_color_prom[n] & 0x07;
plot_byte(bitmap, y, x, data, color);
}
@@ -272,7 +269,7 @@ TIMER_CALLBACK_MEMBER(astinvad_state::kamizake_int_gen)
m_int_timer->adjust(m_screen->time_until_pos(param), param);
/* an RC circuit turns the interrupt off after a short amount of time */
- timer_set(attotime::from_double(300 * 0.1e-6), TIMER_INT_OFF);
+ m_int_off_timer->adjust(attotime::from_double(300 * 0.1e-6));
}
@@ -280,6 +277,7 @@ MACHINE_START_MEMBER(astinvad_state,kamikaze)
{
m_int_timer = timer_alloc(TIMER_INT_GEN);
m_int_timer->adjust(m_screen->time_until_pos(128), 128);
+ m_int_off_timer = timer_alloc(TIMER_INT_OFF);
save_item(NAME(m_screen_flip));
save_item(NAME(m_screen_red));
diff --git a/src/mame/drivers/boxer.cpp b/src/mame/drivers/boxer.cpp
index 5ac60774766..02a94862c2f 100644
--- a/src/mame/drivers/boxer.cpp
+++ b/src/mame/drivers/boxer.cpp
@@ -48,6 +48,8 @@ public:
/* misc */
uint8_t m_pot_state;
uint8_t m_pot_latch;
+ emu_timer *m_pot_interrupt;
+ emu_timer *m_periodic_timer;
/* devices */
required_device<cpu_device> m_maincpu;
@@ -55,21 +57,21 @@ public:
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
- DECLARE_READ8_MEMBER(boxer_input_r);
- DECLARE_READ8_MEMBER(boxer_misc_r);
- DECLARE_WRITE8_MEMBER(boxer_bell_w);
- DECLARE_WRITE8_MEMBER(boxer_sound_w);
- DECLARE_WRITE8_MEMBER(boxer_pot_w);
- DECLARE_WRITE8_MEMBER(boxer_irq_reset_w);
- DECLARE_WRITE8_MEMBER(boxer_crowd_w);
- DECLARE_WRITE8_MEMBER(boxer_led_w);
+ DECLARE_READ8_MEMBER(input_r);
+ DECLARE_READ8_MEMBER(misc_r);
+ DECLARE_WRITE8_MEMBER(bell_w);
+ DECLARE_WRITE8_MEMBER(sound_w);
+ DECLARE_WRITE8_MEMBER(pot_w);
+ DECLARE_WRITE8_MEMBER(irq_reset_w);
+ DECLARE_WRITE8_MEMBER(crowd_w);
+ DECLARE_WRITE8_MEMBER(led_w);
virtual void machine_start() override;
virtual void machine_reset() override;
DECLARE_PALETTE_INIT(boxer);
- uint32_t screen_update_boxer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(pot_interrupt);
TIMER_CALLBACK_MEMBER(periodic_callback);
- void draw_boxer( bitmap_ind16 &bitmap, const rectangle &cliprect );
+ void draw(bitmap_ind16 &bitmap, const rectangle &cliprect);
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
@@ -130,7 +132,7 @@ TIMER_CALLBACK_MEMBER(boxer_state::periodic_callback)
for (i = 1; i < 256; i++)
if (mask[i] != 0)
- timer_set(m_screen->time_until_pos(i), TIMER_POT_INTERRUPT, mask[i]);
+ m_pot_interrupt->adjust(m_screen->time_until_pos(i), mask[i]);
m_pot_state = 0;
}
@@ -140,7 +142,7 @@ TIMER_CALLBACK_MEMBER(boxer_state::periodic_callback)
if (scanline >= 262)
scanline = 0;
- timer_set(m_screen->time_until_pos(scanline), TIMER_PERIODIC, scanline);
+ m_periodic_timer->adjust(m_screen->time_until_pos(scanline), scanline);
}
@@ -159,7 +161,7 @@ PALETTE_INIT_MEMBER(boxer_state, boxer)
palette.set_pen_color(3, rgb_t(0x00,0x00,0x00));
}
-void boxer_state::draw_boxer( bitmap_ind16 &bitmap, const rectangle &cliprect )
+void boxer_state::draw( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
int n;
@@ -206,7 +208,7 @@ void boxer_state::draw_boxer( bitmap_ind16 &bitmap, const rectangle &cliprect )
}
-uint32_t boxer_state::screen_update_boxer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t boxer_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int i, j;
@@ -228,7 +230,7 @@ uint32_t boxer_state::screen_update_boxer(screen_device &screen, bitmap_ind16 &b
}
}
- draw_boxer(bitmap, cliprect);
+ draw(bitmap, cliprect);
return 0;
}
@@ -239,7 +241,7 @@ uint32_t boxer_state::screen_update_boxer(screen_device &screen, bitmap_ind16 &b
*
*************************************/
-READ8_MEMBER(boxer_state::boxer_input_r)
+READ8_MEMBER(boxer_state::input_r)
{
uint8_t val = ioport("IN0")->read();
@@ -250,7 +252,7 @@ READ8_MEMBER(boxer_state::boxer_input_r)
}
-READ8_MEMBER(boxer_state::boxer_misc_r)
+READ8_MEMBER(boxer_state::misc_r)
{
uint8_t val = 0;
@@ -279,17 +281,17 @@ READ8_MEMBER(boxer_state::boxer_misc_r)
-WRITE8_MEMBER(boxer_state::boxer_bell_w)
+WRITE8_MEMBER(boxer_state::bell_w)
{
}
-WRITE8_MEMBER(boxer_state::boxer_sound_w)
+WRITE8_MEMBER(boxer_state::sound_w)
{
}
-WRITE8_MEMBER(boxer_state::boxer_pot_w)
+WRITE8_MEMBER(boxer_state::pot_w)
{
/* BIT0 => HPOT1 */
/* BIT1 => VPOT1 */
@@ -304,13 +306,13 @@ WRITE8_MEMBER(boxer_state::boxer_pot_w)
}
-WRITE8_MEMBER(boxer_state::boxer_irq_reset_w)
+WRITE8_MEMBER(boxer_state::irq_reset_w)
{
m_maincpu->set_input_line(0, CLEAR_LINE);
}
-WRITE8_MEMBER(boxer_state::boxer_crowd_w)
+WRITE8_MEMBER(boxer_state::crowd_w)
{
/* BIT0 => ATTRACT */
/* BIT1 => CROWD-1 */
@@ -321,7 +323,7 @@ WRITE8_MEMBER(boxer_state::boxer_crowd_w)
}
-WRITE8_MEMBER(boxer_state::boxer_led_w)
+WRITE8_MEMBER(boxer_state::led_w)
{
output().set_led_value(1, !(data & 1));
output().set_led_value(0, !(data & 2));
@@ -338,14 +340,14 @@ static ADDRESS_MAP_START( boxer_map, AS_PROGRAM, 8, boxer_state )
ADDRESS_MAP_GLOBAL_MASK(0x3fff)
AM_RANGE(0x0000, 0x01ff) AM_RAM
AM_RANGE(0x0200, 0x03ff) AM_RAM AM_SHARE("tile_ram")
- AM_RANGE(0x0800, 0x08ff) AM_READ(boxer_input_r)
- AM_RANGE(0x1000, 0x17ff) AM_READ(boxer_misc_r)
- AM_RANGE(0x1800, 0x1800) AM_WRITE(boxer_pot_w)
- AM_RANGE(0x1900, 0x19ff) AM_WRITE(boxer_led_w)
- AM_RANGE(0x1a00, 0x1aff) AM_WRITE(boxer_sound_w)
- AM_RANGE(0x1b00, 0x1bff) AM_WRITE(boxer_crowd_w)
- AM_RANGE(0x1c00, 0x1cff) AM_WRITE(boxer_irq_reset_w)
- AM_RANGE(0x1d00, 0x1dff) AM_WRITE(boxer_bell_w)
+ AM_RANGE(0x0800, 0x08ff) AM_READ(input_r)
+ AM_RANGE(0x1000, 0x17ff) AM_READ(misc_r)
+ AM_RANGE(0x1800, 0x1800) AM_WRITE(pot_w)
+ AM_RANGE(0x1900, 0x19ff) AM_WRITE(led_w)
+ AM_RANGE(0x1a00, 0x1aff) AM_WRITE(sound_w)
+ AM_RANGE(0x1b00, 0x1bff) AM_WRITE(crowd_w)
+ AM_RANGE(0x1c00, 0x1cff) AM_WRITE(irq_reset_w)
+ AM_RANGE(0x1d00, 0x1dff) AM_WRITE(bell_w)
AM_RANGE(0x1e00, 0x1eff) AM_WRITEONLY AM_SHARE("sprite_ram")
AM_RANGE(0x1f00, 0x1fff) AM_DEVWRITE("watchdog", watchdog_timer_device, reset_w)
AM_RANGE(0x3000, 0x3fff) AM_ROM
@@ -462,13 +464,16 @@ GFXDECODE_END
void boxer_state::machine_start()
{
+ m_pot_interrupt = timer_alloc(TIMER_POT_INTERRUPT);
+ m_periodic_timer = timer_alloc(TIMER_PERIODIC);
+
save_item(NAME(m_pot_state));
save_item(NAME(m_pot_latch));
}
void boxer_state::machine_reset()
{
- timer_set(m_screen->time_until_pos(0), TIMER_PERIODIC);
+ m_periodic_timer->adjust(m_screen->time_until_pos(0));
m_pot_state = 0;
m_pot_latch = 0;
@@ -488,7 +493,7 @@ static MACHINE_CONFIG_START( boxer, boxer_state )
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_SIZE(256, 262)
MCFG_SCREEN_VISIBLE_AREA(8, 247, 0, 239)
- MCFG_SCREEN_UPDATE_DRIVER(boxer_state, screen_update_boxer)
+ MCFG_SCREEN_UPDATE_DRIVER(boxer_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", boxer)
@@ -540,4 +545,4 @@ ROM_END
*
*************************************/
-GAME( 1978, boxer, 0, boxer, boxer, driver_device, 0, 0, "Atari", "Boxer (prototype)", MACHINE_NO_SOUND )
+GAME( 1978, boxer, 0, boxer, boxer, driver_device, 0, 0, "Atari", "Boxer (prototype)", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/destroyr.cpp b/src/mame/drivers/destroyr.cpp
index 01bcc499706..1b643230a0a 100644
--- a/src/mame/drivers/destroyr.cpp
+++ b/src/mame/drivers/destroyr.cpp
@@ -202,7 +202,7 @@ TIMER_CALLBACK_MEMBER(destroyr_state::frame_callback)
void destroyr_state::machine_reset()
{
- timer_set(m_screen->time_until_pos(0), TIMER_DESTROYR_FRAME);
+ m_frame_timer->adjust(m_screen->time_until_pos(0));
m_cursor = 0;
m_wavemod = 0;