diff options
author | Vas Crabb <vas@vastheman.com> | 2018-11-23 19:15:49 +1100 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2018-11-23 19:15:49 +1100 |
commit | 8dfe57c729d16b26d02322680e0416181e8677be (patch) | |
tree | 4c8e40044cafa7b6d5a18a1adb9372e0dacac3ab | |
parent | 25100fc16e132963b7848bbd8ae1431085bd02e5 (diff) |
(nw) more header cleanup, make tx1 use something that looks like C++ rather than driver_data abuse (still needs splitting tx1 and buggyboy parts)
54 files changed, 1149 insertions, 894 deletions
diff --git a/src/mame/drivers/cchance.cpp b/src/mame/drivers/cchance.cpp index b699873508d..9b20cf0d609 100644 --- a/src/mame/drivers/cchance.cpp +++ b/src/mame/drivers/cchance.cpp @@ -234,7 +234,7 @@ MACHINE_CONFIG_START(cchance_state::cchance) MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD("palette", 512) - MCFG_PALETTE_INIT_OWNER(tnzs_base_state, prompalette) + MCFG_PALETTE_INIT_OWNER(cchance_state, prompalette) SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/taito_l.cpp b/src/mame/drivers/taito_l.cpp index b25abd27916..8693f05170c 100644 --- a/src/mame/drivers/taito_l.cpp +++ b/src/mame/drivers/taito_l.cpp @@ -1471,8 +1471,6 @@ MACHINE_CONFIG_START(taitol_state::l_system_video) MCFG_PALETTE_ADD("palette", 256) MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR) - MCFG_VIDEO_START_OVERRIDE(taitol_state, taito_l) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", taitol_state, vbl_interrupt, "screen", 0, 1) MACHINE_CONFIG_END diff --git a/src/mame/drivers/tnzs.cpp b/src/mame/drivers/tnzs.cpp index 09cece229cd..4c2fe4195cd 100644 --- a/src/mame/drivers/tnzs.cpp +++ b/src/mame/drivers/tnzs.cpp @@ -1600,7 +1600,7 @@ MACHINE_CONFIG_START(extrmatn_state::extrmatn) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_INIT_OWNER(tnzs_base_state, prompalette) + MCFG_PALETTE_INIT_OWNER(extrmatn_state, prompalette) MACHINE_CONFIG_END void extrmatn_state::plumppop(machine_config &config) diff --git a/src/mame/includes/ashnojoe.h b/src/mame/includes/ashnojoe.h index 83705151c61..4182a68f75d 100644 --- a/src/mame/includes/ashnojoe.h +++ b/src/mame/includes/ashnojoe.h @@ -6,6 +6,10 @@ Success Joe / Ashita no Joe *************************************************************************/ +#ifndef MAME_INCLUDES_ASHNOJOE_H +#define MAME_INCLUDES_ASHNOJOE_H + +#pragma once #include "machine/gen_latch.h" #include "sound/msm5205.h" @@ -13,8 +17,8 @@ class ashnojoe_state : public driver_device { public: - ashnojoe_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + ashnojoe_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_tileram_3(*this, "tileram_3"), m_tileram_4(*this, "tileram_4"), m_tileram_5(*this, "tileram_5"), @@ -27,7 +31,8 @@ public: m_audiocpu(*this, "audiocpu"), m_msm(*this, "msm"), m_gfxdecode(*this, "gfxdecode"), - m_soundlatch(*this, "soundlatch") { } + m_soundlatch(*this, "soundlatch") + { } /* memory pointers */ uint16_t * m_tileram_1; @@ -92,3 +97,5 @@ public: void sound_map(address_map &map); void sound_portmap(address_map &map); }; + +#endif // MAME_INCLUDES_ASHNOJOE_H diff --git a/src/mame/includes/bking.h b/src/mame/includes/bking.h index 5a8300ee155..6eaa4675f30 100644 --- a/src/mame/includes/bking.h +++ b/src/mame/includes/bking.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Mike Balfour, Zsolt Vasvari +#ifndef MAME_INCLUDES_BKING_H +#define MAME_INCLUDES_BKING_H + +#pragma once #include "machine/taito68705interface.h" #include "machine/gen_latch.h" @@ -10,8 +14,8 @@ class bking_state : public driver_device { public: - bking_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + bking_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_playfield_ram(*this, "playfield_ram"), m_audiocpu(*this, "audiocpu"), m_bmcu(*this, "bmcu"), @@ -101,3 +105,5 @@ public: void bking_io_map(address_map &map); void bking_map(address_map &map); }; + +#endif // MAME_INCLUDES_BKING_H diff --git a/src/mame/includes/bogeyman.h b/src/mame/includes/bogeyman.h index a20b299d859..871eae6f92b 100644 --- a/src/mame/includes/bogeyman.h +++ b/src/mame/includes/bogeyman.h @@ -5,6 +5,10 @@ Bogey Manor *************************************************************************/ +#ifndef MAME_INCLUDES_BOGEYMAN_H +#define MAME_INCLUDES_BOGEYMAN_H + +#pragma once #include "sound/ay8910.h" #include "emupal.h" @@ -12,8 +16,8 @@ class bogeyman_state : public driver_device { public: - bogeyman_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + bogeyman_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), @@ -23,8 +27,17 @@ public: m_videoram2(*this, "videoram2"), m_colorram(*this, "colorram"), m_colorram2(*this, "colorram2"), - m_spriteram(*this, "spriteram") { } + m_spriteram(*this, "spriteram") + { } + + void bogeyman(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; +private: /* devices */ required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; @@ -59,13 +72,10 @@ public: TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - DECLARE_PALETTE_INIT(bogeyman); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - void bogeyman(machine_config &config); void bogeyman_map(address_map &map); }; + +#endif // MAME_INCLUDES_BOGEYMAN_H diff --git a/src/mame/includes/buggychl.h b/src/mame/includes/buggychl.h index 48d4e2395ff..018feb73fd9 100644 --- a/src/mame/includes/buggychl.h +++ b/src/mame/includes/buggychl.h @@ -3,6 +3,10 @@ /* buggychl */ +#ifndef MAME_INCLUDES_BUGGYCHL_H +#define MAME_INCLUDES_BUGGYCHL_H + +#pragma once #include "machine/taito68705interface.h" #include "machine/input_merger.h" @@ -16,8 +20,8 @@ class buggychl_state : public driver_device { public: - buggychl_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + buggychl_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_charram(*this, "charram"), m_videoram(*this, "videoram"), m_spriteram(*this, "spriteram"), @@ -106,3 +110,5 @@ private: bool m_sound_irq_enable; uint8_t m_sprite_lookup[0x2000]; }; + +#endif // MAME_INCLUDES_BUGGYCHL_H diff --git a/src/mame/includes/chaknpop.h b/src/mame/includes/chaknpop.h index 91f55c92040..dc09ae584ed 100644 --- a/src/mame/includes/chaknpop.h +++ b/src/mame/includes/chaknpop.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:BUT +#ifndef MAME_INCLUDES_CHAKNPOP_H +#define MAME_INCLUDES_CHAKNPOP_H + +#pragma once #include "machine/taito68705interface.h" #include "emupal.h" @@ -7,15 +11,16 @@ class chaknpop_state : public driver_device { public: - chaknpop_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + chaknpop_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_bmcu(*this, "bmcu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_tx_ram(*this, "tx_ram"), m_attr_ram(*this, "attr_ram"), - m_spr_ram(*this, "spr_ram") { } + m_spr_ram(*this, "spr_ram") + { } /* devices */ required_device<cpu_device> m_maincpu; @@ -63,3 +68,5 @@ public: void chaknpop(machine_config &config); void chaknpop_map(address_map &map); }; + +#endif // MAME_INCLUDES_CHAKNPOP_H diff --git a/src/mame/includes/crbaloon.h b/src/mame/includes/crbaloon.h index 187af52d450..3a2c1024499 100644 --- a/src/mame/includes/crbaloon.h +++ b/src/mame/includes/crbaloon.h @@ -5,6 +5,10 @@ Crazy Ballooon *************************************************************************/ +#ifndef MAME_INCLUDES_CRBALOON_H +#define MAME_INCLUDES_CRBALOON_H + +#pragma once #include "sound/discrete.h" #include "sound/sn76477.h" @@ -16,8 +20,8 @@ Crazy Ballooon class crbaloon_state : public driver_device { public: - crbaloon_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + crbaloon_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_spriteram(*this, "spriteram"), @@ -25,7 +29,8 @@ public: m_maincpu(*this, "maincpu"), m_sn(*this, "snsnd"), m_discrete(*this, "discrete"), - m_gfxdecode(*this, "gfxdecode") { } + m_gfxdecode(*this, "gfxdecode") + { } required_shared_ptr<uint8_t> m_videoram; required_shared_ptr<uint8_t> m_colorram; @@ -69,3 +74,5 @@ public: void main_io_map(address_map &map); void main_map(address_map &map); }; + +#endif // MAME_INCLUDES_CRBALOON_H diff --git a/src/mame/includes/darius.h b/src/mame/includes/darius.h index 93195471858..9f24288128e 100644 --- a/src/mame/includes/darius.h +++ b/src/mame/includes/darius.h @@ -5,6 +5,10 @@ Darius *************************************************************************/ +#ifndef MAME_INCLUDES_DARIUS_H +#define MAME_INCLUDES_DARIUS_H + +#pragma once #include "sound/flt_vol.h" #include "sound/msm5205.h" @@ -17,8 +21,8 @@ class darius_state : public driver_device { public: - darius_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + darius_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_spriteram(*this, "spriteram"), m_fg_ram(*this, "fg_ram"), m_maincpu(*this, "maincpu"), @@ -46,12 +50,17 @@ public: m_msm5205_l(*this, "msm5205.l"), m_msm5205_r(*this, "msm5205.r"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette") + { } void darius(machine_config &config); -private: +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; +private: /* memory pointers */ required_shared_ptr<uint16_t> m_spriteram; required_shared_ptr<uint16_t> m_fg_ram; @@ -119,21 +128,18 @@ private: DECLARE_WRITE8_MEMBER(darius_write_portB1); DECLARE_WRITE8_MEMBER(adpcm_data_w); TILE_GET_INFO_MEMBER(get_fg_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; uint32_t screen_update_darius_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_darius_middle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_darius_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void darius_postload(); - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int primask, int x_offs, int y_offs ); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int primask, int x_offs, int y_offs); uint32_t update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs); - void parse_control( ) /* assumes Z80 sandwiched between 68Ks */; - void update_fm0( ); - void update_fm1( ); - void update_psg0( int port ); - void update_psg1( int port ); - void update_da( ); + void parse_control(); // assumes Z80 sandwiched between 68Ks + void update_fm0(); + void update_fm1(); + void update_psg0(int port); + void update_psg1(int port); + void update_da(); DECLARE_WRITE_LINE_MEMBER(darius_adpcm_int); void darius_cpub_map(address_map &map); void darius_map(address_map &map); @@ -141,3 +147,5 @@ private: void darius_sound2_map(address_map &map); void darius_sound_map(address_map &map); }; + +#endif // MAME_INCLUDES_DARIUS_H diff --git a/src/mame/includes/ddragon.h b/src/mame/includes/ddragon.h index eedfce5cf5c..8b6e164597f 100644 --- a/src/mame/includes/ddragon.h +++ b/src/mame/includes/ddragon.h @@ -5,6 +5,10 @@ Double Dragon & Double Dragon II (but also China Gate) *************************************************************************/ +#ifndef MAME_INCLUDES_DDRAGON_H +#define MAME_INCLUDES_DDRAGON_H + +#pragma once #include "cpu/m6805/m68705.h" #include "machine/bankdev.h" @@ -178,7 +182,6 @@ private: DECLARE_WRITE8_MEMBER(darktowr_bankswitch_w); DECLARE_WRITE8_MEMBER(mcu_port_a_w); - void darktowr_map(address_map &map); void darktowr_banked_map(address_map &map); @@ -206,3 +209,5 @@ private: void toffy_map(address_map &map); }; + +#endif // MAME_INCLUDES_DDRAGON_H diff --git a/src/mame/includes/ddragon3.h b/src/mame/includes/ddragon3.h index d4668ebe9d9..394fba2b248 100644 --- a/src/mame/includes/ddragon3.h +++ b/src/mame/includes/ddragon3.h @@ -6,6 +6,10 @@ Double Dragon 3 & The Combatribes *************************************************************************/ +#ifndef MAME_INCLUDES_DDRAGON3_H +#define MAME_INCLUDES_DDRAGON3_H + +#pragma once #include "machine/gen_latch.h" #include "machine/timer.h" @@ -18,8 +22,8 @@ class ddragon3_state : public driver_device { public: - ddragon3_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + ddragon3_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), @@ -67,28 +71,28 @@ protected: uint16_t m_bg1_dx[2]; uint16_t m_sprite_xoff; + /* memory pointers */ + required_shared_ptr<uint16_t> m_bg_videoram; + required_shared_ptr<uint16_t> m_fg_videoram; +// required_shared_ptr<uint16_t> m_spriteram; + required_device<buffered_spriteram16_device> m_spriteram; + + /* devices */ + required_device<okim6295_device> m_oki; + required_device<screen_device> m_screen; + DECLARE_WRITE16_MEMBER(ddragon3_scroll_w); DECLARE_READ16_MEMBER(ddragon3_scroll_r); DECLARE_WRITE16_MEMBER(ddragon3_bg_videoram_w); DECLARE_WRITE16_MEMBER(ddragon3_fg_videoram_w); - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); void sound_map(address_map &map); virtual void video_start() override; private: - /* memory pointers */ - required_shared_ptr<uint16_t> m_bg_videoram; - required_shared_ptr<uint16_t> m_fg_videoram; -// required_shared_ptr<uint16_t> m_spriteram; - required_device<buffered_spriteram16_device> m_spriteram; - - /* devices */ - required_device<okim6295_device> m_oki; - required_device<screen_device> m_screen; - DECLARE_WRITE16_MEMBER(ddragon3_vreg_w); DECLARE_WRITE16_MEMBER(irq6_ack_w); DECLARE_WRITE16_MEMBER(irq5_ack_w); @@ -110,8 +114,8 @@ private: class wwfwfest_state : public ddragon3_state { public: - wwfwfest_state(const machine_config &mconfig, device_type type, const char *tag) - : ddragon3_state(mconfig, type, tag), + wwfwfest_state(const machine_config &mconfig, device_type type, const char *tag) : + ddragon3_state(mconfig, type, tag), m_fg0_videoram(*this, "fg0_videoram"), m_paletteram(*this, "palette") { @@ -132,7 +136,6 @@ private: tilemap_t *m_fg0_tilemap; DECLARE_WRITE16_MEMBER(wwfwfest_fg0_videoram_w); - //required_device<buffered_spriteram16_device> m_spriteram; DECLARE_WRITE8_MEMBER(wwfwfest_priority_w); DECLARE_WRITE16_MEMBER(wwfwfest_irq_ack_w); @@ -149,3 +152,5 @@ private: void main_map(address_map &map); }; + +#endif // MAME_INCLUDES_DDRAGON3_H diff --git a/src/mame/includes/dogfgt.h b/src/mame/includes/dogfgt.h index 899e3ead329..370b1b34c99 100644 --- a/src/mame/includes/dogfgt.h +++ b/src/mame/includes/dogfgt.h @@ -1,5 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Nicola Salmoria +#ifndef MAME_INCLUDES_DOGFGT_H +#define MAME_INCLUDES_DOGFGT_H + +#pragma once + #include "sound/ay8910.h" #include "emupal.h" #include "screen.h" @@ -11,8 +16,8 @@ class dogfgt_state : public driver_device { public: - dogfgt_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + dogfgt_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_bgvideoram(*this, "bgvideoram"), m_spriteram(*this, "spriteram"), m_sharedram(*this, "sharedram"), @@ -21,7 +26,8 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), - m_ay(*this, "ay%u", 0U) { } + m_ay(*this, "ay%u", 0U) + { } void dogfgt(machine_config &config); @@ -74,8 +80,10 @@ private: TILE_GET_INFO_MEMBER(get_tile_info); DECLARE_PALETTE_INIT(dogfgt); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect ); + void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); void main_map(address_map &map); void sub_map(address_map &map); }; + +#endif // MAME_INCLUDES_DOGFGT_H diff --git a/src/mame/includes/fgoal.h b/src/mame/includes/fgoal.h index d56c391716e..d46689acd77 100644 --- a/src/mame/includes/fgoal.h +++ b/src/mame/includes/fgoal.h @@ -1,5 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Stefan Jokisch +#ifndef MAME_INCLUDES_FGOAL_H +#define MAME_INCLUDES_FGOAL_H + +#pragma once + #include "machine/mb14241.h" #include "emupal.h" #include "screen.h" @@ -7,25 +12,31 @@ class fgoal_state : public driver_device { public: - fgoal_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + fgoal_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_mb14241(*this, "mb14241"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), - m_video_ram(*this, "video_ram") { } + m_video_ram(*this, "video_ram") + { } void fgoal(machine_config &config); DECLARE_CUSTOM_INPUT_MEMBER(_80_r); -private: +protected: enum { TIMER_INTERRUPT }; + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: /* devices */ required_device<cpu_device> m_maincpu; required_device<mb14241_device> m_mb14241; @@ -68,16 +79,15 @@ private: TIMER_CALLBACK_MEMBER(interrupt_callback); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(fgoal); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - int intensity(int bits); - unsigned video_ram_address( ); + static int intensity(int bits); + unsigned video_ram_address(); void cpu_map(address_map &map); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; }; + +#endif // MAME_INCLUDES_FGOAL_H diff --git a/src/mame/includes/flstory.h b/src/mame/includes/flstory.h index 7612d2ebe2a..7aed1a12e7b 100644 --- a/src/mame/includes/flstory.h +++ b/src/mame/includes/flstory.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Nicola Salmoria +#ifndef MAME_INCLUDES_FLSTORY_H +#define MAME_INCLUDES_FLSTORY_H + +#pragma once #include "machine/gen_latch.h" #include "machine/input_merger.h" @@ -12,8 +16,8 @@ class flstory_state : public driver_device { public: - flstory_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + flstory_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_spriteram(*this, "spriteram"), m_scrlram(*this, "scrlram"), @@ -28,7 +32,8 @@ public: m_palette(*this, "palette"), m_soundlatch(*this, "soundlatch"), m_soundlatch2(*this, "soundlatch2"), - m_soundnmi(*this, "soundnmi") { } + m_soundnmi(*this, "soundnmi") + { } void flstory(machine_config &config); void rumba(machine_config &config); @@ -38,6 +43,9 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(victnine_mcu_status_bit01_r); +protected: + virtual void machine_start() override; + private: /* memory pointers */ required_shared_ptr<uint8_t> m_videoram; @@ -96,7 +104,6 @@ private: TILE_GET_INFO_MEMBER(get_tile_info); TILE_GET_INFO_MEMBER(victnine_get_tile_info); TILE_GET_INFO_MEMBER(get_rumba_tile_info); - virtual void machine_start() override; DECLARE_MACHINE_RESET(flstory); DECLARE_VIDEO_START(flstory); DECLARE_VIDEO_START(victnine); @@ -116,3 +123,5 @@ private: void sound_map(address_map &map); void victnine_map(address_map &map); }; + +#endif // MAME_INCLUDES_FLSTORY_H diff --git a/src/mame/includes/grchamp.h b/src/mame/includes/grchamp.h index e112d4129d2..4b1e0457a1d 100644 --- a/src/mame/includes/grchamp.h +++ b/src/mame/includes/grchamp.h @@ -5,6 +5,10 @@ Taito Grand Champ hardware *************************************************************************/ +#ifndef MAME_INCLUDES_GRCHAMP_H +#define MAME_INCLUDES_GRCHAMP_H + +#pragma once #include "machine/input_merger.h" #include "machine/watchdog.h" @@ -15,8 +19,8 @@ class grchamp_state : public driver_device { public: - grchamp_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + grchamp_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_subcpu(*this, "sub"), @@ -33,10 +37,15 @@ public: m_rightram(*this, "rightram"), m_centerram(*this, "centerram"), m_digits(*this, "digit%u", 0U) - { } + { } void grchamp(machine_config &config); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + private: DECLARE_WRITE8_MEMBER(cpu0_outputs_w); DECLARE_WRITE8_MEMBER(led_board_w); @@ -98,14 +107,10 @@ private: uint8_t m_collmode; bitmap_ind16 m_work_bitmap; - tilemap_t * m_text_tilemap; - tilemap_t * m_left_tilemap; - tilemap_t * m_center_tilemap; - tilemap_t * m_right_tilemap; - - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; + tilemap_t *m_text_tilemap; + tilemap_t *m_left_tilemap; + tilemap_t *m_center_tilemap; + tilemap_t *m_right_tilemap; required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; @@ -140,3 +145,5 @@ private: /*----------- defined in audio/grchamp.c -----------*/ DISCRETE_SOUND_EXTERN( grchamp_discrete ); + +#endif // MAME_INCLUDES_GRCHAMP_H diff --git a/src/mame/includes/gsword.h b/src/mame/includes/gsword.h index 9d1b2ee6a77..ac8945a2493 100644 --- a/src/mame/includes/gsword.h +++ b/src/mame/includes/gsword.h @@ -30,6 +30,7 @@ public: { } +protected: required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; optional_device<cpu_device> m_subcpu; @@ -85,6 +86,12 @@ public: { } + void init_gsword(); + void init_gsword2(); + + void gsword(machine_config &config); + +protected: DECLARE_READ8_MEMBER(hack_r); DECLARE_WRITE8_MEMBER(nmi_set_w); DECLARE_WRITE8_MEMBER(sound_command_w); @@ -94,19 +101,16 @@ public: INTERRUPT_GEN_MEMBER(sound_interrupt); - void init_gsword(); - void init_gsword2(); - DECLARE_PALETTE_INIT(gsword); virtual void machine_start() override; virtual void machine_reset() override; - void gsword(machine_config &config); void cpu1_io_map(address_map &map); void cpu2_io_map(address_map &map); void cpu2_map(address_map &map); void cpu3_map(address_map &map); + private: required_device<generic_latch_8_device> m_soundlatch; required_device<msm5205_device> m_msm; @@ -128,6 +132,9 @@ public: { } + void josvolly(machine_config &config); + +protected: DECLARE_READ8_MEMBER(mcu1_p1_r); DECLARE_READ8_MEMBER(mcu1_p2_r); DECLARE_READ8_MEMBER(mcu2_p1_r); @@ -145,10 +152,10 @@ public: virtual void machine_start() override; virtual void machine_reset() override; - void josvolly(machine_config &config); void josvolly_cpu1_io_map(address_map &map); void josvolly_cpu2_io_map(address_map &map); void josvolly_cpu2_map(address_map &map); + private: bool m_cpu2_nmi_enable; u8 m_mcu1_p1; diff --git a/src/mame/includes/kickgoal.h b/src/mame/includes/kickgoal.h index ab91ac1fcde..0fa7eb4d0c4 100644 --- a/src/mame/includes/kickgoal.h +++ b/src/mame/includes/kickgoal.h @@ -5,6 +5,10 @@ Kick Goal - Action Hollywood *************************************************************************/ +#ifndef MAME_INCLUDES_KICKGOAL_H +#define MAME_INCLUDES_KICKGOAL_H + +#pragma once #include "sound/okim6295.h" #include "machine/eepromser.h" @@ -14,8 +18,8 @@ class kickgoal_state : public driver_device { public: - kickgoal_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + kickgoal_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_fgram(*this, "fgram"), m_bgram(*this, "bgram"), m_bg2ram(*this, "bg2ram"), @@ -37,6 +41,10 @@ public: void init_kickgoal(); void init_actionhw(); +protected: + void machine_start() override; + void machine_reset() override; + private: DECLARE_READ16_MEMBER(kickgoal_eeprom_r); DECLARE_WRITE16_MEMBER(kickgoal_eeprom_w); @@ -69,9 +77,6 @@ private: void kickgoal_program_map(address_map &map); void oki_map(address_map &map); - virtual void machine_start() override; - virtual void machine_reset() override; - /* video-related */ tilemap_t *m_fgtm; tilemap_t *m_bgtm; @@ -115,3 +120,5 @@ private: required_device<palette_device> m_palette; required_device<generic_latch_8_device> m_soundlatch; }; + +#endif // MAME_INCLUDES_KICKGOAL_H diff --git a/src/mame/includes/ksayakyu.h b/src/mame/includes/ksayakyu.h index f0da4d38597..46a698c6ac6 100644 --- a/src/mame/includes/ksayakyu.h +++ b/src/mame/includes/ksayakyu.h @@ -6,6 +6,10 @@ Kusayakyuu *************************************************************************/ +#ifndef MAME_INCLUDES_KSAYAKYU_H +#define MAME_INCLUDES_KSAYAKYU_H + +#pragma once #include "machine/gen_latch.h" #include "emupal.h" @@ -13,17 +17,23 @@ class ksayakyu_state : public driver_device { public: - ksayakyu_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + ksayakyu_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_spriteram(*this, "spriteram"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch") { } + m_soundlatch(*this, "soundlatch") + { } void ksayakyu(machine_config &config); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + private: /* memory pointers */ required_shared_ptr<uint8_t> m_videoram; @@ -49,9 +59,6 @@ private: DECLARE_WRITE8_MEMBER(dummy3_w); TILE_GET_INFO_MEMBER(get_ksayakyu_tile_info); TILE_GET_INFO_MEMBER(get_text_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(ksayakyu); uint32_t screen_update_ksayakyu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); @@ -62,3 +69,5 @@ private: void maincpu_map(address_map &map); void soundcpu_map(address_map &map); }; + +#endif // MAME_INCLUDES_KSAYAKYU_H diff --git a/src/mame/includes/lkage.h b/src/mame/includes/lkage.h index 2577ffd0adf..ab4c69b1d9e 100644 --- a/src/mame/includes/lkage.h +++ b/src/mame/includes/lkage.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Phil Stroffolino +#ifndef MAME_INCLUDES_LKAGE_H +#define MAME_INCLUDES_LKAGE_H + +#pragma once #include "machine/gen_latch.h" #include "machine/input_merger.h" @@ -9,8 +13,8 @@ class lkage_state : public driver_device { public: - lkage_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + lkage_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_vreg(*this, "vreg"), m_scroll(*this, "scroll"), m_spriteram(*this, "spriteram"), @@ -21,7 +25,8 @@ public: m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_soundlatch(*this, "soundlatch"), - m_soundnmi(*this, "soundnmi") { } + m_soundnmi(*this, "soundnmi") + { } void lkageb(machine_config &config); void lkage(machine_config &config); @@ -29,6 +34,11 @@ public: void init_bygone(); void init_lkage(); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + private: required_shared_ptr<uint8_t> m_vreg; required_shared_ptr<uint8_t> m_scroll; @@ -71,9 +81,6 @@ private: TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info); TILE_GET_INFO_MEMBER(get_tx_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; uint32_t screen_update_lkage(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ); void lkage_io_map(address_map &map); @@ -82,3 +89,5 @@ private: void lkage_map_mcu(address_map &map); void lkage_sound_map(address_map &map); }; + +#endif // MAME_INCLUDES_LKAGE_H diff --git a/src/mame/includes/lockon.h b/src/mame/includes/lockon.h index 996b9b963af..7eb313c5af1 100644 --- a/src/mame/includes/lockon.h +++ b/src/mame/includes/lockon.h @@ -5,6 +5,10 @@ Lock-On hardware *************************************************************************/ +#ifndef MAME_INCLUDES_LOCKON_H +#define MAME_INCLUDES_LOCKON_H + +#pragma once #include "machine/watchdog.h" #include "sound/flt_vol.h" @@ -152,3 +156,5 @@ private: void sound_io(address_map &map); void sound_prg(address_map &map); }; + +#endif // MAME_INCLUDES_LOCKON_H diff --git a/src/mame/includes/matmania.h b/src/mame/includes/matmania.h index 7bf512f9304..0e85d2f7ea2 100644 --- a/src/mame/includes/matmania.h +++ b/src/mame/includes/matmania.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Brad Oliver +#ifndef MAME_INCLUDES_MATMANIA_H +#define MAME_INCLUDES_MATMANIA_H + +#pragma once #include "machine/taito68705interface.h" @@ -10,8 +14,8 @@ class matmania_state : public driver_device { public: - matmania_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + matmania_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_videoram2(*this, "videoram2"), m_videoram3(*this, "videoram3"), @@ -34,6 +38,9 @@ public: void matmania(machine_config &config); void maniach(machine_config &config); +protected: + virtual void video_start() override; + private: /* memory pointers */ required_shared_ptr<uint8_t> m_videoram; @@ -64,7 +71,6 @@ private: DECLARE_WRITE8_MEMBER(matmania_sh_command_w); DECLARE_WRITE8_MEMBER(maniach_sh_command_w); DECLARE_WRITE8_MEMBER(matmania_paletteram_w); - virtual void video_start() override; DECLARE_PALETTE_INIT(matmania); uint32_t screen_update_matmania(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_maniach(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -73,3 +79,5 @@ private: void matmania_map(address_map &map); void matmania_sound_map(address_map &map); }; + +#endif // MAME_INCLUDES_MATMANIA_H diff --git a/src/mame/includes/msisaac.h b/src/mame/includes/msisaac.h index e24ef8db46a..452dd16432c 100644 --- a/src/mame/includes/msisaac.h +++ b/src/mame/includes/msisaac.h @@ -1,5 +1,9 @@ // license:GPL-2.0+ // copyright-holders:Jarek Burczynski +#ifndef MAME_INCLUDES_MSISAAC_H +#define MAME_INCLUDES_MSISAAC_H + +#pragma once #include "machine/taito68705interface.h" #include "machine/gen_latch.h" @@ -13,8 +17,8 @@ class msisaac_state : public driver_device { public: - msisaac_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + msisaac_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_spriteram(*this, "spriteram"), m_videoram(*this, "videoram"), m_videoram3(*this, "videoram3"), @@ -26,10 +30,16 @@ public: m_ta7630(*this, "ta7630"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch") { } + m_soundlatch(*this, "soundlatch") + { } void msisaac(machine_config &config); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + private: /* memory pointers */ required_shared_ptr<uint8_t> m_spriteram; @@ -92,12 +102,11 @@ private: TILE_GET_INFO_MEMBER(get_fg_tile_info); TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_bg2_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; uint32_t screen_update_msisaac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(nmi_callback); void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); void msisaac_map(address_map &map); void msisaac_sound_map(address_map &map); }; + +#endif // MAME_INCLUDES_MSISAAC_H diff --git a/src/mame/includes/nycaptor.h b/src/mame/includes/nycaptor.h index 4931d73bcba..f99bc09b840 100644 --- a/src/mame/includes/nycaptor.h +++ b/src/mame/includes/nycaptor.h @@ -41,6 +41,11 @@ public: void init_bronx(); void init_nycaptor(); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + private: /* memory pointers */ required_shared_ptr<uint8_t> m_videoram; @@ -100,12 +105,9 @@ private: DECLARE_WRITE8_MEMBER(nycaptor_scrlram_w); DECLARE_WRITE8_MEMBER(unk_w); TILE_GET_INFO_MEMBER(get_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; uint32_t screen_update_nycaptor(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - int nycaptor_spot( ); - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ); + int nycaptor_spot(); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri); void bronx_master_map(address_map &map); void bronx_slave_io_map(address_map &map); void bronx_slave_map(address_map &map); diff --git a/src/mame/includes/pitnrun.h b/src/mame/includes/pitnrun.h index d45b169da6e..43f21b2c01c 100644 --- a/src/mame/includes/pitnrun.h +++ b/src/mame/includes/pitnrun.h @@ -1,24 +1,34 @@ // license:BSD-3-Clause // copyright-holders:Tomasz Slanina, Pierpaolo Prazzoli +#ifndef MAME_INCLUDES_PITNRUN_H +#define MAME_INCLUDES_PITNRUN_H + +#pragma once #include "emupal.h" class pitnrun_state : public driver_device { public: - pitnrun_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + pitnrun_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_mcu(*this, "mcu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_videoram(*this, "videoram"), m_videoram2(*this, "videoram2"), - m_spriteram(*this, "spriteram") { } + m_spriteram(*this, "spriteram") + { } void pitnrun_mcu(machine_config &config); void pitnrun(machine_config &config); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + private: required_device<cpu_device> m_maincpu; optional_device<cpu_device> m_mcu; @@ -77,9 +87,6 @@ private: TIMER_CALLBACK_MEMBER(mcu_data_real_r); TIMER_CALLBACK_MEMBER(mcu_status_real_w); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(pitnrun); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -90,3 +97,5 @@ private: void pitnrun_sound_io_map(address_map &map); void pitnrun_sound_map(address_map &map); }; + +#endif // MAME_INCLUDES_PITNRUN_H diff --git a/src/mame/includes/rastan.h b/src/mame/includes/rastan.h index 0e52e5a6d8c..8070116414a 100644 --- a/src/mame/includes/rastan.h +++ b/src/mame/includes/rastan.h @@ -5,6 +5,10 @@ Rastan *************************************************************************/ +#ifndef MAME_INCLUDES_RASTAN_H +#define MAME_INCLUDES_RASTAN_H + +#pragma once #include "machine/74157.h" #include "sound/msm5205.h" @@ -14,16 +18,24 @@ class rastan_state : public driver_device { public: - rastan_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + rastan_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_msm(*this, "msm"), m_adpcm_sel(*this, "adpcm_sel"), m_adpcm_data(*this, "adpcm"), m_pc080sn(*this, "pc080sn"), - m_pc090oj(*this, "pc090oj") { } + m_pc090oj(*this, "pc090oj") + { } + + void rastan(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; +private: /* video-related */ u16 m_sprite_ctrl; u16 m_sprites_flipscreen; @@ -40,16 +52,16 @@ public: required_region_ptr<u8> m_adpcm_data; required_device<pc080sn_device> m_pc080sn; required_device<pc090oj_device> m_pc090oj; + DECLARE_WRITE8_MEMBER(rastan_msm5205_address_w); DECLARE_WRITE16_MEMBER(rastan_spritectrl_w); DECLARE_WRITE8_MEMBER(rastan_bankswitch_w); DECLARE_WRITE8_MEMBER(rastan_msm5205_start_w); DECLARE_WRITE8_MEMBER(rastan_msm5205_stop_w); - virtual void machine_start() override; - virtual void machine_reset() override; uint32_t screen_update_rastan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(rastan_msm5205_vck); - void rastan(machine_config &config); void rastan_map(address_map &map); void rastan_s_map(address_map &map); }; + +#endif // MAME_INCLUDES_RASTAN_H diff --git a/src/mame/includes/rbisland.h b/src/mame/includes/rbisland.h index ef025d677a4..cd540597591 100644 --- a/src/mame/includes/rbisland.h +++ b/src/mame/includes/rbisland.h @@ -41,6 +41,9 @@ public: void init_jumping(); void init_rbisland(); +protected: + virtual void machine_start() override; + private: DECLARE_WRITE16_MEMBER(jumping_sound_w); DECLARE_READ8_MEMBER(jumping_latch_r); @@ -53,7 +56,6 @@ private: DECLARE_WRITE16_MEMBER(jumping_spritectrl_w); DECLARE_WRITE8_MEMBER(bankswitch_w); DECLARE_WRITE8_MEMBER(counters_w); - virtual void machine_start() override; DECLARE_VIDEO_START(jumping); uint32_t screen_update_rainbow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_jumping(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -87,5 +89,4 @@ private: optional_device<timer_device> m_cchip_irq_clear; }; - #endif // MAME_INCLUDES_RBISLAND_H diff --git a/src/mame/includes/renegade.h b/src/mame/includes/renegade.h index 1238a51666d..34ea2c4369f 100644 --- a/src/mame/includes/renegade.h +++ b/src/mame/includes/renegade.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Phil Stroffolino, Carlos A. Lozano, Rob Rosenbrock +#ifndef MAME_INCLUDES_RENEGADE_H +#define MAME_INCLUDES_RENEGADE_H + +#pragma once #include "machine/taito68705interface.h" @@ -31,6 +35,11 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(mcu_status_r); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + private: required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; @@ -73,10 +82,6 @@ private: TIMER_DEVICE_CALLBACK_MEMBER(interrupt); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -84,3 +89,5 @@ private: void renegade_nomcu_map(address_map &map); void renegade_sound_map(address_map &map); }; + +#endif // MAME_INCLUDES_RENEGADE_H diff --git a/src/mame/includes/retofinv.h b/src/mame/includes/retofinv.h index 66d6402f714..670cc5658d4 100644 --- a/src/mame/includes/retofinv.h +++ b/src/mame/includes/retofinv.h @@ -34,6 +34,10 @@ public: void retofinv(machine_config &config); void retofinvb1(machine_config &config); +protected: + virtual void machine_start() override; + virtual void video_start() override; + private: DECLARE_WRITE8_MEMBER(cpu2_m6000_w); DECLARE_READ8_MEMBER(cpu0_mf800_r); @@ -64,9 +68,6 @@ private: void sound_map(address_map &map); void sub_map(address_map &map); - virtual void machine_start() override; - virtual void video_start() override; - void draw_sprites(bitmap_ind16 &bitmap); required_device<cpu_device> m_maincpu; diff --git a/src/mame/includes/rollrace.h b/src/mame/includes/rollrace.h index b5e1c038400..8931389cea6 100644 --- a/src/mame/includes/rollrace.h +++ b/src/mame/includes/rollrace.h @@ -1,23 +1,32 @@ // license:BSD-3-Clause // copyright-holders:Pierpaolo Prazzoli +#ifndef MAME_INCLUDES_ROLLRACE_H +#define MAME_INCLUDES_ROLLRACE_H + +#pragma once #include "emupal.h" class rollrace_state : public driver_device { public: - rollrace_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + rollrace_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), - m_spriteram(*this, "spriteram") { } + m_spriteram(*this, "spriteram") + { } void rollace2(machine_config &config); void rollrace(machine_config &config); +protected: + virtual void machine_start() override; + virtual void video_start() override; + private: required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; @@ -59,8 +68,6 @@ private: void tilemap_refresh_flip(); DECLARE_PALETTE_INIT(rollrace); - virtual void machine_start() override; - virtual void video_start() override; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -69,3 +76,5 @@ private: void rollrace_map(address_map &map); void rollrace_sound_map(address_map &map); }; + +#endif // MAME_INCLUDES_ROLLRACE_H diff --git a/src/mame/includes/shadfrce.h b/src/mame/includes/shadfrce.h index c7980da0c2c..23b1648b41f 100644 --- a/src/mame/includes/shadfrce.h +++ b/src/mame/includes/shadfrce.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:David Haywood +#ifndef MAME_INCLUDES_SHADFRCE_H +#define MAME_INCLUDES_SHADFRCE_H + +#pragma once #include "machine/gen_latch.h" #include "machine/timer.h" @@ -10,8 +14,8 @@ class shadfrce_state : public driver_device { public: - shadfrce_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + shadfrce_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_oki(*this, "oki"), @@ -30,10 +34,14 @@ public: m_fgvideoram(*this, "fgvideoram"), m_bg0videoram(*this, "bg0videoram"), m_bg1videoram(*this, "bg1videoram"), - m_spvideoram(*this, "spvideoram") { } + m_spvideoram(*this, "spvideoram") + { } void shadfrce(machine_config &config); +protected: + virtual void video_start() override; + private: required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; @@ -87,8 +95,6 @@ private: TILE_GET_INFO_MEMBER(get_bg0tile_info); TILE_GET_INFO_MEMBER(get_bg1tile_info); - virtual void video_start() override; - TIMER_DEVICE_CALLBACK_MEMBER(scanline); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -98,3 +104,5 @@ private: void shadfrce_map(address_map &map); void shadfrce_sound_map(address_map &map); }; + +#endif // MAME_INCLUDES_SHADFRCE_H diff --git a/src/mame/includes/slapshot.h b/src/mame/includes/slapshot.h index bbeed581f16..2b407b8499d 100644 --- a/src/mame/includes/slapshot.h +++ b/src/mame/includes/slapshot.h @@ -5,6 +5,10 @@ Slapshot / Operation Wolf 3 *************************************************************************/ +#ifndef MAME_INCLUDES_SLAPSHOT_H +#define MAME_INCLUDES_SLAPSHOT_H + +#pragma once #include "audio/taitosnd.h" #include "machine/taitoio.h" @@ -12,21 +16,11 @@ #include "video/tc0480scp.h" #include "emupal.h" -struct slapshot_tempsprite -{ - int gfx; - int code,color; - int flipx,flipy; - int x,y; - int zoomx,zoomy; - int primask; -}; - class slapshot_state : public driver_device { public: - slapshot_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + slapshot_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_tc0140syt(*this, "tc0140syt"), m_tc0480scp(*this, "tc0480scp"), @@ -35,7 +29,8 @@ public: m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_spriteram(*this,"spriteram"), - m_spriteext(*this,"spriteext") { } + m_spriteext(*this,"spriteext") + { } void opwolf3(machine_config &config); void slapshot(machine_config &config); @@ -43,14 +38,24 @@ public: void init_slapshot(); protected: + enum + { + TIMER_SLAPSHOT_INTERRUPT6 + }; + virtual void machine_start() override; virtual void video_start() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; private: - enum + struct slapshot_tempsprite { - TIMER_SLAPSHOT_INTERRUPT6 + int gfx; + int code,color; + int flipx,flipy; + int x,y; + int zoomx,zoomy; + int primask; }; /* devices */ @@ -69,7 +74,7 @@ private: std::unique_ptr<uint16_t[]> m_spriteram_delayed; /* video-related */ - struct slapshot_tempsprite *m_spritelist; + slapshot_tempsprite *m_spritelist; int32_t m_sprites_disabled; int32_t m_sprites_active_area; int32_t m_sprites_master_scrollx; @@ -99,3 +104,5 @@ private: void opwolf3_z80_sound_map(address_map &map); void slapshot_map(address_map &map); }; + +#endif // MAME_INCLUDES_SLAPSHOT_H diff --git a/src/mame/includes/spdodgeb.h b/src/mame/includes/spdodgeb.h index 6174ba80ff4..943ffeca7ed 100644 --- a/src/mame/includes/spdodgeb.h +++ b/src/mame/includes/spdodgeb.h @@ -5,6 +5,10 @@ Super Dodge Ball hardware *************************************************************************/ +#ifndef MAME_INCLUDES_SPDODGEB_H +#define MAME_INCLUDES_SPDODGEB_H + +#pragma once #include "machine/gen_latch.h" #include "machine/timer.h" @@ -15,8 +19,8 @@ class spdodgeb_state : public driver_device { public: - spdodgeb_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + spdodgeb_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this,"maincpu"), m_audiocpu(*this, "audiocpu"), m_msm1(*this, "msm1"), @@ -26,12 +30,18 @@ public: m_palette(*this, "palette"), m_soundlatch(*this, "soundlatch"), m_videoram(*this, "videoram"), - m_spriteram(*this, "spriteram") { } + m_spriteram(*this, "spriteram") + { } void spdodgeb(machine_config &config); DECLARE_CUSTOM_INPUT_MEMBER(mcu63705_busy_r); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + private: required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; @@ -80,9 +90,6 @@ private: TILEMAP_MAPPER_MEMBER(background_scan); TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(spdodgeb); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -95,3 +102,5 @@ private: void spdodgeb_map(address_map &map); void spdodgeb_sound_map(address_map &map); }; + +#endif // MAME_INCLUDES_SPDODGEB_H diff --git a/src/mame/includes/speedbal.h b/src/mame/includes/speedbal.h index 1beb3adbac1..da1d25dbb91 100644 --- a/src/mame/includes/speedbal.h +++ b/src/mame/includes/speedbal.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Joseba Epalza +#ifndef MAME_INCLUDES_SPEEDBAL_H +#define MAME_INCLUDES_SPEEDBAL_H + +#pragma once #include "emupal.h" @@ -22,6 +26,10 @@ public: void init_speedbal(); void init_musicbal(); +protected: + virtual void machine_start() override; + virtual void video_start() override; + private: required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; @@ -37,9 +45,6 @@ private: tilemap_t *m_bg_tilemap; tilemap_t *m_fg_tilemap; - virtual void machine_start() override; - virtual void video_start() override; - DECLARE_WRITE8_MEMBER(coincounter_w); DECLARE_WRITE8_MEMBER(foreground_videoram_w); DECLARE_WRITE8_MEMBER(background_videoram_w); @@ -59,3 +64,5 @@ private: void sound_cpu_io_map(address_map &map); void sound_cpu_map(address_map &map); }; + +#endif // MAME_INCLUDES_SPEEDBAL_H diff --git a/src/mame/includes/speedspn.h b/src/mame/includes/speedspn.h index 1e9ab2c243f..9e18f8da368 100644 --- a/src/mame/includes/speedspn.h +++ b/src/mame/includes/speedspn.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:David Haywood, Farfetch'd +#ifndef MAME_INCLUDES_SPEEDSPN_H +#define MAME_INCLUDES_SPEEDSPN_H + +#pragma once #include "machine/gen_latch.h" #include "sound/okim6295.h" @@ -8,8 +12,8 @@ class speedspn_state : public driver_device { public: - speedspn_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + speedspn_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_oki(*this, "oki"), @@ -18,10 +22,15 @@ public: m_soundlatch(*this, "soundlatch"), m_prgbank(*this, "prgbank"), m_okibank(*this, "okibank"), - m_attram(*this, "attram") { } + m_attram(*this, "attram") + { } void speedspn(machine_config &config); +protected: + virtual void machine_start() override; + virtual void video_start() override; + private: required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; @@ -48,13 +57,13 @@ private: DECLARE_WRITE8_MEMBER(display_disable_w); DECLARE_WRITE8_MEMBER(okibank_w); TILE_GET_INFO_MEMBER(get_tile_info); - virtual void machine_start() override; - virtual void video_start() override; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); void io_map(address_map &map); void oki_map(address_map &map); void program_map(address_map &map); void sound_map(address_map &map); }; + +#endif // MAME_INCLUDES_SPEEDSPN_H diff --git a/src/mame/includes/ssozumo.h b/src/mame/includes/ssozumo.h index a2affae7b49..95c456a3b89 100644 --- a/src/mame/includes/ssozumo.h +++ b/src/mame/includes/ssozumo.h @@ -1,13 +1,17 @@ // license:BSD-3-Clause // copyright-holders:Takahiro Nogi +#ifndef MAME_INCLUDES_SSOZUMO_H +#define MAME_INCLUDES_SSOZUMO_H + +#pragma once #include "emupal.h" class ssozumo_state : public driver_device { public: - ssozumo_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + ssozumo_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), @@ -17,12 +21,17 @@ public: m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_videoram2(*this, "videoram2"), - m_colorram2(*this, "colorram2") { } + m_colorram2(*this, "colorram2") + { } void ssozumo(machine_config &config); DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); +protected: + virtual void machine_start() override; + virtual void video_start() override; + private: DECLARE_WRITE8_MEMBER(sound_nmi_mask_w); DECLARE_WRITE8_MEMBER(videoram_w); @@ -44,9 +53,6 @@ private: void ssozumo_map(address_map &map); void ssozumo_sound_map(address_map &map); - virtual void machine_start() override; - virtual void video_start() override; - required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; required_device<gfxdecode_device> m_gfxdecode; @@ -66,3 +72,5 @@ private: void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); }; + +#endif // MAME_INCLUDES_SSOZUMO_H diff --git a/src/mame/includes/ssrj.h b/src/mame/includes/ssrj.h index 4db0839e211..edbed1271c9 100644 --- a/src/mame/includes/ssrj.h +++ b/src/mame/includes/ssrj.h @@ -1,13 +1,17 @@ // license:BSD-3-Clause // copyright-holders:Tomasz Slanina +#ifndef MAME_INCLUDES_SSRJ_H +#define MAME_INCLUDES_SSRJ_H + +#pragma once #include "emupal.h" class ssrj_state : public driver_device { public: - ssrj_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + ssrj_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), @@ -15,10 +19,16 @@ public: m_vram2(*this, "vram2"), m_vram3(*this, "vram3"), m_vram4(*this, "vram4"), - m_scrollram(*this, "scrollram") { } + m_scrollram(*this, "scrollram") + { } void ssrj(machine_config &config); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + private: required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; @@ -45,9 +55,6 @@ private: TILE_GET_INFO_MEMBER(get_tile_info2); TILE_GET_INFO_MEMBER(get_tile_info4); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(ssrj); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -56,3 +63,5 @@ private: void ssrj_map(address_map &map); }; + +#endif // MAME_INCLUDES_SSRJ_H diff --git a/src/mame/includes/superchs.h b/src/mame/includes/superchs.h index 52ad06e6161..f15849ae2a4 100644 --- a/src/mame/includes/superchs.h +++ b/src/mame/includes/superchs.h @@ -9,16 +9,6 @@ #include "video/tc0480scp.h" #include "emupal.h" -struct schs_tempsprite -{ - int gfx; - int code,color; - int flipx,flipy; - int x,y; - int zoomx,zoomy; - int primask; -}; - class superchs_state : public driver_device { public: @@ -44,6 +34,16 @@ protected: virtual void video_start() override; private: + struct schs_tempsprite + { + int gfx; + int code,color; + int flipx,flipy; + int x,y; + int zoomx,zoomy; + int primask; + }; + required_shared_ptr<uint32_t> m_ram; required_shared_ptr<uint32_t> m_spriteram; required_shared_ptr<uint32_t> m_shared_ram; @@ -59,7 +59,7 @@ private: DECLARE_READ32_MEMBER(main_cycle_r); DECLARE_READ16_MEMBER(sub_cycle_r); uint32_t screen_update_superchs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs); + void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int x_offs, int y_offs); required_device<cpu_device> m_maincpu; required_device<cpu_device> m_subcpu; required_device<tc0480scp_device> m_tc0480scp; diff --git a/src/mame/includes/tagteam.h b/src/mame/includes/tagteam.h index 36f93a1d6cc..f90cc030bc0 100644 --- a/src/mame/includes/tagteam.h +++ b/src/mame/includes/tagteam.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Steve Ellenoff, Brad Oliver +#ifndef MAME_INCLUDES_TAGTEAM_H +#define MAME_INCLUDES_TAGTEAM_H + +#pragma once #include "machine/gen_latch.h" #include "emupal.h" @@ -7,20 +11,25 @@ class tagteam_state : public driver_device { public: - tagteam_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + tagteam_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_soundlatch(*this, "soundlatch"), m_videoram(*this, "videoram"), - m_colorram(*this, "colorram") { } + m_colorram(*this, "colorram") + { } void tagteam(machine_config &config); DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); +protected: + virtual void machine_start() override; + virtual void video_start() override; + private: required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; @@ -50,8 +59,6 @@ private: TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void machine_start() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(tagteam); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -59,3 +66,5 @@ private: void main_map(address_map &map); void sound_map(address_map &map); }; + +#endif // MAME_INCLUDES_TAGTEAM_H diff --git a/src/mame/includes/taito_f3.h b/src/mame/includes/taito_f3.h index 148137d3f22..fff482d847c 100644 --- a/src/mame/includes/taito_f3.h +++ b/src/mame/includes/taito_f3.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Bryan McPhail +#ifndef MAME_INCLUDES_TAITO_F3_H +#define MAME_INCLUDES_TAITO_F3_H + +#pragma once #include "audio/taito_en.h" #include "machine/eepromser.h" @@ -409,3 +413,5 @@ protected: void get_vram_info(tilemap_t *vram_tilemap, tilemap_t *pixel_tilemap, int sx, int sy); void scanline_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect); }; + +#endif // MAME_INCLUDES_TAITO_F3_H diff --git a/src/mame/includes/taito_h.h b/src/mame/includes/taito_h.h index d98c912cfc0..b835f57898e 100644 --- a/src/mame/includes/taito_h.h +++ b/src/mame/includes/taito_h.h @@ -34,6 +34,10 @@ public: void dleague(machine_config &config); void tetristh(machine_config &config); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + private: /* memory pointers */ required_shared_ptr<uint16_t> m_m68000_mainram; @@ -49,8 +53,6 @@ private: DECLARE_WRITE8_MEMBER(coin_control_w); DECLARE_READ8_MEMBER(syvalion_input_bypass_r); DECLARE_WRITE8_MEMBER(sound_bankswitch_w); - virtual void machine_start() override; - virtual void machine_reset() override; uint32_t screen_update_syvalion(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_recordbr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_dleague(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); diff --git a/src/mame/includes/taito_l.h b/src/mame/includes/taito_l.h index 2d47ee07348..97839725a92 100644 --- a/src/mame/includes/taito_l.h +++ b/src/mame/includes/taito_l.h @@ -77,7 +77,7 @@ protected: DECLARE_WRITE8_MEMBER(vram_w); template<int Offset> TILE_GET_INFO_MEMBER(get_tile_info); TILE_GET_INFO_MEMBER(get_tx_tile_info); - DECLARE_VIDEO_START(taito_l); + virtual void video_start() override; u32 screen_update_taitol(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(screen_vblank_taitol); TIMER_DEVICE_CALLBACK_MEMBER(vbl_interrupt); @@ -119,6 +119,11 @@ public: void kurikint(machine_config &config); void evilston(machine_config &config); void raimais(machine_config &config); + +protected: + virtual void state_register() override; + virtual void taito_machine_reset() override; + void evilston_2_map(address_map &map); void evilston_map(address_map &map); void kurikint_2_map(address_map &map); @@ -127,10 +132,6 @@ public: void raimais_3_map(address_map &map); void raimais_map(address_map &map); -protected: - virtual void state_register() override; - virtual void taito_machine_reset() override; - required_device<cpu_device> m_audio_cpu; required_memory_region m_audio_prg; optional_memory_bank m_audio_bnk; @@ -154,13 +155,15 @@ public: DECLARE_WRITE8_MEMBER(portA_w); void fhawk(machine_config &config); - void fhawk_2_map(address_map &map); - void fhawk_3_map(address_map &map); - void fhawk_map(address_map &map); + protected: virtual void state_register() override; virtual void taito_machine_reset() override; + void fhawk_2_map(address_map &map); + void fhawk_3_map(address_map &map); + void fhawk_map(address_map &map); + required_memory_region m_slave_prg; required_memory_bank m_slave_bnk; @@ -190,13 +193,15 @@ public: DECLARE_WRITE8_MEMBER(msm5205_volume_w); void champwr(machine_config &config); - void champwr_2_map(address_map &map); - void champwr_3_map(address_map &map); - void champwr_map(address_map &map); + protected: virtual void state_register() override; virtual void taito_machine_reset() override; + void champwr_2_map(address_map &map); + void champwr_3_map(address_map &map); + void champwr_map(address_map &map); + required_device<msm5205_device> m_msm; required_region_ptr<u8> m_adpcm_rgn; @@ -231,14 +236,16 @@ public: void puzznici(machine_config &config); void cachat(machine_config &config); void puzznic(machine_config &config); + +protected: + virtual void state_register() override; + virtual void taito_machine_reset() override; + void cachat_map(address_map &map); void palamed_map(address_map &map); void plotting_map(address_map &map); void puzznic_map(address_map &map); void puzznici_map(address_map &map); -protected: - virtual void state_register() override; - virtual void taito_machine_reset() override; required_device<ym2203_device> m_ymsnd; optional_device_array<ls157_x2_device, 2> m_mux; diff --git a/src/mame/includes/taito_o.h b/src/mame/includes/taito_o.h index 15fcd89dceb..5c4a616f3b7 100644 --- a/src/mame/includes/taito_o.h +++ b/src/mame/includes/taito_o.h @@ -5,6 +5,10 @@ Taito O system *************************************************************************/ +#ifndef MAME_INCLUDES_TAITO_O_H +#define MAME_INCLUDES_TAITO_O_H + +#pragma once #include "machine/timer.h" #include "machine/watchdog.h" @@ -14,16 +18,20 @@ class taitoo_state : public driver_device { public: - taitoo_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + taitoo_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_watchdog(*this, "watchdog"), m_tc0080vco(*this, "tc0080vco"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette") + { } void parentj(machine_config &config); +protected: + virtual void machine_start() override; + private: /* devices */ required_device<cpu_device> m_maincpu; @@ -34,9 +42,10 @@ private: DECLARE_WRITE16_MEMBER(io_w); DECLARE_READ16_MEMBER(io_r); - virtual void machine_start() override; uint32_t screen_update_parentj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(parentj_interrupt); - void parentj_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ); + void parentj_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority); void parentj_map(address_map &map); }; + +#endif // MAME_INCLUDES_TAITO_O_H diff --git a/src/mame/includes/tatsumi.h b/src/mame/includes/tatsumi.h index 5ab93716a87..faa1e7963c8 100644 --- a/src/mame/includes/tatsumi.h +++ b/src/mame/includes/tatsumi.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Bryan McPhail, Angelo Salese +#ifndef MAME_INCLUDES_TATSUMI_H +#define MAME_INCLUDES_TATSUMI_H + +#pragma once #include "sound/okim6295.h" #include "sound/ym2151.h" @@ -200,12 +204,14 @@ public: { } - void cyclwarr(machine_config &config); void bigfight(machine_config &config); void init_cyclwarr(); +protected: + virtual void machine_reset() override; + private: DECLARE_READ16_MEMBER(cyclwarr_sprite_r); DECLARE_WRITE16_MEMBER(cyclwarr_sprite_w); @@ -231,8 +237,6 @@ private: void slave_map(address_map &map); void sound_map(address_map &map); - virtual void machine_reset() override; - required_device<generic_latch_8_device> m_soundlatch; required_shared_ptr<uint16_t> m_master_ram; @@ -258,3 +262,4 @@ private: void apply_highlight_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_ind8 &highlight_bitmap); }; +#endif // MAME_INCLUDES_TATSUMI_H diff --git a/src/mame/includes/tnzs.h b/src/mame/includes/tnzs.h index a71c95c10d6..6c02e4e0814 100644 --- a/src/mame/includes/tnzs.h +++ b/src/mame/includes/tnzs.h @@ -1,10 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Luca Elia, Mirko Buffoni, Takahiro Nogi +#ifndef MAME_INCLUDES_TNZS_H +#define MAME_INCLUDES_TNZS_H #pragma once -#ifndef MAME_INCLUDES_TNZS_H -#define MAME_INCLUDES_TNZS_H #include "sound/dac.h" #include "sound/samples.h" @@ -15,7 +15,6 @@ #include "machine/upd4701.h" #include "emupal.h" -#define MAX_SAMPLES 0x2f /* max samples */ class tnzs_base_state : public driver_device { @@ -33,8 +32,6 @@ public: void tnzs_base(machine_config &config); void tnzs_mainbank(machine_config &config); - DECLARE_PALETTE_INIT(prompalette); - protected: virtual void machine_start() override; @@ -42,6 +39,7 @@ protected: DECLARE_WRITE8_MEMBER(ramrom_bankswitch_w); + DECLARE_PALETTE_INIT(prompalette); uint32_t screen_update_tnzs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(screen_vblank_tnzs); @@ -185,10 +183,13 @@ public: void init_kageki(); -private: +protected: virtual void machine_start() override; virtual void machine_reset() override; +private: + static constexpr unsigned MAX_SAMPLES = 0x2f; + virtual DECLARE_WRITE8_MEMBER(bankswitch1_w) override; DECLARE_READ8_MEMBER(csport_r); @@ -222,9 +223,10 @@ public: void jpopnics(machine_config &config); -private: +protected: virtual void machine_reset() override; +private: DECLARE_WRITE8_MEMBER(subbankswitch_w); void jpopnics_main_map(address_map &map); @@ -284,9 +286,10 @@ public: void kabukiz(machine_config &config); -private: +protected: virtual void machine_start() override; +private: DECLARE_WRITE8_MEMBER(sound_bank_w); void kabukiz_cpu2_map(address_map &map); diff --git a/src/mame/includes/topspeed.h b/src/mame/includes/topspeed.h index 9a453de40b6..495e236461e 100644 --- a/src/mame/includes/topspeed.h +++ b/src/mame/includes/topspeed.h @@ -5,6 +5,10 @@ Top Speed / Full Throttle *************************************************************************/ +#ifndef MAME_INCLUDES_TOPSPEED_H +#define MAME_INCLUDES_TOPSPEED_H + +#pragma once #include "sound/msm5205.h" #include "sound/flt_vol.h" @@ -39,6 +43,10 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(pedal_r); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + private: required_shared_ptr<uint16_t> m_spritemap; required_shared_ptr<uint16_t> m_raster_ctrl; @@ -74,10 +82,6 @@ private: uint8_t m_dislayer[5]; #endif - // drivers/topspeed.c - virtual void machine_start() override; - virtual void machine_reset() override; - void msm5205_update(int chip); DECLARE_WRITE16_MEMBER(cpua_ctrl_w); @@ -100,3 +104,5 @@ private: void z80_io(address_map &map); void z80_prg(address_map &map); }; + +#endif // MAME_INCLUDES_TOPSPEED_H diff --git a/src/mame/includes/tx1.h b/src/mame/includes/tx1.h index c5fae904f6e..c5c2547a23a 100644 --- a/src/mame/includes/tx1.h +++ b/src/mame/includes/tx1.h @@ -38,103 +38,112 @@ #define CPU_MASTER_CLOCK (XTAL(15'000'000)) #define BUGGYBOY_ZCLK (CPU_MASTER_CLOCK / 2) -struct math_t -{ - uint16_t cpulatch; - uint16_t promaddr; - uint16_t inslatch; - uint32_t mux; - uint16_t ppshift; - uint32_t i0ff; - uint16_t retval; - uint16_t muxlatch; // TX-1 - int dbgaddr; - int dbgpc; -}; - -/* - SN74S516 16x16 Multiplier/Divider -*/ -struct sn74s516_t -{ - int16_t X; - int16_t Y; - - union - { - #ifdef LSB_FIRST - struct { uint16_t W; int16_t Z; } as16bit; - #else - struct { int16_t Z; uint16_t W; } as16bit; - #endif - int32_t ZW32; - } ZW; - - int code; - int state; - int ZWfl; -}; - -struct vregs_t -{ - uint16_t scol; /* Road colours */ - uint32_t slock; /* Scroll lock */ - uint8_t flags; /* Road flags */ - - uint32_t ba_val; /* Accumulator */ - uint32_t ba_inc; - uint32_t bank_mode; - - uint16_t h_val; /* Accumulator */ - uint16_t h_inc; - uint16_t h_init; - - uint8_t slin_val; /* Accumulator */ - uint8_t slin_inc; - - /* Buggyboy only */ - uint8_t wa8; - uint8_t wa4; - - uint16_t wave_lfsr; - uint8_t sky; - uint16_t gas; - uint8_t shift; -}; - class tx1_state : public driver_device { public: - tx1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_mathcpu(*this, "math_cpu"), - m_maincpu(*this, "main_cpu"), - m_math_ram(*this, "math_ram"), - m_vram(*this, "vram"), - m_objram(*this, "objram"), - m_rcram(*this, "rcram"), - m_char_tiles(*this, "char_tiles"), - m_obj_tiles(*this, "obj_tiles"), - m_road_rom(*this, "road"), - m_obj_map(*this, "obj_map"), - m_obj_luts(*this, "obj_luts"), - m_proms(*this, "proms"), - m_screen(*this, "screen"), - m_sound(*this, "soundbrd") - { } + tx1_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_mathcpu(*this, "math_cpu"), + m_maincpu(*this, "main_cpu"), + m_math_ram(*this, "math_ram"), + m_vram(*this, "vram"), + m_objram(*this, "objram"), + m_rcram(*this, "rcram"), + m_char_tiles(*this, "char_tiles"), + m_obj_tiles(*this, "obj_tiles"), + m_road_rom(*this, "road"), + m_obj_map(*this, "obj_map"), + m_obj_luts(*this, "obj_luts"), + m_proms(*this, "proms"), + m_screen(*this, "screen"), + m_sound(*this, "soundbrd") + { } void tx1(machine_config &config); void tx1j(machine_config &config); void buggyboy(machine_config &config); void buggybjr(machine_config &config); +private: + struct math_t + { + uint16_t cpulatch; + uint16_t promaddr; + uint16_t inslatch; + uint32_t mux; + uint16_t ppshift; + uint32_t i0ff; + uint16_t retval; + uint16_t muxlatch; // TX-1 + int dbgaddr; + int dbgpc; + + uint16_t get_datarom_addr() const; + uint16_t get_bb_datarom_addr() const; + }; + + // SN74S516 16x16 Multiplier/Divider + class sn74s516_t + { + public: + int16_t X; + int16_t Y; + + union + { +#ifdef LSB_FIRST + struct { uint16_t W; int16_t Z; } as16bit; +#else + struct { int16_t Z; uint16_t W; } as16bit; +#endif + int32_t ZW32; + } ZW; + + int code; + int state; + int ZWfl; + + void kick(running_machine &machine, math_t &math, uint16_t *data, int ins); + + private: + void multiply(running_machine &machine); + void divide(running_machine &machine); + void update(running_machine &machine, int ins); + }; + + struct vregs_t + { + uint16_t scol; /* Road colours */ + uint32_t slock; /* Scroll lock */ + uint8_t flags; /* Road flags */ + + uint32_t ba_val; /* Accumulator */ + uint32_t ba_inc; + uint32_t bank_mode; + + uint16_t h_val; /* Accumulator */ + uint16_t h_inc; + uint16_t h_init; + + uint8_t slin_val; /* Accumulator */ + uint8_t slin_inc; + + /* Buggyboy only */ + uint8_t wa8; + uint8_t wa4; + + uint16_t wave_lfsr; + uint8_t sky; + uint16_t gas; + uint8_t shift; + }; + math_t m_math; sn74s516_t m_sn74s516; required_device<cpu_device> m_mathcpu; -private: required_device<cpu_device> m_maincpu; required_shared_ptr<uint16_t> m_math_ram; required_shared_ptr<uint16_t> m_vram; @@ -161,6 +170,10 @@ private: bool m_needs_update; + void kick_sn74s516(uint16_t *data, int ins); + void tx1_update_state(); + void buggyboy_update_state(); + DECLARE_READ16_MEMBER(tx1_math_r); DECLARE_WRITE16_MEMBER(tx1_math_w); DECLARE_READ16_MEMBER(tx1_spcs_rom_r); diff --git a/src/mame/includes/undrfire.h b/src/mame/includes/undrfire.h index be6a0c4fc52..67351907c6b 100644 --- a/src/mame/includes/undrfire.h +++ b/src/mame/includes/undrfire.h @@ -10,16 +10,6 @@ #include "video/tc0480scp.h" #include "emupal.h" -struct uf_tempsprite -{ - int gfx; - int code,color; - int flipx,flipy; - int x,y; - int zoomx,zoomy; - int primask; -}; - class undrfire_state : public driver_device { public: @@ -44,12 +34,22 @@ public: void init_cbombers(); protected: + enum + { + TIMER_INTERRUPT5 + }; + virtual void video_start() override; private: - enum + struct uf_tempsprite { - TIMER_INTERRUPT5 + int gfx; + int code,color; + int flipx,flipy; + int x,y; + int zoomx,zoomy; + int primask; }; required_device<cpu_device> m_maincpu; diff --git a/src/mame/includes/volfied.h b/src/mame/includes/volfied.h index 95cc0393a77..f3b2bd48f72 100644 --- a/src/mame/includes/volfied.h +++ b/src/mame/includes/volfied.h @@ -30,11 +30,17 @@ public: void volfied(machine_config &config); -private: +protected: enum { TIMER_VOLFIED }; + + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: DECLARE_READ16_MEMBER(video_ram_r); DECLARE_WRITE16_MEMBER(video_ram_w); DECLARE_WRITE16_MEMBER(video_ctrl_w); @@ -42,9 +48,6 @@ private: DECLARE_WRITE16_MEMBER(video_mask_w); DECLARE_WRITE16_MEMBER(sprite_ctrl_w); DECLARE_WRITE8_MEMBER(counters_w); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(interrupt); TIMER_DEVICE_CALLBACK_MEMBER(cchip_irq_clear_cb); diff --git a/src/mame/includes/wgp.h b/src/mame/includes/wgp.h index 8b923363ca1..9863ceec1fe 100644 --- a/src/mame/includes/wgp.h +++ b/src/mame/includes/wgp.h @@ -5,6 +5,10 @@ World Grand Prix *************************************************************************/ +#ifndef MAME_INCLUDES_WGP_H +#define MAME_INCLUDES_WGP_H + +#pragma once #include "audio/taitosnd.h" #include "machine/taitoio.h" @@ -15,8 +19,8 @@ class wgp_state : public driver_device { public: - wgp_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + wgp_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_spritemap(*this, "spritemap"), m_spriteram(*this, "spriteram"), m_pivram(*this, "pivram"), @@ -41,7 +45,7 @@ public: void init_wgp(); void init_wgp2(); -private: +protected: enum { TIMER_INTERRUPT4, @@ -49,6 +53,12 @@ private: TIMER_CPUB_INTERRUPT6 }; + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + +private: DECLARE_WRITE8_MEMBER(coins_w); DECLARE_WRITE16_MEMBER(cpua_ctrl_w); DECLARE_READ16_MEMBER(lan_status_r); @@ -67,11 +77,6 @@ private: void main_map(address_map &map); void z80_sound_map(address_map &map); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - TILE_GET_INFO_MEMBER(get_piv0_tile_info); TILE_GET_INFO_MEMBER(get_piv1_tile_info); TILE_GET_INFO_MEMBER(get_piv2_tile_info); @@ -120,3 +125,5 @@ private: optional_ioport m_unknown; optional_ioport m_fake; }; + +#endif // MAME_INCLUDES_WGP_H diff --git a/src/mame/includes/wwfsstar.h b/src/mame/includes/wwfsstar.h index 7a9857bc61e..8fef284f708 100644 --- a/src/mame/includes/wwfsstar.h +++ b/src/mame/includes/wwfsstar.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:David Haywood +#ifndef MAME_INCLUDES_WWFSSTAR_H +#define MAME_INCLUDES_WWFSSTAR_H + +#pragma once #include "machine/gen_latch.h" #include "machine/timer.h" @@ -9,8 +13,8 @@ class wwfsstar_state : public driver_device { public: - wwfsstar_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + wwfsstar_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), @@ -19,12 +23,16 @@ public: m_soundlatch(*this, "soundlatch"), m_spriteram(*this, "spriteram"), m_fg0_videoram(*this, "fg0_videoram"), - m_bg0_videoram(*this, "bg0_videoram") { } + m_bg0_videoram(*this, "bg0_videoram") + { } void wwfsstar(machine_config &config); DECLARE_CUSTOM_INPUT_MEMBER(vblank_r); +protected: + virtual void video_start() override; + private: required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; @@ -55,11 +63,11 @@ private: TILEMAP_MAPPER_MEMBER(bg0_scan); TILE_GET_INFO_MEMBER(get_bg0_tile_info); - virtual void video_start() override; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); void main_map(address_map &map); void sound_map(address_map &map); }; + +#endif // MAME_INCLUDES_WWFSSTAR_H diff --git a/src/mame/includes/xain.h b/src/mame/includes/xain.h index 91e2a0ba810..60837bd9752 100644 --- a/src/mame/includes/xain.h +++ b/src/mame/includes/xain.h @@ -40,6 +40,10 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(vblank_r); DECLARE_CUSTOM_INPUT_MEMBER(mcu_status_r); +protected: + virtual void machine_start() override; + virtual void video_start() override; + private: DECLARE_WRITE8_MEMBER(cpuA_bankswitch_w); DECLARE_WRITE8_MEMBER(cpuB_bankswitch_w); @@ -66,10 +70,7 @@ private: void cpu_map_B(address_map &map); void sound_map(address_map &map); - virtual void machine_start() override; - virtual void video_start() override; - - inline int scanline_to_vcount(int scanline); + int scanline_to_vcount(int scanline); void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); diff --git a/src/mame/machine/tx1.cpp b/src/mame/machine/tx1.cpp index 4521e4fcb5d..959d4a47a1e 100644 --- a/src/mame/machine/tx1.cpp +++ b/src/mame/machine/tx1.cpp @@ -15,7 +15,7 @@ /* Helper functions */ -#define INC_PROM_ADDR ( math.promaddr = (math.promaddr + 1) & 0x1ff ) +#define INC_PROM_ADDR ( m_math.promaddr = (m_math.promaddr + 1) & 0x1ff ) #define ROR16(val, shift) ( ((uint16_t)val >> shift) | ((uint16_t)val << (16 - shift)) ) #define ROL16(val, shift) ( ((uint16_t)val << shift) | ((uint16_t)val >> (16 - shift)) ) #define SWAP16(val) ( (((uint16_t)val << 8) & 0xff00) | ((uint16_t)val >> 8) ) @@ -36,7 +36,7 @@ static inline uint8_t reverse_nibble(uint8_t nibble) there are no states between final input and multiplication/division. */ -static const uint8_t state_table[16][8] = +static constexpr uint8_t state_table[16][8] = { { 4, 4, 4, 4, 5, 1, 1, 0 }, { 4, 4, 4, 4, 5, 5, 3, 0 }, @@ -56,322 +56,272 @@ static const uint8_t state_table[16][8] = {0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf }, }; -static void sn_multiply(running_machine &machine) +void tx1_state::sn74s516_t::multiply(running_machine &machine) { - tx1_state *state = machine.driver_data<tx1_state>(); - sn74s516_t &SN74S516 = state->m_sn74s516; - - switch (SN74S516.code) + switch (code) { - case 0: - { - SN74S516.ZW.ZW32 = SN74S516.X * SN74S516.Y; - break; - } - case 2: - { - SN74S516.ZW.ZW32 += SN74S516.X * SN74S516.Y; - break; - } - case 3: - { - SN74S516.ZW.ZW32 += -SN74S516.X * SN74S516.Y; - break; - } - case 0x60: - { - SN74S516.ZW.ZW32 = SN74S516.X * SN74S516.Y; - break; - } - case 0x61: - { - SN74S516.ZW.ZW32 = -SN74S516.X * SN74S516.Y; - break; - } - case 0x62: - { - SN74S516.ZW.ZW32 += SN74S516.X * SN74S516.Y; - break; - } - case 0x63: - { - SN74S516.ZW.ZW32 += -SN74S516.X * SN74S516.Y; - break; - } - case 0x660: - { - SN74S516.ZW.ZW32 = (SN74S516.X * SN74S516.Y) + (SN74S516.ZW.ZW32 & 0xffff0000); - break; - } - case 0x661: - { - SN74S516.ZW.ZW32 = (-SN74S516.X * SN74S516.Y) + (SN74S516.ZW.ZW32 & 0xffff0000); - break; - } - case 0x662: - { - SN74S516.ZW.ZW32 = (-SN74S516.X * SN74S516.Y) + (SN74S516.ZW.ZW32 & 0xffff0000); - break; - } - case 0x6660: - { - SN74S516.ZW.ZW32 += (SN74S516.X * SN74S516.Y); - break; - } - default: - { - osd_printf_debug("sn74s516 ??? multiply: %x\n", SN74S516.code); - } + case 0: + ZW.ZW32 = X * Y; + break; + case 2: + ZW.ZW32 += X * Y; + break; + case 3: + ZW.ZW32 += -X * Y; + break; + case 0x60: + ZW.ZW32 = X * Y; + break; + case 0x61: + ZW.ZW32 = -X * Y; + break; + case 0x62: + ZW.ZW32 += X * Y; + break; + case 0x63: + ZW.ZW32 += -X * Y; + break; + case 0x660: + ZW.ZW32 = (X * Y) + (ZW.ZW32 & 0xffff0000); + break; + case 0x661: + ZW.ZW32 = (-X * Y) + (ZW.ZW32 & 0xffff0000); + break; + case 0x662: + ZW.ZW32 = (-X * Y) + (ZW.ZW32 & 0xffff0000); + break; + case 0x6660: + ZW.ZW32 += (X * Y); + break; + default: + osd_printf_debug("sn74s516 ??? multiply: %x\n", code); } - /* Seems a good enough place to clear it. */ - SN74S516.ZWfl = 0; + // Seems a good enough place to clear it. + ZWfl = 0; } -static void sn_divide(running_machine &machine) +void tx1_state::sn74s516_t::divide(running_machine &machine) { - tx1_state *state = machine.driver_data<tx1_state>(); - sn74s516_t &SN74S516 = state->m_sn74s516; - int32_t Z = 0; - int32_t W = 0; - - if (SN74S516.X == 0) + if (X == 0) { - machine.logerror("%s:SN74S516 tried to divide by zero\n", machine.describe_context()); - SN74S516.ZW.as16bit.Z = (int16_t)0xffff; - SN74S516.ZW.as16bit.W = 0xffff; - SN74S516.ZWfl = 0; + machine.logerror("%s: SN74S516 tried to divide by zero\n", machine.describe_context()); + ZW.as16bit.Z = int16_t(0xffff); + ZW.as16bit.W = 0xffff; + ZWfl = 0; return; } - switch (SN74S516.code) + int32_t Z = 0; + int32_t W = 0; + + switch (code) { - case 4: - { - Z = SN74S516.ZW.ZW32 / SN74S516.X; - W = SN74S516.ZW.ZW32 % SN74S516.X; - break; - } - case 0x664: - { - Z = SN74S516.ZW.ZW32 / SN74S516.X; - W = SN74S516.ZW.ZW32 % SN74S516.X; - break; - } - case 0x6664: - { - Z = SN74S516.ZW.as16bit.W / SN74S516.X; - W = SN74S516.ZW.as16bit.W % SN74S516.X; - break; - } - default: - { - osd_printf_debug("SN74S516 unhandled divide type: %x\n", SN74S516.code); - } + case 4: + Z = ZW.ZW32 / X; + W = ZW.ZW32 % X; + break; + case 0x664: + Z = ZW.ZW32 / X; + W = ZW.ZW32 % X; + break; + case 0x6664: + Z = ZW.as16bit.W / X; + W = ZW.as16bit.W % X; + break; + default: + osd_printf_debug("SN74S516 unhandled divide type: %x\n", code); } - /* Divide overflow Only happens during chip test anyway */ + // Divide overflow Only happens during chip test anyway if (Z > 0xffff) Z |= 0xff00; - SN74S516.ZW.as16bit.Z = Z; - SN74S516.ZW.as16bit.W = W; - SN74S516.ZWfl = 0; + ZW.as16bit.Z = Z; + ZW.as16bit.W = W; + ZWfl = 0; } -static void sn74s516_update(running_machine &machine, int ins) +void tx1_state::sn74s516_t::update(running_machine &machine, int ins) { - tx1_state *state = machine.driver_data<tx1_state>(); - sn74s516_t &SN74S516 = state->m_sn74s516; - SN74S516.state = state_table[SN74S516.state][ins]; + state = state_table[state][ins]; - if (SN74S516.state == 4) + if (state == 4) { - sn_multiply(machine); - SN74S516.state = 8; + multiply(machine); + state = 8; } - else if (SN74S516.state == 5) + else if (state == 5) { - sn_divide(machine); - SN74S516.state = 10; + divide(machine); + state = 10; } } -static void kick_sn74s516(running_machine &machine, uint16_t *data, const int ins) +void tx1_state::sn74s516_t::kick(running_machine &machine, math_t &math, uint16_t *data, int ins) { - tx1_state *state = machine.driver_data<tx1_state>(); - sn74s516_t &SN74S516 = state->m_sn74s516; - math_t &math = state->m_math; +#define LOAD_X (X = *data) +#define LOAD_Y (Y = *data) +#define LOAD_Z (ZW.as16bit.Z = *data) +#define LOAD_W (ZW.as16bit.W = *data) +#define READ_ZW *data = ZWfl ? ZW.as16bit.W : ZW.as16bit.Z; \ + ZWfl ^= 1; -#define LOAD_X (SN74S516.X = *data) -#define LOAD_Y (SN74S516.Y = *data) -#define LOAD_Z (SN74S516.ZW.as16bit.Z = *data) -#define LOAD_W (SN74S516.ZW.as16bit.W = *data) -#define READ_ZW *data = SN74S516.ZWfl ? SN74S516.ZW.as16bit.W : SN74S516.ZW.as16bit.Z; \ - SN74S516.ZWfl ^= 1; - -#define UPDATE_SEQUENCE (SN74S516.code = (SN74S516.code << 4) | ins) -#define CLEAR_SEQUENCE (SN74S516.code = 0) +#define UPDATE_SEQUENCE (code = (code << 4) | ins) +#define CLEAR_SEQUENCE (code = 0) /* Remember to change the Z/W flag. */ - switch (SN74S516.state) + switch (state) { - case 0: + case 0: + CLEAR_SEQUENCE; + UPDATE_SEQUENCE; + + if (ins < 4) { - CLEAR_SEQUENCE; - UPDATE_SEQUENCE; + LOAD_Y; + update(machine, ins); + } + else if (ins == 4) + { + update(machine, ins); + } + else if (ins < 7) + { + LOAD_X; + update(machine, ins); + } + else if (ins == 7) + { + READ_ZW; + break; + } - if (ins < 4) - { - LOAD_Y; - sn74s516_update(machine, ins); - } - else if (ins == 4) - { - sn74s516_update(machine, ins); - } - else if (ins < 7) - { - LOAD_X; - sn74s516_update(machine, ins); - } - else if (ins == 7) - { - READ_ZW; - break; - } + break; + case 8: + case 10: + CLEAR_SEQUENCE; + UPDATE_SEQUENCE; - break; + if (ins < 4) + { + LOAD_Y; + update(machine, ins); + } + else if (ins == 4) + { + update(machine, ins); } - case 8: - case 10: + else if (ins == 5) + { + // Rounding + // Operation + update(machine, ins); + } + else if (ins == 6) + { + LOAD_X; + update(machine, ins); + } + else if (ins == 7) + { + READ_ZW; + update(machine, ins); + } + break; + case 1: + // TODO: 6666 represents an incomplete state - clear it. + if (code == 0x6666) { CLEAR_SEQUENCE; - UPDATE_SEQUENCE; + machine.logerror("%s: Code 6666: PROMADDR:%x\n", machine.describe_context(), math.promaddr); + } - if (ins < 4) - { - LOAD_Y; - sn74s516_update(machine, ins); - } - else if (ins == 4) - { - sn74s516_update(machine, ins); - } - else if (ins == 5) - { - // Rounding - // Operation - sn74s516_update(machine, ins); - } - else if (ins == 6) - { - LOAD_X; - sn74s516_update(machine, ins); - } - else if (ins == 7) - { - READ_ZW; - sn74s516_update(machine, ins); - } - break; + UPDATE_SEQUENCE; + if (ins < 4) + { + LOAD_Y; + update(machine, ins); } - case 1: + else if (ins < 6) { - // TODO: 6666 represents an incomplete state - clear it. - if (SN74S516.code == 0x6666) - { - CLEAR_SEQUENCE; - machine.logerror("%s:Code 6666: PROMADDR:%x\n", machine.describe_context(), math.promaddr); - } - - UPDATE_SEQUENCE; - if (ins < 4) - { - LOAD_Y; - sn74s516_update(machine, ins); - } - else if (ins < 6) - { - sn74s516_update(machine, ins); - } - else if (ins == 6) - { - LOAD_Z; - sn74s516_update(machine, ins); - } - else if (ins == 7) - { - // Pointless operation. - sn74s516_update(machine, ins); - } + update(machine, ins); + } + else if (ins == 6) + { + LOAD_Z; + update(machine, ins); + } + else if (ins == 7) + { + // Pointless operation. + update(machine, ins); + } - break; + break; + case 3: + UPDATE_SEQUENCE; + if (ins < 4) + { + LOAD_Y; + update(machine, ins); } - case 3: + else if (ins == 4) { - UPDATE_SEQUENCE; - if (ins < 4) - { - LOAD_Y; - sn74s516_update(machine, ins); - } - else if (ins == 4) - { - LOAD_W; - sn74s516_update(machine, ins); - } - else if (ins == 5) - { - sn74s516_update(machine, ins); - } - else if (ins == 6) - { - LOAD_W; - sn74s516_update(machine, ins); - } - else if (ins == 7) - { - READ_ZW; - sn74s516_update(machine, ins); - } - break; + LOAD_W; + update(machine, ins); } - case 11: + else if (ins == 5) { - UPDATE_SEQUENCE; - if (ins < 4) - { - LOAD_Y; - sn74s516_update(machine, ins); - } - else if (ins < 6) - { - sn74s516_update(machine, ins); - } - else if (ins == 6) - { - // CHECK: Incomplete state - sn74s516_update(machine, ins); - } - else if (ins == 7) - { - /* 6667 = Load X, Load Z, Load W, Clear Z */ - SN74S516.ZW.as16bit.Z = 0; - sn74s516_update(machine, ins); - } - break; + update(machine, ins); } - default: + else if (ins == 6) { - osd_printf_debug("Unknown SN74S516 state. %x\n", SN74S516.code); + LOAD_W; + update(machine, ins); } + else if (ins == 7) + { + READ_ZW; + update(machine, ins); + } + break; + case 11: + UPDATE_SEQUENCE; + if (ins < 4) + { + LOAD_Y; + update(machine, ins); + } + else if (ins < 6) + { + update(machine, ins); + } + else if (ins == 6) + { + // CHECK: Incomplete state + update(machine, ins); + } + else if (ins == 7) + { + // 6667 = Load X, Load Z, Load W, Clear Z + ZW.as16bit.Z = 0; + update(machine, ins); + } + break; + default: + osd_printf_debug("Unknown SN74S516 state. %x\n", code); } +} + +inline void tx1_state::kick_sn74s516(uint16_t *data, int ins) +{ + m_sn74s516.kick(machine(), m_math, data, ins); - math.dbgaddr = math.promaddr; - math.dbgpc = state->m_mathcpu->pcbase(); + m_math.dbgaddr = m_math.promaddr; + m_math.dbgpc = m_mathcpu->pcbase(); } @@ -400,37 +350,33 @@ enum TX1_SEL_ILDEN }; -#define TX1_SET_INS0_BIT do { if (!(ins & 0x4) && math.i0ff) ins |= math.i0ff; } while(0) +#define TX1_SET_INS0_BIT do { if (!(ins & 0x4) && m_math.i0ff) ins |= m_math.i0ff; } while(0) -static inline uint16_t get_tx1_datarom_addr(math_t &math) +inline uint16_t tx1_state::math_t::get_datarom_addr() const { - uint16_t addr; + uint16_t addr = ((inslatch & 0x1c00) << 1) | (ppshift & 0xff); - addr = ((math.inslatch & 0x1c00) << 1) | (math.ppshift & 0xff); - - if ((math.inslatch >> 8) & TX1_RADCHG) - addr |= (math.ppshift & 0x0700); + if ((inslatch >> 8) & TX1_RADCHG) + addr |= (ppshift & 0x0700); else - addr |= (math.promaddr << 3) & 0x0700; + addr |= (promaddr << 3) & 0x0700; return addr & 0x3fff; } -static void tx1_update_state(running_machine &machine) +void tx1_state::tx1_update_state() { #define LHIEN(a) !(a & 0x80) #define LLOEN(a) !(a & 0x40) #define GO_EN(a) !(a & 0x4000) - tx1_state *state = machine.driver_data<tx1_state>(); - math_t &math = state->m_math; - const uint16_t *prom = (uint16_t*)state->memregion("au_data")->base() + (0x8000 >> 1); + const uint16_t *prom = (uint16_t*)memregion("au_data")->base() + (0x8000 >> 1); for (;;) { int go = 0; - if (!GO_EN(math.inslatch) && GO_EN(prom[math.promaddr])) + if (!GO_EN(m_math.inslatch) && GO_EN(prom[m_math.promaddr])) go = 1; /* Example: @@ -438,18 +384,18 @@ static void tx1_update_state(running_machine &machine) 121 /GO /LLOEN Both 120 and 121 are used. */ - else if ((GO_EN(math.inslatch) && GO_EN(prom[math.promaddr])) && (LHIEN(math.inslatch) && LLOEN(prom[math.promaddr]))) + else if ((GO_EN(m_math.inslatch) && GO_EN(prom[m_math.promaddr])) && (LHIEN(m_math.inslatch) && LLOEN(prom[m_math.promaddr]))) go = 1; /* Now update the latch */ - math.inslatch = prom[math.promaddr] & 0x7fff; - math.mux = (math.inslatch >> 3) & 7; + m_math.inslatch = prom[m_math.promaddr] & 0x7fff; + m_math.mux = (m_math.inslatch >> 3) & 7; - if (math.mux == TX1_SEL_INSCL) + if (m_math.mux == TX1_SEL_INSCL) { - math.i0ff = 0; + m_math.i0ff = 0; } - else if (math.mux == TX1_SEL_PPSEN) + else if (m_math.mux == TX1_SEL_PPSEN) { // NOTE: Doesn't do anything without SPCS. } @@ -457,15 +403,15 @@ static void tx1_update_state(running_machine &machine) /* TODO */ if (go) { - int ins = math.inslatch & 7; + int ins = m_math.inslatch & 7; TX1_SET_INS0_BIT; - if (math.mux == TX1_SEL_DSELOE) + if (m_math.mux == TX1_SEL_DSELOE) { - int dsel = (math.inslatch >> 8) & TX1_DSEL; - int tfad = (math.inslatch & 0x1c00) << 1; - int sd = math.ppshift; + int dsel = (m_math.inslatch >> 8) & TX1_DSEL; + int tfad = (m_math.inslatch & 0x1c00) << 1; + int sd = m_math.ppshift; int o4; uint16_t data; @@ -479,19 +425,19 @@ static void tx1_update_state(running_machine &machine) dsel = (dsel & 2) | ((dsel & o4) ^ 1); if (dsel == 0) - data = math.muxlatch; + data = m_math.muxlatch; else if (dsel == 1) { - uint16_t *romdata = (uint16_t*)machine.root_device().memregion("au_data")->base(); - uint16_t addr = get_tx1_datarom_addr(math); + uint16_t *romdata = (uint16_t*)memregion("au_data")->base(); + uint16_t addr = m_math.get_datarom_addr(); data = romdata[addr]; } else if (dsel == 2) - data = ROL16(math.muxlatch, 4); + data = ROL16(m_math.muxlatch, 4); else if (dsel == 3) - data = ROL16(SWAP16(math.muxlatch), 3); + data = ROL16(SWAP16(m_math.muxlatch), 3); - kick_sn74s516(machine, &data, ins); + kick_sn74s516(&data, ins); } /* TODO: Changed ppshift to muxlatch for TX-1 @@ -503,30 +449,30 @@ static void tx1_update_state(running_machine &machine) !SD8.SD9./LMSEL + !SD7.SD8./LMSEL + /LMSEL./DSEL1 + /LMSEL.TFAD13 + /LMSEL.TFAD12 + /LMSEL.TFAD11 */ - else if (LHIEN(math.inslatch) || LLOEN(math.inslatch)) + else if (LHIEN(m_math.inslatch) || LLOEN(m_math.inslatch)) { uint16_t data; - kick_sn74s516(machine, &data, ins); + kick_sn74s516(&data, ins); /* All latches enabled */ - if (LHIEN(math.inslatch) && LLOEN(math.inslatch)) + if (LHIEN(m_math.inslatch) && LLOEN(m_math.inslatch)) { - math.muxlatch = data; + m_math.muxlatch = data; } - else if (math.mux == TX1_SEL_LMSEL) // O4 = 0 + else if (m_math.mux == TX1_SEL_LMSEL) // O4 = 0 { // TMPLD2/TMPLD3 15-5 - if (LLOEN(math.inslatch)) + if (LLOEN(m_math.inslatch)) { - math.muxlatch &= 0x001f; - math.muxlatch |= data & 0xffe0; + m_math.muxlatch &= 0x001f; + m_math.muxlatch |= data & 0xffe0; } // TMLPD1 4-0??????? - else if (LHIEN(math.inslatch)) + else if (LHIEN(m_math.inslatch)) { - math.muxlatch &= 0xffe0; - math.muxlatch |= data & 0x001f; + m_math.muxlatch &= 0xffe0; + m_math.muxlatch |= data & 0x001f; } } else @@ -539,9 +485,9 @@ static void tx1_update_state(running_machine &machine) !SD8.SD9./LMSEL + !SD7.SD8./LMSEL + /LMSEL./DSEL1 + /LMSEL.TFAD13 + /LMSEL.TFAD12 + /LMSEL.TFAD11 */ - int dsel = (math.inslatch >> 8) & TX1_DSEL; - int tfad = (math.inslatch & 0x1c00) << 1; - int sd = math.ppshift; + int dsel = (m_math.inslatch >> 8) & TX1_DSEL; + int tfad = (m_math.inslatch & 0x1c00) << 1; + int sd = m_math.ppshift; int o4; o4 = @@ -551,49 +497,49 @@ static void tx1_update_state(running_machine &machine) (!BIT(sd, 7) && BIT(sd, 8)) || !BIT(dsel, 1) || BIT(tfad, 13) || BIT(tfad, 12) || BIT(tfad, 11); - if (LLOEN(math.inslatch)) + if (LLOEN(m_math.inslatch)) { - math.muxlatch &= 0x0fff; - math.muxlatch |= data & 0xf000; + m_math.muxlatch &= 0x0fff; + m_math.muxlatch |= data & 0xf000; if (!o4) { // TMPLD11-5 - math.muxlatch &= 0xf01f; - math.muxlatch |= data & 0x0fe0; + m_math.muxlatch &= 0xf01f; + m_math.muxlatch |= data & 0x0fe0; } } - else if (LHIEN(math.inslatch)) + else if (LHIEN(m_math.inslatch)) { - math.muxlatch &= 0xffe0; - math.muxlatch |= data & 0x001f; + m_math.muxlatch &= 0xffe0; + m_math.muxlatch |= data & 0x001f; if (o4) { // TMPLD11-5 - math.muxlatch &= 0xf01f; - math.muxlatch |= data & 0x0fe0; + m_math.muxlatch &= 0xf01f; + m_math.muxlatch |= data & 0x0fe0; } } } } else { - if (math.mux == TX1_SEL_PPSEN) + if (m_math.mux == TX1_SEL_PPSEN) { - kick_sn74s516(machine, &math.ppshift, ins); + kick_sn74s516(&m_math.ppshift, ins); } else { /* Bus pullups give 0xffff */ uint16_t data = 0xffff; - kick_sn74s516(machine, &data, ins); + kick_sn74s516(&data, ins); } } } /* Is there another instruction in the sequence? */ - if (prom[math.promaddr] & 0x8000) + if (prom[m_math.promaddr] & 0x8000) break; else INC_PROM_ADDR; @@ -602,7 +548,6 @@ static void tx1_update_state(running_machine &machine) READ16_MEMBER(tx1_state::tx1_math_r) { - math_t &math = m_math; offset = offset << 1; /* /MLPCS */ @@ -612,7 +557,7 @@ READ16_MEMBER(tx1_state::tx1_math_r) if (offset & 0x200) { - ins = math.inslatch & 7; + ins = m_math.inslatch & 7; TX1_SET_INS0_BIT; } else @@ -621,23 +566,23 @@ READ16_MEMBER(tx1_state::tx1_math_r) } /* TODO What do we return? */ - kick_sn74s516(machine(), &math.retval, ins); + kick_sn74s516(&m_math.retval, ins); } /* /PPSEN */ else if (offset < 0x800) { // Unused - just pullups? - math.retval = 0xffff; + m_math.retval = 0xffff; } /* /MUXCS */ else if ((offset & 0xc00) == 0xc00) { - int dsel = (math.inslatch >> 8) & TX1_DSEL; - int tfad = (math.inslatch & 0x1c00) << 1; - int sd = math.ppshift; + int dsel = (m_math.inslatch >> 8) & TX1_DSEL; + int tfad = (m_math.inslatch & 0x1c00) << 1; + int sd = m_math.ppshift; int o4; - if (math.mux == TX1_SEL_LMSEL) + if (m_math.mux == TX1_SEL_LMSEL) o4 = 0; else { @@ -652,74 +597,73 @@ READ16_MEMBER(tx1_state::tx1_math_r) dsel = (dsel & 2) | ((dsel & o4) ^ 1); if (dsel == 0) - math.retval = math.muxlatch; + m_math.retval = m_math.muxlatch; else if (dsel == 1 ) { /* TODO make this constant somewhere - e.g. math.retval = math.romptr[ get_tx1_datarom_addr() ]; + e.g. m_math.retval = m_math.romptr[ m_math.get_datarom_addr() ]; */ uint16_t *romdata = (uint16_t*)memregion("au_data")->base(); - uint16_t addr = get_tx1_datarom_addr(math); - math.retval = romdata[addr]; + uint16_t addr = m_math.get_datarom_addr(); + m_math.retval = romdata[addr]; } else if (dsel == 2) - math.retval = ROL16(math.muxlatch, 4); + m_math.retval = ROL16(m_math.muxlatch, 4); else if (dsel == 3) - math.retval = ROL16(SWAP16(math.muxlatch), 3); + m_math.retval = ROL16(SWAP16(m_math.muxlatch), 3); /* TODO for TX-1: This is /SPCS region? */ if (offset < 0xe00) { // Load the PP with retval?????? - if (math.mux == TX1_SEL_PPSEN) + if (m_math.mux == TX1_SEL_PPSEN) { - math.ppshift = math.retval & 0x3fff; + m_math.ppshift = m_math.retval & 0x3fff; } - else if (math.mux == TX1_SEL_PSSEN) + else if (m_math.mux == TX1_SEL_PSSEN) { // WRONG!!!! osd_printf_debug("Math Read with PSSEN!\n"); - math.ppshift = math.retval; + m_math.ppshift = m_math.retval; } - if (math.mux != TX1_SEL_ILDEN) + if (m_math.mux != TX1_SEL_ILDEN) { INC_PROM_ADDR; - tx1_update_state(machine()); + tx1_update_state(); // MUST RETURN HERE? - return math.retval; + return m_math.retval; } } } else { - if (math.mux == TX1_SEL_PPSEN) - math.retval = math.ppshift & 0x3fff; + if (m_math.mux == TX1_SEL_PPSEN) + m_math.retval = m_math.ppshift & 0x3fff; else /* Nothing is mapped - read from pull up resistors! */ - math.retval = 0xffff; + m_math.retval = 0xffff; } if (offset & TX1_INSLD) { - math.promaddr = (offset << 2) & 0x1ff; - tx1_update_state(machine()); + m_math.promaddr = (offset << 2) & 0x1ff; + tx1_update_state(); } else if (offset & TX1_CNTST) { INC_PROM_ADDR; - tx1_update_state(machine()); + tx1_update_state(); } - return math.retval; + return m_math.retval; } WRITE16_MEMBER(tx1_state::tx1_math_w) { - math_t &math = m_math; - math.cpulatch = data; + m_math.cpulatch = data; offset <<= 1; // printf("W %x: %x\n", 0x3000 + offset, data); @@ -731,7 +675,7 @@ WRITE16_MEMBER(tx1_state::tx1_math_w) if (offset & 0x200) { - ins = math.inslatch & 7; + ins = m_math.inslatch & 7; TX1_SET_INS0_BIT; } else @@ -739,25 +683,25 @@ WRITE16_MEMBER(tx1_state::tx1_math_w) ins = (offset >> 1) & 7; } - kick_sn74s516(machine(), &math.cpulatch, ins); + kick_sn74s516(&m_math.cpulatch, ins); } /* /PPSEN */ else if ((offset & 0xc00) == 0x400) { /* Input is 14 bits */ - math.ppshift = math.cpulatch & 0x3fff; + m_math.ppshift = m_math.cpulatch & 0x3fff; } /* /PSSEN */ else if ((offset & 0xc00) == 0x800) { - //if (((math.inslatch >> 8) & TX1_DSEL) == 3 ) + //if (((m_math.inslatch >> 8) & TX1_DSEL) == 3 ) { int shift; - uint16_t val = math.ppshift; + uint16_t val = m_math.ppshift; - if (math.cpulatch & 0x3800) + if (m_math.cpulatch & 0x3800) { - shift = (math.cpulatch >> 11) & 0x7; + shift = (m_math.cpulatch >> 11) & 0x7; while (shift) { @@ -767,7 +711,7 @@ WRITE16_MEMBER(tx1_state::tx1_math_w) } else { - shift = (math.cpulatch >> 7) & 0xf; + shift = (m_math.cpulatch >> 7) & 0xf; shift = reverse_nibble(shift); shift >>= 1; @@ -777,7 +721,7 @@ WRITE16_MEMBER(tx1_state::tx1_math_w) shift >>= 1; } } - math.ppshift = val; + m_math.ppshift = val; } } /* /MUXCS */ @@ -788,51 +732,50 @@ WRITE16_MEMBER(tx1_state::tx1_math_w) /TMPLD2: 0 /TMPLD3: 0 */ - math.muxlatch = math.cpulatch; + m_math.muxlatch = m_math.cpulatch; } if (offset & TX1_INSLD) { - math.promaddr = (offset << 2) & 0x1ff; - tx1_update_state(machine()); + m_math.promaddr = (offset << 2) & 0x1ff; + tx1_update_state(); } else if (offset & TX1_CNTST) { INC_PROM_ADDR; - tx1_update_state(machine()); + tx1_update_state(); } } READ16_MEMBER(tx1_state::tx1_spcs_rom_r) { - math_t &math = m_math; - math.cpulatch = *(uint16_t*)((uint8_t*)memregion("math_cpu")->base() + 0x04000 + 0x1000 + offset*2); + m_math.cpulatch = *(uint16_t*)((uint8_t*)memregion("math_cpu")->base() + 0x04000 + 0x1000 + offset*2); - if (math.mux == TX1_SEL_ILDEN) + if (m_math.mux == TX1_SEL_ILDEN) { - math.i0ff = math.cpulatch & (1 << 14) ? 1 : 0; + m_math.i0ff = m_math.cpulatch & (1 << 14) ? 1 : 0; } - else if (math.mux == TX1_SEL_MULEN) + else if (m_math.mux == TX1_SEL_MULEN) { - int ins = math.inslatch & 7; + int ins = m_math.inslatch & 7; TX1_SET_INS0_BIT; - kick_sn74s516(machine(), &math.cpulatch, ins); + kick_sn74s516(&m_math.cpulatch, ins); } - else if (math.mux == TX1_SEL_PPSEN) + else if (m_math.mux == TX1_SEL_PPSEN) { - math.ppshift = math.cpulatch; + m_math.ppshift = m_math.cpulatch; } - else if (math.mux == TX1_SEL_PSSEN) + else if (m_math.mux == TX1_SEL_PSSEN) { - //if ( ((math.inslatch >> 8) & TX1_DSEL) == 3 ) + //if ( ((m_math.inslatch >> 8) & TX1_DSEL) == 3 ) { int shift; - uint16_t val = math.ppshift; + uint16_t val = m_math.ppshift; - if (math.cpulatch & 0x3800) + if (m_math.cpulatch & 0x3800) { - shift = (math.cpulatch >> 11) & 0x7; + shift = (m_math.cpulatch >> 11) & 0x7; while (shift) { @@ -842,7 +785,7 @@ READ16_MEMBER(tx1_state::tx1_spcs_rom_r) } else { - shift = (math.cpulatch >> 7) & 0xf; + shift = (m_math.cpulatch >> 7) & 0xf; shift = reverse_nibble(shift); shift >>= 1; @@ -852,51 +795,50 @@ READ16_MEMBER(tx1_state::tx1_spcs_rom_r) shift >>= 1; } } - math.ppshift = val & 0x7ff; + m_math.ppshift = val & 0x7ff; } } - if (math.mux != TX1_SEL_ILDEN) + if (m_math.mux != TX1_SEL_ILDEN) { INC_PROM_ADDR; - tx1_update_state(machine()); + tx1_update_state(); } - return math.cpulatch; + return m_math.cpulatch; } READ16_MEMBER(tx1_state::tx1_spcs_ram_r) { - math_t &math = m_math; - math.cpulatch = m_math_ram[offset]; + m_math.cpulatch = m_math_ram[offset]; offset <<= 1; - if (math.mux == TX1_SEL_ILDEN) + if (m_math.mux == TX1_SEL_ILDEN) { - math.i0ff = math.cpulatch & (1 << 14) ? 1 : 0; + m_math.i0ff = m_math.cpulatch & (1 << 14) ? 1 : 0; } - else if (math.mux == TX1_SEL_MULEN) + else if (m_math.mux == TX1_SEL_MULEN) { - int ins = math.inslatch & 7; + int ins = m_math.inslatch & 7; TX1_SET_INS0_BIT; - kick_sn74s516(machine(), &math.cpulatch, ins); + kick_sn74s516(&m_math.cpulatch, ins); } - else if (math.mux == TX1_SEL_PPSEN) + else if (m_math.mux == TX1_SEL_PPSEN) { -// math.ppshift = math.retval & 0x3fff; - math.ppshift = math.cpulatch; +// m_math.ppshift = m_math.retval & 0x3fff; + m_math.ppshift = m_math.cpulatch; } - else if (math.mux == TX1_SEL_PSSEN) + else if (m_math.mux == TX1_SEL_PSSEN) { int shift; - uint16_t val = math.ppshift; + uint16_t val = m_math.ppshift; - if (math.cpulatch & 0x3800) + if (m_math.cpulatch & 0x3800) { - shift = (math.cpulatch >> 11) & 0x7; + shift = (m_math.cpulatch >> 11) & 0x7; while (shift) { @@ -906,7 +848,7 @@ READ16_MEMBER(tx1_state::tx1_spcs_ram_r) } else { - shift = (math.cpulatch >> 7) & 0xf; + shift = (m_math.cpulatch >> 7) & 0xf; shift = reverse_nibble(shift); shift >>= 1; @@ -916,16 +858,16 @@ READ16_MEMBER(tx1_state::tx1_spcs_ram_r) shift >>= 1; } } - math.ppshift = val & 0x7ff; + m_math.ppshift = val & 0x7ff; } - if (math.mux != TX1_SEL_ILDEN) + if (m_math.mux != TX1_SEL_ILDEN) { INC_PROM_ADDR; - tx1_update_state(machine()); + tx1_update_state(); } - return math.cpulatch; + return m_math.cpulatch; } /* Should never occur */ @@ -958,142 +900,134 @@ enum BB_MUX_ILDEN }; -#define BB_SET_INS0_BIT do { if (!(ins & 0x4) && math.i0ff) ins |= math.i0ff;} while(0) +#define BB_SET_INS0_BIT do { if (!(ins & 0x4) && m_math.i0ff) ins |= m_math.i0ff;} while(0) -static inline uint16_t get_bb_datarom_addr(math_t &math) +inline uint16_t tx1_state::math_t::get_bb_datarom_addr() const { - uint16_t addr; - - addr = ((math.inslatch & 0x1c00) << 1) | (math.ppshift & 0xff); + uint16_t addr = ((inslatch & 0x1c00) << 1) | (ppshift & 0xff); - if ((math.inslatch >> 8) & BB_RADCHG) - { - addr |= (math.ppshift & 0x0700); - } + if ((inslatch >> 8) & BB_RADCHG) + addr |= (ppshift & 0x0700); else - { - addr |= (math.promaddr << 3) & 0x0700; - } + addr |= (promaddr << 3) & 0x0700; return addr & 0x3fff; } -static void buggyboy_update_state(running_machine &machine) +void tx1_state::buggyboy_update_state() { #define LHIEN(a) !(a & 0x80) #define LLOEN(a) !(a & 0x40) #define GO_EN(a) !(a & 0x4000) - tx1_state *state = machine.driver_data<tx1_state>(); - math_t &math = state->m_math; - const uint16_t *prom = (uint16_t*)state->memregion("au_data")->base() + (0x8000 >> 1); + const uint16_t *prom = (uint16_t*)memregion("au_data")->base() + (0x8000 >> 1); for (;;) { int go = 0; - if (!GO_EN(math.inslatch) && GO_EN(prom[math.promaddr])) + if (!GO_EN(m_math.inslatch) && GO_EN(prom[m_math.promaddr])) go = 1; - else if ((GO_EN(math.inslatch) && GO_EN(prom[math.promaddr])) && (LHIEN(math.inslatch) && LLOEN(prom[math.promaddr]))) + else if ((GO_EN(m_math.inslatch) && GO_EN(prom[m_math.promaddr])) && (LHIEN(m_math.inslatch) && LLOEN(prom[m_math.promaddr]))) go = 1; /* Now update the latch */ - math.inslatch = prom[math.promaddr] & 0x7fff; - math.mux = (math.inslatch >> 3) & 7; + m_math.inslatch = prom[m_math.promaddr] & 0x7fff; + m_math.mux = (m_math.inslatch >> 3) & 7; - if (math.mux == BB_MUX_INSCL) - math.i0ff = 0; - else if (math.mux == BB_MUX_PPSEN) + if (m_math.mux == BB_MUX_INSCL) + m_math.i0ff = 0; + else if (m_math.mux == BB_MUX_PPSEN) { // TODO: Needed? - //osd_printf_debug("/PPSEN with INS: %x\n", math.promaddr); - //math.ppshift = lastval;//math.cpulatch; + //osd_printf_debug("/PPSEN with INS: %x\n", m_math.promaddr); + //m_math.ppshift = lastval;//m_math.cpulatch; } /* TODO */ if (go) { - int ins = math.inslatch & 7; + int ins = m_math.inslatch & 7; BB_SET_INS0_BIT; - if (math.mux == BB_MUX_DPROE) + if (m_math.mux == BB_MUX_DPROE) { - uint16_t *romdata = (uint16_t*)machine.root_device().memregion("au_data")->base(); - uint16_t addr = get_bb_datarom_addr(math); - kick_sn74s516(machine, &romdata[addr], ins); + uint16_t *romdata = (uint16_t*)memregion("au_data")->base(); + uint16_t addr = m_math.get_bb_datarom_addr(); + kick_sn74s516(&romdata[addr], ins); } - else if (math.mux == BB_MUX_PPOE) + else if (m_math.mux == BB_MUX_PPOE) { - kick_sn74s516(machine, &math.ppshift, ins); + kick_sn74s516(&m_math.ppshift, ins); } /* This is quite tricky. */ /* It can either be a read operation or */ /* What if /LHIEN and /LLOEN? */ - else if (LHIEN(math.inslatch) || LLOEN(math.inslatch)) + else if (LHIEN(m_math.inslatch) || LLOEN(m_math.inslatch)) { uint16_t data; - kick_sn74s516(machine, &data, ins); + kick_sn74s516(&data, ins); - if (LHIEN(math.inslatch) && LLOEN(math.inslatch)) + if (LHIEN(m_math.inslatch) && LLOEN(m_math.inslatch)) { - math.ppshift = data; + m_math.ppshift = data; } - else if (math.mux == BB_MUX_LMSEL) + else if (m_math.mux == BB_MUX_LMSEL) { - if (LLOEN(math.inslatch)) + if (LLOEN(m_math.inslatch)) { - math.ppshift &= 0x000f; - math.ppshift |= data & 0xfff0; + m_math.ppshift &= 0x000f; + m_math.ppshift |= data & 0xfff0; } - else if (LHIEN(math.inslatch)) + else if (LHIEN(m_math.inslatch)) { - math.ppshift &= 0xfff0; - math.ppshift |= data & 0x000f; + m_math.ppshift &= 0xfff0; + m_math.ppshift |= data & 0x000f; } } else { - if (LLOEN(math.inslatch)) + if (LLOEN(m_math.inslatch)) { - math.ppshift &= 0x0fff; - math.ppshift |= data & 0xf000; + m_math.ppshift &= 0x0fff; + m_math.ppshift |= data & 0xf000; } - else if (LHIEN(math.inslatch)) + else if (LHIEN(m_math.inslatch)) { - math.ppshift &= 0xf000; - math.ppshift |= data & 0x0fff; + m_math.ppshift &= 0xf000; + m_math.ppshift |= data & 0x0fff; } } } else { - if (math.mux == BB_MUX_PPSEN) + if (m_math.mux == BB_MUX_PPSEN) { - kick_sn74s516(machine, &math.ppshift, ins); + kick_sn74s516(&m_math.ppshift, ins); } else { /* Bus pullups give 0xffff */ uint16_t data = 0xffff; - kick_sn74s516(machine, &data, ins); + kick_sn74s516(&data, ins); } } } /* Handle rotation */ - if (((math.inslatch >> 8) & BB_DSEL) == 1) + if (((m_math.inslatch >> 8) & BB_DSEL) == 1) { - math.ppshift = ROR16(math.ppshift, 4); + m_math.ppshift = ROR16(m_math.ppshift, 4); } - else if (((math.inslatch >> 8) & BB_DSEL) == 2) + else if (((m_math.inslatch >> 8) & BB_DSEL) == 2) { - math.ppshift = ROL16(math.ppshift, 4); + m_math.ppshift = ROL16(m_math.ppshift, 4); } /* Is there another instruction in the sequence? */ - if (prom[math.promaddr] & 0x8000) + if (prom[m_math.promaddr] & 0x8000) break; else INC_PROM_ADDR; @@ -1102,7 +1036,6 @@ static void buggyboy_update_state(running_machine &machine) READ16_MEMBER(tx1_state::buggyboy_math_r) { - math_t &math = m_math; offset = offset << 1; /* /MLPCS */ @@ -1112,7 +1045,7 @@ READ16_MEMBER(tx1_state::buggyboy_math_r) if (offset & 0x200) { - ins = math.inslatch & 7; + ins = m_math.inslatch & 7; BB_SET_INS0_BIT; } else @@ -1121,66 +1054,65 @@ READ16_MEMBER(tx1_state::buggyboy_math_r) } /* TODO What do we return? */ - kick_sn74s516(machine(), &math.retval, ins); + kick_sn74s516(&m_math.retval, ins); /* TODO */ - //if (math.mux == BB_MUX_PPSEN) - // math.ppshift = math.retval; + //if (m_math.mux == BB_MUX_PPSEN) + // m_math.ppshift = m_math.retval; } /* /PPSEN */ else if (offset < 0x800) { - math.retval = math.ppshift; + m_math.retval = m_math.ppshift; } /* /DPROE */ else if ((offset & 0xc00) == 0xc00) { uint16_t *romdata = (uint16_t*)memregion("au_data")->base(); - uint16_t addr = get_bb_datarom_addr(math); + uint16_t addr = m_math.get_bb_datarom_addr(); - math.retval = romdata[addr]; + m_math.retval = romdata[addr]; /* This is necessary */ - if (math.mux == BB_MUX_PPSEN) - math.ppshift = romdata[addr]; + if (m_math.mux == BB_MUX_PPSEN) + m_math.ppshift = romdata[addr]; /* This is /SPCS region? Necessary anyway */ if (offset < 0xe00) { - if (math.mux != BB_MUX_ILDEN) + if (m_math.mux != BB_MUX_ILDEN) { INC_PROM_ADDR; - buggyboy_update_state(machine()); + buggyboy_update_state(); } } } else { - if (math.mux == BB_MUX_PPSEN) - math.retval = math.ppshift; + if (m_math.mux == BB_MUX_PPSEN) + m_math.retval = m_math.ppshift; else /* Nothing is mapped - read from pull up resistors! */ - math.retval = 0xffff; + m_math.retval = 0xffff; } if (offset & BB_INSLD) { - math.promaddr = (offset << 2) & 0x1ff; - buggyboy_update_state(machine()); + m_math.promaddr = (offset << 2) & 0x1ff; + buggyboy_update_state(); } else if (offset & BB_CNTST) { INC_PROM_ADDR; - buggyboy_update_state(machine()); + buggyboy_update_state(); } - return math.retval; + return m_math.retval; } WRITE16_MEMBER(tx1_state::buggyboy_math_w) { - math_t &math = m_math; - math.cpulatch = data; + m_math.cpulatch = data; offset <<= 1; @@ -1191,7 +1123,7 @@ WRITE16_MEMBER(tx1_state::buggyboy_math_w) if (offset & 0x200) { - ins = math.inslatch & 7; + ins = m_math.inslatch & 7; BB_SET_INS0_BIT; } else @@ -1199,24 +1131,24 @@ WRITE16_MEMBER(tx1_state::buggyboy_math_w) ins = (offset >> 1) & 7; } - kick_sn74s516(machine(), &math.cpulatch, ins); + kick_sn74s516(&m_math.cpulatch, ins); } /* /PPSEN */ else if ((offset & 0xc00) == 0x400) { - math.ppshift = math.cpulatch; + m_math.ppshift = m_math.cpulatch; } /* /PSSEN */ else if ((offset & 0xc00) == 0x800) { - if (((math.inslatch >> 8) & BB_DSEL) == 3) + if (((m_math.inslatch >> 8) & BB_DSEL) == 3) { int shift; - uint16_t val = math.ppshift; + uint16_t val = m_math.ppshift; - if (math.cpulatch & 0x3800) + if (m_math.cpulatch & 0x3800) { - shift = (math.cpulatch >> 11) & 0x7; + shift = (m_math.cpulatch >> 11) & 0x7; while (shift) { @@ -1226,7 +1158,7 @@ WRITE16_MEMBER(tx1_state::buggyboy_math_w) } else { - shift = (math.cpulatch >> 7) & 0xf; + shift = (m_math.cpulatch >> 7) & 0xf; shift = reverse_nibble(shift); shift >>= 1; @@ -1236,7 +1168,7 @@ WRITE16_MEMBER(tx1_state::buggyboy_math_w) shift >>= 1; } } - math.ppshift = val; + m_math.ppshift = val; } else { @@ -1252,13 +1184,13 @@ WRITE16_MEMBER(tx1_state::buggyboy_math_w) if (offset & BB_INSLD) { - math.promaddr = (offset << 2) & 0x1ff; - buggyboy_update_state(machine()); + m_math.promaddr = (offset << 2) & 0x1ff; + buggyboy_update_state(); } else if (offset & BB_CNTST) { INC_PROM_ADDR; - buggyboy_update_state(machine()); + buggyboy_update_state(); } } @@ -1267,34 +1199,33 @@ WRITE16_MEMBER(tx1_state::buggyboy_math_w) */ READ16_MEMBER(tx1_state::buggyboy_spcs_rom_r) { - math_t &math = m_math; - math.cpulatch = *(uint16_t*)((uint8_t*)memregion("math_cpu")->base() + 0x04000 + 0x1000 + offset*2); + m_math.cpulatch = *(uint16_t*)((uint8_t*)memregion("math_cpu")->base() + 0x04000 + 0x1000 + offset*2); - if (math.mux == BB_MUX_ILDEN) + if (m_math.mux == BB_MUX_ILDEN) { - math.i0ff = math.cpulatch & (1 << 14) ? 1 : 0; + m_math.i0ff = m_math.cpulatch & (1 << 14) ? 1 : 0; } - else if (math.mux == BB_MUX_MULEN) + else if (m_math.mux == BB_MUX_MULEN) { - int ins = math.inslatch & 7; + int ins = m_math.inslatch & 7; BB_SET_INS0_BIT; - kick_sn74s516(machine(), &math.cpulatch, ins); + kick_sn74s516(&m_math.cpulatch, ins); } - else if (math.mux == BB_MUX_PPSEN) + else if (m_math.mux == BB_MUX_PPSEN) { - math.ppshift = math.cpulatch; + m_math.ppshift = m_math.cpulatch; } - else if (math.mux == BB_MUX_PSSEN) + else if (m_math.mux == BB_MUX_PSSEN) { - if (((math.inslatch >> 8) & BB_DSEL) == 3) + if (((m_math.inslatch >> 8) & BB_DSEL) == 3) { int shift; - uint16_t val = math.ppshift; + uint16_t val = m_math.ppshift; - if (math.cpulatch & 0x3800) + if (m_math.cpulatch & 0x3800) { - shift = (math.cpulatch >> 11) & 0x7; + shift = (m_math.cpulatch >> 11) & 0x7; while (shift) { @@ -1304,7 +1235,7 @@ READ16_MEMBER(tx1_state::buggyboy_spcs_rom_r) } else { - shift = (math.cpulatch >> 7) & 0xf; + shift = (m_math.cpulatch >> 7) & 0xf; shift = reverse_nibble(shift); shift >>= 1; @@ -1314,17 +1245,17 @@ READ16_MEMBER(tx1_state::buggyboy_spcs_rom_r) shift >>= 1; } } - math.ppshift = val; + m_math.ppshift = val; } } - if (math.mux != BB_MUX_ILDEN) + if (m_math.mux != BB_MUX_ILDEN) { INC_PROM_ADDR; - buggyboy_update_state(machine()); + buggyboy_update_state(); } - return math.cpulatch; + return m_math.cpulatch; } WRITE16_MEMBER(tx1_state::buggyboy_spcs_ram_w) @@ -1334,36 +1265,35 @@ WRITE16_MEMBER(tx1_state::buggyboy_spcs_ram_w) READ16_MEMBER(tx1_state::buggyboy_spcs_ram_r) { - math_t &math = m_math; - math.cpulatch = m_math_ram[offset]; + m_math.cpulatch = m_math_ram[offset]; offset <<= 1; - if (math.mux == BB_MUX_ILDEN) + if (m_math.mux == BB_MUX_ILDEN) { - math.i0ff = math.cpulatch & (1 << 14) ? 1 : 0; + m_math.i0ff = m_math.cpulatch & (1 << 14) ? 1 : 0; } - else if (math.mux == BB_MUX_MULEN) + else if (m_math.mux == BB_MUX_MULEN) { - int ins = math.inslatch & 7; + int ins = m_math.inslatch & 7; BB_SET_INS0_BIT; - kick_sn74s516(machine(), &math.cpulatch, ins); + kick_sn74s516(&m_math.cpulatch, ins); } - else if (math.mux == BB_MUX_PPSEN) + else if (m_math.mux == BB_MUX_PPSEN) { - math.ppshift = math.cpulatch; + m_math.ppshift = m_math.cpulatch; } - else if (math.mux == BB_MUX_PSSEN) + else if (m_math.mux == BB_MUX_PSSEN) { - if (((math.inslatch >> 8) & BB_DSEL) == 3) + if (((m_math.inslatch >> 8) & BB_DSEL) == 3) { int shift; - uint16_t val = math.ppshift; + uint16_t val = m_math.ppshift; - if (math.cpulatch & 0x3800) + if (m_math.cpulatch & 0x3800) { - shift = (math.cpulatch >> 11) & 0x7; + shift = (m_math.cpulatch >> 11) & 0x7; while (shift) { @@ -1373,7 +1303,7 @@ READ16_MEMBER(tx1_state::buggyboy_spcs_ram_r) } else { - shift = (math.cpulatch >> 7) & 0xf; + shift = (m_math.cpulatch >> 7) & 0xf; shift = reverse_nibble(shift); shift >>= 1; @@ -1383,17 +1313,17 @@ READ16_MEMBER(tx1_state::buggyboy_spcs_ram_r) shift >>= 1; } } - math.ppshift = val; + m_math.ppshift = val; } } - if (math.mux != BB_MUX_ILDEN) + if (m_math.mux != BB_MUX_ILDEN) { INC_PROM_ADDR; - buggyboy_update_state(machine()); + buggyboy_update_state(); } - return math.cpulatch; + return m_math.cpulatch; } diff --git a/src/mame/video/taito_l.cpp b/src/mame/video/taito_l.cpp index 93f87f28621..f1d2a02ed5c 100644 --- a/src/mame/video/taito_l.cpp +++ b/src/mame/video/taito_l.cpp @@ -46,7 +46,7 @@ TILE_GET_INFO_MEMBER(taitol_state::get_tx_tile_info) ***************************************************************************/ -VIDEO_START_MEMBER(taitol_state, taito_l) +void taitol_state::video_start() { m_buff_spriteram = make_unique_clear<u8[]>(SPRITERAM_SIZE); int i; |