1 // license:BSD-3-Clause 2 // copyright-holders:Miodrag Milanovic, AJR 3 /***************************************************************************** 4 * 5 * includes/pk8020.h 6 * 7 ****************************************************************************/ 8 #ifndef MAME_INCLUDES_PK8020_H 9 #define MAME_INCLUDES_PK8020_H 10 11 #pragma once 12 13 #include "bus/centronics/ctronics.h" 14 #include "imagedev/cassette.h" 15 #include "imagedev/floppy.h" 16 #include "machine/bankdev.h" 17 #include "machine/i8251.h" 18 #include "machine/pic8259.h" 19 #include "machine/pla.h" 20 #include "machine/ram.h" 21 #include "machine/wd_fdc.h" 22 #include "sound/spkrdev.h" 23 #include "emupal.h" 24 25 26 class pk8020_state : public driver_device 27 { 28 public: pk8020_state(const machine_config & mconfig,device_type type,const char * tag)29 pk8020_state(const machine_config &mconfig, device_type type, const char *tag) 30 : driver_device(mconfig, type, tag) 31 , m_maincpu(*this, "maincpu") 32 , m_decplm(*this, "decplm") 33 , m_devbank(*this, "devbank") 34 , m_ram(*this, RAM_TAG) 35 , m_ios(*this, "ios%u", 1U) 36 , m_fdc(*this, "fdc") 37 , m_floppy(*this, "fdc:%u", 0U) 38 , m_cass(*this, "cassette") 39 , m_inr(*this, "inr") 40 , m_speaker(*this, "speaker") 41 , m_printer(*this, "printer") 42 , m_region_maincpu(*this, "maincpu") 43 , m_region_gfx1(*this, "gfx1") 44 , m_io_port(*this, "LINE%u", 0U) 45 , m_palette(*this, "palette") 46 { } 47 48 void pk8020(machine_config &config); 49 50 protected: 51 virtual void machine_start() override; 52 virtual void machine_reset() override; 53 virtual void video_start() override; 54 55 private: 56 DECLARE_FLOPPY_FORMATS(floppy_formats); 57 58 uint8_t keyboard_r(offs_t offset); 59 void sysreg_w(offs_t offset, uint8_t data); 60 void color_w(uint8_t data); 61 void palette_w(uint8_t data); 62 void video_page_w(uint8_t data); 63 uint8_t text_r(offs_t offset); 64 void text_w(offs_t offset, uint8_t data); 65 uint8_t gzu_r(offs_t offset); 66 void gzu_w(offs_t offset, uint8_t data); 67 uint8_t devices_r(offs_t offset); 68 void devices_w(offs_t offset, uint8_t data); 69 uint8_t memory_r(offs_t offset); 70 void memory_w(offs_t offset, uint8_t data); 71 void pk8020_palette(palette_device &palette) const; 72 uint32_t screen_update_pk8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 73 INTERRUPT_GEN_MEMBER(pk8020_interrupt); 74 uint8_t ppi_porta_r(); 75 void floppy_control_w(uint8_t data); 76 void ppi_2_portc_w(uint8_t data); 77 DECLARE_WRITE_LINE_MEMBER(pit_out0); 78 79 static const char *plm_select_name(uint8_t data); 80 void log_bank_select(uint8_t bank, offs_t start, offs_t end, uint8_t rdecplm, uint8_t wdecplm); 81 82 void pk8020_io(address_map &map); 83 void pk8020_mem(address_map &map); 84 void devices_map(address_map &map); 85 86 uint8_t m_bank_select; 87 uint8_t m_color; 88 uint8_t m_video_page; 89 uint8_t m_wide; 90 uint8_t m_font; 91 uint8_t m_attr; 92 uint8_t m_text_attr; 93 uint8_t m_takt; 94 uint8_t m_video_page_access; 95 uint8_t m_sound_gate; 96 uint8_t m_sound_level; 97 98 required_device<cpu_device> m_maincpu; 99 required_device<pls100_device> m_decplm; 100 required_device<address_map_bank_device> m_devbank; 101 required_device<ram_device> m_ram; 102 required_device_array<i8251_device, 2> m_ios; 103 required_device<kr1818vg93_device> m_fdc; 104 required_device_array<floppy_connector, 4> m_floppy; 105 required_device<cassette_image_device> m_cass; 106 required_device<pic8259_device> m_inr; 107 required_device<speaker_sound_device> m_speaker; 108 required_device<centronics_device> m_printer; 109 required_memory_region m_region_maincpu; 110 required_region_ptr<uint8_t> m_region_gfx1; 111 required_ioport_array<16> m_io_port; 112 required_device<palette_device> m_palette; 113 }; 114 115 #endif // MAME_INCLUDES_PK8020_H 116