mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
dblcrown.cpp, usgames.cpp, wangpc.cpp: Use output finders (nw)
This commit is contained in:
parent
2d146cdfbf
commit
83b36d3ea1
@ -65,25 +65,24 @@ public:
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_watchdog(*this, "watchdog"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette")
|
||||
m_palette(*this, "palette"),
|
||||
m_inputs(*this, "IN%u", 0U),
|
||||
m_lamps(*this, "lamp%u", 0U)
|
||||
{ }
|
||||
|
||||
// devices
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<watchdog_timer_device> m_watchdog;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
void dblcrown(machine_config &config);
|
||||
|
||||
protected:
|
||||
// driver_device overrides
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
virtual void video_start() override;
|
||||
|
||||
private:
|
||||
// screen updates
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
uint8_t m_bank;
|
||||
uint8_t m_irq_src;
|
||||
std::unique_ptr<uint8_t[]> m_pal_ram;
|
||||
std::unique_ptr<uint8_t[]> m_vram;
|
||||
uint8_t m_vram_bank[2];
|
||||
uint8_t m_mux_data;
|
||||
|
||||
DECLARE_WRITE8_MEMBER(bank_w);
|
||||
DECLARE_READ8_MEMBER(irq_source_r);
|
||||
DECLARE_WRITE8_MEMBER(irq_source_w);
|
||||
@ -103,15 +102,23 @@ public:
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(dblcrown_irq_scanline);
|
||||
DECLARE_PALETTE_INIT(dblcrown);
|
||||
|
||||
void dblcrown(machine_config &config);
|
||||
void dblcrown_io(address_map &map);
|
||||
void dblcrown_map(address_map &map);
|
||||
protected:
|
||||
// driver_device overrides
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
virtual void video_start() override;
|
||||
// devices
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<watchdog_timer_device> m_watchdog;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
required_ioport_array<4> m_inputs;
|
||||
output_finder<8> m_lamps;
|
||||
|
||||
uint8_t m_bank;
|
||||
uint8_t m_irq_src;
|
||||
std::unique_ptr<uint8_t[]> m_pal_ram;
|
||||
std::unique_ptr<uint8_t[]> m_vram;
|
||||
uint8_t m_vram_bank[2];
|
||||
uint8_t m_mux_data;
|
||||
};
|
||||
|
||||
void dblcrown_state::video_start()
|
||||
@ -251,7 +258,6 @@ WRITE8_MEMBER( dblcrown_state::mux_w)
|
||||
|
||||
READ8_MEMBER( dblcrown_state::in_mux_r )
|
||||
{
|
||||
const char *const muxnames[] = { "IN0", "IN1", "IN2", "IN3" };
|
||||
int i;
|
||||
uint8_t res;
|
||||
|
||||
@ -260,7 +266,7 @@ READ8_MEMBER( dblcrown_state::in_mux_r )
|
||||
for(i = 0; i < 4; i++)
|
||||
{
|
||||
if(m_mux_data & 1 << i)
|
||||
res |= ioport(muxnames[i])->read();
|
||||
res |= m_inputs[i]->read();
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -268,7 +274,6 @@ READ8_MEMBER( dblcrown_state::in_mux_r )
|
||||
|
||||
READ8_MEMBER( dblcrown_state::in_mux_type_r )
|
||||
{
|
||||
const char *const muxnames[] = { "IN0", "IN1", "IN2", "IN3" };
|
||||
int i;
|
||||
uint8_t res;
|
||||
|
||||
@ -276,7 +281,7 @@ READ8_MEMBER( dblcrown_state::in_mux_type_r )
|
||||
|
||||
for(i = 0; i < 4; i++)
|
||||
{
|
||||
if(ioport(muxnames[i])->read() != 0xff)
|
||||
if (m_inputs[i]->read() != 0xff)
|
||||
res &= ~(1 << i);
|
||||
}
|
||||
|
||||
@ -313,14 +318,9 @@ WRITE8_MEMBER( dblcrown_state::lamps_w )
|
||||
-x-- ---- Hold 2
|
||||
x--- ---- Hold 1
|
||||
*/
|
||||
output().set_lamp_value(0, (data) & 1); /* Deal */
|
||||
output().set_lamp_value(1, (data >> 1) & 1); /* Bet */
|
||||
output().set_lamp_value(2, (data >> 2) & 1); /* Cancel */
|
||||
output().set_lamp_value(3, (data >> 3) & 1); /* Hold 5 */
|
||||
output().set_lamp_value(4, (data >> 4) & 1); /* Hold 4 */
|
||||
output().set_lamp_value(5, (data >> 5) & 1); /* Hold 3 */
|
||||
output().set_lamp_value(6, (data >> 6) & 1); /* Hold 2 */
|
||||
output().set_lamp_value(7, (data >> 7) & 1); /* Hold 1 */
|
||||
|
||||
for (int n = 0; n < 8; n++)
|
||||
m_lamps[n] = BIT(data, n);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(dblcrown_state::watchdog_w)
|
||||
@ -543,6 +543,8 @@ void dblcrown_state::machine_start()
|
||||
{
|
||||
uint8_t *ROM = memregion("maincpu")->base();
|
||||
membank("rom_bank")->configure_entries(0, 0x20, &ROM[0], 0x2000);
|
||||
|
||||
m_lamps.resolve();
|
||||
}
|
||||
|
||||
void dblcrown_state::machine_reset()
|
||||
|
@ -38,6 +38,8 @@ Sound: AY-3-8912A
|
||||
|
||||
void usgames_state::machine_start()
|
||||
{
|
||||
m_leds.resolve();
|
||||
|
||||
membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000);
|
||||
}
|
||||
|
||||
@ -49,11 +51,8 @@ WRITE8_MEMBER(usgames_state::rombank_w)
|
||||
WRITE8_MEMBER(usgames_state::lamps1_w)
|
||||
{
|
||||
/* button lamps */
|
||||
output().set_led_value(0,data & 0x01);
|
||||
output().set_led_value(1,data & 0x02);
|
||||
output().set_led_value(2,data & 0x04);
|
||||
output().set_led_value(3,data & 0x08);
|
||||
output().set_led_value(4,data & 0x10);
|
||||
for (int i = 0; i < 4; i++)
|
||||
m_leds[i] = BIT(data, i);
|
||||
|
||||
/* bit 5 toggles all the time - extra lamp? */
|
||||
}
|
||||
|
@ -47,6 +47,7 @@
|
||||
#define CENTRONICS_TAG "centronics"
|
||||
#define RS232_TAG "rs232"
|
||||
#define WANGPC_KEYBOARD_TAG "wangpckb"
|
||||
#define LED_DIAGNOSTIC "led0"
|
||||
|
||||
class wangpc_state : public driver_device
|
||||
{
|
||||
@ -70,6 +71,7 @@ public:
|
||||
m_cent_data_out(*this, "cent_data_out"),
|
||||
m_bus(*this, WANGPC_BUS_TAG),
|
||||
m_sw(*this, "SW"),
|
||||
m_led_diagnostic(*this, LED_DIAGNOSTIC),
|
||||
m_timer2_irq(1),
|
||||
m_centronics_ack(1),
|
||||
m_dav(1),
|
||||
@ -89,6 +91,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void wangpc(machine_config &config);
|
||||
|
||||
private:
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<am9517a_device> m_dmac;
|
||||
required_device<pic8259_device> m_pic;
|
||||
@ -105,6 +110,7 @@ public:
|
||||
required_device<output_latch_device> m_cent_data_out;
|
||||
required_device<wangpcbus_device> m_bus;
|
||||
required_ioport m_sw;
|
||||
output_finder<> m_led_diagnostic;
|
||||
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
@ -189,6 +195,9 @@ public:
|
||||
image_init_result on_disk1_load(floppy_image_device *image);
|
||||
void on_disk1_unload(floppy_image_device *image);
|
||||
|
||||
void wangpc_io(address_map &map);
|
||||
void wangpc_mem(address_map &map);
|
||||
|
||||
uint8_t m_dma_page[4];
|
||||
int m_dack;
|
||||
|
||||
@ -214,9 +223,6 @@ public:
|
||||
int m_ds2;
|
||||
|
||||
int m_led[6];
|
||||
void wangpc(machine_config &config);
|
||||
void wangpc_io(address_map &map);
|
||||
void wangpc_mem(address_map &map);
|
||||
};
|
||||
|
||||
|
||||
@ -227,11 +233,6 @@ public:
|
||||
|
||||
#define LOG 0
|
||||
|
||||
enum
|
||||
{
|
||||
LED_DIAGNOSTIC = 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
@ -511,7 +512,7 @@ READ8_MEMBER( wangpc_state::led_on_r )
|
||||
{
|
||||
if (LOG) logerror("%s: Diagnostic LED on\n", machine().describe_context());
|
||||
|
||||
output().set_led_value(LED_DIAGNOSTIC, 1);
|
||||
m_led_diagnostic = 1;
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
@ -675,7 +676,7 @@ READ8_MEMBER( wangpc_state::led_off_r )
|
||||
{
|
||||
if (LOG) logerror("%s: Diagnostic LED off\n", machine().describe_context());
|
||||
|
||||
output().set_led_value(LED_DIAGNOSTIC, 0);
|
||||
m_led_diagnostic = 0;
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
@ -1188,6 +1189,8 @@ void wangpc_state::machine_start()
|
||||
m_floppy1->setup_load_cb(floppy_image_device::load_cb(&wangpc_state::on_disk1_load, this));
|
||||
m_floppy1->setup_unload_cb(floppy_image_device::unload_cb(&wangpc_state::on_disk1_unload, this));
|
||||
|
||||
m_led_diagnostic.resolve();
|
||||
|
||||
// state saving
|
||||
save_item(NAME(m_dma_page));
|
||||
save_item(NAME(m_dack));
|
||||
|
@ -8,14 +8,21 @@ public:
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_charram(*this, "charram") { }
|
||||
m_charram(*this, "charram"),
|
||||
m_leds(*this, "led%u", 0U) { }
|
||||
|
||||
void usg32(machine_config &config);
|
||||
void usg185(machine_config &config);
|
||||
|
||||
private:
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
|
||||
required_shared_ptr<uint8_t> m_videoram;
|
||||
required_shared_ptr<uint8_t> m_charram;
|
||||
|
||||
output_finder<5> m_leds;
|
||||
|
||||
tilemap_t *m_tilemap;
|
||||
|
||||
DECLARE_WRITE8_MEMBER(rombank_w);
|
||||
@ -31,8 +38,6 @@ public:
|
||||
DECLARE_PALETTE_INIT(usgames);
|
||||
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void usg32(machine_config &config);
|
||||
void usg185(machine_config &config);
|
||||
void usg185_map(address_map &map);
|
||||
void usgames_map(address_map &map);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user