1 // license:BSD-3-Clause 2 // copyright-holders:Martin Buchholz 3 // thanks-to:James Wallace, Martin Buchholz, Juergen Oppermann, Volker Hann, Jan-Ole Christian 4 #ifndef MAME_INCLUDES_POLYPLAY_H 5 #define MAME_INCLUDES_POLYPLAY_H 6 7 #include "cpu/z80/z80.h" 8 #include "machine/z80ctc.h" 9 #include "machine/z80pio.h" 10 #include "machine/z80sio.h" 11 #include "sound/spkrdev.h" 12 #include "emupal.h" 13 14 #define POLYPLAY_MAIN_CLOCK XTAL(9'830'400) 15 16 #define Z80CPU_TAG "maincpu" 17 #define Z80CTC_TAG "z80ctc" 18 #define Z80PIO_TAG "z80pio" 19 #define Z80SIO_TAG "z80sio" 20 21 class polyplay_state : public driver_device 22 { 23 public: polyplay_state(const machine_config & mconfig,device_type type,const char * tag)24 polyplay_state(const machine_config &mconfig, device_type type, const char *tag) : 25 driver_device(mconfig, type, tag), 26 m_videoram(*this, "videoram"), 27 m_characterram(*this, "characterram"), 28 m_maincpu(*this, Z80CPU_TAG), 29 m_z80ctc(*this, Z80CTC_TAG), 30 m_z80pio(*this, Z80PIO_TAG), 31 m_z80sio(*this, Z80SIO_TAG), 32 m_in0_port(*this, "IN0"), 33 m_gfxdecode(*this, "gfxdecode"), 34 m_palette(*this, "palette"), 35 m_speaker1(*this, "speaker1"), 36 m_speaker2(*this, "speaker2"), 37 m_lamps(*this, "lamp%u", 1U) 38 { } 39 40 void polyplay_zre(machine_config &config); 41 void polyplay_zrepp(machine_config &config); 42 43 DECLARE_INPUT_CHANGED_MEMBER(input_changed); 44 45 protected: machine_start()46 virtual void machine_start() override { m_lamps.resolve(); } 47 virtual void video_start() override; 48 49 private: 50 INTERRUPT_GEN_MEMBER(nmi_handler); 51 52 /* devices */ 53 DECLARE_WRITE_LINE_MEMBER(ctc_zc0_w); 54 DECLARE_WRITE_LINE_MEMBER(ctc_zc1_w); 55 DECLARE_WRITE_LINE_MEMBER(ctc_zc2_w); 56 57 uint8_t pio_porta_r(); 58 void pio_porta_w(uint8_t data); 59 uint8_t pio_portb_r(); 60 void pio_portb_w(uint8_t data); 61 62 void polyplay_characterram_w(offs_t offset, uint8_t data); 63 void polyplay_palette(palette_device &palette) const; 64 uint32_t screen_update_polyplay(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 65 void polyplay_io_zre(address_map &map); 66 void polyplay_io_zrepp(address_map &map); 67 void polyplay_mem_zre(address_map &map); 68 void polyplay_mem_zrepp(address_map &map); 69 70 required_shared_ptr<uint8_t> m_videoram; 71 required_shared_ptr<uint8_t> m_characterram; 72 73 required_device<z80_device> m_maincpu; 74 required_device<z80ctc_device> m_z80ctc; 75 required_device<z80pio_device> m_z80pio; 76 optional_device<z80sio_device> m_z80sio; 77 required_ioport m_in0_port; 78 required_device<gfxdecode_device> m_gfxdecode; 79 required_device<palette_device> m_palette; 80 81 /* audio */ 82 uint8_t m_flipflop1; 83 uint8_t m_flipflop2; 84 required_device<speaker_sound_device> m_speaker1; 85 required_device<speaker_sound_device> m_speaker2; 86 output_finder<4> m_lamps; 87 }; 88 89 #endif // MAME_INCLUDES_POLYPLAY_H 90