1 // license:BSD-3-Clause 2 // copyright-holders:Nathan Woods 3 /*************************************************************************** 4 5 dragon.h 6 7 Dragon Family 8 9 ***************************************************************************/ 10 11 #ifndef MAME_INCLUDES_DRAGON_H 12 #define MAME_INCLUDES_DRAGON_H 13 14 #pragma once 15 16 17 #include "includes/coco12.h" 18 #include "imagedev/printer.h" 19 #include "machine/mos6551.h" 20 #include "video/mc6845.h" 21 #include "emupal.h" 22 23 24 //************************************************************************** 25 // MACROS / CONSTANTS 26 //************************************************************************** 27 28 #define PRINTER_TAG "printer" 29 #define ACIA_TAG "acia" 30 31 32 33 //************************************************************************** 34 // TYPE DEFINITIONS 35 //************************************************************************** 36 37 class dragon_state : public coco12_state 38 { 39 public: dragon_state(const machine_config & mconfig,device_type type,const char * tag)40 dragon_state(const machine_config &mconfig, device_type type, const char *tag) 41 : coco12_state(mconfig, type, tag) 42 , m_printer(*this, PRINTER_TAG) 43 { 44 } 45 46 void dragon_base(machine_config &config); 47 void dragon32(machine_config &config); 48 void dragon_mem(address_map &map); 49 protected: 50 virtual void pia1_pa_changed(uint8_t data) override; 51 52 private: 53 required_device<printer_image_device> m_printer; 54 }; 55 56 57 // dragon64 has an ACIA chip 58 class dragon64_state : public dragon_state 59 { 60 public: dragon64_state(const machine_config & mconfig,device_type type,const char * tag)61 dragon64_state(const machine_config &mconfig, device_type type, const char *tag) 62 : dragon_state(mconfig, type, tag) 63 , m_acia(*this, ACIA_TAG) 64 , m_rombank(*this, "rombank%u", 0U) 65 { 66 } 67 68 void tanodr64(machine_config &config); 69 void dragon64(machine_config &config); 70 void tanodr64h(machine_config &config); 71 void dragon64h(machine_config &config); 72 DECLARE_WRITE_LINE_MEMBER( acia_irq ); 73 protected: 74 void d64_rom0(address_map &map); 75 void d64_rom1(address_map &map); 76 void d64_io0(address_map &map); 77 78 virtual void device_start() override; 79 virtual void device_reset() override; 80 virtual void pia1_pb_changed(uint8_t data) override; 81 void page_rom(bool romswitch); 82 83 private: 84 required_device<mos6551_device> m_acia; 85 required_memory_bank_array<2> m_rombank; 86 }; 87 88 89 // dragon200e has a character generator 90 class dragon200e_state : public dragon64_state 91 { 92 public: dragon200e_state(const machine_config & mconfig,device_type type,const char * tag)93 dragon200e_state(const machine_config &mconfig, device_type type, const char *tag) 94 : dragon64_state(mconfig, type, tag) 95 , m_char_rom(*this, "chargen") 96 , m_lk1(*this, "LK1") 97 { 98 } 99 100 uint8_t sam_read(offs_t offset); 101 MC6847_GET_CHARROM_MEMBER(char_rom_r); 102 103 void dragon200e(machine_config &config); 104 private: 105 required_memory_region m_char_rom; 106 required_ioport m_lk1; 107 }; 108 109 110 // d64plus has a HD6845 and character generator 111 class d64plus_state : public dragon64_state 112 { 113 public: d64plus_state(const machine_config & mconfig,device_type type,const char * tag)114 d64plus_state(const machine_config &mconfig, device_type type, const char *tag) 115 : dragon64_state(mconfig, type, tag) 116 , m_crtc(*this, "crtc") 117 , m_palette(*this, "palette") 118 , m_plus_ram(*this, "plus_ram") 119 , m_video_ram(*this, "video_ram") 120 , m_char_rom(*this, "chargen") 121 { 122 } 123 124 uint8_t d64plus_6845_disp_r(); 125 void d64plus_bank_w(uint8_t data); 126 MC6845_UPDATE_ROW(crtc_update_row); 127 128 void d64plus(machine_config &config); 129 protected: 130 virtual void device_start() override; 131 virtual void device_reset() override; 132 133 private: 134 required_device<hd6845s_device> m_crtc; 135 required_device<palette_device> m_palette; 136 optional_shared_ptr<uint8_t> m_plus_ram; 137 optional_shared_ptr<uint8_t> m_video_ram; 138 required_memory_region m_char_rom; 139 }; 140 141 #endif // MAME_INCLUDES_DRAGON_H 142