1 // license:BSD-3-Clause 2 // copyright-holders:Curt Coder 3 #ifndef MAME_INCLUDES_CIDELSA_H 4 #define MAME_INCLUDES_CIDELSA_H 5 6 #pragma once 7 8 9 #include "cpu/cosmac/cosmac.h" 10 #include "cpu/cop400/cop400.h" 11 #include "sound/cdp1869.h" 12 #include "sound/ay8910.h" 13 #include "machine/cdp1852.h" 14 #include "machine/nvram.h" 15 16 17 #define SCREEN_TAG "screen" 18 #define CDP1802_TAG "cdp1802" 19 #define CDP1869_TAG "cdp1869" 20 #define COP402N_TAG "cop402n" 21 #define AY8910_TAG "ay8910" 22 23 #define DESTRYER_CHR1 3579000.0 // unverified 24 #define DESTRYER_CHR2 XTAL(5'714'300) 25 #define ALTAIR_CHR1 3579000.0 // unverified 26 #define ALTAIR_CHR2 cdp1869_device::DOT_CLK_PAL // unverified 27 #define DRACO_CHR1 XTAL(4'433'610) 28 #define DRACO_CHR2 cdp1869_device::DOT_CLK_PAL // unverified 29 #define DRACO_SND_CHR1 XTAL(2'012'160) 30 31 #define CIDELSA_PAGERAM_SIZE 0x400 32 #define DRACO_PAGERAM_SIZE 0x800 33 #define CIDELSA_CHARRAM_SIZE 0x800 34 35 #define CIDELSA_PAGERAM_MASK 0x3ff 36 #define DRACO_PAGERAM_MASK 0x7ff 37 #define CIDELSA_CHARRAM_MASK 0x7ff 38 39 40 class cidelsa_state : public driver_device 41 { 42 public: 43 enum 44 { 45 TIMER_SET_CPU_MODE 46 }; 47 cidelsa_state(const machine_config & mconfig,device_type type,const char * tag)48 cidelsa_state(const machine_config &mconfig, device_type type, const char *tag) 49 : driver_device(mconfig, type, tag) 50 , m_maincpu(*this, CDP1802_TAG) 51 , m_vis(*this, CDP1869_TAG) 52 , m_leds(*this, "led%u", 0U) 53 { } 54 55 void cdp1869_w(offs_t offset, uint8_t data); 56 void destryer_out1_w(uint8_t data); 57 void altair_out1_w(uint8_t data); 58 59 DECLARE_READ_LINE_MEMBER( clear_r ); 60 61 DECLARE_WRITE_LINE_MEMBER( q_w ); 62 DECLARE_WRITE_LINE_MEMBER( prd_w ); 63 DECLARE_READ_LINE_MEMBER( cdp1869_pcb_r ); 64 65 CDP1869_CHAR_RAM_READ_MEMBER(cidelsa_charram_r); 66 CDP1869_CHAR_RAM_WRITE_MEMBER(cidelsa_charram_w); 67 CDP1869_PCB_READ_MEMBER(cidelsa_pcb_r); 68 69 void destryera(machine_config &config); 70 void altair(machine_config &config); 71 void destryer(machine_config &config); 72 void destryer_video(machine_config &config); 73 void altair_video(machine_config &config); 74 void altair_io_map(address_map &map); 75 void altair_map(address_map &map); 76 void cidelsa_page_ram(address_map &map); 77 void destryer_io_map(address_map &map); 78 void destryer_map(address_map &map); 79 void destryera_map(address_map &map); 80 81 protected: 82 virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; 83 virtual void machine_start() override; 84 virtual void machine_reset() override; 85 86 virtual void video_start() override; 87 88 required_device<cosmac_device> m_maincpu; 89 required_device<cdp1869_device> m_vis; 90 output_finder<3> m_leds; 91 92 // cpu state 93 int m_reset; 94 95 // video state 96 int m_cdp1802_q; 97 int m_cdp1869_pcb; 98 99 uint8_t *m_pageram; 100 std::unique_ptr<uint8_t[]> m_pcbram; 101 std::unique_ptr<uint8_t[]> m_charram; 102 }; 103 104 class draco_state : public cidelsa_state 105 { 106 public: draco_state(const machine_config & mconfig,device_type type,const char * tag)107 draco_state(const machine_config &mconfig, device_type type, const char *tag) 108 : cidelsa_state(mconfig, type, tag), 109 m_psg(*this, AY8910_TAG) 110 { } 111 112 uint8_t sound_in_r(); 113 uint8_t psg_r(); 114 void sound_bankswitch_w(uint8_t data); 115 void sound_g_w(uint8_t data); 116 void psg_w(uint8_t data); 117 void out1_w(uint8_t data); 118 void psg_pb_w(uint8_t data); 119 120 CDP1869_CHAR_RAM_READ_MEMBER(draco_charram_r); 121 CDP1869_CHAR_RAM_WRITE_MEMBER(draco_charram_w); 122 CDP1869_PCB_READ_MEMBER(draco_pcb_r); 123 124 void draco(machine_config &config); 125 void draco_video(machine_config &config); 126 void draco_io_map(address_map &map); 127 void draco_map(address_map &map); 128 void draco_page_ram(address_map &map); 129 void draco_sound_map(address_map &map); 130 131 protected: 132 virtual void machine_start() override; 133 134 required_device<ay8910_device> m_psg; 135 // sound state 136 int m_sound; 137 int m_psg_latch; 138 }; 139 140 #endif // MAME_INCLUDES_CIDELSA_H 141