1 // license:BSD-3-Clause 2 // copyright-holders:Curt Coder 3 4 #ifndef MAME_VIDEO_AMS40041_H 5 #define MAME_VIDEO_AMS40041_H 6 7 #pragma once 8 9 #include "video/mc6845.h" 10 11 12 //************************************************************************** 13 // TYPE DEFINITIONS 14 //************************************************************************** 15 16 // ======================> ams40041_device 17 18 class ams40041_device : public mc6845_device 19 { 20 public: 21 // device type constructor 22 ams40041_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 23 24 // screen update callback 25 uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 26 27 // memory handlers 28 uint8_t video_ram_r(offs_t offset); 29 void video_ram_w(offs_t offset, uint8_t data); 30 31 // I/O handlers 32 uint8_t vdu_r(offs_t offset); 33 void vdu_w(offs_t offset, uint8_t data); 34 35 protected: 36 // device-level overrides 37 virtual void device_start() override; 38 virtual void device_reset() override; 39 40 private: 41 // VDU helpers 42 static int get_display_mode(uint8_t mode); 43 offs_t get_char_rom_offset(); 44 int get_color(uint8_t data); 45 MC6845_UPDATE_ROW(draw_alpha); 46 MC6845_UPDATE_ROW(draw_graphics_1); 47 MC6845_UPDATE_ROW(draw_graphics_2); 48 MC6845_UPDATE_ROW(crtc_update_row); 49 50 std::unique_ptr<uint8_t[]> m_video_ram; 51 required_region_ptr<uint8_t> m_char_rom; 52 required_ioport m_lk; 53 54 // video state 55 int m_toggle; 56 int m_lpen; 57 int m_blink; 58 int m_cursor; 59 int m_blink_ctr; 60 uint8_t m_vdu_mode; 61 uint8_t m_vdu_color; 62 uint8_t m_vdu_plane; 63 uint8_t m_vdu_rdsel; 64 uint8_t m_vdu_border; 65 }; 66 67 // device type declaration 68 DECLARE_DEVICE_TYPE(AMS40041, ams40041_device) 69 70 #endif // MAME_VIDEO_AMS40041_H 71