1 // license:BSD-3-Clause 2 // copyright-holders:Miodrag Milanovic 3 #ifndef MAME_INCLUDES_PECOM_H 4 #define MAME_INCLUDES_PECOM_H 5 6 #pragma once 7 8 #include "cpu/cosmac/cosmac.h" 9 #include "imagedev/cassette.h" 10 #include "sound/cdp1869.h" 11 12 class pecom_state : public driver_device 13 { 14 public: pecom_state(const machine_config & mconfig,device_type type,const char * tag)15 pecom_state(const machine_config &mconfig, device_type type, const char *tag) 16 : driver_device(mconfig, type, tag) 17 , m_maincpu(*this, "maincpu") 18 , m_cdp1869(*this, "cdp1869") 19 , m_cassette(*this, "cassette") 20 , m_bank1(*this, "bank1") 21 , m_bank3(*this, "bank3") 22 , m_bank4(*this, "bank4") 23 , m_rom(*this, "maincpu") 24 , m_ram(*this, "mainram") 25 , m_io_cnt(*this, "CNT") 26 , m_io_keyboard(*this, "LINE%d", 0U) 27 { } 28 29 DECLARE_INPUT_CHANGED_MEMBER(ef_w); 30 void pecom64(machine_config &config); 31 32 private: 33 uint8_t cdp1869_charram_r(offs_t offset); 34 void cdp1869_charram_w(offs_t offset, uint8_t data); 35 uint8_t cdp1869_pageram_r(offs_t offset); 36 void cdp1869_pageram_w(offs_t offset, uint8_t data); 37 void bank_w(uint8_t data); 38 uint8_t keyboard_r(); 39 void cdp1869_w(offs_t offset, uint8_t data); 40 TIMER_CALLBACK_MEMBER(reset_tick); 41 DECLARE_READ_LINE_MEMBER(clear_r); 42 DECLARE_READ_LINE_MEMBER(ef2_r); 43 DECLARE_WRITE_LINE_MEMBER(q_w); 44 void sc_w(uint8_t data); 45 DECLARE_WRITE_LINE_MEMBER(prd_w); 46 CDP1869_CHAR_RAM_READ_MEMBER(char_ram_r); 47 CDP1869_CHAR_RAM_WRITE_MEMBER(char_ram_w); 48 CDP1869_PCB_READ_MEMBER(pcb_r); 49 50 virtual void machine_start() override; 51 virtual void machine_reset() override; 52 void cdp1869_page_ram(address_map &map); 53 void io_map(address_map &map); 54 void mem_map(address_map &map); 55 56 std::unique_ptr<uint8_t[]> m_charram; /* character generator ROM */ 57 bool m_reset; /* CPU mode */ 58 bool m_dma; /* memory refresh DMA */ 59 60 /* timers */ 61 emu_timer *m_reset_timer; /* power on reset timer */ 62 63 required_device<cosmac_device> m_maincpu; 64 required_device<cdp1869_device> m_cdp1869; 65 required_device<cassette_image_device> m_cassette; 66 required_memory_bank m_bank1; 67 required_memory_bank m_bank3; 68 required_memory_bank m_bank4; 69 required_region_ptr<u8> m_rom; 70 required_shared_ptr<u8> m_ram; 71 required_ioport m_io_cnt; 72 required_ioport_array<26> m_io_keyboard; 73 }; 74 75 #endif // MAME_INCLUDES_PECOM_H 76