1 // license:BSD-3-Clause 2 // copyright-holders:Curt Coder 3 /********************************************************************** 4 5 RCA CDP1861 Video Display Controller emulation 6 7 ********************************************************************** 8 _____ _____ 9 _CLK 1 |* \_/ | 24 Vdd 10 _DMAO 2 | | 23 _CLEAR 11 _INT 3 | | 22 SC1 12 TPA 4 | | 21 SC0 13 TPB 5 | | 20 DI7 14 _COMP SYNC 6 | CDP1861 | 19 DI6 15 VIDEO 7 | | 18 DI5 16 _RESET 8 | | 17 DI4 17 _EFX 9 | | 16 DI3 18 DISP ON 10 | | 15 DI2 19 DISP OFF 11 | | 14 DI1 20 Vss 12 |_____________| 13 DI0 21 22 **********************************************************************/ 23 24 #ifndef MAME_VIDEO_CDP1861_H 25 #define MAME_VIDEO_CDP1861_H 26 27 #pragma once 28 29 30 //************************************************************************** 31 // TYPE DEFINITIONS 32 //************************************************************************** 33 34 // ======================> cdp1861_device 35 36 class cdp1861_device : public device_t, 37 public device_video_interface 38 { 39 public: 40 static constexpr unsigned VISIBLE_COLUMNS = 64; 41 static constexpr unsigned VISIBLE_LINES = 128; 42 43 static constexpr unsigned HBLANK_START = 14 * 8; 44 static constexpr unsigned HBLANK_END = 12; 45 static constexpr unsigned HSYNC_START = 0; 46 static constexpr unsigned HSYNC_END = 12; 47 static constexpr unsigned SCREEN_WIDTH = 14 * 8; 48 49 static constexpr unsigned TOTAL_SCANLINES = 262; 50 51 static constexpr unsigned SCANLINE_DISPLAY_START = 80; 52 static constexpr unsigned SCANLINE_DISPLAY_END = 208; 53 static constexpr unsigned SCANLINE_VBLANK_START = 262; 54 static constexpr unsigned SCANLINE_VBLANK_END = 16; 55 static constexpr unsigned SCANLINE_VSYNC_START = 16; 56 static constexpr unsigned SCANLINE_VSYNC_END = 0; 57 static constexpr unsigned SCANLINE_INT_START = SCANLINE_DISPLAY_START - 2; 58 static constexpr unsigned SCANLINE_INT_END = SCANLINE_DISPLAY_START; 59 static constexpr unsigned SCANLINE_EFX_TOP_START = SCANLINE_DISPLAY_START - 4; 60 static constexpr unsigned SCANLINE_EFX_TOP_END = SCANLINE_DISPLAY_START; 61 static constexpr unsigned SCANLINE_EFX_BOTTOM_START = SCANLINE_DISPLAY_END - 4; 62 static constexpr unsigned SCANLINE_EFX_BOTTOM_END = SCANLINE_DISPLAY_END; 63 64 // construction/destruction 65 cdp1861_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 66 int_cb()67 auto int_cb() { return m_write_int.bind(); } dma_out_cb()68 auto dma_out_cb() { return m_write_dma_out.bind(); } efx_cb()69 auto efx_cb() { return m_write_efx.bind(); } 70 71 void dma_w(uint8_t data); 72 void disp_on_w(int state); 73 void disp_off_w(int state); 74 75 uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 76 77 bitmap_rgb32 m_bitmap; 78 79 protected: 80 // device-level overrides 81 virtual void device_config_complete() override; 82 virtual void device_start() override; 83 virtual void device_reset() override; 84 virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; 85 86 private: 87 enum 88 { 89 TIMER_INT, 90 TIMER_EFX, 91 TIMER_DMA 92 }; 93 94 devcb_write_line m_write_int; 95 devcb_write_line m_write_dma_out; 96 devcb_write_line m_write_efx; 97 98 int m_disp; // display enabled 99 int m_dispon; // display on latch 100 int m_dispoff; // display off latch 101 int m_dmaout; // DMA request active 102 103 // timers 104 emu_timer *m_int_timer; // interrupt timer 105 emu_timer *m_efx_timer; // EFx timer 106 emu_timer *m_dma_timer; // DMA timer 107 }; 108 109 110 // device type definition 111 DECLARE_DEVICE_TYPE(CDP1861, cdp1861_device) 112 113 #endif // MAME_VIDEO_CDP1861_H 114