1 // license:BSD-3-Clause 2 // copyright-holders:hap 3 /* 4 5 Sharp SM5xx family handhelds. 6 7 */ 8 9 #ifndef MAME_INCLUDES_HH_SM510_H 10 #define MAME_INCLUDES_HH_SM510_H 11 12 #include "cpu/sm510/sm510.h" 13 #include "sound/spkrdev.h" 14 15 16 class hh_sm510_state : public driver_device 17 { 18 public: hh_sm510_state(const machine_config & mconfig,device_type type,const char * tag)19 hh_sm510_state(const machine_config &mconfig, device_type type, const char *tag) : 20 driver_device(mconfig, type, tag), 21 m_maincpu(*this, "maincpu"), 22 m_speaker(*this, "speaker"), 23 m_inputs(*this, "IN.%u", 0), 24 m_io_ba(*this, "BA"), 25 m_io_b(*this, "B"), 26 m_out_x(*this, "%u.%u.%u", 0U, 0U, 0U), 27 m_inp_lines(0), 28 m_inp_fixed(-1), 29 m_decay_pivot(8), 30 m_decay_len(17) 31 { } 32 33 virtual DECLARE_INPUT_CHANGED_MEMBER(input_changed); 34 virtual DECLARE_INPUT_CHANGED_MEMBER(acl_button); 35 36 protected: 37 // devices 38 required_device<sm510_base_device> m_maincpu; 39 optional_device<speaker_sound_device> m_speaker; 40 optional_ioport_array<8+1> m_inputs; // max 8 41 optional_ioport m_io_ba, m_io_b; 42 output_finder<16, 16, 4> m_out_x; 43 44 // misc common 45 u16 m_inp_mux; // multiplexed inputs mask 46 int m_inp_lines; // number of input mux columns 47 int m_inp_fixed; // input column fixed to GND/Vdd (-1 means none) 48 u8 m_speaker_data; // speaker output data(if more than 1 bit) 49 u8 m_s; // MCU S output pins 50 u8 m_r; // MCU R output pins 51 inp_fixed_last()52 void inp_fixed_last() { m_inp_fixed = -2; } // last input line to GND 53 u8 read_inputs(int columns, int fixed = -1); 54 55 virtual void update_k_line(); 56 virtual void sm510_lcd_segment_w(offs_t offset, u16 data); 57 virtual void sm500_lcd_segment_w(offs_t offset, u16 data); 58 virtual u8 input_r(); 59 virtual void input_w(u8 data); 60 virtual void piezo_r1_w(u8 data); 61 virtual void piezo_r2_w(u8 data); 62 virtual void piezo_input_w(u8 data); 63 virtual void piezo2bit_r1_w(u8 data); 64 virtual void piezo2bit_input_w(u8 data); 65 66 // display common 67 int m_decay_pivot; // lcd segment off-to-on delay in 1kHz ticks (affects input lag) 68 int m_decay_len; // lcd segment on-to-off delay in 1kHz ticks (lcd persistence) 69 u8 m_display_x_len; // lcd number of groups 70 u8 m_display_y_len; // lcd number of segments 71 u8 m_display_z_len; // lcd number of commons 72 u32 m_display_state[0x20]; // lcd segment data (max. 5-bit offset) 73 u8 m_display_decay[0x20][0x20]; // (internal use) 74 75 void set_display_size(u8 x, u8 y, u8 z); 76 TIMER_CALLBACK_MEMBER(display_decay_tick); 77 emu_timer *m_display_decay_timer; 78 79 virtual void machine_start() override; 80 virtual void machine_reset() override; 81 82 // machine configs 83 void mcfg_cpu_common(machine_config &config); 84 void mcfg_cpu_sm5a(machine_config &config); 85 void mcfg_cpu_kb1013vk12(machine_config &config); 86 void mcfg_cpu_sm510(machine_config &config); 87 void mcfg_cpu_sm511(machine_config &config); 88 void mcfg_cpu_sm512(machine_config &config); 89 void mcfg_svg_screen(machine_config &config, u16 width, u16 height, const char *tag = "screen"); 90 void mcfg_sound_r1(machine_config &config); 91 92 void sm5a_common(machine_config &config, u16 width, u16 height); 93 void kb1013vk12_common(machine_config &config, u16 width, u16 height); 94 void sm510_common(machine_config &config, u16 width, u16 height); 95 void sm511_common(machine_config &config, u16 width, u16 height); 96 //void sm512_common(machine_config &config, u16 width, u16 height); 97 98 void sm510_dualh(machine_config &config, u16 leftwidth, u16 leftheight, u16 rightwidth, u16 rightheight); 99 void dualv_common(machine_config &config, u16 topwidth, u16 topheight, u16 botwidth, u16 botheight); 100 void sm510_dualv(machine_config &config, u16 topwidth, u16 topheight, u16 botwidth, u16 botheight); 101 void sm511_dualv(machine_config &config, u16 topwidth, u16 topheight, u16 botwidth, u16 botheight); 102 void sm512_dualv(machine_config &config, u16 topwidth, u16 topheight, u16 botwidth, u16 botheight); 103 void sm510_tiger(machine_config &config, u16 width, u16 height); 104 void sm511_tiger1bit(machine_config &config, u16 width, u16 height); 105 void sm511_tiger2bit(machine_config &config, u16 width, u16 height); 106 }; 107 108 109 #endif // MAME_INCLUDES_HH_SM510_H 110