1 // license:BSD-3-Clause 2 // copyright-holders:Curt Coder 3 #ifndef MAME_INCLUDES_ELF_H 4 #define MAME_INCLUDES_ELF_H 5 6 #pragma once 7 8 9 #include "cpu/cosmac/cosmac.h" 10 #include "imagedev/cassette.h" 11 #include "imagedev/snapquik.h" 12 #include "machine/mm74c922.h" 13 #include "video/cdp1861.h" 14 #include "video/dm9368.h" 15 #include "machine/rescap.h" 16 #include "machine/ram.h" 17 18 #define SCREEN_TAG "screen" 19 #define CDP1802_TAG "a6" 20 #define CDP1861_TAG "a14" 21 #define MM74C923_TAG "a10" 22 #define DM9368_L_TAG "a12" 23 #define DM9368_H_TAG "a8" 24 25 class elf2_state : public driver_device 26 { 27 public: elf2_state(const machine_config & mconfig,device_type type,const char * tag)28 elf2_state(const machine_config &mconfig, device_type type, const char *tag) 29 : driver_device(mconfig, type, tag) 30 , m_maincpu(*this, CDP1802_TAG) 31 , m_vdc(*this, CDP1861_TAG) 32 , m_kb(*this, MM74C923_TAG) 33 , m_led_l(*this, DM9368_L_TAG) 34 , m_led_h(*this, DM9368_H_TAG) 35 , m_cassette(*this, "cassette") 36 , m_ram(*this, RAM_TAG) 37 , m_special(*this, "SPECIAL") 38 , m_7segs(*this, "digit%u", 0U) 39 , m_led(*this, "led0") 40 { } 41 42 void elf2(machine_config &config); 43 44 DECLARE_INPUT_CHANGED_MEMBER( input_w ); 45 46 private: 47 uint8_t dispon_r(); 48 uint8_t data_r(); 49 void data_w(uint8_t data); 50 void memory_w(offs_t offset, uint8_t data); 51 DECLARE_READ_LINE_MEMBER( wait_r ); 52 DECLARE_READ_LINE_MEMBER( clear_r ); 53 DECLARE_READ_LINE_MEMBER( ef4_r ); 54 DECLARE_WRITE_LINE_MEMBER( q_w ); 55 uint8_t dma_r(); 56 void sc_w(uint8_t data); 57 DECLARE_WRITE_LINE_MEMBER( da_w ); digit_w(uint8_t data)58 template <unsigned N> void digit_w(uint8_t data) { m_7segs[N] = data; } 59 60 DECLARE_QUICKLOAD_LOAD_MEMBER( quickload_cb ); 61 void elf2_io(address_map &map); 62 void elf2_mem(address_map &map); 63 64 virtual void machine_start() override; 65 66 required_device<cosmac_device> m_maincpu; 67 required_device<cdp1861_device> m_vdc; 68 required_device<mm74c922_device> m_kb; 69 required_device<dm9368_device> m_led_l; 70 required_device<dm9368_device> m_led_h; 71 required_device<cassette_image_device> m_cassette; 72 required_device<ram_device> m_ram; 73 required_ioport m_special; 74 output_finder<2> m_7segs; 75 output_finder<> m_led; 76 77 // display state 78 uint8_t m_data; 79 }; 80 81 #endif 82