1 // license:BSD-3-Clause 2 // copyright-holders:AJR 3 /********************************************************************** 4 5 National Semiconductor DP8350 Series CRT Controllers 6 7 *********************************************************************** 8 _____ _____ 9 RSB 1 |* \__/ | 40 Vcc 10 VBLANK 2 | | 39 RSA 11 50/60 HZ 3 | | 38 RL 12 VSYNC 4 | | 37 RAE 13 FULL/HALF 5 | | 36 A0 14 LC3 6 | | 35 A1 15 LC2 7 | | 34 A2 16 LC1 8 | | 33 A3 17 LC0 9 | | 32 A4 18 CLC 10 | | 31 A5 19 CGP 11 | DP835X | 30 A6 20 LBRE 12 | | 29 A7 21 LRC 13 | | 28 A8 22 HSYNC 14 | | 27 A9 23 RESET 15 | | 26 A10 24 LBC 16 | | 25 A11 25 ECLC 17 | | 24 LCGA 26 LVSR 18 | | 23 DRC 27 CUR 19 | | 22 X2 28 GND 20 |______________| 21 X1 29 30 **********************************************************************/ 31 32 #ifndef MAME_VIDEO_DP8350_H 33 #define MAME_VIDEO_DP8350_H 34 35 #pragma once 36 37 //************************************************************************** 38 // TYPE DEFINITIONS 39 //************************************************************************** 40 41 // ======================> dp835x_device 42 43 class dp835x_device : public device_t, public device_video_interface 44 { 45 public: 46 // device configuration lrc_callback()47 auto lrc_callback() { return m_lrc_callback.bind(); } clc_callback()48 auto clc_callback() { return m_clc_callback.bind(); } lc_callback()49 auto lc_callback() { return m_lc_callback.bind(); } lbre_callback()50 auto lbre_callback() { return m_lbre_callback.bind(); } hsync_callback()51 auto hsync_callback() { return m_hsync_callback.bind(); } vsync_callback()52 auto vsync_callback() { return m_vsync_callback.bind(); } vblank_callback()53 auto vblank_callback() { return m_vblank_callback.bind(); } set_half_shift(bool half_shift)54 void set_half_shift(bool half_shift) { m_half_shift = half_shift; } 55 56 // write handlers 57 DECLARE_WRITE_LINE_MEMBER(refresh_control); 58 DECLARE_WRITE_LINE_MEMBER(character_generator_program); 59 void register_load(u8 rs, u16 addr); 60 61 // read handlers 62 DECLARE_READ_LINE_MEMBER(lrc_r); lc_r()63 u8 lc_r() { return m_lc; } 64 DECLARE_READ_LINE_MEMBER(lbre_r); 65 DECLARE_READ_LINE_MEMBER(hsync_r); 66 DECLARE_READ_LINE_MEMBER(vsync_r); 67 DECLARE_READ_LINE_MEMBER(vblank_r); 68 69 // address getters (TODO: accurate character-by-character emulation) top_of_page()70 u16 top_of_page() const { return m_topr; } row_start()71 u16 row_start() const { return m_row_start; } cursor_address()72 u16 cursor_address() const { return m_cr; } 73 74 protected: 75 // base type constructor 76 dp835x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, 77 int char_width, int char_height, int chars_per_row, int rows_per_frame, 78 int vsync_delay_f1, int vsync_width_f1, int vblank_interval_f1, 79 int vsync_delay_f0, int vsync_width_f0, int vblank_interval_f0, 80 int chars_per_line, int hsync_delay, int hsync_width, int vblank_stop, 81 bool cursor_on_all_lines, int lbc_0_width, int hsync_serration, 82 bool hsync_active, bool vsync_active, bool vblank_active); 83 84 // device-specific overrides 85 virtual void device_config_complete() override; 86 virtual void device_resolve_objects() override; 87 virtual void device_start() override; 88 virtual void device_clock_changed() override; 89 virtual void device_reset() override; 90 91 private: 92 // internal helpers 93 void reconfigure_screen(); 94 95 // timer callbacks 96 TIMER_CALLBACK_MEMBER(hblank_start); 97 TIMER_CALLBACK_MEMBER(hblank_near_end); 98 TIMER_CALLBACK_MEMBER(hsync_update); 99 100 // mask parameters 101 const int m_char_width; // character field cell size (width in dots) 102 const int m_char_height; // character field cell size (height in scan lines) 103 const int m_chars_per_row; // video characters per row 104 const int m_rows_per_frame; // video characters per frame 105 const int m_vsync_delay[2]; // delay from VBLANK start to VSYNC in scan lines 106 const int m_vsync_width[2]; // vertical sync width in scan lines 107 const int m_vblank_interval[2]; // scan lines of vertical blanking 108 const int m_chars_per_line; // character times per scan line 109 const int m_hsync_delay; // delay from HBLANK start to HSYNC in character times 110 const int m_hsync_width; // horizontal sync width in character times 111 const int m_vblank_stop; // VBLANK stop before video start in scan lines 112 const bool m_cursor_on_all_lines; // true if cursor active on all scan lines of row 113 const int m_lbc_0_width; // width of LBC 0 output within character time 114 const int m_hsync_serration; // width of HSYNC pulse serrations within VSYNC (0 if unused) 115 const bool m_hsync_active; // active level of horizontal sync pulse 116 const bool m_vsync_active; // active level of vertical sync pulse 117 const bool m_vblank_active; // active level of vertical blanking pulse 118 119 // derived parameters 120 const int m_dots_per_line; // number of dots per scan line 121 const int m_dots_per_row; // number of dots displayed in each scan line 122 const int m_video_scan_lines; // number of active scan lines between VBLANK periods 123 124 // misc. configuration 125 bool m_half_shift; // adjust screen parameters to allow half-dot shifting 126 127 // device callbacks 128 devcb_write_line m_lrc_callback; // line rate clock output (active high) 129 devcb_write_line m_clc_callback; // clear line counter output (active low during blanking) 130 devcb_write8 m_lc_callback; // line counter output 131 devcb_write_line m_lbre_callback; // line buffer recirculate enable output (active high) 132 devcb_write_line m_hsync_callback; // horizontal sync output (polarity may vary by type) 133 devcb_write_line m_vsync_callback; // vertical sync output (polarity may vary by type) 134 devcb_write_line m_vblank_callback; // vertical blanking output (polarity may vary by type) 135 136 // internal registers and control parameters 137 bool m_60hz_refresh; // refresh rate selector (true = f1, false = f0) 138 bool m_cgpi; // character generator program/address mode input 139 u16 m_topr; // top-of-page register 140 u16 m_rsr; // row start register (to be loaded during next row) 141 u16 m_cr; // cursor register 142 u16 m_row_start; // start of current row 143 u16 m_line; // current scan line (starting at HBLANK) 144 145 // output state 146 u8 m_lc; // 4-bit line counter 147 148 // timers 149 emu_timer *m_hblank_start_timer; 150 emu_timer *m_hblank_near_end_timer; 151 emu_timer *m_hsync_on_timer; 152 emu_timer *m_hsync_off_timer; 153 }; 154 155 // ======================> dp8350_device 156 157 class dp8350_device : public dp835x_device 158 { 159 public: 160 // device constructor 161 dp8350_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); 162 }; 163 164 // ======================> dp8367_device 165 166 class dp8367_device : public dp835x_device 167 { 168 public: 169 // device constructor 170 dp8367_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); 171 }; 172 173 // ======================> dp835x_a_device 174 175 class dp835x_a_device : public dp835x_device 176 { 177 public: 178 // device constructor 179 dp835x_a_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); 180 }; 181 182 // device type declarations 183 DECLARE_DEVICE_TYPE(DP8350, dp8350_device) 184 DECLARE_DEVICE_TYPE(DP8367, dp8367_device) 185 DECLARE_DEVICE_TYPE(DP835X_A, dp835x_a_device) 186 187 #endif // MAME_VIDEO_DP8350_H 188