1 // license:BSD-3-Clause 2 // copyright-holders:Wilbert Pol, Curt Coder 3 #ifndef MAME_INCLUDES_MPF1_H 4 #define MAME_INCLUDES_MPF1_H 5 6 #pragma once 7 8 9 #include "machine/spchrom.h" 10 #include "cpu/z80/z80.h" 11 #include "machine/z80daisy.h" 12 #include "imagedev/cassette.h" 13 #include "machine/i8255.h" 14 #include "machine/timer.h" 15 #include "machine/z80ctc.h" 16 #include "machine/z80pio.h" 17 #include "sound/spkrdev.h" 18 #include "sound/tms5220.h" 19 20 #define Z80_TAG "u1" 21 #define Z80CTC_TAG "u11" 22 #define Z80PIO_TAG "u10" 23 #define I8255A_TAG "u14" 24 #define TMS5220_TAG "tms5220" 25 26 class mpf1_state : public driver_device 27 { 28 public: mpf1_state(const machine_config & mconfig,device_type type,const char * tag)29 mpf1_state(const machine_config &mconfig, device_type type, const char *tag) 30 : driver_device(mconfig, type, tag), 31 m_maincpu(*this, Z80_TAG), 32 m_ctc(*this, Z80CTC_TAG), 33 m_speaker(*this, "speaker"), 34 m_cassette(*this, "cassette"), 35 m_pc(*this, "PC%u", 0U), 36 m_special(*this, "SPECIAL"), 37 m_digits(*this, "digit%u", 0U), 38 m_leds(*this, "led%u", 0U) 39 { } 40 41 void mpf1p(machine_config &config); 42 void mpf1b(machine_config &config); 43 void mpf1(machine_config &config); 44 45 void init_mpf1(); 46 47 DECLARE_INPUT_CHANGED_MEMBER( trigger_nmi ); 48 DECLARE_INPUT_CHANGED_MEMBER( trigger_irq ); 49 DECLARE_INPUT_CHANGED_MEMBER( trigger_res ); 50 51 private: 52 required_device<z80_device> m_maincpu; 53 required_device<z80ctc_device> m_ctc; 54 required_device<speaker_sound_device> m_speaker; 55 required_device<cassette_image_device> m_cassette; 56 required_ioport_array<6> m_pc; 57 required_ioport m_special; 58 output_finder<6> m_digits; 59 output_finder<2> m_leds; 60 61 virtual void machine_start() override; 62 virtual void machine_reset() override; 63 64 uint8_t step_r(offs_t offset); 65 uint8_t ppi_pa_r(); 66 void ppi_pb_w(uint8_t data); 67 void ppi_pc_w(uint8_t data); 68 69 int m_break; 70 int m_m1; 71 72 uint8_t m_lednum; 73 74 emu_timer *m_led_refresh_timer; 75 address_space *m_program; 76 77 TIMER_CALLBACK_MEMBER(led_refresh); 78 TIMER_DEVICE_CALLBACK_MEMBER(check_halt_callback); 79 void mpf1_io_map(address_map &map); 80 void mpf1_map(address_map &map); 81 void mpf1_step(address_map &map); 82 void mpf1b_io_map(address_map &map); 83 void mpf1b_map(address_map &map); 84 void mpf1p_io_map(address_map &map); 85 void mpf1p_map(address_map &map); 86 }; 87 88 #endif // MAME_INCLUDES_MPF1_H 89