diff --git a/src/mame/drivers/bbusters.cpp b/src/mame/drivers/bbusters.cpp index 6a05ca92f4b..33d33e7d1b1 100644 --- a/src/mame/drivers/bbusters.cpp +++ b/src/mame/drivers/bbusters.cpp @@ -230,14 +230,19 @@ Country : /******************************************************************************/ -void bbusters_state::machine_start() +void bbusters_state_base::machine_start() { m_gun_recoil.resolve(); +} + +void bbusters_state::machine_start() +{ + bbusters_state_base::machine_start(); save_item(NAME(m_gun_select)); } -WRITE8_MEMBER(bbusters_state::sound_cpu_w) +WRITE8_MEMBER(bbusters_state_base::sound_cpu_w) { m_soundlatch[0]->write(space, 0, data&0xff); m_audiocpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); @@ -280,7 +285,7 @@ READ16_MEMBER(bbusters_state::kludge_r) } template -WRITE16_MEMBER(bbusters_state::pf_w) +WRITE16_MEMBER(bbusters_state_base::pf_w) { COMBINE_DATA(&m_pf_data[Layer][offset]); m_pf_tilemap[Layer]->mark_tile_dirty(offset); @@ -319,11 +324,6 @@ void bbusters_state::bbusters_map(address_map &map) /*******************************************************************************/ -void mechatt_state::machine_start() -{ - m_gun_recoil.resolve(); -} - WRITE16_MEMBER(mechatt_state::two_gun_output_w) { for (int i = 0; i < 2; i++) @@ -367,7 +367,7 @@ void mechatt_state::mechatt_map(address_map &map) /******************************************************************************/ -void bbusters_state::sound_map(address_map &map) +void bbusters_state_base::sound_map(address_map &map) { map(0x0000, 0xefff).rom(); map(0xf000, 0xf7ff).ram(); @@ -660,8 +660,8 @@ MACHINE_CONFIG_START(bbusters_state::bbusters) MCFG_PALETTE_ADD("palette", 2048) MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx) - MCFG_DEVICE_ADD("spriteram1", BUFFERED_SPRITERAM16) - MCFG_DEVICE_ADD("spriteram2", BUFFERED_SPRITERAM16) + BUFFERED_SPRITERAM16(config, m_spriteram[0]); + BUFFERED_SPRITERAM16(config, m_spriteram[1]); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); @@ -702,7 +702,7 @@ MACHINE_CONFIG_START(mechatt_state::mechatt) MCFG_PALETTE_ADD("palette", 1024) MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx) - MCFG_DEVICE_ADD("spriteram1", BUFFERED_SPRITERAM16) + BUFFERED_SPRITERAM16(config, m_spriteram[0]); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); diff --git a/src/mame/drivers/gb.cpp b/src/mame/drivers/gb.cpp index 2fe407b629a..75986d121d3 100644 --- a/src/mame/drivers/gb.cpp +++ b/src/mame/drivers/gb.cpp @@ -771,9 +771,6 @@ void megaduck_state::megaduck(machine_config &config) screen.set_size(20*8, 18*8); screen.set_visarea(0*8, 20*8-1, 0*8, 18*8-1); - MCFG_MACHINE_START_OVERRIDE(megaduck_state, megaduck) - MCFG_MACHINE_RESET_OVERRIDE(megaduck_state, megaduck) - GFXDECODE(config, "gfxdecode", m_palette, gfxdecode_device::empty); PALETTE(config, m_palette, 4).set_init(FUNC(megaduck_state::palette_init_megaduck)); diff --git a/src/mame/drivers/mbc55x.cpp b/src/mame/drivers/mbc55x.cpp index 636df2fba74..c5f4d03f57d 100644 --- a/src/mame/drivers/mbc55x.cpp +++ b/src/mame/drivers/mbc55x.cpp @@ -30,17 +30,17 @@ ToDo: #include "softlist.h" #include "speaker.h" -const unsigned char mbc55x_palette[SCREEN_NO_COLOURS][3] = +static constexpr rgb_t mbc55x_palette[SCREEN_NO_COLOURS] = { - /*normal brightness */ - { 0x00,0x00,0x00 }, /* black */ - { 0x00,0x00,0x80 }, /* blue */ - { 0x00,0x80,0x00 }, /* green */ - { 0x00,0x80,0x80 }, /* cyan */ - { 0x80,0x00,0x00 }, /* red */ - { 0x80,0x00,0x80 }, /* magenta */ - { 0x80,0x80,0x00 }, /* yellow */ - { 0x80,0x80,0x80 }, /* light grey */ + // normal brightness + { 0x00, 0x00, 0x00 }, // black + { 0x00, 0x00, 0x80 }, // blue + { 0x00, 0x80, 0x00 }, // green + { 0x00, 0x80, 0x80 }, // cyan + { 0x80, 0x00, 0x00 }, // red + { 0x80, 0x00, 0x80 }, // magenta + { 0x80, 0x80, 0x00 }, // yellow + { 0x80, 0x80, 0x80 } // light grey }; @@ -226,12 +226,9 @@ INPUT_PORTS_END PALETTE_INIT_MEMBER(mbc55x_state, mbc55x) { - int colourno; - logerror("initializing palette\n"); - for ( colourno = 0; colourno < SCREEN_NO_COLOURS; colourno++ ) - palette.set_pen_color(colourno, mbc55x_palette[colourno][RED], mbc55x_palette[colourno][GREEN], mbc55x_palette[colourno][BLUE]); + palette.set_pen_colors(0, mbc55x_palette, ARRAY_LENGTH(mbc55x_palette)); } diff --git a/src/mame/drivers/novag6502.cpp b/src/mame/drivers/novag6502.cpp index edfb13e134d..c94290627dd 100644 --- a/src/mame/drivers/novag6502.cpp +++ b/src/mame/drivers/novag6502.cpp @@ -880,7 +880,7 @@ MACHINE_CONFIG_START(novag6502_state::supercon) NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1); - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novagbase_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novag6502_state, display_decay_tick, attotime::from_msec(1)) config.set_default_layout(layout_novag_supercon); /* sound hardware */ @@ -904,7 +904,7 @@ MACHINE_CONFIG_START(novag6502_state::cforte) HLCD0538(config, m_hlcd0538, 0); m_hlcd0538->write_cols_callback().set(FUNC(novag6502_state::cforte_lcd_output_w)); - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novagbase_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novag6502_state, display_decay_tick, attotime::from_msec(1)) config.set_default_layout(layout_novag_cforte); /* sound hardware */ @@ -946,13 +946,13 @@ MACHINE_CONFIG_START(novag6502_state::sexpert) MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(novagbase_state, novag_lcd) + MCFG_PALETTE_INIT_OWNER(novag6502_state, novag_lcd) MCFG_HD44780_ADD("hd44780") MCFG_HD44780_LCD_SIZE(2, 8) - MCFG_HD44780_PIXEL_UPDATE_CB(novagbase_state, novag_lcd_pixel_update) + MCFG_HD44780_PIXEL_UPDATE_CB(novag6502_state, novag_lcd_pixel_update) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novagbase_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novag6502_state, display_decay_tick, attotime::from_msec(1)) config.set_default_layout(layout_novag_sexpert); /* sound hardware */ diff --git a/src/mame/drivers/novag68k.cpp b/src/mame/drivers/novag68k.cpp index 6ae8b414bdd..aa0cba70ccf 100644 --- a/src/mame/drivers/novag68k.cpp +++ b/src/mame/drivers/novag68k.cpp @@ -258,13 +258,13 @@ MACHINE_CONFIG_START(novag68k_state::diablo68k) MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD("palette", 3) - MCFG_PALETTE_INIT_OWNER(novagbase_state, novag_lcd) + MCFG_PALETTE_INIT_OWNER(novag68k_state, novag_lcd) MCFG_HD44780_ADD("hd44780") MCFG_HD44780_LCD_SIZE(2, 8) - MCFG_HD44780_PIXEL_UPDATE_CB(novagbase_state, novag_lcd_pixel_update) + MCFG_HD44780_PIXEL_UPDATE_CB(novag68k_state, novag_lcd_pixel_update) - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novagbase_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novag68k_state, display_decay_tick, attotime::from_msec(1)) config.set_default_layout(layout_novag_diablo68k); /* sound hardware */ diff --git a/src/mame/drivers/novagf8.cpp b/src/mame/drivers/novagf8.cpp index c747b4c66e9..37f5553ec80 100644 --- a/src/mame/drivers/novagf8.cpp +++ b/src/mame/drivers/novagf8.cpp @@ -196,7 +196,7 @@ MACHINE_CONFIG_START(novagf8_state::delta1) f3853_device &f3853(F3853(config, "f3853", 2000000)); f3853.int_req_callback().set_inputline("maincpu", F8_INPUT_LINE_INT_REQ); - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novagbase_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novagf8_state, display_decay_tick, attotime::from_msec(1)) config.set_default_layout(layout_novag_delta1); MACHINE_CONFIG_END diff --git a/src/mame/drivers/novagmcs48.cpp b/src/mame/drivers/novagmcs48.cpp index bf40fdbf5c7..6066c821f14 100644 --- a/src/mame/drivers/novagmcs48.cpp +++ b/src/mame/drivers/novagmcs48.cpp @@ -155,7 +155,7 @@ MACHINE_CONFIG_START(novagmcs48_state::presto) maincpu.p2_out_cb().set(FUNC(novagmcs48_state::presto_control_w)); maincpu.bus_out_cb().set(FUNC(novagmcs48_state::presto_mux_w)); - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novagbase_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", novagmcs48_state, display_decay_tick, attotime::from_msec(1)) config.set_default_layout(layout_novag_presto); /* sound hardware */ diff --git a/src/mame/drivers/osi.cpp b/src/mame/drivers/osi.cpp index f7108b28c6b..583ee49bdbc 100644 --- a/src/mame/drivers/osi.cpp +++ b/src/mame/drivers/osi.cpp @@ -681,7 +681,7 @@ void c1pmf_state::machine_start() // drive select logic missing if (m_floppy0->get_device()) - m_floppy0->get_device()->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(&sb2m600_state::floppy_index_callback, this)); + m_floppy0->get_device()->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(&c1pmf_state::floppy_index_callback, this)); } // disk format: 1 head, 36 tracks (? - manual displays a directory listing with 40 tracks), @@ -754,9 +754,9 @@ void uk101_state::uk101(machine_config &config) /* cassette ACIA */ ACIA6850(config, m_acia_0, 0); - m_acia_0->txd_handler().set(FUNC(sb2m600_state::cassette_tx)); + m_acia_0->txd_handler().set(FUNC(uk101_state::cassette_tx)); - CLOCK(config, "cassette_clock", 500000).signal_handler().set(FUNC(sb2m600_state::write_cassette_clock)); + CLOCK(config, "cassette_clock", 500000).signal_handler().set(FUNC(uk101_state::write_cassette_clock)); /* cassette */ CASSETTE(config, m_cassette); @@ -790,9 +790,9 @@ void c1p_state::c1p(machine_config &config) /* cassette ACIA */ ACIA6850(config, m_acia_0, 0); - m_acia_0->txd_handler().set(FUNC(sb2m600_state::cassette_tx)); + m_acia_0->txd_handler().set(FUNC(c1p_state::cassette_tx)); - CLOCK(config, "cassette_clock", X1/32).signal_handler().set(FUNC(sb2m600_state::write_cassette_clock)); + CLOCK(config, "cassette_clock", X1/32).signal_handler().set(FUNC(c1p_state::write_cassette_clock)); /* cassette */ CASSETTE(config, m_cassette); diff --git a/src/mame/includes/aquarius.h b/src/mame/includes/aquarius.h index 658cf8f0874..5dc3ba748a7 100644 --- a/src/mame/includes/aquarius.h +++ b/src/mame/includes/aquarius.h @@ -5,7 +5,6 @@ * includes/aquarius.h * ****************************************************************************/ - #ifndef MAME_INCLUDES_AQUARIUS_H #define MAME_INCLUDES_AQUARIUS_H @@ -29,28 +28,38 @@ class aquarius_state : public driver_device { public: aquarius_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_cassette(*this, "cassette"), - m_speaker(*this, "speaker"), - m_cart(*this, "cartslot"), - m_ram(*this, RAM_TAG), - m_videoram(*this, "videoram"), - m_colorram(*this, "colorram"), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_tea1002(*this, "encoder"), - m_palette(*this, "palette") + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_cassette(*this, "cassette") + , m_speaker(*this, "speaker") + , m_cart(*this, "cartslot") + , m_ram(*this, RAM_TAG) + , m_videoram(*this, "videoram") + , m_colorram(*this, "colorram") + , m_y0(*this, "Y0") + , m_y1(*this, "Y1") + , m_y2(*this, "Y2") + , m_y3(*this, "Y3") + , m_y4(*this, "Y4") + , m_y5(*this, "Y5") + , m_y6(*this, "Y6") + , m_y7(*this, "Y7") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_tea1002(*this, "encoder") + , m_palette(*this, "palette") { } + void init_aquarius(); + + DECLARE_INPUT_CHANGED_MEMBER(aquarius_reset); + + void aquarius(machine_config &config); + +protected: + virtual void video_start() override; + +private: required_device m_maincpu; required_device m_cassette; required_device m_speaker; @@ -85,14 +94,11 @@ public: DECLARE_READ8_MEMBER(keyboard_r); DECLARE_WRITE8_MEMBER(scrambler_w); DECLARE_READ8_MEMBER(cartridge_r); - void init_aquarius(); TILE_GET_INFO_MEMBER(aquarius_gettileinfo); - virtual void video_start() override; DECLARE_PALETTE_INIT(aquarius); uint32_t screen_update_aquarius(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_INPUT_CHANGED_MEMBER(aquarius_reset); - void aquarius(machine_config &config); void aquarius_io(address_map &map); void aquarius_mem(address_map &map); }; + #endif // MAME_INCLUDES_AQUARIUS_H diff --git a/src/mame/includes/bbusters.h b/src/mame/includes/bbusters.h index 98902aca971..43ca33acce4 100644 --- a/src/mame/includes/bbusters.h +++ b/src/mame/includes/bbusters.h @@ -9,10 +9,10 @@ #include "video/bufsprite.h" #include "screen.h" -class bbusters_state : public driver_device +class bbusters_state_base : public driver_device { -public: - bbusters_state(const machine_config &mconfig, device_type type, const char *tag) : +protected: + bbusters_state_base(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), @@ -24,14 +24,9 @@ public: m_pf_scroll_data(*this, "pf%u_scroll_data", 1U), m_scale_table(*this, "scale_table"), m_gun_io(*this, { "GUNX1", "GUNY1", "GUNX2", "GUNY2", "GUNX3", "GUNY3" }), - m_gun_recoil(*this, "Player%u_Gun_Recoil", 1U), - m_eprom_data(*this, "eeprom") + m_gun_recoil(*this, "Player%u_Gun_Recoil", 1U) { } - TILE_GET_INFO_MEMBER(get_tile_info); - - void bbusters(machine_config &config); -protected: required_device m_maincpu; required_device m_audiocpu; required_device m_gfxdecode; @@ -52,19 +47,41 @@ protected: const uint8_t *m_scale_table_ptr; uint8_t m_scale_line_count; + virtual void machine_start() override; + virtual void video_start() override; + + TILE_GET_INFO_MEMBER(get_tile_info); template TILE_GET_INFO_MEMBER(get_pf_tile_info); DECLARE_WRITE8_MEMBER(sound_cpu_w); DECLARE_WRITE16_MEMBER(video_w); template DECLARE_WRITE16_MEMBER(pf_w); - inline const uint8_t *get_source_ptr(gfx_element *gfx, uint32_t sprite, int dx, int dy, int block); + const uint8_t *get_source_ptr(gfx_element *gfx, uint32_t sprite, int dx, int dy, int block); void draw_block(screen_device &screen, bitmap_ind16 &dest,int x,int y,int size,int flipx,int flipy,uint32_t sprite,int color,int bank,int block,int priority); void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const uint16_t *source, int bank); void sound_map(address_map &map); +}; + +class bbusters_state : public bbusters_state_base +{ +public: + bbusters_state(const machine_config &mconfig, device_type type, const char *tag) : + bbusters_state_base(mconfig, type, tag), + m_eprom_data(*this, "eeprom") + { } + + void bbusters(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + private: - optional_shared_ptr m_eprom_data; + required_shared_ptr m_eprom_data; + + int m_gun_select; DECLARE_READ16_MEMBER(eprom_r); DECLARE_READ16_MEMBER(control_3_r); @@ -72,31 +89,27 @@ private: DECLARE_WRITE16_MEMBER(three_gun_output_w); DECLARE_READ16_MEMBER(kludge_r); - int m_gun_select; - - virtual void machine_start() override; - virtual void video_start() override; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void bbusters_map(address_map &map); void sound_portmap(address_map &map); }; -class mechatt_state : public bbusters_state +class mechatt_state : public bbusters_state_base { public: mechatt_state(const machine_config &mconfig, device_type type, const char *tag) : - bbusters_state(mconfig, type, tag) + bbusters_state_base(mconfig, type, tag) { } void mechatt(machine_config &config); + +protected: + virtual void video_start() override; + private: DECLARE_WRITE16_MEMBER(two_gun_output_w); DECLARE_READ16_MEMBER(mechatt_gun_r); - virtual void machine_start() override; - virtual void video_start() override; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void mechatt_map(address_map &map); void sounda_portmap(address_map &map); diff --git a/src/mame/includes/busicom.h b/src/mame/includes/busicom.h index 35fa114c122..48da84f18b6 100644 --- a/src/mame/includes/busicom.h +++ b/src/mame/includes/busicom.h @@ -26,33 +26,38 @@ public: { } - uint8_t m_drum_index; - uint16_t m_keyboard_shifter; - uint32_t m_printer_shifter; - uint8_t m_timer; - uint8_t m_printer_line[11][17]; - uint8_t m_printer_line_color[11]; + void busicom(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: DECLARE_READ8_MEMBER(keyboard_r); DECLARE_READ8_MEMBER(printer_r); DECLARE_WRITE8_MEMBER(shifter_w); DECLARE_WRITE8_MEMBER(printer_w); DECLARE_WRITE8_MEMBER(status_w); DECLARE_WRITE8_MEMBER(printer_ctrl_w); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(busicom); uint32_t screen_update_busicom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(timer_callback); uint8_t get_bit_selected(uint32_t val,int num); - void busicom(machine_config &config); void busicom_mem(address_map &map); void busicom_mp(address_map &map); void busicom_rom(address_map &map); void busicom_rp(address_map &map); void busicom_stat(address_map &map); -private: + + uint8_t m_drum_index; + uint16_t m_keyboard_shifter; + uint32_t m_printer_shifter; + uint8_t m_timer; + uint8_t m_printer_line[11][17]; + uint8_t m_printer_line_color[11]; + required_device m_maincpu; required_device m_palette; required_ioport_array<10> m_input_lines; diff --git a/src/mame/includes/dday.h b/src/mame/includes/dday.h index d0c7bf08372..f344ebaa366 100644 --- a/src/mame/includes/dday.h +++ b/src/mame/includes/dday.h @@ -5,6 +5,10 @@ D-Day *************************************************************************/ +#ifndef MAME_INCLUDES_DDAY_H +#define MAME_INCLUDES_DDAY_H + +#pragma once #include "emupal.h" #include "screen.h" @@ -14,8 +18,8 @@ class dday_state : public driver_device { public: - dday_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + dday_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_textvideoram(*this, "textvideoram"), m_fgvideoram(*this, "fgvideoram"), m_bgvideoram(*this, "bgvideoram"), @@ -24,10 +28,16 @@ public: m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_palette(*this, "palette"), - m_ay1(*this, "ay1") { } + m_ay1(*this, "ay1") + { } void dday(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 m_textvideoram; @@ -48,6 +58,12 @@ private: emu_timer *m_countdown_timer; /* devices */ + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + required_device m_ay1; + DECLARE_READ8_MEMBER(dday_countdown_timer_r); DECLARE_WRITE8_MEMBER(dday_bgvideoram_w); DECLARE_WRITE8_MEMBER(dday_fgvideoram_w); @@ -60,17 +76,11 @@ private: TILE_GET_INFO_MEMBER(get_fg_tile_info); TILE_GET_INFO_MEMBER(get_text_tile_info); TILE_GET_INFO_MEMBER(get_sl_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(dday); uint32_t screen_update_dday(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(countdown_timer_callback); void start_countdown_timer(); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - required_device m_ay1; void dday_map(address_map &map); }; + +#endif // MAME_INCLUDES_DDAY_H diff --git a/src/mame/includes/gb.h b/src/mame/includes/gb.h index f2d9828ec0f..fef86844961 100644 --- a/src/mame/includes/gb.h +++ b/src/mame/includes/gb.h @@ -5,7 +5,6 @@ * includes/gb.h * ****************************************************************************/ - #ifndef MAME_INCLUDES_GB_H #define MAME_INCLUDES_GB_H @@ -102,6 +101,7 @@ public: void gameboy_map(address_map &map); void gbc_map(address_map &map); void sgb_map(address_map &map); + protected: enum { SIO_ENABLED = 0x80, @@ -137,29 +137,31 @@ protected: class megaduck_state : public gb_state { public: - megaduck_state(const machine_config &mconfig, device_type type, const char *tag) - : gb_state(mconfig, type, tag) - , m_cartslot(*this, "duckslot") + megaduck_state(const machine_config &mconfig, device_type type, const char *tag) : + gb_state(mconfig, type, tag), + m_cartslot(*this, "duckslot") { } + void megaduck(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: DECLARE_READ8_MEMBER(megaduck_video_r); DECLARE_WRITE8_MEMBER(megaduck_video_w); DECLARE_WRITE8_MEMBER(megaduck_sound_w1); DECLARE_READ8_MEMBER(megaduck_sound_r1); DECLARE_WRITE8_MEMBER(megaduck_sound_w2); DECLARE_READ8_MEMBER(megaduck_sound_r2); - DECLARE_MACHINE_START(megaduck); - DECLARE_MACHINE_RESET(megaduck); DECLARE_PALETTE_INIT(megaduck); + void megaduck_map(address_map &map); DECLARE_READ8_MEMBER(cart_r); DECLARE_WRITE8_MEMBER(bank1_w); DECLARE_WRITE8_MEMBER(bank2_w); - optional_device m_cartslot; - void megaduck(machine_config &config); - void megaduck_map(address_map &map); + required_device m_cartslot; }; - - #endif // MAME_INCLUDES_GB_H diff --git a/src/mame/includes/hng64.h b/src/mame/includes/hng64.h index 94a40f97eff..2ba112d4d78 100644 --- a/src/mame/includes/hng64.h +++ b/src/mame/includes/hng64.h @@ -1,5 +1,9 @@ // license:LGPL-2.1+ // copyright-holders:David Haywood, Angelo Salese, ElSemi, Andrew Gardner +#ifndef MAME_INCLUDES_HNG64_H +#define MAME_INCLUDES_HNG64_H + +#pragma once #include "machine/msm6242.h" #include "machine/timer.h" @@ -154,8 +158,8 @@ private: class hng64_state : public driver_device { public: - hng64_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + hng64_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_screen(*this, "screen"), m_palette(*this, "palette"), m_maincpu(*this, "maincpu"), @@ -185,7 +189,7 @@ public: m_an_in(*this, "AN%u", 0U), m_samsho64_3d_hack(0), m_roadedge_3d_hack(0) - {} + { } void hng64(machine_config &config); void hng64_default(machine_config &config); @@ -533,3 +537,5 @@ private: void hng_sound_io(address_map &map); void hng_sound_map(address_map &map); }; + +#endif // MAME_INCLUDES_HNG64_H diff --git a/src/mame/includes/lasso.h b/src/mame/includes/lasso.h index c1642a8f8c0..b44454f1d0a 100644 --- a/src/mame/includes/lasso.h +++ b/src/mame/includes/lasso.h @@ -44,6 +44,11 @@ public: DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + private: /* memory pointers */ required_shared_ptr m_videoram; @@ -82,9 +87,6 @@ private: TILE_GET_INFO_MEMBER(lasso_get_bg_tile_info); TILE_GET_INFO_MEMBER(wwjgtin_get_track_tile_info); TILE_GET_INFO_MEMBER(pinbo_get_bg_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; DECLARE_PALETTE_INIT(lasso); DECLARE_MACHINE_START(wwjgtin); DECLARE_MACHINE_RESET(wwjgtin); @@ -94,10 +96,10 @@ private: uint32_t screen_update_lasso(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_chameleo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_wwjgtin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - rgb_t get_color( int data ); + static rgb_t get_color(int data); void wwjgtin_set_last_four_colors(); - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int reverse ); - void draw_lasso( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int reverse); + void draw_lasso(bitmap_ind16 &bitmap, const rectangle &cliprect); void chameleo_audio_map(address_map &map); void chameleo_main_map(address_map &map); void lasso_audio_map(address_map &map); diff --git a/src/mame/includes/mainsnk.h b/src/mame/includes/mainsnk.h index 8f9ca97a1f1..58b8c418fe8 100644 --- a/src/mame/includes/mainsnk.h +++ b/src/mame/includes/mainsnk.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:David Haywood, Tomasz Slanina +#ifndef MAME_INCLUDES_MAINSNK_H +#define MAME_INCLUDES_MAINSNK_H + +#pragma once #include "machine/gen_latch.h" #include "emupal.h" @@ -7,8 +11,8 @@ class mainsnk_state : public driver_device { public: - mainsnk_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + mainsnk_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"), @@ -16,10 +20,14 @@ public: m_soundlatch(*this, "soundlatch"), m_bgram(*this, "bgram"), m_spriteram(*this, "spriteram"), - m_fgram(*this, "fgram") { } + m_fgram(*this, "fgram") + { } void mainsnk(machine_config &config); +protected: + virtual void video_start() override; + private: required_device m_maincpu; required_device m_audiocpu; @@ -45,7 +53,6 @@ private: TILE_GET_INFO_MEMBER(get_tx_tile_info); TILE_GET_INFO_MEMBER(get_bg_tile_info); - virtual void video_start() override; DECLARE_PALETTE_INIT(mainsnk); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -54,3 +61,5 @@ private: void sound_map(address_map &map); void sound_portmap(address_map &map); }; + +#endif // MAME_INCLUDES_MAINSNK_H diff --git a/src/mame/includes/mario.h b/src/mame/includes/mario.h index d02c919a841..2135f0ec64d 100644 --- a/src/mame/includes/mario.h +++ b/src/mame/includes/mario.h @@ -1,9 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Mirko Buffoni - #ifndef MAME_INCLUDES_MARIO_H #define MAME_INCLUDES_MARIO_H +#pragma once + #include "machine/gen_latch.h" #include "machine/z80dma.h" #include "emupal.h" @@ -47,9 +48,8 @@ class mario_state : public driver_device { public: - mario_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - + mario_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"), @@ -69,7 +69,8 @@ public: #endif m_spriteram(*this, "spriteram"), m_videoram(*this, "videoram"), - m_monitor(0) { } + m_monitor(0) + { } void mario_base(machine_config &config); void masao(machine_config &config); diff --git a/src/mame/includes/mbc55x.h b/src/mame/includes/mbc55x.h index 4a73b3b44d9..d046a5d6732 100644 --- a/src/mame/includes/mbc55x.h +++ b/src/mame/includes/mbc55x.h @@ -92,8 +92,8 @@ struct keyboard_t class mbc55x_state : public driver_device { public: - mbc55x_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + mbc55x_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, MAINCPU_TAG), m_iodecode(*this, "iodecode"), m_crtc(*this, VID_MC6845_NAME), @@ -118,6 +118,12 @@ public: required_device m_iodecode; uint32_t m_debug_machine; +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + virtual void video_reset() override; + private: DECLARE_FLOPPY_FORMATS(floppy_formats); @@ -147,11 +153,6 @@ private: void mbc55x_mem(address_map &map); void mbc55x_iodecode(address_map &map); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - virtual void video_reset() override; - void keyboard_reset(); void scan_keyboard(); void set_ram_size(); @@ -179,11 +180,6 @@ private: void video_debug(int ref, const std::vector ¶ms); }; -/*----------- defined in drivers/mbc55x.c -----------*/ - -extern const unsigned char mbc55x_palette[SCREEN_NO_COLOURS][3]; - - /*----------- defined in machine/mbc55x.c -----------*/ /* Memory controller */ @@ -213,10 +209,6 @@ extern const unsigned char mbc55x_palette[SCREEN_NO_COLOURS][3]; /*----------- defined in video/mbc55x.c -----------*/ -#define RED 0 -#define GREEN 1 -#define BLUE 2 - #define LINEAR_ADDR(seg,ofs) ((seg<<4)+ofs) #define OUTPUT_SEGOFS(mess,seg,ofs) logerror("%s=%04X:%04X [%08X]\n",mess,seg,ofs,((seg<<4)+ofs)) diff --git a/src/mame/includes/micronic.h b/src/mame/includes/micronic.h index 7aa76860d77..82656a0ea18 100644 --- a/src/mame/includes/micronic.h +++ b/src/mame/includes/micronic.h @@ -5,10 +5,11 @@ includes/micronic.h *****************************************************************************/ - #ifndef MAME_INCLUDES_MICRONIC_H #define MAME_INCLUDES_MICRONIC_H +#pragma once + #include "cpu/z80/z80.h" #include "video/hd61830.h" #include "machine/mc146818.h" @@ -26,8 +27,8 @@ class micronic_state : public driver_device { public: - micronic_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + micronic_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, Z80_TAG), m_lcdc(*this, HD61830_TAG), m_beep(*this, "beeper"), @@ -51,17 +52,11 @@ public: void micronic(machine_config &config); -private: - required_device m_maincpu; - required_device m_lcdc; - required_device m_beep; - required_device m_rtc; - required_device m_nvram1; - required_device m_nvram2; - required_device m_ram; - +protected: virtual void machine_start() override; virtual void machine_reset() override; + +private: void nvram_init(nvram_device &nvram, void *data, size_t size); DECLARE_READ8_MEMBER( keypad_r ); @@ -78,16 +73,25 @@ private: DECLARE_WRITE8_MEMBER( rtc_data_w ); DECLARE_WRITE_LINE_MEMBER( mc146818_irq ); + DECLARE_PALETTE_INIT(micronic); + + void micronic_io(address_map &map); + void micronic_mem(address_map &map); + + required_device m_maincpu; + required_device m_lcdc; + required_device m_beep; + required_device m_rtc; + required_device m_nvram1; + required_device m_nvram2; + required_device m_ram; + required_shared_ptr m_ram_base; uint8_t m_banks_num; uint8_t m_kp_matrix; uint8_t m_lcd_contrast; int m_lcd_backlight; uint8_t m_status_flag; - DECLARE_PALETTE_INIT(micronic); - - void micronic_io(address_map &map); - void micronic_mem(address_map &map); required_memory_bank m_bank1; required_ioport m_bit0; @@ -101,4 +105,4 @@ private: optional_device m_cassette; }; -#endif +#endif // MAME_INCLUDES_MICRONIC_H diff --git a/src/mame/includes/mikromik.h b/src/mame/includes/mikromik.h index 3a0e914e4d7..92186318482 100644 --- a/src/mame/includes/mikromik.h +++ b/src/mame/includes/mikromik.h @@ -1,9 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Curt Coder -#pragma once +#ifndef MAME_INCLUDES_MIKROMIK_H +#define MAME_INCLUDES_MIKROMIK_H -#ifndef MAME_INCLUDES_MIKROMIKKO_H -#define MAME_INCLUDES_MIKROMIKKO_H +#pragma once #include "bus/rs232/rs232.h" #include "cpu/i8085/i8085.h" @@ -70,6 +70,10 @@ public: void mm1m6_video(machine_config &config); void mm1m7(machine_config &config); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + private: required_device m_maincpu; required_device m_iop; @@ -91,8 +95,22 @@ private: required_memory_region m_char_rom; required_shared_ptr m_video_ram; - virtual void machine_start() override; - virtual void machine_reset() override; + int m_a8; + + // video state + int m_llen; + + // serial state + int m_intc; + int m_rx21; + int m_tx21; + int m_rcl; + + // floppy state + int m_recall; + int m_dack3; + int m_tc; + int m_fdc_tc; uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); @@ -113,23 +131,6 @@ private: void update_tc(); - int m_a8; - - // video state - int m_llen; - - // serial state - int m_intc; - int m_rx21; - int m_tx21; - int m_rcl; - - // floppy state - int m_recall; - int m_dack3; - int m_tc; - int m_fdc_tc; - DECLARE_FLOPPY_FORMATS( floppy_formats ); I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels ); UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); @@ -138,4 +139,4 @@ private: void mm1_upd7220_map(address_map &map); }; -#endif +#endif // MAME_INCLUDES_MIKROMIK_H diff --git a/src/mame/includes/munchmo.h b/src/mame/includes/munchmo.h index 8be1cd9e236..80ec3fcbf69 100644 --- a/src/mame/includes/munchmo.h +++ b/src/mame/includes/munchmo.h @@ -5,6 +5,10 @@ Munch Mobile *************************************************************************/ +#ifndef MAME_INCLUDES_MUNCHMO_H +#define MAME_INCLUDES_MUNCHMO_H + +#pragma once #include "machine/gen_latch.h" #include "machine/74259.h" @@ -34,10 +38,11 @@ public: void mnchmobl(machine_config &config); -private: +protected: virtual void machine_start() override; virtual void video_start() override; +private: DECLARE_WRITE_LINE_MEMBER(nmi_enable_w); DECLARE_WRITE8_MEMBER(nmi_ack_w); DECLARE_WRITE8_MEMBER(sound_nmi_ack_w); @@ -87,3 +92,5 @@ private: required_device m_soundlatch; required_device_array m_ay8910; }; + +#endif // MAME_INCLUDES_MUNCHMO_H diff --git a/src/mame/includes/mz2500.h b/src/mame/includes/mz2500.h index f925419c2ce..013582b222c 100644 --- a/src/mame/includes/mz2500.h +++ b/src/mame/includes/mz2500.h @@ -5,11 +5,11 @@ Sharp MZ-2500 (c) 1985 Sharp Corporation ********************************************************************************************************************************/ +#ifndef MAME_INCLUDES_MZ2500_H +#define MAME_INCLUDES_MZ2500_H #pragma once -#ifndef MAME_INCLUDES_MZ2500_H -#define MAME_INCLUDES_MZ2500_H #include "cpu/z80/z80.h" #include "machine/i8255.h" @@ -34,8 +34,8 @@ class mz2500_state : public driver_device { public: - mz2500_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + mz2500_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_screen(*this, "screen"), m_rtc(*this, RP5C15_TAG), @@ -203,7 +203,7 @@ private: void mz2500_draw_pixel(bitmap_ind16 &bitmap,int x,int y,uint16_t pen,uint8_t width,uint8_t height); void mz2500_reconfigure_screen(); - uint8_t pal_256_param(int index, int param); + static uint8_t pal_256_param(int index, int param); void reset_banks(uint8_t type); void mz2500_io(address_map &map); @@ -211,5 +211,4 @@ private: void mz2500_bank_window_map(address_map &map); }; - -#endif +#endif // MAME_INCLUDES_MZ2500_H diff --git a/src/mame/includes/n8080.h b/src/mame/includes/n8080.h index b9fb46d9065..02a5e6fdb23 100644 --- a/src/mame/includes/n8080.h +++ b/src/mame/includes/n8080.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Pierpaolo Prazzoli +#ifndef MAME_INCLUDES_N8080_H +#define MAME_INCLUDES_N8080_H + +#pragma once #include "cpu/i8085/i8085.h" #include "cpu/mcs48/mcs48.h" @@ -12,8 +16,8 @@ class n8080_state : public driver_device { public: - n8080_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + n8080_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_maincpu(*this, "maincpu"), @@ -22,7 +26,8 @@ public: m_helifire_dac(*this, "helifire_dac"), m_sn(*this, "snsnd"), m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_palette(*this, "palette") + { } void sheriff(machine_config &config); void sheriff_sound(machine_config &config); @@ -32,6 +37,9 @@ public: void spacefev(machine_config &config); void spacefev_sound(machine_config &config); +protected: + virtual void machine_start() override; + private: /* memory pointers */ required_shared_ptr m_videoram; @@ -90,7 +98,6 @@ private: DECLARE_WRITE8_MEMBER(helifire_sound_ctrl_w); DECLARE_WRITE_LINE_MEMBER(n8080_inte_callback); DECLARE_WRITE8_MEMBER(n8080_status_callback); - virtual void machine_start() override; DECLARE_MACHINE_RESET(spacefev); DECLARE_VIDEO_START(spacefev); DECLARE_PALETTE_INIT(n8080); @@ -139,3 +146,5 @@ private: void main_io_map(address_map &map); void n8080_sound_cpu_map(address_map &map); }; + +#endif // MAME_INCLUDES_N8080_H diff --git a/src/mame/includes/novagbase.h b/src/mame/includes/novagbase.h index a29e0cc3056..65205da3fba 100644 --- a/src/mame/includes/novagbase.h +++ b/src/mame/includes/novagbase.h @@ -6,12 +6,11 @@ * main driver is novag6502.cpp * ******************************************************************************/ - -#pragma once - #ifndef MAME_INCLUDES_NOVAGBASE_H #define MAME_INCLUDES_NOVAGBASE_H +#pragma once + #include "machine/timer.h" #include "sound/dac.h" #include "sound/beep.h" @@ -21,11 +20,11 @@ class novagbase_state : public driver_device { public: - novagbase_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + novagbase_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_beeper(*this, "beeper"), m_maincpu(*this, "maincpu"), m_dac(*this, "dac"), - m_beeper(*this, "beeper"), m_lcd(*this, "hd44780"), m_inp_matrix(*this, "IN.%u", 0), m_out_x(*this, "%u.%u", 0U, 0U), @@ -36,15 +35,16 @@ public: m_display_maxx(0) { } - TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); - DECLARE_PALETTE_INIT(novag_lcd); - HD44780_PIXEL_UPDATE(novag_lcd_pixel_update); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + optional_device m_beeper; protected: // devices/pointers required_device m_maincpu; optional_device m_dac; - optional_device m_beeper; optional_device m_lcd; optional_ioport_array<9> m_inp_matrix; // max 9 output_finder<0x20, 0x20> m_out_x; @@ -69,14 +69,13 @@ protected: u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments u8 m_display_decay[0x20][0x20]; // (internal use) + DECLARE_PALETTE_INIT(novag_lcd); + TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); + HD44780_PIXEL_UPDATE(novag_lcd_pixel_update); void display_update(); void set_display_size(int maxx, int maxy); void set_display_segmask(u32 digits, u32 mask); void display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update = true); - - - virtual void machine_start() override; - virtual void machine_reset() override; }; diff --git a/src/mame/includes/orion.h b/src/mame/includes/orion.h index 51d009e9d31..3a17968b13f 100644 --- a/src/mame/includes/orion.h +++ b/src/mame/includes/orion.h @@ -82,7 +82,6 @@ protected: DECLARE_MACHINE_START(orion128); DECLARE_MACHINE_RESET(orion128); DECLARE_PALETTE_INIT(orion128); - virtual void video_start() override; uint32_t screen_update_orion128(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(orionz80_interrupt); DECLARE_READ8_MEMBER(orion_romdisk_porta_r); @@ -145,8 +144,9 @@ protected: class orion_z80_state : public orion_state { public: - orion_z80_state(const machine_config &mconfig, device_type type, const char *tag) : - orion_state(mconfig, type, tag) {} + orion_z80_state(const machine_config &mconfig, device_type type, const char *tag) + : orion_state(mconfig, type, tag) + { } void orionz80(machine_config &config); void orionz80ms(machine_config &config); @@ -159,8 +159,9 @@ protected: class orion_pro_state : public orion_state { public: - orion_pro_state(const machine_config &mconfig, device_type type, const char *tag) : - orion_state(mconfig, type, tag) {} + orion_pro_state(const machine_config &mconfig, device_type type, const char *tag) + : orion_state(mconfig, type, tag) + { } void orionpro(machine_config &config); diff --git a/src/mame/includes/osi.h b/src/mame/includes/osi.h index 62357dcdd9a..a67d3b2ec5f 100644 --- a/src/mame/includes/osi.h +++ b/src/mame/includes/osi.h @@ -45,6 +45,12 @@ public: , m_io_reset(*this, "Reset") { } + void osi600(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_READ8_MEMBER( keyboard_r ); DECLARE_WRITE8_MEMBER( keyboard_w ); @@ -56,13 +62,9 @@ public: DECLARE_PALETTE_INIT(osi630); - void osi600(machine_config &config); void osi600_video(machine_config &config); void osi630_video(machine_config &config); void osi600_mem(address_map &map); -protected: - virtual void machine_start() override; - virtual void video_start() override; required_device m_maincpu; required_device m_acia_0; @@ -90,26 +92,28 @@ protected: class c1p_state : public sb2m600_state { public: - enum - { - TIMER_SETUP_BEEP - }; - c1p_state(const machine_config &mconfig, device_type type, const char *tag) : sb2m600_state(mconfig, type, tag) , m_beeper(*this, "beeper") { } + void init_c1p(); + void c1p(machine_config &config); + +protected: + enum + { + TIMER_SETUP_BEEP + }; + virtual void machine_start() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - required_device m_beeper; - DECLARE_WRITE8_MEMBER( osi630_ctrl_w ); DECLARE_WRITE8_MEMBER( osi630_sound_w ); - void init_c1p(); - void c1p(machine_config &config); void c1p_mem(address_map &map); + + required_device m_beeper; }; class c1pmf_state : public c1p_state @@ -119,17 +123,19 @@ public: : c1p_state(mconfig, type, tag) , m_floppy0(*this, "floppy0") , m_floppy1(*this, "floppy1") - { } + { } + + void c1pmf(machine_config &config); + +protected: + virtual void machine_start() override; DECLARE_READ8_MEMBER( osi470_pia_pa_r ); DECLARE_WRITE8_MEMBER( osi470_pia_pa_w ); DECLARE_WRITE8_MEMBER( osi470_pia_pb_w ); DECLARE_WRITE_LINE_MEMBER( osi470_pia_cb2_w ); - void c1pmf(machine_config &config); void c1pmf_mem(address_map &map); -protected: - virtual void machine_start() override; private: required_device m_floppy0; @@ -141,14 +147,16 @@ class uk101_state : public sb2m600_state public: uk101_state(const machine_config &mconfig, device_type type, const char *tag) : sb2m600_state(mconfig, type, tag) - { } + { } + void uk101(machine_config &config); + +protected: uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE8_MEMBER( keyboard_w ); - void uk101(machine_config &config); void uk101_video(machine_config &config); void uk101_mem(address_map &map); }; -#endif +#endif // MAME_INCLUDES_OSI_H diff --git a/src/mame/includes/p2000t.h b/src/mame/includes/p2000t.h index a421fa30c1a..c66a33d1e23 100644 --- a/src/mame/includes/p2000t.h +++ b/src/mame/includes/p2000t.h @@ -50,9 +50,10 @@ protected: required_shared_ptr m_videoram; -private: required_device m_maincpu; required_device m_speaker; + +private: required_ioport_array<10> m_keyboard; uint8_t m_port_101f; uint8_t m_port_202f; diff --git a/src/mame/includes/pc6001.h b/src/mame/includes/pc6001.h index e7d0f841911..836d5ceeebc 100644 --- a/src/mame/includes/pc6001.h +++ b/src/mame/includes/pc6001.h @@ -1,10 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Angelo Salese +#ifndef MAME_INCLUDES_PC6001_H +#define MAME_INCLUDES_PC6001_H #pragma once -#ifndef MAME_INCLUDES_PC6001_H -#define MAME_INCLUDES_PC6001_H #include "cpu/z80/z80.h" #include "imagedev/cassette.h" @@ -29,8 +29,8 @@ class pc6001_state : public driver_device { public: - pc6001_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + pc6001_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_ppi(*this, "ppi8255"), m_ram(*this, "ram"), m_maincpu(*this, "maincpu"), @@ -43,10 +43,11 @@ public: m_io_mode4_dsw(*this, "MODE4_DSW"), m_io_p1(*this, "P1"), m_io_p2(*this, "P2"), - m_io_keys(*this, {"key1", "key2", "key3"}), + m_io_keys(*this, "key%u", 1U), m_io_key_modifiers(*this, "key_modifiers"), m_bank1(*this, "bank1"), - m_palette(*this, "palette") { } + m_palette(*this, "palette") + { } DECLARE_WRITE8_MEMBER(system_latch_w); DECLARE_READ8_MEMBER(nec_ppi8255_r); @@ -140,8 +141,8 @@ private: class pc6001mk2_state : public pc6001_state { public: - pc6001mk2_state(const machine_config &mconfig, device_type type, const char *tag) - : pc6001_state(mconfig, type, tag), + pc6001mk2_state(const machine_config &mconfig, device_type type, const char *tag) : + pc6001_state(mconfig, type, tag), m_bank2(*this, "bank2"), m_bank3(*this, "bank3"), m_bank4(*this, "bank4"), @@ -149,7 +150,7 @@ public: m_bank6(*this, "bank6"), m_bank7(*this, "bank7"), m_bank8(*this, "bank8") - {} + { } DECLARE_READ8_MEMBER(mk2_bank_r0_r); DECLARE_READ8_MEMBER(mk2_bank_r1_r); @@ -212,9 +213,9 @@ private: class pc6601_state : public pc6001mk2_state { public: - pc6601_state(const machine_config &mconfig, device_type type, const char *tag) - : pc6001mk2_state(mconfig, type, tag) - {} + pc6601_state(const machine_config &mconfig, device_type type, const char *tag) : + pc6001mk2_state(mconfig, type, tag) + { } DECLARE_READ8_MEMBER(fdc_r); DECLARE_WRITE8_MEMBER(fdc_w); @@ -226,10 +227,10 @@ public: class pc6001sr_state : public pc6601_state { public: - pc6001sr_state(const machine_config &mconfig, device_type type, const char *tag) - : pc6601_state(mconfig, type, tag), + pc6001sr_state(const machine_config &mconfig, device_type type, const char *tag) : + pc6601_state(mconfig, type, tag), m_sr_irq_vectors(*this, "irq_vectors") - {}; + { } DECLARE_READ8_MEMBER(hw_rev_r); DECLARE_READ8_MEMBER(sr_bank_rn_r); diff --git a/src/mame/includes/pc8401a.h b/src/mame/includes/pc8401a.h index 17117a76819..4548da89ad4 100644 --- a/src/mame/includes/pc8401a.h +++ b/src/mame/includes/pc8401a.h @@ -1,10 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Curt Coder -#pragma once - #ifndef MAME_INCLUDES_PC8401A_H #define MAME_INCLUDES_PC8401A_H +#pragma once + #include "cpu/z80/z80.h" #include "machine/i8255.h" @@ -113,10 +113,15 @@ public: : pc8401a_state(mconfig, type, tag) { } - virtual void video_start() override; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void pc8500(machine_config &config); + +protected: + virtual void video_start() override; + void pc8500_video(machine_config &config); + +private: + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); }; -#endif +#endif // MAME_INCLUDES_PC8401A_H diff --git a/src/mame/includes/pc8801.h b/src/mame/includes/pc8801.h index 98a14770986..5de446834dc 100644 --- a/src/mame/includes/pc8801.h +++ b/src/mame/includes/pc8801.h @@ -5,11 +5,11 @@ PC-8801 (c) 1981 NEC ********************************************************************************************/ +#ifndef MAME_INCLUDES_PC8801_H +#define MAME_INCLUDES_PC8801_H #pragma once -#ifndef MAME_INCLUDES_PC8801_H -#define MAME_INCLUDES_PC8801_H #include "cpu/z80/z80.h" #include "bus/centronics/ctronics.h" @@ -35,49 +35,50 @@ #define UPD1990A_TAG "upd1990a" #define I8251_TAG "i8251" -struct crtc_t -{ - uint8_t cmd,param_count,cursor_on,status,irq_mask; - uint8_t param[8][5]; - uint8_t inverse; -}; - -struct mouse_t -{ - uint8_t phase; - uint8_t x,y; - attotime time; -}; - class pc8801_state : public driver_device { public: pc8801_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_screen(*this, "screen"), - m_fdccpu(*this, "fdccpu"), - m_fdc(*this, "upd765"), - m_fdd(*this, "upd765:%u", 0U), - m_pic(*this, I8214_TAG), - m_rtc(*this, UPD1990A_TAG), - m_cassette(*this, "cassette"), - m_beeper(*this, "beeper"), - m_opna(*this, "opna"), - m_opn(*this, "opn"), - m_palette(*this, "palette") + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_screen(*this, "screen") + , m_fdccpu(*this, "fdccpu") + , m_fdc(*this, "upd765") + , m_fdd(*this, "upd765:%u", 0U) + , m_pic(*this, I8214_TAG) + , m_rtc(*this, UPD1990A_TAG) + , m_cassette(*this, "cassette") + , m_beeper(*this, "beeper") + , m_opna(*this, "opna") + , m_opn(*this, "opn") + , m_palette(*this, "palette") { } + void pc8801mc(machine_config &config); void pc8801fh(machine_config &config); void pc8801(machine_config &config); void pc8801ma(machine_config &config); -protected: +protected: virtual void video_start() override; virtual void machine_start() override; virtual void machine_reset() override; private: + struct crtc_t + { + uint8_t cmd,param_count,cursor_on,status,irq_mask; + uint8_t param[8][5]; + uint8_t inverse; + }; + + struct mouse_t + { + uint8_t phase; + uint8_t x,y; + attotime time; + }; + required_device m_maincpu; required_device m_screen; required_device m_fdccpu; @@ -257,5 +258,4 @@ private: DECLARE_WRITE_LINE_MEMBER(pc8801_sound_irq); }; - -#endif +#endif // MAME_INCLUDES_PC8801_H diff --git a/src/mame/includes/pc9801.h b/src/mame/includes/pc9801.h index 3d42d1e03dd..69dcc89c0f1 100644 --- a/src/mame/includes/pc9801.h +++ b/src/mame/includes/pc9801.h @@ -416,5 +416,4 @@ private: uint16_t egc_shift(int plane, uint16_t val); }; - -#endif +#endif // MAME_INCLUDES_PC9801_H diff --git a/src/mame/includes/pocketc.h b/src/mame/includes/pocketc.h index 6b21c0b07b1..a750bac9c6c 100644 --- a/src/mame/includes/pocketc.h +++ b/src/mame/includes/pocketc.h @@ -5,10 +5,11 @@ * includes/pocketc.h * ****************************************************************************/ - #ifndef MAME_INCLUDES_POCKETC_H #define MAME_INCLUDES_POCKETC_H +#pragma once + #include "cpu/sc61860/sc61860.h" #include "machine/nvram.h" #include "emupal.h" diff --git a/src/mame/includes/popeye.h b/src/mame/includes/popeye.h index 61d69021234..3400e80af0b 100644 --- a/src/mame/includes/popeye.h +++ b/src/mame/includes/popeye.h @@ -1,6 +1,10 @@ // license:BSD-3-Clause // copyright-holders:smf, Nicola Salmoria, Couriersud // thanks-to: Marc Lafontaine +#ifndef MAME_INCLUDES_POPEYE_H +#define MAME_INCLUDES_POPEYE_H + +#pragma once #include "cpu/z80/z80.h" #include "sound/ay8910.h" @@ -10,8 +14,8 @@ class tnx1_state : public driver_device { public: - tnx1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + tnx1_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_aysnd(*this, "aysnd"), m_gfxdecode(*this, "gfxdecode"), @@ -20,10 +24,12 @@ public: m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_color_prom(*this, "proms"), - m_color_prom_spr(*this, "sprpal") { } + m_color_prom_spr(*this, "sprpal") + { } DECLARE_CUSTOM_INPUT_MEMBER(dsw1_read); DECLARE_CUSTOM_INPUT_MEMBER(pop_field_r); + virtual void config(machine_config &config); protected: @@ -125,6 +131,9 @@ protected: class tpp2_noalu_state : public tpp2_state { using tpp2_state::tpp2_state; + protected: virtual void maincpu_program_map(address_map &map) override; }; + +#endif // MAME_INCLUDES_POPEYE_H diff --git a/src/mame/includes/portrait.h b/src/mame/includes/portrait.h index b4ccb34c0bd..6bbce95a165 100644 --- a/src/mame/includes/portrait.h +++ b/src/mame/includes/portrait.h @@ -1,5 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Steve Ellenoff, Pierpaolo Prazzoli +#ifndef MAME_INCLUDES_PORTRAIT_H +#define MAME_INCLUDES_PORTRAIT_H + +#pragma once + #include "sound/tms5220.h" #include "emupal.h" @@ -22,6 +27,10 @@ public: void portrait(machine_config &config); +protected: + virtual void machine_start() override { m_lamps.resolve(); } + virtual void video_start() override; + private: DECLARE_WRITE8_MEMBER(ctrl_w); DECLARE_WRITE8_MEMBER(positive_scroll_w); @@ -40,9 +49,6 @@ private: void portrait_map(address_map &map); void portrait_sound_map(address_map &map); - virtual void machine_start() override { m_lamps.resolve(); } - virtual void video_start() override; - required_device m_maincpu; required_device m_gfxdecode; required_device m_palette; @@ -57,3 +63,5 @@ private: tilemap_t *m_foreground; tilemap_t *m_background; }; + +#endif // MAME_INCLUDES_PORTRAIT_H diff --git a/src/mame/includes/prehisle.h b/src/mame/includes/prehisle.h index fa4e048bd0a..862d33ea4fb 100644 --- a/src/mame/includes/prehisle.h +++ b/src/mame/includes/prehisle.h @@ -1,5 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Bryan McPhail +#ifndef MAME_INCLUDES_PREHISLE_H +#define MAME_INCLUDES_PREHISLE_H + +#pragma once #include "machine/gen_latch.h" #include "sound/upd7759.h" @@ -20,11 +24,34 @@ public: m_upd7759(*this, "upd"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch") { } + m_soundlatch(*this, "soundlatch") + { } void prehisle(machine_config &config); +protected: + virtual void machine_start() override; + virtual void video_start() override; + private: + DECLARE_WRITE16_MEMBER(soundcmd_w); + DECLARE_WRITE16_MEMBER(fg_vram_w); + DECLARE_WRITE16_MEMBER(tx_vram_w); + void fg_scrolly_w(offs_t offset, u16 data, u16 mem_mask); + void fg_scrollx_w(offs_t offset, u16 data, u16 mem_mask); + void bg_scrolly_w(offs_t offset, u16 data, u16 mem_mask); + void bg_scrollx_w(offs_t offset, u16 data, u16 mem_mask); + DECLARE_WRITE8_MEMBER(upd_port_w); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + TILE_GET_INFO_MEMBER(get_tx_tile_info); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void prehisle_map(address_map &map); + void prehisle_sound_io_map(address_map &map); + void prehisle_sound_map(address_map &map); + required_shared_ptr m_tx_vram; required_shared_ptr m_spriteram; required_shared_ptr m_fg_vram; @@ -41,29 +68,12 @@ private: tilemap_t *m_fg_tilemap; tilemap_t *m_tx_tilemap; - DECLARE_WRITE16_MEMBER(soundcmd_w); - DECLARE_WRITE16_MEMBER(fg_vram_w); - DECLARE_WRITE16_MEMBER(tx_vram_w); - void fg_scrolly_w(offs_t offset, u16 data, u16 mem_mask); - void fg_scrollx_w(offs_t offset, u16 data, u16 mem_mask); - void bg_scrolly_w(offs_t offset, u16 data, u16 mem_mask); - void bg_scrollx_w(offs_t offset, u16 data, u16 mem_mask); - DECLARE_WRITE8_MEMBER(upd_port_w); - 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 video_start() override; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; required_device m_audiocpu; required_device m_upd7759; required_device m_gfxdecode; required_device m_palette; required_device m_soundlatch; - void prehisle_map(address_map &map); - void prehisle_sound_io_map(address_map &map); - void prehisle_sound_map(address_map &map); }; + +#endif // MAME_INCLUDES_PREHISLE_H diff --git a/src/mame/includes/radio86.h b/src/mame/includes/radio86.h index cf6a1d6b02b..fbc6c5907b1 100644 --- a/src/mame/includes/radio86.h +++ b/src/mame/includes/radio86.h @@ -5,10 +5,11 @@ * includes/radio86.h * ****************************************************************************/ - #ifndef MAME_INCLUDES_RADIO86_H #define MAME_INCLUDES_RADIO86_H +#pragma once + #include "machine/i8255.h" #include "machine/i8257.h" #include "video/i8275.h" @@ -26,8 +27,8 @@ public: TIMER_RESET }; - radio86_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + radio86_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_cassette(*this, "cassette"), m_cart(*this, "cartslot"), @@ -38,9 +39,9 @@ public: m_bank1(*this, "bank1"), m_io_line(*this, "LINE%u", 0), m_io_cline(*this, "CLINE%u", 0), - m_palette(*this, "palette") { } - - virtual void video_start() override; + m_palette(*this, "palette"), + m_charmap(*this, "gfx1") + { } uint8_t m_tape_value; uint8_t m_mikrosha_font_page; @@ -49,7 +50,6 @@ public: uint8_t m_romdisk_lsb; uint8_t m_romdisk_msb; uint8_t m_disk_sel; - const uint8_t *m_charmap; uint8_t radio_cpu_state_r(); uint8_t radio_io_r(offs_t offset); void radio_io_w(offs_t offset, uint8_t data); @@ -83,14 +83,7 @@ public: void radio16(machine_config &config); void radioram(machine_config &config); void kr03(machine_config &config); - void impuls03_mem(address_map &map); - void mikron2_mem(address_map &map); - void radio86_16_mem(address_map &map); - void radio86_io(address_map &map); - void radio86_mem(address_map &map); - void radio86ram_mem(address_map &map); - void radio86rom_mem(address_map &map); - void rk7007_io(address_map &map); + protected: required_device m_cassette; optional_device m_cart; // for ROMDisk - only Radio86K & Orion? @@ -106,8 +99,18 @@ protected: virtual void machine_reset() override; void radio86_init_keyboard(); -public: + + void impuls03_mem(address_map &map); + void mikron2_mem(address_map &map); + void radio86_16_mem(address_map &map); + void radio86_io(address_map &map); + void radio86_mem(address_map &map); + void radio86ram_mem(address_map &map); + void radio86rom_mem(address_map &map); + void rk7007_io(address_map &map); + required_device m_palette; + optional_region_ptr m_charmap; }; diff --git a/src/mame/includes/samcoupe.h b/src/mame/includes/samcoupe.h index 748309ba40f..f484c71a75c 100644 --- a/src/mame/includes/samcoupe.h +++ b/src/mame/includes/samcoupe.h @@ -13,6 +13,8 @@ #ifndef MAME_INCLUDES_SAMCOUPE_H #define MAME_INCLUDES_SAMCOUPE_H +#pragma once + #include "bus/centronics/ctronics.h" #include "imagedev/cassette.h" #include "imagedev/floppy.h" @@ -46,33 +48,33 @@ class samcoupe_state : public driver_device { public: - samcoupe_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_screen(*this, "screen"), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_lpt1(*this, "lpt1"), - m_lpt2(*this, "lpt2"), - m_ram(*this, RAM_TAG), - m_rtc(*this, "sambus_clock"), - m_fdc(*this, "wd1772"), - m_wd1772_0(*this, "wd1772:0"), - m_wd1772_1(*this, "wd1772:1"), - m_region_maincpu(*this, "maincpu"), - m_keyboard_row_fe(*this, "keyboard_row_fe"), - m_keyboard_row_fd(*this, "keyboard_row_fd"), - m_keyboard_row_fb(*this, "keyboard_row_fb"), - m_keyboard_row_f7(*this, "keyboard_row_f7"), - m_keyboard_row_ef(*this, "keyboard_row_ef"), - m_keyboard_row_df(*this, "keyboard_row_df"), - m_keyboard_row_bf(*this, "keyboard_row_bf"), - m_keyboard_row_7f(*this, "keyboard_row_7f"), - m_keyboard_row_ff(*this, "keyboard_row_ff"), - m_mouse_buttons(*this, "mouse_buttons"), - m_io_mouse_x(*this, "mouse_x"), - m_io_mouse_y(*this, "mouse_y"), - m_config(*this, "config") + samcoupe_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_screen(*this, "screen"), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_lpt1(*this, "lpt1"), + m_lpt2(*this, "lpt2"), + m_ram(*this, RAM_TAG), + m_rtc(*this, "sambus_clock"), + m_fdc(*this, "wd1772"), + m_wd1772_0(*this, "wd1772:0"), + m_wd1772_1(*this, "wd1772:1"), + m_region_maincpu(*this, "maincpu"), + m_keyboard_row_fe(*this, "keyboard_row_fe"), + m_keyboard_row_fd(*this, "keyboard_row_fd"), + m_keyboard_row_fb(*this, "keyboard_row_fb"), + m_keyboard_row_f7(*this, "keyboard_row_f7"), + m_keyboard_row_ef(*this, "keyboard_row_ef"), + m_keyboard_row_df(*this, "keyboard_row_df"), + m_keyboard_row_bf(*this, "keyboard_row_bf"), + m_keyboard_row_7f(*this, "keyboard_row_7f"), + m_keyboard_row_ff(*this, "keyboard_row_ff"), + m_mouse_buttons(*this, "mouse_buttons"), + m_io_mouse_x(*this, "mouse_x"), + m_io_mouse_y(*this, "mouse_y"), + m_config(*this, "config") { sam_bank_read_ptr[0] = nullptr; sam_bank_write_ptr[0] = nullptr; @@ -86,7 +88,7 @@ public: void samcoupe(machine_config &config); -private: +protected: enum { TIMER_IRQ_OFF, @@ -94,8 +96,13 @@ private: TIMER_VIDEO_UPDATE }; + 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: uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); bitmap_ind16 m_bitmap; @@ -136,8 +143,6 @@ private: DECLARE_READ8_MEMBER(samcoupe_keyboard_r); DECLARE_WRITE8_MEMBER(samcoupe_border_w); DECLARE_READ8_MEMBER(samcoupe_attributes_r); - virtual void machine_start() override; - virtual void machine_reset() override; DECLARE_PALETTE_INIT(samcoupe); INTERRUPT_GEN_MEMBER(samcoupe_frame_interrupt); TIMER_CALLBACK_MEMBER(irq_off); @@ -207,8 +212,6 @@ private: void samcoupe_io(address_map &map); void samcoupe_mem(address_map &map); - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; }; #endif // MAME_INCLUDES_SAMCOUPE_H diff --git a/src/mame/includes/snk.h b/src/mame/includes/snk.h index dd65349ee81..634c7b92492 100644 --- a/src/mame/includes/snk.h +++ b/src/mame/includes/snk.h @@ -7,6 +7,10 @@ various SNK triple Z80 games *************************************************************************/ +#ifndef MAME_INCLUDES_SNK_H +#define MAME_INCLUDES_SNK_H + +#pragma once #include "machine/gen_latch.h" #include "emupal.h" @@ -281,3 +285,5 @@ private: void tnk3_cpuA_map(address_map &map); void tnk3_cpuB_map(address_map &map); }; + +#endif // MAME_INCLUDES_SNK_H diff --git a/src/mame/includes/spectrum.h b/src/mame/includes/spectrum.h index fae8b6bce1d..19b92f34e1c 100644 --- a/src/mame/includes/spectrum.h +++ b/src/mame/includes/spectrum.h @@ -66,8 +66,8 @@ struct EVENT_LIST_ITEM class spectrum_state : public driver_device { public: - spectrum_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + spectrum_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_video_ram(*this, "video_ram"), m_maincpu(*this, "maincpu"), m_screen(*this, "screen"), @@ -95,7 +95,8 @@ public: m_io_plus3(*this, "PLUS3"), m_io_plus4(*this, "PLUS4"), m_io_joy1(*this, "JOY1"), - m_io_joy2(*this, "JOY2") { } + m_io_joy2(*this, "JOY2") + { } void spectrum_common(machine_config &config); void spectrum(machine_config &config); diff --git a/src/mame/includes/tx0.h b/src/mame/includes/tx0.h index fb45518db06..e079dd883bd 100644 --- a/src/mame/includes/tx0.h +++ b/src/mame/includes/tx0.h @@ -5,10 +5,11 @@ * includes/tx0.h * ****************************************************************************/ - #ifndef MAME_INCLUDES_TX0_H #define MAME_INCLUDES_TX0_H +#pragma once + #include "video/crt.h" #include "cpu/pdp1/tx0.h" #include "emupal.h" @@ -133,8 +134,8 @@ struct magtape_t class tx0_state : public driver_device { public: - tx0_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + tx0_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"), diff --git a/src/mame/includes/x68k.h b/src/mame/includes/x68k.h index 8b555b1d90e..cf7b3cbef74 100644 --- a/src/mame/includes/x68k.h +++ b/src/mame/includes/x68k.h @@ -11,6 +11,8 @@ #ifndef MAME_INCLUDES_X68K_H #define MAME_INCLUDES_X68K_H +#pragma once + #include "cpu/m68000/m68000.h" #include "imagedev/floppy.h" #include "machine/8530scc.h" @@ -251,7 +253,6 @@ protected: TILE_GET_INFO_MEMBER(get_bg0_tile_16); TILE_GET_INFO_MEMBER(get_bg1_tile_16); virtual void video_start() override; - DECLARE_PALETTE_INIT(x68000); uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(led_callback); TIMER_CALLBACK_MEMBER(scc_ack); diff --git a/src/mame/includes/zx.h b/src/mame/includes/zx.h index 456e70891b7..099b5a012b0 100644 --- a/src/mame/includes/zx.h +++ b/src/mame/includes/zx.h @@ -27,8 +27,8 @@ class zx_state : public driver_device { public: - zx_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + zx_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_ram(*this, RAM_TAG), m_cassette(*this, "cassette"), diff --git a/src/mame/machine/gb.cpp b/src/mame/machine/gb.cpp index 5c4ff891b7a..3e0e04686cc 100644 --- a/src/mame/machine/gb.cpp +++ b/src/mame/machine/gb.cpp @@ -196,7 +196,7 @@ void gb_state::machine_reset() { gb_init(); - /* Enable BIOS rom */ + // Enable BIOS ROM m_bios_disable = false; } @@ -663,15 +663,15 @@ READ8_MEMBER(gb_state::gbc_io2_r) ****************************************************************************/ -MACHINE_START_MEMBER(megaduck_state,megaduck) +void megaduck_state::machine_start() { - save_gb_base(); + gb_state::machine_start(); } -MACHINE_RESET_MEMBER(megaduck_state,megaduck) +void megaduck_state::machine_reset() { - /* We may have to add some more stuff here, if not then it can be merged back into gb */ - gb_init(); + // We may have to add some more stuff here, if not then it can be merged back into gb + gb_state::machine_reset(); m_bios_disable = true; } diff --git a/src/mame/machine/radio86.cpp b/src/mame/machine/radio86.cpp index 82c861e6b1c..6f8a46acd8f 100644 --- a/src/mame/machine/radio86.cpp +++ b/src/mame/machine/radio86.cpp @@ -213,36 +213,28 @@ void radio86_state::mikrosha_8255_font_page_w(uint8_t data) I8275_DRAW_CHARACTER_MEMBER(radio86_state::display_pixels) { - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - const uint8_t *charmap = m_charmap; - uint8_t pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; - if (vsp) { + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t pixels = m_charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; + if (vsp) pixels = 0; - } - if (lten) { + + if (lten) pixels = 0xff; - } - if (rvv) { + + if (rvv) pixels ^= 0xff; - } - for(i=0;i<6;i++) { + + for (int i = 0; i < 6; i++) bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; - } } -static const rgb_t radio86_palette[3] = { - rgb_t(0x00, 0x00, 0x00), // black - rgb_t(0xa0, 0xa0, 0xa0), // white - rgb_t(0xff, 0xff, 0xff) // highlight +static constexpr rgb_t radio86_palette[3] = { + { 0x00, 0x00, 0x00 }, // black + { 0xa0, 0xa0, 0xa0 }, // white + { 0xff, 0xff, 0xff } // highlight }; PALETTE_INIT_MEMBER(radio86_state,radio86) { palette.set_pen_colors(0, radio86_palette, ARRAY_LENGTH(radio86_palette)); } - -void radio86_state::video_start() -{ - m_charmap = memregion("gfx1")->base(); -} diff --git a/src/mame/video/bbusters.cpp b/src/mame/video/bbusters.cpp index b4aae331873..41ad5fd5337 100644 --- a/src/mame/video/bbusters.cpp +++ b/src/mame/video/bbusters.cpp @@ -26,7 +26,7 @@ /******************************************************************************/ -TILE_GET_INFO_MEMBER(bbusters_state::get_tile_info) +TILE_GET_INFO_MEMBER(bbusters_state_base::get_tile_info) { uint16_t tile = m_videoram[tile_index]; @@ -34,14 +34,14 @@ TILE_GET_INFO_MEMBER(bbusters_state::get_tile_info) } template -TILE_GET_INFO_MEMBER(bbusters_state::get_pf_tile_info) +TILE_GET_INFO_MEMBER(bbusters_state_base::get_pf_tile_info) { uint16_t tile = m_pf_data[Layer][tile_index]; SET_TILE_INFO_MEMBER(Gfx,tile&0xfff,tile>>12,0); } -WRITE16_MEMBER(bbusters_state::video_w) +WRITE16_MEMBER(bbusters_state_base::video_w) { COMBINE_DATA(&m_videoram[offset]); m_fix_tilemap->mark_tile_dirty(offset); @@ -49,28 +49,32 @@ WRITE16_MEMBER(bbusters_state::video_w) /******************************************************************************/ -void bbusters_state::video_start() +void bbusters_state_base::video_start() { - m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(bbusters_state::get_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_pf_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(&bbusters_state::get_pf_tile_info<0,3>, "layer0_gfx3", this), TILEMAP_SCAN_COLS, 16, 16, 128, 32); - m_pf_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(&bbusters_state::get_pf_tile_info<1,4>, "layer1_gfx4", this), TILEMAP_SCAN_COLS, 16, 16, 128, 32); - - m_pf_tilemap[0]->set_transparent_pen(15); + m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(bbusters_state_base::get_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); m_fix_tilemap->set_transparent_pen(15); save_item(NAME(m_scale_line_count)); } +void bbusters_state::video_start() +{ + bbusters_state_base::video_start(); + + m_pf_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(&bbusters_state::get_pf_tile_info<0,3>, "layer0_gfx3", this), TILEMAP_SCAN_COLS, 16, 16, 128, 32); + m_pf_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(&bbusters_state::get_pf_tile_info<1,4>, "layer1_gfx4", this), TILEMAP_SCAN_COLS, 16, 16, 128, 32); + + m_pf_tilemap[0]->set_transparent_pen(15); +} + void mechatt_state::video_start() { - m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(mechatt_state::get_tile_info), this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + bbusters_state_base::video_start(); + m_pf_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(&mechatt_state::get_pf_tile_info<0,2>, "layer0_gfx2", this), TILEMAP_SCAN_COLS, 16, 16, 256, 32); m_pf_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(&mechatt_state::get_pf_tile_info<1,3>, "layer1_gfx3", this), TILEMAP_SCAN_COLS, 16, 16, 256, 32); m_pf_tilemap[0]->set_transparent_pen(15); - m_fix_tilemap->set_transparent_pen(15); - - save_item(NAME(m_scale_line_count)); } /******************************************************************************/ @@ -90,7 +94,7 @@ void mechatt_state::video_start() else if (dy&0x40) code+=32; \ else if (dx&0x40) code+=16 -inline const uint8_t *bbusters_state::get_source_ptr(gfx_element *gfx, uint32_t sprite, int dx, int dy, int block) +inline const uint8_t *bbusters_state_base::get_source_ptr(gfx_element *gfx, uint32_t sprite, int dx, int dy, int block) { int code=0; @@ -128,7 +132,7 @@ inline const uint8_t *bbusters_state::get_source_ptr(gfx_element *gfx, uint32_t return gfx->get_data((sprite+code) % gfx->elements()) + ((dy%16) * gfx->rowbytes()); } -void bbusters_state::draw_block(screen_device &screen, bitmap_ind16 &dest,int x,int y,int size,int flipx,int flipy,uint32_t sprite,int color,int bank,int block,int priority) +void bbusters_state_base::draw_block(screen_device &screen, bitmap_ind16 &dest,int x,int y,int size,int flipx,int flipy,uint32_t sprite,int color,int bank,int block,int priority) { gfx_element *gfx = m_gfxdecode->gfx(bank); pen_t pen_base = gfx->colorbase() + gfx->granularity() * (color % gfx->colors()); @@ -177,7 +181,7 @@ void bbusters_state::draw_block(screen_device &screen, bitmap_ind16 &dest,int x, } } -void bbusters_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const uint16_t *source, int bank) +void bbusters_state_base::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const uint16_t *source, int bank) { int offs; diff --git a/src/mame/video/orion.cpp b/src/mame/video/orion.cpp index 032dba10149..7edea6ec578 100644 --- a/src/mame/video/orion.cpp +++ b/src/mame/video/orion.cpp @@ -13,10 +13,6 @@ #include "emu.h" #include "includes/orion.h" -void orion_state::video_start() -{ -} - uint32_t orion_state::screen_update_orion128(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { uint8_t code1,code2,code3,code4,color,val;