1 // license:BSD-3-Clause 2 // copyright-holders:Aaron Giles 3 /*************************************************************************** 4 5 Sega 16-bit common hardware 6 7 ***************************************************************************/ 8 9 #ifndef MAME_MACHINE_SEGAIC16_H 10 #define MAME_MACHINE_SEGAIC16_H 11 12 #pragma once 13 14 15 //************************************************************************** 16 // TYPE DEFINITIONS 17 //************************************************************************** 18 19 20 // ======================> sega_315_5248_multiplier_device 21 22 class sega_315_5248_multiplier_device : public device_t 23 { 24 public: 25 // construction/destruction 26 sega_315_5248_multiplier_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); 27 28 // public interface 29 u16 read(offs_t offset); 30 void write(offs_t offset, u16 data, u16 mem_mask = ~0); 31 32 protected: 33 // device-level overrides 34 virtual void device_start() override; 35 virtual void device_reset() override; 36 37 private: 38 // internal state 39 u16 m_regs[4]; 40 }; 41 42 43 // ======================> sega_315_5249_divider_device 44 45 class sega_315_5249_divider_device : public device_t 46 { 47 public: 48 // construction/destruction 49 sega_315_5249_divider_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); 50 51 // public interface 52 u16 read(offs_t offset); 53 void write(offs_t offset, u16 data, u16 mem_mask = ~0); 54 55 protected: 56 // device-level overrides 57 virtual void device_start() override; 58 virtual void device_reset() override; 59 60 private: 61 // internal helpers 62 void execute(int mode); 63 64 // internal state 65 u16 m_regs[8]; 66 }; 67 68 69 // ======================> sega_315_5250_compare_timer_device 70 71 class sega_315_5250_compare_timer_device : public device_t 72 { 73 public: 74 // construction/destruction 75 sega_315_5250_compare_timer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); 76 77 // configuration helpers m68kint_callback()78 auto m68kint_callback() { return m_68kint_callback.bind(); } zint_callback()79 auto zint_callback() { return m_zint_callback.bind(); } 80 81 // public interface 82 DECLARE_WRITE_LINE_MEMBER(exck_w); 83 u16 read(offs_t offset); 84 void write(offs_t offset, u16 data, u16 mem_mask = ~0); 85 u8 zread(); 86 87 protected: 88 // device-level overrides 89 virtual void device_start() override; 90 virtual void device_reset() override; 91 92 private: 93 // internal helpers 94 void execute(bool update_history = false); 95 void interrupt_ack(); 96 TIMER_CALLBACK_MEMBER(write_to_sound); 97 98 // configuration 99 devcb_write_line m_68kint_callback; 100 devcb_write_line m_zint_callback; 101 102 // internal state 103 u16 m_regs[16]; 104 u16 m_counter; 105 u8 m_bit; 106 bool m_exck; 107 }; 108 109 110 // device type definition 111 DECLARE_DEVICE_TYPE(SEGA_315_5248_MULTIPLIER, sega_315_5248_multiplier_device) 112 DECLARE_DEVICE_TYPE(SEGA_315_5249_DIVIDER, sega_315_5249_divider_device) 113 DECLARE_DEVICE_TYPE(SEGA_315_5250_COMPARE_TIMER, sega_315_5250_compare_timer_device) 114 115 116 #endif // MAME_MACHINE_SEGAIC16_H 117