1 // license:BSD-3-Clause 2 // copyright-holders:Curt Coder 3 /********************************************************************** 4 5 Hitachi HD61830 LCD Timing Controller emulation 6 7 **********************************************************************/ 8 9 #ifndef MAME_VIDEO_HD61830_H 10 #define MAME_VIDEO_HD61830_H 11 12 #pragma once 13 14 15 //************************************************************************** 16 // TYPE DEFINITIONS 17 //************************************************************************** 18 19 // ======================> hd61830_device 20 21 class hd61830_device : public device_t, 22 public device_memory_interface, 23 public device_video_interface 24 { 25 public: 26 // construction/destruction 27 hd61830_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 28 rd_rd_callback()29 auto rd_rd_callback() { return m_read_rd.bind(); } 30 31 uint8_t status_r(); 32 void control_w(uint8_t data); 33 34 uint8_t data_r(); 35 void data_w(uint8_t data); 36 37 uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 38 39 protected: 40 // device-level overrides 41 virtual const tiny_rom_entry *device_rom_region() const override; 42 virtual void device_start() override; 43 virtual void device_reset() override; 44 virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; 45 46 // device_memory_interface overrides 47 virtual space_config_vector memory_space_config() const override; 48 readbyte(offs_t address)49 uint8_t readbyte(offs_t address) { return space().read_byte(address); } writebyte(offs_t address,uint8_t data)50 void writebyte(offs_t address, uint8_t data) { space().write_byte(address, data); } 51 52 private: 53 enum 54 { 55 INSTRUCTION_MODE_CONTROL = 0, 56 INSTRUCTION_CHARACTER_PITCH, 57 INSTRUCTION_NUMBER_OF_CHARACTERS, 58 INSTRUCTION_NUMBER_OF_TIME_DIVISIONS, 59 INSTRUCTION_CURSOR_POSITION, 60 INSTRUCTION_DISPLAY_START_LOW = 8, 61 INSTRUCTION_DISPLAY_START_HIGH, 62 INSTRUCTION_CURSOR_ADDRESS_LOW, 63 INSTRUCTION_CURSOR_ADDRESS_HIGH, 64 INSTRUCTION_DISPLAY_DATA_WRITE, 65 INSTRUCTION_DISPLAY_DATA_READ, 66 INSTRUCTION_CLEAR_BIT, 67 INSTRUCTION_SET_BIT 68 }; 69 70 void set_busy_flag(); 71 72 uint16_t draw_scanline(bitmap_ind16 &bitmap, const rectangle &cliprect, int y, uint16_t ra); 73 void update_graphics(bitmap_ind16 &bitmap, const rectangle &cliprect); 74 void draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect, uint16_t ma, int x, int y, uint8_t md); 75 void update_text(bitmap_ind16 &bitmap, const rectangle &cliprect); 76 77 void hd61830(address_map &map); 78 79 devcb_read8 m_read_rd; 80 81 emu_timer *m_busy_timer; 82 //address_space *m_data; 83 84 bool m_bf; // busy flag 85 86 uint8_t m_ir; // instruction register 87 uint8_t m_mcr; // mode control register 88 uint8_t m_dor; // data output register 89 90 uint16_t m_dsa; // display start address 91 uint16_t m_cac; // cursor address counter 92 93 int m_vp; // vertical character pitch 94 int m_hp; // horizontal character pitch 95 int m_hn; // horizontal number of characters 96 int m_nx; // number of time divisions 97 int m_cp; // cursor position 98 99 int m_blink; // blink counter 100 int m_cursor; // cursor visible 101 102 // address space configurations 103 const address_space_config m_space_config; 104 105 required_region_ptr<uint8_t> m_char_rom; 106 }; 107 108 109 // device type definition 110 DECLARE_DEVICE_TYPE(HD61830, hd61830_device) 111 DECLARE_DEVICE_TYPE(HD61830B, hd61830_device) 112 113 #endif // MAME_VIDEO_HD61830_H 114