1 // license:BSD-3-Clause 2 // copyright-holders:Curt Coder 3 /********************************************************************** 4 5 uPD7227 Intelligent Dot-Matrix LCD Controller/Driver emulation 6 7 **********************************************************************/ 8 9 #ifndef MAME_VIDEO_UPD7227_H 10 #define MAME_VIDEO_UPD7227_H 11 12 #pragma once 13 14 15 16 ///************************************************************************* 17 // TYPE DEFINITIONS 18 ///************************************************************************* 19 20 // ======================> upd7227_device 21 22 class upd7227_device : public device_t, public device_memory_interface 23 { 24 public: 25 // construction/destruction 26 upd7227_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); upd7227_device(const machine_config & mconfig,const char * tag,device_t * owner,int sx,int sy)27 upd7227_device(const machine_config &mconfig, const char *tag, device_t *owner, int sx, int sy) : upd7227_device(mconfig, tag, owner, 0) 28 { set_offsets(sx, sy); } 29 30 // inline configuration helpers set_offsets(int sx,int sy)31 void set_offsets(int sx, int sy) { m_sx = sx; m_sy = sy; } 32 33 DECLARE_WRITE_LINE_MEMBER( cs_w ); 34 DECLARE_WRITE_LINE_MEMBER( cd_w ); 35 DECLARE_WRITE_LINE_MEMBER( sck_w ); 36 DECLARE_WRITE_LINE_MEMBER( si_w ); 37 DECLARE_READ_LINE_MEMBER( so_r ); 38 39 uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 40 41 protected: 42 // device-level overrides 43 virtual void device_start() override; 44 virtual void device_reset() override; 45 46 // device_memory_interface overrides 47 virtual space_config_vector memory_space_config() const override; 48 49 address_space_config m_space_config; 50 51 private: 52 enum 53 { 54 CMD_SMM = 0x18, 55 CMD_SFF = 0x10, 56 CMD_LDPI = 0x80, 57 CMD_SWM = 0x64, 58 CMD_SRM = 0x60, 59 CMD_SANDM = 0x6c, 60 CMD_SORM = 0x68, 61 CMD_SCM = 0x72, 62 CMD_BSET = 0x40, 63 CMD_BRESET = 0x20, 64 CMD_DISP_ON = 0x09, 65 CMD_DISP_OFF = 0x08 66 }; 67 68 int m_sx; 69 int m_sy; 70 71 int m_cs; 72 int m_cd; 73 int m_sck; 74 int m_si; 75 int m_so; 76 77 void upd7227_map(address_map &map); 78 }; 79 80 81 // device type definition 82 DECLARE_DEVICE_TYPE(UPD7227, upd7227_device) 83 84 #endif // MAME_VIDEO_UPD7227_H 85