1 // license:BSD-3-Clause 2 // copyright-holders:Robbbert,Nigel Barnes 3 // thanks-to:Andrew Trotman 4 /*************************************************************************** 5 6 Poly/Proteus (New Zealand) 7 8 10/07/2011 Skeleton driver. 9 10 http://www.cs.otago.ac.nz/homepages/andrew/poly/Poly.htm 11 12 Andrew has supplied the roms for -bios 1 13 14 It uses a 6809 for all main functions. There is a Z80 for CP/M, but all 15 of the roms are 6809 code. 16 17 The keyboard controller is one of those custom XR devices. 18 Will use the terminal keyboard instead. 19 20 With bios 1, after entering your userid and password, you get a black 21 screen. This is normal, because it joins to a network which isn't there. 22 23 ToDo: 24 - Almost Everything! 25 - Connect up the device ports & lines 26 - Find out about graphics mode and how it is selected 27 - Fix Keyboard so that the Enter key tells BASIC to do something 28 - Find out how to make 2nd teletext screen to display 29 - Banking 30 31 ****************************************************************************/ 32 33 #ifndef MAME_INCLUDES_POLY_H 34 #define MAME_INCLUDES_POLY_H 35 36 #pragma once 37 38 #include "cpu/m6809/m6809.h" 39 #include "imagedev/floppy.h" 40 #include "machine/6821pia.h" 41 #include "machine/6840ptm.h" 42 #include "machine/6850acia.h" 43 #include "machine/kr2376.h" 44 #include "machine/clock.h" 45 #include "machine/mc6854.h" 46 #include "machine/bankdev.h" 47 #include "machine/ram.h" 48 #include "machine/input_merger.h" 49 #include "machine/wd_fdc.h" 50 #include "machine/keyboard.h" 51 #include "sound/spkrdev.h" 52 #include "video/saa5050.h" 53 #include "screen.h" 54 #include "speaker.h" 55 56 //#include "bus/poly/network.h" 57 58 59 class poly_state : public driver_device 60 { 61 public: poly_state(const machine_config & mconfig,device_type type,const char * tag)62 poly_state(const machine_config &mconfig, device_type type, const char *tag) 63 : driver_device(mconfig, type, tag) 64 , m_maincpu(*this, "maincpu") 65 , m_bankdev(*this, "bankdev") 66 , m_ram(*this, RAM_TAG) 67 , m_trom(*this, "saa5050_%u", 1) 68 , m_pia(*this, "pia%u", 0) 69 , m_adlc(*this, "mc6854") 70 , m_ptm(*this, "ptm") 71 , m_irqs(*this, "irqs") 72 // , m_kr2376(*this, "kr2376") 73 , m_kbd(*this, "X%u", 0) 74 , m_modifiers(*this, "MODIFIERS") 75 , m_speaker(*this, "speaker") 76 , m_user(*this, "user") 77 , m_system(*this, "system") 78 , m_videoram(*this, "videoram") 79 , m_dat(*this, "dat") 80 , m_acia(*this, "acia") 81 , m_acia_clock(*this, "acia_clock") 82 { 83 } 84 imperfect_features()85 static constexpr feature_type imperfect_features() { return feature::KEYBOARD; } 86 87 void poly(machine_config &config); 88 void poly2(machine_config &config); 89 90 void init_poly(); 91 92 virtual void poly_bank(address_map &map); 93 94 private: 95 uint8_t logical_mem_r(offs_t offset); 96 void logical_mem_w(offs_t offset, uint8_t data); 97 uint8_t vector_r(offs_t offset); 98 void kbd_put(u8 data); // remove when KR2376 is implemented 99 DECLARE_READ_LINE_MEMBER( kbd_shift_r ); 100 DECLARE_READ_LINE_MEMBER( kbd_control_r ); 101 void pia0_pa_w(uint8_t data); 102 void pia0_pb_w(uint8_t data); 103 uint8_t pia1_b_in(); 104 uint8_t videoram_1_r(offs_t offset); 105 uint8_t videoram_2_r(offs_t offset); 106 DECLARE_WRITE_LINE_MEMBER( ptm_o2_callback ); 107 DECLARE_WRITE_LINE_MEMBER( ptm_o3_callback ); 108 void baud_rate_w(uint8_t data); 109 TIMER_CALLBACK_MEMBER( set_protect ); 110 void set_protect_w(uint8_t data); 111 uint8_t select_map_r(); 112 void select_map1_w(uint8_t data); 113 void select_map2_w(uint8_t data); 114 uint8_t network_r(offs_t offset); 115 void network_w(offs_t offset, uint8_t data); 116 DECLARE_WRITE_LINE_MEMBER( network_clk_w ); 117 118 uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); 119 120 void poly_mem(address_map &map); 121 122 virtual void machine_start() override; 123 virtual void machine_reset() override; 124 125 required_device<cpu_device> m_maincpu; 126 required_device<address_map_bank_device> m_bankdev; 127 required_device<ram_device> m_ram; 128 required_device_array<saa5050_device, 2> m_trom; 129 required_device_array<pia6821_device, 2> m_pia; 130 required_device<mc6854_device> m_adlc; 131 required_device<ptm6840_device> m_ptm; 132 required_device<input_merger_device> m_irqs; 133 //required_device<kr2376_device> m_kr2376; 134 required_ioport_array<8> m_kbd; 135 required_ioport m_modifiers; 136 required_device<speaker_sound_device> m_speaker; 137 required_memory_region m_user; 138 required_memory_region m_system; 139 required_shared_ptr<uint8_t> m_videoram; 140 required_shared_ptr<uint8_t> m_dat; 141 optional_device<acia6850_device> m_acia; 142 optional_device<clock_device> m_acia_clock; 143 uint8_t m_video_pa, m_video_pb; 144 uint8_t m_term_data; 145 146 inline offs_t physical(offs_t offset); 147 148 int m_dat_bank; 149 }; 150 151 152 class polydev_state : public poly_state 153 { 154 public: polydev_state(const machine_config & mconfig,device_type type,const char * tag)155 polydev_state(const machine_config &mconfig, device_type type, const char *tag) 156 : poly_state(mconfig, type, tag) 157 , m_fdc(*this, "fdc") 158 , m_floppy(*this, "fdc:%u", 0) 159 , m_current_floppy(nullptr) 160 { 161 } 162 imperfect_features()163 static constexpr feature_type imperfect_features() { return feature::KEYBOARD; } 164 165 void polydev(machine_config &config); 166 167 private: 168 void drive_register_w(uint8_t data); 169 uint8_t drive_register_r(); 170 DECLARE_WRITE_LINE_MEMBER(motor_w); 171 uint8_t fdc_inv_r(offs_t offset); 172 void fdc_inv_w(offs_t offset, uint8_t data); 173 174 175 virtual void poly_bank(address_map &map) override; 176 177 DECLARE_FLOPPY_FORMATS(floppy_formats); 178 179 required_device<fd1771_device> m_fdc; 180 required_device_array<floppy_connector, 2> m_floppy; 181 floppy_image_device *m_current_floppy; 182 }; 183 184 #endif // MAME_INCLUDES_POLY_H 185