From 632ab13b46976b47bf418de8b2802c194c8d9a35 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Sun, 9 Oct 2016 13:36:09 +0300 Subject: [PATCH] required_ioport_array. (nw) --- scripts/target/mame/mess.lua | 10 - src/devices/bus/adamnet/kb.cpp | 41 +-- src/devices/bus/adamnet/kb.h | 14 +- src/devices/bus/c64/music64.cpp | 22 +- src/devices/bus/c64/music64.h | 10 +- src/devices/bus/c64/sfx_sound_expander.cpp | 25 +- src/devices/bus/c64/sfx_sound_expander.h | 9 +- src/mame/drivers/bw2.cpp | 13 +- src/mame/drivers/c128.cpp | 254 +++++++++++++++- src/mame/drivers/c64.cpp | 217 +++++++++++++- src/mame/drivers/cbm2.cpp | 324 ++++++++++++++++++-- src/mame/drivers/ep64.cpp | 79 ++++- src/mame/drivers/kyocera.cpp | 26 +- src/mame/drivers/mc1000.cpp | 121 +++++++- src/mame/drivers/newbrain.cpp | 20 +- src/mame/drivers/pet.cpp | 299 +++++++++++++++++-- src/mame/drivers/plus4.cpp | 170 ++++++++++- src/mame/drivers/ql.cpp | 135 ++++++++- src/mame/drivers/vic10.cpp | 111 ++++++- src/mame/drivers/vic20.cpp | 149 +++++++++- src/mame/drivers/vidbrain.cpp | 13 +- src/mame/includes/bw2.h | 52 ++-- src/mame/includes/c128.h | 253 ---------------- src/mame/includes/c64.h | 216 -------------- src/mame/includes/cbm2.h | 327 --------------------- src/mame/includes/ep64.h | 96 ------ src/mame/includes/kyocera.h | 112 +++---- src/mame/includes/mc1000.h | 118 -------- src/mame/includes/newbrain.h | 34 +-- src/mame/includes/pet.h | 284 ------------------ src/mame/includes/plus4.h | 173 ----------- src/mame/includes/ql.h | 141 --------- src/mame/includes/vic10.h | 113 ------- src/mame/includes/vic20.h | 159 ---------- src/mame/includes/vidbrain.h | 54 ++-- 35 files changed, 1846 insertions(+), 2348 deletions(-) delete mode 100644 src/mame/includes/c128.h delete mode 100644 src/mame/includes/c64.h delete mode 100644 src/mame/includes/cbm2.h delete mode 100644 src/mame/includes/ep64.h delete mode 100644 src/mame/includes/mc1000.h delete mode 100644 src/mame/includes/pet.h delete mode 100644 src/mame/includes/plus4.h delete mode 100644 src/mame/includes/ql.h delete mode 100644 src/mame/includes/vic10.h delete mode 100644 src/mame/includes/vic20.h diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 1f70fdf6e77..b109a1a8b11 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -1561,24 +1561,17 @@ files { createMESSProjects(_target, _subtarget, "cbm") files { MAME_DIR .. "src/mame/drivers/c128.cpp", - MAME_DIR .. "src/mame/includes/c128.h", MAME_DIR .. "src/mame/drivers/c64.cpp", - MAME_DIR .. "src/mame/includes/c64.h", MAME_DIR .. "src/mame/drivers/c64dtv.cpp", MAME_DIR .. "src/mame/drivers/c65.cpp", MAME_DIR .. "src/mame/includes/c65.h", MAME_DIR .. "src/mame/drivers/c900.cpp", MAME_DIR .. "src/mame/drivers/cbm2.cpp", - MAME_DIR .. "src/mame/includes/cbm2.h", MAME_DIR .. "src/mame/drivers/clcd.cpp", MAME_DIR .. "src/mame/drivers/pet.cpp", - MAME_DIR .. "src/mame/includes/pet.h", MAME_DIR .. "src/mame/drivers/plus4.cpp", - MAME_DIR .. "src/mame/includes/plus4.h", MAME_DIR .. "src/mame/drivers/vic10.cpp", - MAME_DIR .. "src/mame/includes/vic10.h", MAME_DIR .. "src/mame/drivers/vic20.cpp", - MAME_DIR .. "src/mame/includes/vic20.h", MAME_DIR .. "src/mame/machine/cbm_snqk.cpp", MAME_DIR .. "src/mame/machine/cbm_snqk.h", MAME_DIR .. "src/mame/drivers/mps1230.cpp", @@ -1623,7 +1616,6 @@ files { createMESSProjects(_target, _subtarget, "cce") files { MAME_DIR .. "src/mame/drivers/mc1000.cpp", - MAME_DIR .. "src/mame/includes/mc1000.h", } createMESSProjects(_target, _subtarget, "ccs") @@ -1827,7 +1819,6 @@ files { createMESSProjects(_target, _subtarget, "enterprise") files { MAME_DIR .. "src/mame/drivers/ep64.cpp", - MAME_DIR .. "src/mame/includes/ep64.h", MAME_DIR .. "src/mame/audio/dave.cpp", MAME_DIR .. "src/mame/audio/dave.h", MAME_DIR .. "src/mame/video/nick.cpp", @@ -2725,7 +2716,6 @@ files { MAME_DIR .. "src/mame/machine/spec_snqk.cpp", MAME_DIR .. "src/mame/machine/spec_snqk.h", MAME_DIR .. "src/mame/drivers/ql.cpp", - MAME_DIR .. "src/mame/includes/ql.h", MAME_DIR .. "src/mame/machine/qimi.cpp", MAME_DIR .. "src/mame/machine/qimi.h", MAME_DIR .. "src/mame/video/zx8301.cpp", diff --git a/src/devices/bus/adamnet/kb.cpp b/src/devices/bus/adamnet/kb.cpp index 0a2481bc7cd..3249680e608 100644 --- a/src/devices/bus/adamnet/kb.cpp +++ b/src/devices/bus/adamnet/kb.cpp @@ -222,24 +222,12 @@ ioport_constructor adam_keyboard_device::device_input_ports() const // adam_keyboard_device - constructor //------------------------------------------------- -adam_keyboard_device::adam_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, ADAM_KB, "Adam keyboard", tag, owner, clock, "adam_kb", __FILE__), - device_adamnet_card_interface(mconfig, *this), - m_maincpu(*this, M6801_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_y10(*this, "Y10"), - m_y11(*this, "Y11"), - m_y12(*this, "Y12"), - m_key_y(0x1ff) +adam_keyboard_device::adam_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, ADAM_KB, "Adam keyboard", tag, owner, clock, "adam_kb", __FILE__), + device_adamnet_card_interface(mconfig, *this), + m_maincpu(*this, M6801_TAG), + m_y(*this, "Y%u", 0), + m_key_y(0x1ff) { } @@ -288,19 +276,10 @@ READ8_MEMBER( adam_keyboard_device::p1_r ) UINT8 data = 0xff; - if (!BIT(m_key_y, 0)) data &= m_y0->read(); - if (!BIT(m_key_y, 1)) data &= m_y1->read(); - if (!BIT(m_key_y, 2)) data &= m_y2->read(); - if (!BIT(m_key_y, 3)) data &= m_y3->read(); - if (!BIT(m_key_y, 4)) data &= m_y4->read(); - if (!BIT(m_key_y, 5)) data &= m_y5->read(); - if (!BIT(m_key_y, 6)) data &= m_y6->read(); - if (!BIT(m_key_y, 7)) data &= m_y7->read(); - if (!BIT(m_key_y, 8)) data &= m_y8->read(); - if (!BIT(m_key_y, 9)) data &= m_y9->read(); - if (!BIT(m_key_y, 10)) data &= m_y10->read(); - if (!BIT(m_key_y, 11)) data &= m_y11->read(); - if (!BIT(m_key_y, 12)) data &= m_y12->read(); + for (int i = 0; i < 13; i++) + { + if (!BIT(m_key_y, i)) data &= m_y[i]->read(); + } return data; } diff --git a/src/devices/bus/adamnet/kb.h b/src/devices/bus/adamnet/kb.h index 34885d083c9..9d8e198ef3a 100644 --- a/src/devices/bus/adamnet/kb.h +++ b/src/devices/bus/adamnet/kb.h @@ -52,19 +52,7 @@ protected: virtual void adamnet_reset_w(int state) override; required_device m_maincpu; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_y10; - required_ioport m_y11; - required_ioport m_y12; + required_ioport_array<13> m_y; UINT16 m_key_y; }; diff --git a/src/devices/bus/c64/music64.cpp b/src/devices/bus/c64/music64.cpp index 723acad7fa7..ea45ce21bec 100644 --- a/src/devices/bus/c64/music64.cpp +++ b/src/devices/bus/c64/music64.cpp @@ -153,13 +153,7 @@ c64_music64_cartridge_device::c64_music64_cartridge_device(const machine_config device_t(mconfig, C64_MUSIC64, "C64 Music 64 cartridge", tag, owner, clock, "c64_music64", __FILE__), device_c64_expansion_card_interface(mconfig, *this), m_exp(*this, C64_EXPANSION_SLOT_TAG), - m_kb0(*this, "KB0"), - m_kb1(*this, "KB1"), - m_kb2(*this, "KB2"), - m_kb3(*this, "KB3"), - m_kb4(*this, "KB4"), - m_kb5(*this, "KB5"), - m_kb6(*this, "KB6") + m_kb(*this, "KB%u", 0) { } @@ -194,13 +188,13 @@ UINT8 c64_music64_cartridge_device::c64_cd_r(address_space &space, offs_t offset { switch (offset & 0x07) { - case 0x00: data = m_kb0->read(); break; - case 0x01: data = m_kb1->read(); break; - case 0x02: data = m_kb2->read(); break; - case 0x03: data = m_kb3->read(); break; - case 0x04: data = m_kb4->read(); break; - case 0x05: data = m_kb5->read(); break; - case 0x06: data = m_kb6->read(); break; + case 0x00: data = m_kb[0]->read(); break; + case 0x01: data = m_kb[1]->read(); break; + case 0x02: data = m_kb[2]->read(); break; + case 0x03: data = m_kb[3]->read(); break; + case 0x04: data = m_kb[4]->read(); break; + case 0x05: data = m_kb[5]->read(); break; + case 0x06: data = m_kb[6]->read(); break; } } diff --git a/src/devices/bus/c64/music64.h b/src/devices/bus/c64/music64.h index 8af27d6601e..5af70da1744 100644 --- a/src/devices/bus/c64/music64.h +++ b/src/devices/bus/c64/music64.h @@ -23,7 +23,7 @@ // ======================> c64_music64_cartridge_device class c64_music64_cartridge_device : public device_t, - public device_c64_expansion_card_interface + public device_c64_expansion_card_interface { public: // construction/destruction @@ -46,13 +46,7 @@ protected: private: required_device m_exp; - required_ioport m_kb0; - required_ioport m_kb1; - required_ioport m_kb2; - required_ioport m_kb3; - required_ioport m_kb4; - required_ioport m_kb5; - required_ioport m_kb6; + required_ioport_array<7> m_kb; }; diff --git a/src/devices/bus/c64/sfx_sound_expander.cpp b/src/devices/bus/c64/sfx_sound_expander.cpp index 8c3f7291620..9693db59729 100644 --- a/src/devices/bus/c64/sfx_sound_expander.cpp +++ b/src/devices/bus/c64/sfx_sound_expander.cpp @@ -185,14 +185,7 @@ c64_sfx_sound_expander_cartridge_device::c64_sfx_sound_expander_cartridge_device device_c64_expansion_card_interface(mconfig, *this), m_opl(*this, YM3526_TAG), m_exp(*this, C64_EXPANSION_SLOT_TAG), - m_kb0(*this, "KB0"), - m_kb1(*this, "KB1"), - m_kb2(*this, "KB2"), - m_kb3(*this, "KB3"), - m_kb4(*this, "KB4"), - m_kb5(*this, "KB5"), - m_kb6(*this, "KB6"), - m_kb7(*this, "KB7") + m_kb(*this, "KB%u", 0) { } @@ -230,14 +223,14 @@ UINT8 c64_sfx_sound_expander_cartridge_device::c64_cd_r(address_space &space, of { switch (offset & 0x07) { - case 0: data = m_kb0->read(); break; - case 1: data = m_kb1->read(); break; - case 2: data = m_kb2->read(); break; - case 3: data = m_kb3->read(); break; - case 4: data = m_kb4->read(); break; - case 5: data = m_kb5->read(); break; - case 6: data = m_kb6->read(); break; - case 7: data = m_kb7->read(); break; + case 0: data = m_kb[0]->read(); break; + case 1: data = m_kb[1]->read(); break; + case 2: data = m_kb[2]->read(); break; + case 3: data = m_kb[3]->read(); break; + case 4: data = m_kb[4]->read(); break; + case 5: data = m_kb[5]->read(); break; + case 6: data = m_kb[6]->read(); break; + case 7: data = m_kb[7]->read(); break; } } diff --git a/src/devices/bus/c64/sfx_sound_expander.h b/src/devices/bus/c64/sfx_sound_expander.h index b51fd23e751..a422c4df784 100644 --- a/src/devices/bus/c64/sfx_sound_expander.h +++ b/src/devices/bus/c64/sfx_sound_expander.h @@ -50,14 +50,7 @@ protected: private: required_device m_opl; required_device m_exp; - required_ioport m_kb0; - required_ioport m_kb1; - required_ioport m_kb2; - required_ioport m_kb3; - required_ioport m_kb4; - required_ioport m_kb5; - required_ioport m_kb6; - required_ioport m_kb7; + required_ioport_array<8> m_kb; inline offs_t get_offset(offs_t offset, int rw); }; diff --git a/src/mame/drivers/bw2.cpp b/src/mame/drivers/bw2.cpp index 3cf623fbc02..5b65b3c57eb 100644 --- a/src/mame/drivers/bw2.cpp +++ b/src/mame/drivers/bw2.cpp @@ -443,18 +443,9 @@ READ8_MEMBER( bw2_state::ppi_pb_r ) UINT8 data = 0xff; - switch (m_kb) + if (m_kb < 10) { - case 0: data = m_y0->read(); break; - case 1: data = m_y1->read(); break; - case 2: data = m_y2->read(); break; - case 3: data = m_y3->read(); break; - case 4: data = m_y4->read(); break; - case 5: data = m_y5->read(); break; - case 6: data = m_y6->read(); break; - case 7: data = m_y7->read(); break; - case 8: data = m_y8->read(); break; - case 9: data = m_y9->read(); break; + data = m_y[m_kb]->read(); } return data; diff --git a/src/mame/drivers/c128.cpp b/src/mame/drivers/c128.cpp index 741a2ce6620..2ab7999827e 100644 --- a/src/mame/drivers/c128.cpp +++ b/src/mame/drivers/c128.cpp @@ -8,13 +8,237 @@ */ -#include "includes/c128.h" +#include "emu.h" +#include "softlist.h" +#include "bus/c64/exp.h" +#include "bus/cbmiec/cbmiec.h" #include "bus/cbmiec/c1571.h" #include "bus/cbmiec/c1581.h" +#include "bus/vic20/user.h" +#include "bus/pet/cass.h" +#include "bus/vcs_ctrl/ctrl.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "imagedev/snapquik.h" +#include "cpu/m6502/m8502.h" #include "cpu/z80/z80.h" #include "machine/cbm_snqk.h" +#include "machine/mos6526.h" +#include "machine/mos8722.h" +#include "machine/pla.h" +#include "machine/ram.h" #include "sound/dac.h" -#include "softlist.h" +#include "sound/mos6581.h" +#include "video/mc6845.h" +#include "video/mos6566.h" + +#define Z80A_TAG "u10" +#define M8502_TAG "u6" +#define MOS8563_TAG "u22" +#define MOS8564_TAG "u21" +#define MOS8566_TAG "u21" +#define MOS6581_TAG "u5" +#define MOS6526_1_TAG "u1" +#define MOS6526_2_TAG "u4" +#define MOS8721_TAG "u11" +#define MOS8722_TAG "u7" +#define SCREEN_VIC_TAG "screen" +#define SCREEN_VDC_TAG "screen80" +#define CONTROL1_TAG "joy1" +#define CONTROL2_TAG "joy2" +#define PET_USER_PORT_TAG "user" + +class c128_state : public driver_device +{ +public: + c128_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, Z80A_TAG), + m_subcpu(*this, M8502_TAG), + m_mmu(*this, MOS8722_TAG), + m_pla(*this, MOS8721_TAG), + m_vdc(*this, MOS8563_TAG), + m_vic(*this, MOS8564_TAG), + m_sid(*this, MOS6581_TAG), + m_cia1(*this, MOS6526_1_TAG), + m_cia2(*this, MOS6526_2_TAG), + m_iec(*this, CBM_IEC_TAG), + m_joy1(*this, CONTROL1_TAG), + m_joy2(*this, CONTROL2_TAG), + m_exp(*this, C64_EXPANSION_SLOT_TAG), + m_user(*this, PET_USER_PORT_TAG), + m_ram(*this, RAM_TAG), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_from(*this, "from"), + m_rom(*this, M8502_TAG), + m_charom(*this, "charom"), + m_color_ram(*this, "color_ram"), + m_row(*this, "ROW%u", 0), + m_k(*this, "K%u", 0), + m_lock(*this, "LOCK"), + m_caps(*this, "CAPS"), + m_40_80(*this, "40_80"), + m_z80en(0), + m_loram(1), + m_hiram(1), + m_charen(1), + m_game(1), + m_exrom(1), + m_va14(1), + m_va15(1), + m_clrbank(0), + m_cnt1(1), + m_sp1(1), + m_iec_data_out(1), + m_restore(1), + m_cia1_irq(CLEAR_LINE), + m_cia2_irq(CLEAR_LINE), + m_vic_irq(CLEAR_LINE), + m_exp_irq(CLEAR_LINE), + m_exp_nmi(CLEAR_LINE), + m_cass_rd(1), + m_iec_srq(1), + m_vic_k(0x07), + m_caps_lock(1) + { } + + required_device m_maincpu; + required_device m_subcpu; + required_device m_mmu; + required_device m_pla; + required_device m_vdc; + required_device m_vic; + required_device m_sid; + required_device m_cia1; + required_device m_cia2; + required_device m_iec; + required_device m_joy1; + required_device m_joy2; + required_device m_exp; + required_device m_user; + required_device m_ram; + required_device m_cassette; + required_device m_from; + required_memory_region m_rom; + required_memory_region m_charom; + optional_shared_ptr m_color_ram; + required_ioport_array<8> m_row; + required_ioport_array<3> m_k; + required_ioport m_lock; + required_ioport m_caps; + required_ioport m_40_80; + + virtual void machine_start() override; + virtual void machine_reset() override; + + inline void check_interrupts(); + int read_pla(offs_t offset, offs_t ca, offs_t vma, int ba, int rw, int aec, int z80io, int ms3, int ms2, int ms1, int ms0); + UINT8 read_memory(address_space &space, offs_t offset, offs_t vma, int ba, int aec, int z80io); + void write_memory(address_space &space, offs_t offset, offs_t vma, UINT8 data, int ba, int aec, int z80io); + inline void update_iec(); + + DECLARE_READ8_MEMBER( z80_r ); + DECLARE_WRITE8_MEMBER( z80_w ); + DECLARE_READ8_MEMBER( z80_io_r ); + DECLARE_WRITE8_MEMBER( z80_io_w ); + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + DECLARE_READ8_MEMBER( vic_videoram_r ); + DECLARE_READ8_MEMBER( vic_colorram_r ); + + DECLARE_WRITE_LINE_MEMBER( mmu_z80en_w ); + DECLARE_WRITE_LINE_MEMBER( mmu_fsdir_w ); + DECLARE_READ_LINE_MEMBER( mmu_game_r ); + DECLARE_READ_LINE_MEMBER( mmu_exrom_r ); + DECLARE_READ_LINE_MEMBER( mmu_sense40_r ); + + DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); + DECLARE_WRITE8_MEMBER( vic_k_w ); + + DECLARE_READ8_MEMBER( sid_potx_r ); + DECLARE_READ8_MEMBER( sid_poty_r ); + + DECLARE_WRITE_LINE_MEMBER( cia1_irq_w ); + DECLARE_WRITE_LINE_MEMBER( cia1_cnt_w ); + DECLARE_WRITE_LINE_MEMBER( cia1_sp_w ); + DECLARE_READ8_MEMBER( cia1_pa_r ); + DECLARE_WRITE8_MEMBER( cia1_pa_w ); + DECLARE_READ8_MEMBER( cia1_pb_r ); + DECLARE_WRITE8_MEMBER( cia1_pb_w ); + + DECLARE_WRITE_LINE_MEMBER( cia2_irq_w ); + DECLARE_READ8_MEMBER( cia2_pa_r ); + DECLARE_WRITE8_MEMBER( cia2_pa_w ); + + DECLARE_READ8_MEMBER( cpu_r ); + DECLARE_WRITE8_MEMBER( cpu_w ); + + DECLARE_WRITE_LINE_MEMBER( iec_srq_w ); + DECLARE_WRITE_LINE_MEMBER( iec_data_w ); + + DECLARE_READ8_MEMBER( exp_dma_cd_r ); + DECLARE_WRITE8_MEMBER( exp_dma_cd_w ); + DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); + DECLARE_WRITE_LINE_MEMBER( exp_nmi_w ); + DECLARE_WRITE_LINE_MEMBER( exp_dma_w ); + DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); + + DECLARE_WRITE_LINE_MEMBER( write_restore ); + DECLARE_INPUT_CHANGED_MEMBER( caps_lock ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_c64 ); + + DECLARE_READ8_MEMBER( cia2_pb_r ); + DECLARE_WRITE8_MEMBER( cia2_pb_w ); + + DECLARE_WRITE_LINE_MEMBER( write_user_pa2 ) { m_user_pa2 = state; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb0 ) { if (state) m_user_pb |= 1; else m_user_pb &= ~1; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb1 ) { if (state) m_user_pb |= 2; else m_user_pb &= ~2; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb2 ) { if (state) m_user_pb |= 4; else m_user_pb &= ~4; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb3 ) { if (state) m_user_pb |= 8; else m_user_pb &= ~8; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb4 ) { if (state) m_user_pb |= 16; else m_user_pb &= ~16; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb5 ) { if (state) m_user_pb |= 32; else m_user_pb &= ~32; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb6 ) { if (state) m_user_pb |= 64; else m_user_pb &= ~64; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb7 ) { if (state) m_user_pb |= 128; else m_user_pb &= ~128; } + + // memory state + int m_z80en; + int m_loram; + int m_hiram; + int m_charen; + int m_game; + int m_exrom; + int m_reset; + + // video state + int m_va14; + int m_va15; + int m_clrbank; + + // fast serial state + int m_cnt1; + int m_sp1; + int m_iec_data_out; + + // interrupt state + int m_restore; + int m_cia1_irq; + int m_cia2_irq; + int m_vic_irq; + int m_exp_irq; + int m_exp_nmi; + int m_exp_dma; + int m_cass_rd; + int m_iec_srq; + + // keyboard state + UINT8 m_vic_k; + int m_caps_lock; + + int m_user_pa2; + int m_user_pb; +}; + //************************************************************************** @@ -984,8 +1208,8 @@ READ8_MEMBER( c128_state::cia1_pa_r ) // keyboard UINT8 cia1_pb = m_cia1->pb_r(); - UINT32 row[8] = { m_row0->read(), m_row1->read() & m_lock->read(), m_row2->read(), m_row3->read(), - m_row4->read(), m_row5->read(), m_row6->read(), m_row7->read() }; + UINT32 row[8] = { m_row[0]->read(), m_row[1]->read() & m_lock->read(), m_row[2]->read(), m_row[3]->read(), + m_row[4]->read(), m_row[5]->read(), m_row[6]->read(), m_row[7]->read() }; for (int i = 0; i < 8; i++) { @@ -1053,18 +1277,18 @@ READ8_MEMBER( c128_state::cia1_pb_r ) // keyboard UINT8 cia1_pa = m_cia1->pa_r(); - if (!BIT(cia1_pa, 7)) data &= m_row7->read(); - if (!BIT(cia1_pa, 6)) data &= m_row6->read(); - if (!BIT(cia1_pa, 5)) data &= m_row5->read(); - if (!BIT(cia1_pa, 4)) data &= m_row4->read(); - if (!BIT(cia1_pa, 3)) data &= m_row3->read(); - if (!BIT(cia1_pa, 2)) data &= m_row2->read(); - if (!BIT(cia1_pa, 1)) data &= m_row1->read() & m_lock->read(); - if (!BIT(cia1_pa, 0)) data &= m_row0->read(); + if (!BIT(cia1_pa, 7)) data &= m_row[7]->read(); + if (!BIT(cia1_pa, 6)) data &= m_row[6]->read(); + if (!BIT(cia1_pa, 5)) data &= m_row[5]->read(); + if (!BIT(cia1_pa, 4)) data &= m_row[4]->read(); + if (!BIT(cia1_pa, 3)) data &= m_row[3]->read(); + if (!BIT(cia1_pa, 2)) data &= m_row[2]->read(); + if (!BIT(cia1_pa, 1)) data &= m_row[1]->read() & m_lock->read(); + if (!BIT(cia1_pa, 0)) data &= m_row[0]->read(); - if (!BIT(m_vic_k, 0)) data &= m_k0->read(); - if (!BIT(m_vic_k, 1)) data &= m_k1->read(); - if (!BIT(m_vic_k, 2)) data &= m_k2->read(); + if (!BIT(m_vic_k, 0)) data &= m_k[0]->read(); + if (!BIT(m_vic_k, 1)) data &= m_k[1]->read(); + if (!BIT(m_vic_k, 2)) data &= m_k[2]->read(); return data; } diff --git a/src/mame/drivers/c64.cpp b/src/mame/drivers/c64.cpp index 4d0cea1e7ee..07c3d97565b 100644 --- a/src/mame/drivers/c64.cpp +++ b/src/mame/drivers/c64.cpp @@ -14,10 +14,201 @@ */ -#include "includes/c64.h" -#include "bus/cbmiec/c1541.h" -#include "machine/cbm_snqk.h" +#include "emu.h" #include "softlist.h" +#include "bus/cbmiec/cbmiec.h" +#include "bus/cbmiec/c1541.h" +#include "bus/c64/exp.h" +#include "bus/vic20/user.h" +#include "bus/pet/cass.h" +#include "bus/vcs_ctrl/ctrl.h" +#include "cpu/m6502/m6510.h" +#include "imagedev/snapquik.h" +#include "machine/cbm_snqk.h" +#include "machine/mos6526.h" +#include "machine/pla.h" +#include "machine/ram.h" +#include "sound/mos6581.h" +#include "video/mos6566.h" + +#define M6510_TAG "u7" +#define MOS6567_TAG "u19" +#define MOS6569_TAG "u19" +#define MOS6581_TAG "u18" +#define MOS6526_1_TAG "u1" +#define MOS6526_2_TAG "u2" +#define PLA_TAG "u17" +#define SCREEN_TAG "screen" +#define CONTROL1_TAG "joy1" +#define CONTROL2_TAG "joy2" +#define PET_USER_PORT_TAG "user" + +class c64_state : public driver_device +{ +public: + c64_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, M6510_TAG), + m_pla(*this, PLA_TAG), + m_vic(*this, MOS6569_TAG), + m_sid(*this, MOS6581_TAG), + m_cia1(*this, MOS6526_1_TAG), + m_cia2(*this, MOS6526_2_TAG), + m_iec(*this, CBM_IEC_TAG), + m_joy1(*this, CONTROL1_TAG), + m_joy2(*this, CONTROL2_TAG), + m_exp(*this, C64_EXPANSION_SLOT_TAG), + m_user(*this, PET_USER_PORT_TAG), + m_ram(*this, RAM_TAG), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_color_ram(*this, "color_ram"), + m_row(*this, "ROW%u", 0), + m_lock(*this, "LOCK"), + m_loram(1), + m_hiram(1), + m_charen(1), + m_va14(1), + m_va15(1), + m_restore(1), + m_cia1_irq(CLEAR_LINE), + m_cia2_irq(CLEAR_LINE), + m_vic_irq(CLEAR_LINE), + m_exp_irq(CLEAR_LINE), + m_exp_nmi(CLEAR_LINE) + { } + + // ROM + UINT8 *m_basic; + UINT8 *m_kernal; + UINT8 *m_charom; + + required_device m_maincpu; + required_device m_pla; + required_device m_vic; + required_device m_sid; + required_device m_cia1; + required_device m_cia2; + optional_device m_iec; + required_device m_joy1; + required_device m_joy2; + required_device m_exp; + required_device m_user; + required_device m_ram; + optional_device m_cassette; + optional_shared_ptr m_color_ram; + optional_ioport_array<8> m_row; + optional_ioport m_lock; + + virtual void machine_start() override; + virtual void machine_reset() override; + + void check_interrupts(); + int read_pla(offs_t offset, offs_t va, int rw, int aec, int ba); + UINT8 read_memory(address_space &space, offs_t offset, offs_t va, int aec, int ba); + void write_memory(address_space &space, offs_t offset, UINT8 data, int aec, int ba); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_READ8_MEMBER( vic_videoram_r ); + DECLARE_READ8_MEMBER( vic_colorram_r ); + DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); + + DECLARE_READ8_MEMBER( sid_potx_r ); + DECLARE_READ8_MEMBER( sid_poty_r ); + + DECLARE_WRITE_LINE_MEMBER( cia1_irq_w ); + DECLARE_READ8_MEMBER( cia1_pa_r ); + DECLARE_WRITE8_MEMBER( cia1_pa_w ); + DECLARE_READ8_MEMBER( cia1_pb_r ); + DECLARE_WRITE8_MEMBER( cia1_pb_w ); + + DECLARE_WRITE_LINE_MEMBER( cia2_irq_w ); + DECLARE_READ8_MEMBER( cia2_pa_r ); + DECLARE_WRITE8_MEMBER( cia2_pa_w ); + + DECLARE_READ8_MEMBER( cpu_r ); + DECLARE_WRITE8_MEMBER( cpu_w ); + + DECLARE_WRITE_LINE_MEMBER( write_restore ); + DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); + DECLARE_WRITE_LINE_MEMBER( exp_nmi_w ); + DECLARE_WRITE_LINE_MEMBER( exp_dma_w ); + DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_c64 ); + + DECLARE_READ8_MEMBER( cia2_pb_r ); + DECLARE_WRITE8_MEMBER( cia2_pb_w ); + + DECLARE_WRITE_LINE_MEMBER( write_user_pa2 ) { m_user_pa2 = state; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb0 ) { if (state) m_user_pb |= 1; else m_user_pb &= ~1; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb1 ) { if (state) m_user_pb |= 2; else m_user_pb &= ~2; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb2 ) { if (state) m_user_pb |= 4; else m_user_pb &= ~4; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb3 ) { if (state) m_user_pb |= 8; else m_user_pb &= ~8; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb4 ) { if (state) m_user_pb |= 16; else m_user_pb &= ~16; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb5 ) { if (state) m_user_pb |= 32; else m_user_pb &= ~32; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb6 ) { if (state) m_user_pb |= 64; else m_user_pb &= ~64; } + DECLARE_WRITE_LINE_MEMBER( write_user_pb7 ) { if (state) m_user_pb |= 128; else m_user_pb &= ~128; } + + // memory state + int m_loram; + int m_hiram; + int m_charen; + + // video state + int m_va14; + int m_va15; + + // interrupt state + int m_restore; + int m_cia1_irq; + int m_cia2_irq; + int m_vic_irq; + int m_exp_irq; + int m_exp_nmi; + int m_exp_dma; + + int m_user_pa2; + int m_user_pb; +}; + + +class sx64_state : public c64_state +{ +public: + sx64_state(const machine_config &mconfig, device_type type, const char *tag) + : c64_state(mconfig, type, tag) + { } + + DECLARE_READ8_MEMBER( cpu_r ); + DECLARE_WRITE8_MEMBER( cpu_w ); +}; + + +class c64c_state : public c64_state +{ +public: + c64c_state(const machine_config &mconfig, device_type type, const char *tag) + : c64_state(mconfig, type, tag) + { } +}; + + +class c64gs_state : public c64c_state +{ +public: + c64gs_state(const machine_config &mconfig, device_type type, const char *tag) + : c64c_state(mconfig, type, tag) + { } + + DECLARE_READ8_MEMBER( cpu_r ); + DECLARE_WRITE8_MEMBER( cpu_w ); + + DECLARE_READ8_MEMBER( cia1_pa_r ); + DECLARE_READ8_MEMBER( cia1_pb_r ); +}; + //************************************************************************** @@ -604,8 +795,8 @@ READ8_MEMBER( c64_state::cia1_pa_r ) // keyboard UINT8 cia1_pb = m_cia1->pb_r(); - UINT32 row[8] = { m_row0->read(), m_row1->read() & m_lock->read(), m_row2->read(), m_row3->read(), - m_row4->read(), m_row5->read(), m_row6->read(), m_row7->read() }; + UINT32 row[8] = { m_row[0]->read(), m_row[1]->read() & m_lock->read(), m_row[2]->read(), m_row[3]->read(), + m_row[4]->read(), m_row[5]->read(), m_row[6]->read(), m_row[7]->read() }; for (int i = 0; i < 8; i++) { @@ -673,14 +864,14 @@ READ8_MEMBER( c64_state::cia1_pb_r ) // keyboard UINT8 cia1_pa = m_cia1->pa_r(); - if (!BIT(cia1_pa, 7)) data &= m_row7->read(); - if (!BIT(cia1_pa, 6)) data &= m_row6->read(); - if (!BIT(cia1_pa, 5)) data &= m_row5->read(); - if (!BIT(cia1_pa, 4)) data &= m_row4->read(); - if (!BIT(cia1_pa, 3)) data &= m_row3->read(); - if (!BIT(cia1_pa, 2)) data &= m_row2->read(); - if (!BIT(cia1_pa, 1)) data &= m_row1->read() & m_lock->read(); - if (!BIT(cia1_pa, 0)) data &= m_row0->read(); + if (!BIT(cia1_pa, 7)) data &= m_row[7]->read(); + if (!BIT(cia1_pa, 6)) data &= m_row[6]->read(); + if (!BIT(cia1_pa, 5)) data &= m_row[5]->read(); + if (!BIT(cia1_pa, 4)) data &= m_row[4]->read(); + if (!BIT(cia1_pa, 3)) data &= m_row[3]->read(); + if (!BIT(cia1_pa, 2)) data &= m_row[2]->read(); + if (!BIT(cia1_pa, 1)) data &= m_row[1]->read() & m_lock->read(); + if (!BIT(cia1_pa, 0)) data &= m_row[0]->read(); return data; } diff --git a/src/mame/drivers/cbm2.cpp b/src/mame/drivers/cbm2.cpp index 35dfe16705c..078ae13fdd3 100644 --- a/src/mame/drivers/cbm2.cpp +++ b/src/mame/drivers/cbm2.cpp @@ -10,9 +10,297 @@ */ -#include "includes/cbm2.h" -#include "bus/rs232/rs232.h" +#include "emu.h" #include "softlist.h" +#include "bus/cbm2/exp.h" +#include "bus/cbm2/user.h" +#include "bus/ieee488/ieee488.h" +#include "bus/pet/cass.h" +#include "bus/rs232/rs232.h" +#include "bus/vcs_ctrl/ctrl.h" +#include "cpu/m6502/m6509.h" +#include "cpu/i86/i86.h" +#include "machine/cbm_snqk.h" +#include "machine/6525tpi.h" +#include "machine/ds75160a.h" +#include "machine/ds75161a.h" +#include "machine/mos6526.h" +#include "machine/mos6551.h" +#include "machine/pic8259.h" +#include "machine/pla.h" +#include "machine/ram.h" +#include "sound/dac.h" +#include "sound/mos6581.h" +#include "video/mc6845.h" +#include "video/mos6566.h" + +#define M6509_TAG "u13" +#define PLA1_TAG "u78" +#define PLA2_TAG "u88" +#define MOS6567_TAG "u23" +#define MOS6569_TAG "u23" +#define MC68B45_TAG "u10" +#define MOS6581_TAG "u4" +#define MOS6525_1_TAG "u20" +#define MOS6525_2_TAG "u102" +#define MOS6551A_TAG "u19" +#define MOS6526_TAG "u2" +#define DS75160A_TAG "u3" +#define DS75161A_TAG "u7" +#define SCREEN_TAG "screen" +#define CONTROL1_TAG "joy1" +#define CONTROL2_TAG "joy2" +#define RS232_TAG "rs232" + +#define EXT_I8088_TAG "ext_u1" +#define EXT_I8087_TAG "ext_u4" +#define EXT_I8259A_TAG "ext_u3" +#define EXT_MOS6526_TAG "ext_u15" +#define EXT_MOS6525_TAG "ext_u16" + +class cbm2_state : public driver_device +{ +public: + cbm2_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, M6509_TAG), + m_pla1(*this, PLA1_TAG), + m_crtc(*this, MC68B45_TAG), + m_palette(*this, "palette"), + m_sid(*this, MOS6581_TAG), + m_tpi1(*this, MOS6525_1_TAG), + m_tpi2(*this, MOS6525_2_TAG), + m_acia(*this, MOS6551A_TAG), + m_cia(*this, MOS6526_TAG), + m_ieee1(*this, DS75160A_TAG), + m_ieee2(*this, DS75161A_TAG), + m_joy1(*this, CONTROL1_TAG), + m_joy2(*this, CONTROL2_TAG), + m_exp(*this, CBM2_EXPANSION_SLOT_TAG), + m_user(*this, CBM2_USER_PORT_TAG), + m_ram(*this, RAM_TAG), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_ieee(*this, IEEE488_TAG), + m_ext_cpu(*this, EXT_I8088_TAG), + m_ext_pic(*this, EXT_I8259A_TAG), + m_ext_cia(*this, EXT_MOS6526_TAG), + m_ext_tpi(*this, EXT_MOS6525_TAG), + m_basic(*this, "basic"), + m_kernal(*this, "kernal"), + m_charom(*this, "charom"), + m_buffer_ram(*this, "buffer_ram"), + m_extbuf_ram(*this, "extbuf_ram"), + m_video_ram(*this, "video_ram"), + m_pa(*this, "PA%u", 0), + m_pb(*this, "PB%u", 0), + m_lock(*this, "LOCK"), + m_dramon(1), + m_video_ram_size(0x800), + m_graphics(1), + m_todclk(0), + m_tpi1_irq(CLEAR_LINE), + m_acia_irq(CLEAR_LINE), + m_user_irq(CLEAR_LINE), + m_tpi2_pa(0), + m_tpi2_pb(0) + { } + + required_device m_maincpu; + required_device m_pla1; + optional_device m_crtc; + optional_device m_palette; + required_device m_sid; + required_device m_tpi1; + required_device m_tpi2; + required_device m_acia; + required_device m_cia; + required_device m_ieee1; + required_device m_ieee2; + required_device m_joy1; + required_device m_joy2; + required_device m_exp; + required_device m_user; + required_device m_ram; + required_device m_cassette; + required_device m_ieee; + optional_device m_ext_cpu; + optional_device m_ext_pic; + optional_device m_ext_cia; + optional_device m_ext_tpi; + required_memory_region m_basic; + required_memory_region m_kernal; + required_memory_region m_charom; + optional_shared_ptr m_buffer_ram; + optional_shared_ptr m_extbuf_ram; + optional_shared_ptr m_video_ram; + required_ioport_array<8> m_pa; + required_ioport_array<8> m_pb; + required_ioport m_lock; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + + DECLARE_MACHINE_START( cbm2 ); + DECLARE_MACHINE_START( cbm2_ntsc ); + DECLARE_MACHINE_START( cbm2_pal ); + DECLARE_MACHINE_START( cbm2x_ntsc ); + DECLARE_MACHINE_START( cbm2x_pal ); + DECLARE_MACHINE_RESET( cbm2 ); + + virtual void read_pla(offs_t offset, int ras, int cas, int refen, int eras, int ecas, + int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *rasseg1, int *rasseg2, int *rasseg3, int *rasseg4); + + void bankswitch(offs_t offset, int eras, int ecas, int refen, int cas, int ras, int *sysioen, int *dramen, + int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *buframcs, int *extbufcs, int *vidramcs, + int *diskromcs, int *csbank1, int *csbank2, int *csbank3, int *basiccs, int *knbcs, int *kernalcs, + int *crtccs, int *cs1, int *sidcs, int *extprtcs, int *ciacs, int *aciacs, int *tript1cs, int *tript2cs); + + UINT8 read_keyboard(); + void set_busy2(int state); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + DECLARE_READ8_MEMBER( ext_read ); + DECLARE_WRITE8_MEMBER( ext_write ); + + DECLARE_READ8_MEMBER( sid_potx_r ); + DECLARE_READ8_MEMBER( sid_poty_r ); + + DECLARE_WRITE_LINE_MEMBER( tpi1_irq_w ); + DECLARE_READ8_MEMBER( tpi1_pa_r ); + DECLARE_WRITE8_MEMBER( tpi1_pa_w ); + DECLARE_READ8_MEMBER( tpi1_pb_r ); + DECLARE_WRITE8_MEMBER( tpi1_pb_w ); + DECLARE_WRITE_LINE_MEMBER( tpi1_ca_w ); + DECLARE_WRITE_LINE_MEMBER( tpi1_cb_w ); + + DECLARE_WRITE8_MEMBER( tpi2_pa_w ); + DECLARE_WRITE8_MEMBER( tpi2_pb_w ); + DECLARE_READ8_MEMBER( tpi2_pc_r ); + + DECLARE_READ8_MEMBER( cia_pa_r ); + DECLARE_WRITE8_MEMBER( cia_pa_w ); + DECLARE_READ8_MEMBER( cia_pb_r ); + + DECLARE_READ8_MEMBER( ext_tpi_pb_r ); + DECLARE_WRITE8_MEMBER( ext_tpi_pb_w ); + DECLARE_WRITE8_MEMBER( ext_tpi_pc_w ); + + DECLARE_WRITE_LINE_MEMBER( ext_cia_irq_w ); + DECLARE_READ8_MEMBER( ext_cia_pb_r ); + DECLARE_WRITE8_MEMBER( ext_cia_pb_w ); + + DECLARE_WRITE_LINE_MEMBER( user_irq_w ); + + MC6845_UPDATE_ROW( crtc_update_row ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( cbmb ); + // memory state + int m_dramon; + int m_busen1; + int m_busy2; + + // video state + size_t m_video_ram_size; + int m_graphics; + int m_ntsc; + + // interrupt state + int m_todclk; + int m_tpi1_irq; + int m_acia_irq; + int m_user_irq; + + // keyboard state; + UINT8 m_tpi2_pa; + UINT8 m_tpi2_pb; + UINT8 m_cia_pa; + + UINT8 m_ext_cia_pb; + UINT8 m_ext_tpi_pb; + + // timers + emu_timer *m_todclk_timer; +}; + + +class cbm2hp_state : public cbm2_state +{ +public: + cbm2hp_state(const machine_config &mconfig, device_type type, const char *tag) + : cbm2_state(mconfig, type, tag) + { } + + virtual void read_pla(offs_t offset, int ras, int cas, int refen, int eras, int ecas, + int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *rasseg1, int *rasseg2, int *rasseg3, int *rasseg4) override; + + DECLARE_READ8_MEMBER( tpi2_pc_r ); +}; + + +class p500_state : public cbm2_state +{ +public: + p500_state(const machine_config &mconfig, device_type type, const char *tag) + : cbm2_state(mconfig, type, tag), + m_pla2(*this, PLA2_TAG), + m_vic(*this, MOS6569_TAG), + m_color_ram(*this, "color_ram"), + m_statvid(1), + m_vicdotsel(1), + m_vicbnksel(0x03), + m_vic_irq(CLEAR_LINE) + { } + + required_device m_pla2; + required_device m_vic; + optional_shared_ptr m_color_ram; + + DECLARE_MACHINE_START( p500 ); + DECLARE_MACHINE_START( p500_ntsc ); + DECLARE_MACHINE_START( p500_pal ); + DECLARE_MACHINE_RESET( p500 ); + + void read_pla1(offs_t offset, int busy2, int clrnibcsb, int procvid, int refen, int ba, int aec, int srw, + int *datxen, int *dramxen, int *clrniben, int *segf, int *_64kcasen, int *casenb, int *viddaten, int *viddat_tr); + + void read_pla2(offs_t offset, offs_t va, int ba, int vicen, int ae, int segf, int bank0, + int *clrnibcsb, int *extbufcs, int *discromcs, int *buframcs, int *charomcs, int *procvid, int *viccs, int *vidmatcs); + + void bankswitch(offs_t offset, offs_t va, int srw, int ba, int ae, int busy2, int refen, + int *datxen, int *dramxen, int *clrniben, int *_64kcasen, int *casenb, int *viddaten, int *viddat_tr, + int *clrnibcs, int *extbufcs, int *discromcs, int *buframcs, int *charomcs, int *viccs, int *vidmatcs, + int *csbank1, int *csbank2, int *csbank3, int *basiclocs, int *basichics, int *kernalcs, + int *cs1, int *sidcs, int *extprtcs, int *ciacs, int *aciacs, int *tript1cs, int *tript2cs, int *aec, int *vsysaden); + + UINT8 read_memory(address_space &space, offs_t offset, offs_t va, int ba, int ae); + void write_memory(address_space &space, offs_t offset, UINT8 data, int ba, int ae); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_READ8_MEMBER( vic_videoram_r ); + DECLARE_READ8_MEMBER( vic_colorram_r ); + DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); + + DECLARE_WRITE_LINE_MEMBER( tpi1_irq_w ); + DECLARE_WRITE_LINE_MEMBER( tpi1_ca_w ); + DECLARE_WRITE_LINE_MEMBER( tpi1_cb_w ); + + DECLARE_READ8_MEMBER( tpi2_pc_r ); + DECLARE_WRITE8_MEMBER( tpi2_pc_w ); + + DECLARE_WRITE_LINE_MEMBER( user_irq_w ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( p500 ); + // video state + int m_statvid; + int m_vicdotsel; + int m_vicbnksel; + + // interrupt state + int m_vic_irq; +}; + //************************************************************************** @@ -1370,22 +1658,22 @@ UINT8 cbm2_state::read_keyboard() { UINT8 data = 0xff; - if (!BIT(m_tpi2_pa, 0)) data &= m_pa0->read(); - if (!BIT(m_tpi2_pa, 1)) data &= m_pa1->read(); - if (!BIT(m_tpi2_pa, 2)) data &= m_pa2->read(); - if (!BIT(m_tpi2_pa, 3)) data &= m_pa3->read(); - if (!BIT(m_tpi2_pa, 4)) data &= m_pa4->read(); - if (!BIT(m_tpi2_pa, 5)) data &= m_pa5->read(); - if (!BIT(m_tpi2_pa, 6)) data &= m_pa6->read(); - if (!BIT(m_tpi2_pa, 7)) data &= m_pa7->read(); - if (!BIT(m_tpi2_pb, 0)) data &= m_pb0->read() & m_lock->read(); - if (!BIT(m_tpi2_pb, 1)) data &= m_pb1->read(); - if (!BIT(m_tpi2_pb, 2)) data &= m_pb2->read(); - if (!BIT(m_tpi2_pb, 3)) data &= m_pb3->read(); - if (!BIT(m_tpi2_pb, 4)) data &= m_pb4->read(); - if (!BIT(m_tpi2_pb, 5)) data &= m_pb5->read(); - if (!BIT(m_tpi2_pb, 6)) data &= m_pb6->read(); - if (!BIT(m_tpi2_pb, 7)) data &= m_pb7->read(); + if (!BIT(m_tpi2_pa, 0)) data &= m_pa[0]->read(); + if (!BIT(m_tpi2_pa, 1)) data &= m_pa[1]->read(); + if (!BIT(m_tpi2_pa, 2)) data &= m_pa[2]->read(); + if (!BIT(m_tpi2_pa, 3)) data &= m_pa[3]->read(); + if (!BIT(m_tpi2_pa, 4)) data &= m_pa[4]->read(); + if (!BIT(m_tpi2_pa, 5)) data &= m_pa[5]->read(); + if (!BIT(m_tpi2_pa, 6)) data &= m_pa[6]->read(); + if (!BIT(m_tpi2_pa, 7)) data &= m_pa[7]->read(); + if (!BIT(m_tpi2_pb, 0)) data &= m_pb[0]->read() & m_lock->read(); + if (!BIT(m_tpi2_pb, 1)) data &= m_pb[1]->read(); + if (!BIT(m_tpi2_pb, 2)) data &= m_pb[2]->read(); + if (!BIT(m_tpi2_pb, 3)) data &= m_pb[3]->read(); + if (!BIT(m_tpi2_pb, 4)) data &= m_pb[4]->read(); + if (!BIT(m_tpi2_pb, 5)) data &= m_pb[5]->read(); + if (!BIT(m_tpi2_pb, 6)) data &= m_pb[6]->read(); + if (!BIT(m_tpi2_pb, 7)) data &= m_pb[7]->read(); return data; } diff --git a/src/mame/drivers/ep64.cpp b/src/mame/drivers/ep64.cpp index 84a529841f9..53e4a23b9c1 100644 --- a/src/mame/drivers/ep64.cpp +++ b/src/mame/drivers/ep64.cpp @@ -149,8 +149,72 @@ Notes: (All IC's shown) */ -#include "includes/ep64.h" +#include "emu.h" #include "softlist.h" +#include "audio/dave.h" +#include "bus/rs232/rs232.h" +#include "bus/ep64/exp.h" +#include "cpu/z80/z80.h" +#include "imagedev/cassette.h" +#include "bus/centronics/ctronics.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "machine/ram.h" +#include "video/nick.h" + +#define Z80_TAG "u1" +#define DAVE_TAG "u3" +#define NICK_TAG "u4" +#define CENTRONICS_TAG "centronics" +#define RS232_TAG "rs232" +#define CASSETTE1_TAG "cassette1" +#define CASSETTE2_TAG "cassette2" +#define SCREEN_TAG "screen" + +class ep64_state : public driver_device +{ +public: + ep64_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_dave(*this, DAVE_TAG), + m_nick(*this, NICK_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_rs232(*this, RS232_TAG), + m_cassette1(*this, CASSETTE1_TAG), + m_cassette2(*this, CASSETTE2_TAG), + m_cart(*this, "cartslot"), + m_ram(*this, RAM_TAG), + m_rom(*this, Z80_TAG), + m_y(*this, "Y%u", 0) + { } + + required_device m_maincpu; + required_device m_dave; + required_device m_nick; + required_device m_centronics; + required_device m_rs232; + required_device m_cassette1; + required_device m_cassette2; + required_device m_cart; + required_device m_ram; + required_memory_region m_rom; + required_ioport_array<10> m_y; + + virtual void machine_start() override; + virtual void machine_reset() override; + + DECLARE_READ8_MEMBER( rd0_r ); + DECLARE_WRITE8_MEMBER( wr0_w ); + DECLARE_READ8_MEMBER( rd1_r ); + DECLARE_WRITE8_MEMBER( wr2_w ); + + UINT8 m_key; + + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + int m_centronics_busy; +}; + //************************************************************************** @@ -165,18 +229,9 @@ READ8_MEMBER( ep64_state::rd0_r ) { UINT8 data = 0xff; - switch (m_key) + if (m_key < 10) { - case 0: data &= m_y0->read(); break; - case 1: data &= m_y1->read(); break; - case 2: data &= m_y2->read(); break; - case 3: data &= m_y3->read(); break; - case 4: data &= m_y4->read(); break; - case 5: data &= m_y5->read(); break; - case 6: data &= m_y6->read(); break; - case 7: data &= m_y7->read(); break; - case 8: data &= m_y8->read(); break; - case 9: data &= m_y9->read(); break; + data &= m_y[m_key]->read(); } return data; diff --git a/src/mame/drivers/kyocera.cpp b/src/mame/drivers/kyocera.cpp index aef7a702593..d6f155da916 100644 --- a/src/mame/drivers/kyocera.cpp +++ b/src/mame/drivers/kyocera.cpp @@ -440,15 +440,10 @@ READ8_MEMBER( kc85_state::keyboard_r ) { UINT8 data = 0xff; - if (!BIT(m_keylatch, 0)) data &= m_y0->read(); - if (!BIT(m_keylatch, 1)) data &= m_y1->read(); - if (!BIT(m_keylatch, 2)) data &= m_y2->read(); - if (!BIT(m_keylatch, 3)) data &= m_y3->read(); - if (!BIT(m_keylatch, 4)) data &= m_y4->read(); - if (!BIT(m_keylatch, 5)) data &= m_y5->read(); - if (!BIT(m_keylatch, 6)) data &= m_y6->read(); - if (!BIT(m_keylatch, 7)) data &= m_y7->read(); - if (!BIT(m_keylatch, 8)) data &= m_y8->read(); + for (int i = 0; i < 9; i++) + { + if (!BIT(m_keylatch, i)) data &= m_y[i]->read(); + } return data; } @@ -500,15 +495,10 @@ READ8_MEMBER( tandy200_state::stbk_r ) { UINT8 data = 0xff; - if (!BIT(m_keylatch, 0)) data &= m_y0->read(); - if (!BIT(m_keylatch, 1)) data &= m_y1->read(); - if (!BIT(m_keylatch, 2)) data &= m_y2->read(); - if (!BIT(m_keylatch, 3)) data &= m_y3->read(); - if (!BIT(m_keylatch, 4)) data &= m_y4->read(); - if (!BIT(m_keylatch, 5)) data &= m_y5->read(); - if (!BIT(m_keylatch, 6)) data &= m_y6->read(); - if (!BIT(m_keylatch, 7)) data &= m_y7->read(); - if (!BIT(m_keylatch, 8)) data &= m_y8->read(); + for (int i = 0; i < 9; i++) + { + if (!BIT(m_keylatch, i)) data &= m_y[i]->read(); + } return data; } diff --git a/src/mame/drivers/mc1000.cpp b/src/mame/drivers/mc1000.cpp index c98f66b601e..f805132534d 100644 --- a/src/mame/drivers/mc1000.cpp +++ b/src/mame/drivers/mc1000.cpp @@ -22,8 +22,99 @@ */ -#include "includes/mc1000.h" #include "softlist.h" +#include "emu.h" +#include "cpu/z80/z80.h" +#include "imagedev/cassette.h" +#include "video/mc6845.h" +#include "video/mc6847.h" +#include "sound/ay8910.h" +#include "bus/centronics/ctronics.h" +#include "machine/rescap.h" +#include "machine/ram.h" + +#define SCREEN_TAG "screen" +#define Z80_TAG "u13" +#define AY8910_TAG "u21" +#define MC6845_TAG "mc6845" +#define MC6847_TAG "u19" +#define CENTRONICS_TAG "centronics" + +#define MC1000_MC6845_VIDEORAM_SIZE 0x800 +#define MC1000_MC6847_VIDEORAM_SIZE 0x1800 + +class mc1000_state : public driver_device +{ +public: + mc1000_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_vdg(*this, MC6847_TAG), + m_crtc(*this, MC6845_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_cassette(*this, "cassette"), + m_ram(*this, RAM_TAG), + m_rom(*this, Z80_TAG), + m_mc6845_video_ram(*this, "mc6845_vram"), + m_mc6847_video_ram(*this, "mc6847_vram"), + m_y(*this, "Y%u", 0), + m_joy(*this, "JOY%u", 0), + m_modifiers(*this, "MODIFIERS"), + m_joykeymap(*this, "JOYKEYMAP%u", 0) + { } + + required_device m_maincpu; + required_device m_vdg; + optional_device m_crtc; + required_device m_centronics; + required_device m_cassette; + required_device m_ram; + required_memory_region m_rom; + required_shared_ptr m_mc6845_video_ram; + required_shared_ptr m_mc6847_video_ram; + required_ioport_array<8> m_y; + required_ioport_array<2> m_joy; + required_ioport m_modifiers; + required_ioport_array<2> m_joykeymap; + + virtual void machine_start() override; + virtual void machine_reset() override; + + DECLARE_READ8_MEMBER( printer_r ); + DECLARE_WRITE8_MEMBER( printer_w ); + DECLARE_WRITE8_MEMBER( mc6845_ctrl_w ); + DECLARE_WRITE8_MEMBER( mc6847_attr_w ); + DECLARE_WRITE_LINE_MEMBER( fs_w ); + DECLARE_WRITE_LINE_MEMBER( hs_w ); + DECLARE_READ8_MEMBER( videoram_r ); + DECLARE_WRITE8_MEMBER( keylatch_w ); + DECLARE_READ8_MEMBER( keydata_r ); + DIRECT_UPDATE_MEMBER(mc1000_direct_update_handler); + + void bankswitch(); + + /* cpu state */ + int m_ne555_int; + + /* memory state */ + int m_rom0000; + int m_mc6845_bank; + int m_mc6847_bank; + + /* keyboard state */ + int m_keylatch; + + /* video state */ + int m_hsync; + int m_vsync; + UINT8 m_mc6847_attr; + + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + int m_centronics_busy; + + DECLARE_DRIVER_INIT(mc1000); + TIMER_DEVICE_CALLBACK_MEMBER(ne555_tick); +}; /* Memory Banking */ @@ -155,7 +246,7 @@ ADDRESS_MAP_END /* Input Ports */ static INPUT_PORTS_START( mc1000 ) - PORT_START("JOYA") /* Player 1 */ + PORT_START("JOY0") /* Player 1 */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) /* = 'I' */ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) /* = 'Q' */ @@ -164,7 +255,7 @@ static INPUT_PORTS_START( mc1000 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* = '9' */ PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("JOYB") /* Player 2 */ + PORT_START("JOY1") /* Player 2 */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) /* = '@' */ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) /* = 'H' */ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) /* = 'P' */ @@ -248,12 +339,12 @@ static INPUT_PORTS_START( mc1000 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL)) - PORT_START("JOYAKEYMAP") + PORT_START("JOYKEYMAP0") PORT_CONFNAME( 0x01, 0x00, "JOYSTICK A (P1) keyboard mapping" ) PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) PORT_CONFSETTING( 0x01, DEF_STR( On ) ) - PORT_START("JOYBKEYMAP") + PORT_START("JOYKEYMAP1") PORT_CONFNAME( 0x01, 0x00, "JOYSTICK B (P2) keyboard mapping" ) PORT_CONFSETTING( 0x00, DEF_STR( Off ) ) PORT_CONFSETTING( 0x01, DEF_STR( On ) ) @@ -295,20 +386,20 @@ READ8_MEMBER( mc1000_state::keydata_r ) if (!BIT(m_keylatch, 0)) { - data &= m_y0->read(); - if (m_joybkeymap->read()) data &= m_joyb->read(); + data &= m_y[0]->read(); + if (m_joykeymap[1]->read()) data &= m_joy[1]->read(); } if (!BIT(m_keylatch, 1)) { - data &= m_y1->read(); - if (m_joyakeymap->read()) data &= m_joya->read(); + data &= m_y[1]->read(); + if (m_joykeymap[0]->read()) data &= m_joy[0]->read(); } - if (!BIT(m_keylatch, 2)) data &= m_y2->read(); - if (!BIT(m_keylatch, 3)) data &= m_y3->read(); - if (!BIT(m_keylatch, 4)) data &= m_y4->read(); - if (!BIT(m_keylatch, 5)) data &= m_y5->read(); - if (!BIT(m_keylatch, 6)) data &= m_y6->read(); - if (!BIT(m_keylatch, 7)) data &= m_y7->read(); + if (!BIT(m_keylatch, 2)) data &= m_y[2]->read(); + if (!BIT(m_keylatch, 3)) data &= m_y[3]->read(); + if (!BIT(m_keylatch, 4)) data &= m_y[4]->read(); + if (!BIT(m_keylatch, 5)) data &= m_y[5]->read(); + if (!BIT(m_keylatch, 6)) data &= m_y[6]->read(); + if (!BIT(m_keylatch, 7)) data &= m_y[7]->read(); data = (m_modifiers->read() & 0xc0) | (data & 0x3f); diff --git a/src/mame/drivers/newbrain.cpp b/src/mame/drivers/newbrain.cpp index fb0de502c69..5dd4764501b 100644 --- a/src/mame/drivers/newbrain.cpp +++ b/src/mame/drivers/newbrain.cpp @@ -490,25 +490,7 @@ WRITE8_MEMBER( newbrain_state::cop_d_w ) if (!m_cop_k6 && k6) { //CD4076 CLK - switch (m_keylatch) - { - case 0: m_keydata = m_y0->read(); break; - case 1: m_keydata = m_y1->read(); break; - case 2: m_keydata = m_y2->read(); break; - case 3: m_keydata = m_y3->read(); break; - case 4: m_keydata = m_y4->read(); break; - case 5: m_keydata = m_y5->read(); break; - case 6: m_keydata = m_y6->read(); break; - case 7: m_keydata = m_y7->read(); break; - case 8: m_keydata = m_y8->read(); break; - case 9: m_keydata = m_y9->read(); break; - case 10: m_keydata = m_y10->read(); break; - case 11: m_keydata = m_y11->read(); break; - case 12: m_keydata = m_y12->read(); break; - case 13: m_keydata = m_y13->read(); break; - case 14: m_keydata = m_y14->read(); break; - case 15: m_keydata = m_y15->read(); break; - } + m_keydata = m_y[m_keylatch]->read(); if (LOG_COP) logerror("%s %s keydata %01x\n", machine().time().as_string(), machine().describe_context(), m_keydata); } else if (m_cop_k6 && k6) { diff --git a/src/mame/drivers/pet.cpp b/src/mame/drivers/pet.cpp index 4dd733c274b..9e967e41d4b 100644 --- a/src/mame/drivers/pet.cpp +++ b/src/mame/drivers/pet.cpp @@ -149,10 +149,263 @@ ROM sockets: UA3 2K or 4K character */ -#include "includes/pet.h" -#include "bus/ieee488/c2040.h" -#include "machine/cbm_snqk.h" +#include "emu.h" #include "softlist.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" +#include "bus/ieee488/c2040.h" +#include "bus/ieee488/c8050.h" +#include "bus/ieee488/ieee488.h" +#include "bus/pet/cass.h" +#include "bus/pet/exp.h" +#include "bus/pet/user.h" +#include "cpu/m6502/m6502.h" +#include "imagedev/snapquik.h" +#include "machine/6522via.h" +#include "machine/6821pia.h" +#include "machine/cbm_snqk.h" +#include "machine/pla.h" +#include "machine/ram.h" +#include "sound/speaker.h" +#include "video/mc6845.h" + +#define M6502_TAG "f3" +#define M6522_TAG "a5" +#define M6520_1_TAG "g8" +#define M6520_2_TAG "b8" +#define MC6845_TAG "ub13" +#define SCREEN_TAG "screen" +#define PLA1_TAG "ue6" +#define PLA2_TAG "ue5" +#define PET_USER_PORT_TAG "user" + +class pet_state : public driver_device +{ +public: + pet_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, M6502_TAG), + m_via(*this, M6522_TAG), + m_pia1(*this, M6520_1_TAG), + m_pia2(*this, M6520_2_TAG), + m_crtc(*this, MC6845_TAG), + m_ieee(*this, IEEE488_TAG), + m_palette(*this, "palette"), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_cassette2(*this, PET_DATASSETTE_PORT2_TAG), + m_exp(*this, PET_EXPANSION_SLOT_TAG), + m_user(*this, PET_USER_PORT_TAG), + m_speaker(*this, "speaker"), + m_cart_9000(*this, "cart_9000"), + m_cart_a000(*this, "cart_a000"), + m_cart_b000(*this, "cart_b000"), + m_ram(*this, RAM_TAG), + m_rom(*this, M6502_TAG), + m_char_rom(*this, "charom"), + m_video_ram(*this, "video_ram"), + m_row(*this, "ROW%u", 0), + m_lock(*this, "LOCK"), + m_key(0), + m_sync(0), + m_graphic(0), + m_blanktv(0), + m_via_irq(CLEAR_LINE), + m_pia1a_irq(CLEAR_LINE), + m_pia1b_irq(CLEAR_LINE), + m_pia2a_irq(CLEAR_LINE), + m_pia2b_irq(CLEAR_LINE), + m_exp_irq(CLEAR_LINE), + m_user_diag(1) + { } + + required_device m_maincpu; + required_device m_via; + required_device m_pia1; + required_device m_pia2; + optional_device m_crtc; + required_device m_ieee; + required_device m_palette; + required_device m_cassette; + required_device m_cassette2; + required_device m_exp; + required_device m_user; + optional_device m_speaker; + optional_device m_cart_9000; + optional_device m_cart_a000; + optional_device m_cart_b000; + required_device m_ram; + required_memory_region m_rom; + required_memory_region m_char_rom; + optional_shared_ptr m_video_ram; + required_ioport_array<10> m_row; + required_ioport m_lock; + + DECLARE_MACHINE_START( pet ); + DECLARE_MACHINE_START( pet2001 ); + DECLARE_MACHINE_RESET( pet ); + DECLARE_MACHINE_START( pet40 ); + DECLARE_MACHINE_RESET( pet40 ); + + MC6845_BEGIN_UPDATE( pet_begin_update ); + MC6845_UPDATE_ROW( pet40_update_row ); + + UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void check_interrupts(); + void update_speaker(); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_WRITE_LINE_MEMBER( via_irq_w ); + DECLARE_WRITE8_MEMBER( via_pa_w ); + DECLARE_READ8_MEMBER( via_pb_r ); + DECLARE_WRITE8_MEMBER( via_pb_w ); + DECLARE_WRITE_LINE_MEMBER( via_ca2_w ); + DECLARE_WRITE_LINE_MEMBER( via_cb2_w ); + + DECLARE_WRITE_LINE_MEMBER( pia1_irqa_w ); + DECLARE_WRITE_LINE_MEMBER( pia1_irqb_w ); + DECLARE_READ8_MEMBER( pia1_pa_r ); + DECLARE_READ8_MEMBER( pia1_pb_r ); + DECLARE_WRITE8_MEMBER( pia1_pa_w ); + DECLARE_WRITE_LINE_MEMBER( pia1_ca2_w ); + + DECLARE_WRITE_LINE_MEMBER( pia2_irqa_w ); + DECLARE_WRITE_LINE_MEMBER( pia2_irqb_w ); + + DECLARE_WRITE_LINE_MEMBER( user_diag_w ); + + TIMER_DEVICE_CALLBACK_MEMBER( sync_tick ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_pet ); + + enum + { + SEL0 = 0, + SEL1, + SEL2, + SEL3, + SEL4, + SEL5, + SEL6, + SEL7, + SEL8, + SEL9, + SELA, + SELB, + SELC, + SELD, + SELE, + SELF + }; + + // keyboard state + UINT8 m_key; + + // video state + int m_sync; + int m_graphic; + int m_blanktv; + int m_video_ram_size; + + // sound state + int m_via_cb2; + int m_pia1_pa7; + + UINT8 m_via_pa; + + // interrupt state + int m_via_irq; + int m_pia1a_irq; + int m_pia1b_irq; + int m_pia2a_irq; + int m_pia2b_irq; + int m_exp_irq; + int m_user_diag; +}; + + +class pet2001b_state : public pet_state +{ +public: + pet2001b_state(const machine_config &mconfig, device_type type, const char *tag) : + pet_state(mconfig, type, tag) + { } + + DECLARE_READ8_MEMBER( pia1_pb_r ); +}; + + +class pet80_state : public pet2001b_state +{ +public: + pet80_state(const machine_config &mconfig, device_type type, const char *tag) : + pet2001b_state(mconfig, type, tag) + { } + + DECLARE_MACHINE_START( pet80 ); + DECLARE_MACHINE_RESET( pet80 ); + + MC6845_UPDATE_ROW( pet80_update_row ); + MC6845_UPDATE_ROW( cbm8296_update_row ); +}; + + +class superpet_state : public pet80_state +{ +public: + superpet_state(const machine_config &mconfig, device_type type, const char *tag) + : pet80_state(mconfig, type, tag) + { } +}; + + +class cbm8096_state : public pet80_state +{ +public: + cbm8096_state(const machine_config &mconfig, device_type type, const char *tag) : + pet80_state(mconfig, type, tag) + { } +}; + + +class cbm8296_state : public pet80_state +{ +public: + cbm8296_state(const machine_config &mconfig, device_type type, const char *tag) : + pet80_state(mconfig, type, tag), + m_basic_rom(*this, "basic"), + m_editor_rom(*this, "editor"), + m_ue5_rom(*this, "ue5_eprom"), + m_ue6_rom(*this, "ue6_eprom"), + m_pla1(*this, PLA1_TAG), + m_pla2(*this, PLA2_TAG) + { } + + required_memory_region m_basic_rom; + required_memory_region m_editor_rom; + required_memory_region m_ue5_rom; + required_memory_region m_ue6_rom; + required_device m_pla1; + required_device m_pla2; + + DECLARE_MACHINE_START( cbm8296 ); + DECLARE_MACHINE_RESET( cbm8296 ); + + void read_pla1(offs_t offset, int phi2, int brw, int noscreen, int noio, int ramsela, int ramsel9, int ramon, int norom, + int &cswff, int &cs9, int &csa, int &csio, int &cse, int &cskb, int &fa12, int &casena1); + void read_pla2(offs_t offset, int phi2, int brw, int casena1, int &endra, int &noscreen, int &casena2, int &fa15); + + void read_pla1_eprom(offs_t offset, int phi2, int brw, int noscreen, int noio, int ramsela, int ramsel9, int ramon, int norom, + int &cswff, int &cs9, int &csa, int &csio, int &cse, int &cskb, int &fa12, int &casena1); + void read_pla2_eprom(offs_t offset, int phi2, int brw, int casena1, int &endra, int &noscreen, int &casena2, int &fa15); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + UINT8 m_cr; +}; static void cbm_pet_quick_sethiaddress( address_space &space, UINT16 hiaddress ) @@ -1027,16 +1280,16 @@ READ8_MEMBER( pet_state::pia1_pb_r ) switch (m_key) { - case 0: data &= m_row0->read(); break; - case 1: data &= m_row1->read(); break; - case 2: data &= m_row2->read(); break; - case 3: data &= m_row3->read(); break; - case 4: data &= m_row4->read(); break; - case 5: data &= m_row5->read(); break; - case 6: data &= m_row6->read(); break; - case 7: data &= m_row7->read(); break; - case 8: data &= m_row8->read() & m_lock->read(); break; - case 9: data &= m_row9->read(); break; + case 0: data &= m_row[0]->read(); break; + case 1: data &= m_row[1]->read(); break; + case 2: data &= m_row[2]->read(); break; + case 3: data &= m_row[3]->read(); break; + case 4: data &= m_row[4]->read(); break; + case 5: data &= m_row[5]->read(); break; + case 6: data &= m_row[6]->read(); break; + case 7: data &= m_row[7]->read(); break; + case 8: data &= m_row[8]->read() & m_lock->read(); break; + case 9: data &= m_row[9]->read(); break; } return data; @@ -1048,16 +1301,16 @@ READ8_MEMBER( pet2001b_state::pia1_pb_r ) switch (m_key) { - case 0: data &= m_row0->read(); break; - case 1: data &= m_row1->read(); break; - case 2: data &= m_row2->read(); break; - case 3: data &= m_row3->read(); break; - case 4: data &= m_row4->read(); break; - case 5: data &= m_row5->read(); break; - case 6: data &= m_row6->read() & m_lock->read(); break; - case 7: data &= m_row7->read(); break; - case 8: data &= m_row8->read(); break; - case 9: data &= m_row9->read(); break; + case 0: data &= m_row[0]->read(); break; + case 1: data &= m_row[1]->read(); break; + case 2: data &= m_row[2]->read(); break; + case 3: data &= m_row[3]->read(); break; + case 4: data &= m_row[4]->read(); break; + case 5: data &= m_row[5]->read(); break; + case 6: data &= m_row[6]->read() & m_lock->read(); break; + case 7: data &= m_row[7]->read(); break; + case 8: data &= m_row[8]->read(); break; + case 9: data &= m_row[9]->read(); break; } return data; diff --git a/src/mame/drivers/plus4.cpp b/src/mame/drivers/plus4.cpp index d87ccb65e55..321233c9582 100644 --- a/src/mame/drivers/plus4.cpp +++ b/src/mame/drivers/plus4.cpp @@ -11,10 +11,158 @@ */ -#include "includes/plus4.h" -#include "machine/cbm_snqk.h" -#include "sound/t6721a.h" +#include "emu.h" #include "softlist.h" +#include "bus/cbmiec/cbmiec.h" +#include "bus/pet/cass.h" +#include "bus/plus4/exp.h" +#include "bus/plus4/user.h" +#include "bus/vcs_ctrl/ctrl.h" +#include "cpu/m6502/m7501.h" +#include "imagedev/snapquik.h" +#include "machine/cbm_snqk.h" +#include "machine/mos6529.h" +#include "machine/mos6551.h" +#include "machine/mos8706.h" +#include "machine/pla.h" +#include "machine/ram.h" +#include "sound/mos7360.h" +#include "sound/t6721a.h" + +#define MOS7501_TAG "u2" +#define MOS7360_TAG "u1" +#define MOS6551_TAG "u3" +#define MOS6529_USER_TAG "u5" +#define MOS6529_KB_TAG "u27" +#define T6721A_TAG "t6721a" +#define MOS8706_TAG "mos8706" +#define PLA_TAG "u19" +#define SCREEN_TAG "screen" +#define CONTROL1_TAG "joy1" +#define CONTROL2_TAG "joy2" +#define PET_USER_PORT_TAG "user" + +class plus4_state : public driver_device +{ +public: + plus4_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, MOS7501_TAG), + m_pla(*this, PLA_TAG), + m_ted(*this, MOS7360_TAG), + m_acia(*this, MOS6551_TAG), + m_spi_user(*this, MOS6529_USER_TAG), + m_spi_kb(*this, MOS6529_KB_TAG), + m_vslsi(*this, MOS8706_TAG), + m_iec(*this, CBM_IEC_TAG), + m_joy1(*this, CONTROL1_TAG), + m_joy2(*this, CONTROL2_TAG), + m_exp(*this, PLUS4_EXPANSION_SLOT_TAG), + m_user(*this, PET_USER_PORT_TAG), + m_ram(*this, RAM_TAG), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_kernal(*this, "kernal"), + m_function(*this, "function"), + m_c2(*this, "c2"), + m_row(*this, "ROW%u", 0), + m_lock(*this, "LOCK"), + m_addr(0), + m_ted_irq(CLEAR_LINE), + m_acia_irq(CLEAR_LINE), + m_exp_irq(CLEAR_LINE) + { } + + required_device m_maincpu; + required_device m_pla; + required_device m_ted; + optional_device m_acia; + optional_device m_spi_user; + required_device m_spi_kb; + optional_device m_vslsi; + required_device m_iec; + required_device m_joy1; + required_device m_joy2; + required_device m_exp; + optional_device m_user; + required_device m_ram; + required_device m_cassette; + required_memory_region m_kernal; + optional_memory_region m_function; + optional_memory_region m_c2; + required_ioport_array<8> m_row; + required_ioport m_lock; + + virtual void machine_start() override; + virtual void machine_reset() override; + + void check_interrupts(); + void bankswitch(offs_t offset, int phi0, int mux, int ras, int *scs, int *phi2, int *user, int *_6551, int *addr_clk, int *keyport, int *kernal); + UINT8 read_memory(address_space &space, offs_t offset, int ba, int scs, int phi2, int user, int _6551, int addr_clk, int keyport, int kernal); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + DECLARE_READ8_MEMBER( ted_videoram_r ); + + DECLARE_READ8_MEMBER( cpu_r ); + DECLARE_WRITE8_MEMBER( cpu_w ); + + DECLARE_WRITE_LINE_MEMBER( ted_irq_w ); + DECLARE_READ8_MEMBER( ted_k_r ); + + DECLARE_WRITE_LINE_MEMBER( write_kb0 ) { if (state) m_kb |= 1; else m_kb &= ~1; } + DECLARE_WRITE_LINE_MEMBER( write_kb1 ) { if (state) m_kb |= 2; else m_kb &= ~2; } + DECLARE_WRITE_LINE_MEMBER( write_kb2 ) { if (state) m_kb |= 4; else m_kb &= ~4; } + DECLARE_WRITE_LINE_MEMBER( write_kb3 ) { if (state) m_kb |= 8; else m_kb &= ~8; } + DECLARE_WRITE_LINE_MEMBER( write_kb4 ) { if (state) m_kb |= 16; else m_kb &= ~16; } + DECLARE_WRITE_LINE_MEMBER( write_kb5 ) { if (state) m_kb |= 32; else m_kb &= ~32; } + DECLARE_WRITE_LINE_MEMBER( write_kb6 ) { if (state) m_kb |= 64; else m_kb &= ~64; } + DECLARE_WRITE_LINE_MEMBER( write_kb7 ) { if (state) m_kb |= 128; else m_kb &= ~128; } + + DECLARE_WRITE_LINE_MEMBER( acia_irq_w ); + + DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_c16 ); + + enum + { + CS0_BASIC = 0, + CS0_FUNCTION_LO, + CS0_C1_LOW, + CS0_C2_LOW + }; + + enum + { + CS1_KERNAL = 0, + CS1_FUNCTION_HI, + CS1_C1_HIGH, + CS1_C2_HIGH + }; + + // memory state + UINT8 m_addr; + + // interrupt state + int m_ted_irq; + int m_acia_irq; + int m_exp_irq; + + // keyboard state + UINT8 m_kb; +}; + + +class c16_state : public plus4_state +{ +public: + c16_state(const machine_config &mconfig, device_type type, const char *tag) + : plus4_state(mconfig, type, tag) + { } + + DECLARE_READ8_MEMBER( cpu_r ); +}; + //************************************************************************** @@ -609,14 +757,14 @@ READ8_MEMBER( plus4_state::ted_k_r ) } // keyboard - if (!BIT(m_kb, 7)) data &= m_row7->read(); - if (!BIT(m_kb, 6)) data &= m_row6->read(); - if (!BIT(m_kb, 5)) data &= m_row5->read(); - if (!BIT(m_kb, 4)) data &= m_row4->read(); - if (!BIT(m_kb, 3)) data &= m_row3->read(); - if (!BIT(m_kb, 2)) data &= m_row2->read(); - if (!BIT(m_kb, 1)) data &= m_row1->read() & m_lock->read(); - if (!BIT(m_kb, 0)) data &= m_row0->read(); + if (!BIT(m_kb, 7)) data &= m_row[7]->read(); + if (!BIT(m_kb, 6)) data &= m_row[6]->read(); + if (!BIT(m_kb, 5)) data &= m_row[5]->read(); + if (!BIT(m_kb, 4)) data &= m_row[4]->read(); + if (!BIT(m_kb, 3)) data &= m_row[3]->read(); + if (!BIT(m_kb, 2)) data &= m_row[2]->read(); + if (!BIT(m_kb, 1)) data &= m_row[1]->read() & m_lock->read(); + if (!BIT(m_kb, 0)) data &= m_row[0]->read(); return data; } diff --git a/src/mame/drivers/ql.cpp b/src/mame/drivers/ql.cpp index 9822373350b..e359395d530 100644 --- a/src/mame/drivers/ql.cpp +++ b/src/mame/drivers/ql.cpp @@ -73,8 +73,124 @@ */ -#include "includes/ql.h" +#include "emu.h" #include "softlist.h" +#include "bus/ql/exp.h" +#include "bus/ql/rom.h" +#include "bus/rs232/rs232.h" +#include "cpu/m68000/m68000.h" +#include "cpu/mcs48/mcs48.h" +#include "machine/microdrv.h" +#include "machine/qimi.h" +#include "machine/ram.h" +#include "machine/zx8302.h" +#include "sound/speaker.h" +#include "video/zx8301.h" + +#define SCREEN_TAG "screen" + +#define M68008_TAG "ic18" +#define I8749_TAG "ic24" +#define I8051_TAG "i8051" +#define ZX8301_TAG "ic22" +#define ZX8302_TAG "ic23" +#define RS232_A_TAG "ser1" +#define RS232_B_TAG "ser2" +#define QIMI_TAG "qimi" + +#define X1 XTAL_15MHz +#define X2 XTAL_32_768kHz +#define X3 XTAL_4_436MHz +#define X4 XTAL_11MHz + +class ql_state : public driver_device +{ +public: + ql_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, M68008_TAG), + m_ipc(*this, I8749_TAG), + m_zx8301(*this, ZX8301_TAG), + m_zx8302(*this, ZX8302_TAG), + m_speaker(*this, "speaker"), + m_mdv1(*this, MDV_1), + m_mdv2(*this, MDV_2), + m_ser1(*this, RS232_A_TAG), + m_ser2(*this, RS232_A_TAG), + m_ram(*this, RAM_TAG), + m_exp(*this, "exp"), + m_cart(*this, "rom"), + m_qimi(*this, QIMI_TAG), + m_rom(*this, M68008_TAG), + m_y(*this, "Y%u", 0), + m_joy(*this, "JOY%u", 0), + m_config(*this, "config"), + m_extintl(CLEAR_LINE), + m_keylatch(0), + m_ipl(0), + m_comdata_to_ipc(0), + m_baudx4(0), + m_qimi_enabled(false), + m_qimi_extint(CLEAR_LINE) + { } + + required_device m_maincpu; + required_device m_ipc; + required_device m_zx8301; + required_device m_zx8302; + required_device m_speaker; + required_device m_mdv1; + required_device m_mdv2; + required_device m_ser1; + required_device m_ser2; + required_device m_ram; + required_device m_exp; + required_device m_cart; + optional_device m_qimi; + required_memory_region m_rom; + required_ioport_array<8> m_y; + required_ioport_array<2> m_joy; + required_ioport m_config; + + virtual void machine_start() override; + virtual void machine_reset() override; + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_WRITE8_MEMBER( ipc_w ); + DECLARE_WRITE8_MEMBER( ipc_port1_w ); + DECLARE_WRITE8_MEMBER( ipc_port2_w ); + DECLARE_READ8_MEMBER( ipc_port2_r ); + DECLARE_READ8_MEMBER( ipc_t1_r ); + DECLARE_READ8_MEMBER( ipc_bus_r ); + DECLARE_WRITE_LINE_MEMBER( ql_baudx4_w ); + DECLARE_WRITE_LINE_MEMBER( ql_comdata_w ); + DECLARE_WRITE_LINE_MEMBER( zx8302_mdselck_w ); + DECLARE_WRITE_LINE_MEMBER( zx8302_mdrdw_w ); + DECLARE_WRITE_LINE_MEMBER( zx8302_erase_w ); + DECLARE_WRITE_LINE_MEMBER( zx8302_raw1_w ); + DECLARE_READ_LINE_MEMBER( zx8302_raw1_r ); + DECLARE_WRITE_LINE_MEMBER( zx8302_raw2_w ); + DECLARE_READ_LINE_MEMBER( zx8302_raw2_r ); + DECLARE_WRITE_LINE_MEMBER( exp_extintl_w ); + DECLARE_WRITE_LINE_MEMBER( qimi_extintl_w ); + + void update_interrupt(); + + int m_extintl; + + // IPC + UINT8 m_keylatch; + int m_ipl; + int m_comdata_to_ipc; + int m_baudx4; + + // QIMI + bool m_qimi_enabled; + int m_qimi_extint; +}; + //************************************************************************** @@ -348,21 +464,20 @@ READ8_MEMBER( ql_state::ipc_bus_r ) UINT8 data = 0; - if (BIT(m_keylatch, 0)) data |= m_y0->read() | m_joy0->read(); - if (BIT(m_keylatch, 1)) data |= m_y1->read() | m_joy1->read(); - if (BIT(m_keylatch, 2)) data |= m_y2->read(); - if (BIT(m_keylatch, 3)) data |= m_y3->read(); - if (BIT(m_keylatch, 4)) data |= m_y4->read(); - if (BIT(m_keylatch, 5)) data |= m_y5->read(); - if (BIT(m_keylatch, 6)) data |= m_y6->read(); - if (BIT(m_keylatch, 7)) data |= m_y7->read(); + if (BIT(m_keylatch, 0)) data |= m_y[0]->read() | m_joy[0]->read(); + if (BIT(m_keylatch, 1)) data |= m_y[1]->read() | m_joy[1]->read(); + if (BIT(m_keylatch, 2)) data |= m_y[2]->read(); + if (BIT(m_keylatch, 3)) data |= m_y[3]->read(); + if (BIT(m_keylatch, 4)) data |= m_y[4]->read(); + if (BIT(m_keylatch, 5)) data |= m_y[5]->read(); + if (BIT(m_keylatch, 6)) data |= m_y[6]->read(); + if (BIT(m_keylatch, 7)) data |= m_y[7]->read(); return data; } - //************************************************************************** // ADDRESS MAPS //************************************************************************** diff --git a/src/mame/drivers/vic10.cpp b/src/mame/drivers/vic10.cpp index 183af259232..42ceda580d1 100644 --- a/src/mame/drivers/vic10.cpp +++ b/src/mame/drivers/vic10.cpp @@ -9,10 +9,95 @@ */ - - -#include "includes/vic10.h" +#include "emu.h" #include "softlist.h" +#include "bus/pet/cass.h" +#include "bus/vic10/exp.h" +#include "bus/vcs_ctrl/ctrl.h" +#include "cpu/m6502/m6510.h" +#include "machine/mos6526.h" +#include "machine/ram.h" +#include "sound/dac.h" +#include "sound/mos6581.h" +#include "video/mos6566.h" + +#define M6510_TAG "u3" +#define MOS6566_TAG "u2" +#define MOS6581_TAG "u6" +#define MOS6526_TAG "u9" +#define SCREEN_TAG "screen" +#define TIMER_C1531_TAG "c1531" +#define CONTROL1_TAG "joy1" +#define CONTROL2_TAG "joy2" + +class vic10_state : public driver_device +{ +public: + vic10_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, M6510_TAG), + m_vic(*this, MOS6566_TAG), + m_sid(*this, MOS6581_TAG), + m_cia(*this, MOS6526_TAG), + m_joy1(*this, CONTROL1_TAG), + m_joy2(*this, CONTROL2_TAG), + m_exp(*this, VIC10_EXPANSION_SLOT_TAG), + m_ram(*this, RAM_TAG), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_color_ram(*this, "color_ram"), + m_row(*this, "ROW%u", 0), + m_restore(*this, "RESTORE"), + m_lock(*this, "LOCK"), + m_cia_irq(CLEAR_LINE), + m_vic_irq(CLEAR_LINE), + m_exp_irq(CLEAR_LINE) + { } + + required_device m_maincpu; + required_device m_vic; + required_device m_sid; + required_device m_cia; + required_device m_joy1; + required_device m_joy2; + required_device m_exp; + required_device m_ram; + optional_device m_cassette; + optional_shared_ptr m_color_ram; + required_ioport_array<8> m_row; + required_ioport m_restore; + required_ioport m_lock; + + virtual void machine_start() override; + virtual void machine_reset() override; + + void check_interrupts(); + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); + DECLARE_READ8_MEMBER( vic_videoram_r ); + DECLARE_READ8_MEMBER( vic_colorram_r ); + + DECLARE_READ8_MEMBER( sid_potx_r ); + DECLARE_READ8_MEMBER( sid_poty_r ); + + DECLARE_WRITE_LINE_MEMBER( cia_irq_w ); + DECLARE_READ8_MEMBER( cia_pa_r ); + DECLARE_READ8_MEMBER( cia_pb_r ); + DECLARE_WRITE8_MEMBER( cia_pb_w ); + + DECLARE_READ8_MEMBER( cpu_r ); + DECLARE_WRITE8_MEMBER( cpu_w ); + + DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); + DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); + + // interrupt state + int m_cia_irq; + int m_vic_irq; + int m_exp_irq; +}; //************************************************************************** @@ -391,8 +476,8 @@ READ8_MEMBER( vic10_state::cia_pa_r ) // keyboard UINT8 cia_pb = m_cia->pb_r(); - UINT32 row[8] = { m_row0->read(), m_row1->read() & m_lock->read(), m_row2->read(), m_row3->read(), - m_row4->read(), m_row5->read(), m_row6->read(), m_row7->read() }; + UINT32 row[8] = { m_row[0]->read(), m_row[1]->read() & m_lock->read(), m_row[2]->read(), m_row[3]->read(), + m_row[4]->read(), m_row[5]->read(), m_row[6]->read(), m_row[7]->read() }; for (int i = 0; i < 8; i++) { @@ -440,14 +525,14 @@ READ8_MEMBER( vic10_state::cia_pb_r ) // keyboard UINT8 cia_pa = m_cia->pa_r(); - if (!BIT(cia_pa, 7)) data &= m_row7->read(); - if (!BIT(cia_pa, 6)) data &= m_row6->read(); - if (!BIT(cia_pa, 5)) data &= m_row5->read(); - if (!BIT(cia_pa, 4)) data &= m_row4->read(); - if (!BIT(cia_pa, 3)) data &= m_row3->read(); - if (!BIT(cia_pa, 2)) data &= m_row2->read(); - if (!BIT(cia_pa, 1)) data &= m_row1->read() & m_lock->read(); - if (!BIT(cia_pa, 0)) data &= m_row0->read(); + if (!BIT(cia_pa, 7)) data &= m_row[7]->read(); + if (!BIT(cia_pa, 6)) data &= m_row[6]->read(); + if (!BIT(cia_pa, 5)) data &= m_row[5]->read(); + if (!BIT(cia_pa, 4)) data &= m_row[4]->read(); + if (!BIT(cia_pa, 3)) data &= m_row[3]->read(); + if (!BIT(cia_pa, 2)) data &= m_row[2]->read(); + if (!BIT(cia_pa, 1)) data &= m_row[1]->read() & m_lock->read(); + if (!BIT(cia_pa, 0)) data &= m_row[0]->read(); return data; } diff --git a/src/mame/drivers/vic20.cpp b/src/mame/drivers/vic20.cpp index 5413d1df358..01025a50ae9 100644 --- a/src/mame/drivers/vic20.cpp +++ b/src/mame/drivers/vic20.cpp @@ -9,8 +9,143 @@ */ -#include "includes/vic20.h" +#include "emu.h" #include "softlist.h" +#include "bus/cbmiec/cbmiec.h" +#include "bus/pet/cass.h" +#include "bus/vcs_ctrl/ctrl.h" +#include "bus/vic20/exp.h" +#include "bus/vic20/user.h" +#include "cpu/m6502/m6510.h" +#include "machine/6522via.h" +#include "machine/cbm_snqk.h" +#include "machine/ram.h" +#include "sound/dac.h" +#include "sound/mos6560.h" + +#define M6502_TAG "ue10" +#define M6522_1_TAG "uab3" +#define M6522_2_TAG "uab1" +#define M6560_TAG "ub7" +#define M6561_TAG "ub7" +#define IEC_TAG "iec" +#define SCREEN_TAG "screen" +#define CONTROL1_TAG "joy1" +#define PET_USER_PORT_TAG "user" + +class vic20_state : public driver_device +{ +public: + vic20_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, M6502_TAG), + m_via1(*this, M6522_1_TAG), + m_via2(*this, M6522_2_TAG), + m_vic(*this, M6560_TAG), + m_iec(*this, CBM_IEC_TAG), + m_joy(*this, CONTROL1_TAG), + m_exp(*this, VIC20_EXPANSION_SLOT_TAG), + m_user(*this, PET_USER_PORT_TAG), + m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_ram(*this, RAM_TAG), + m_basic(*this, "basic"), + m_kernal(*this, "kernal"), + m_charom(*this, "charom"), + m_color_ram(*this, "color_ram"), + m_row(*this, "ROW%u", 0), + m_restore(*this, "RESTORE"), + m_lock(*this, "LOCK") + { } + + required_device m_maincpu; + required_device m_via1; + required_device m_via2; + required_device m_vic; + required_device m_iec; + required_device m_joy; + required_device m_exp; + required_device m_user; + required_device m_cassette; + required_device m_ram; + required_region_ptr m_basic; + required_region_ptr m_kernal; + required_region_ptr m_charom; + required_shared_ptr m_color_ram; + required_ioport_array<8> m_row; + required_ioport m_restore; + required_ioport m_lock; + + virtual void machine_start() override; + virtual void machine_reset() override; + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_READ8_MEMBER( vic_videoram_r ); + + DECLARE_WRITE_LINE_MEMBER( write_light_pen ); + DECLARE_WRITE_LINE_MEMBER( write_user_joy0 ); + DECLARE_WRITE_LINE_MEMBER( write_user_joy1 ); + DECLARE_WRITE_LINE_MEMBER( write_user_joy2 ); + DECLARE_WRITE_LINE_MEMBER( write_user_light_pen ); + DECLARE_WRITE_LINE_MEMBER( write_user_cassette_switch ); + + DECLARE_READ8_MEMBER( via1_pa_r ); + DECLARE_WRITE8_MEMBER( via1_pa_w ); + DECLARE_WRITE8_MEMBER( via1_pb_w ); + + DECLARE_READ8_MEMBER( via2_pa_r ); + DECLARE_READ8_MEMBER( via2_pb_r ); + DECLARE_WRITE8_MEMBER( via2_pb_w ); + DECLARE_WRITE_LINE_MEMBER( via2_ca2_w ); + DECLARE_WRITE_LINE_MEMBER( via2_cb2_w ); + + DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); + + DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_vc20 ); + // keyboard state + int m_key_col; + int m_light_pen; + int m_user_joy0; + int m_user_joy1; + int m_user_joy2; + int m_user_light_pen; + int m_user_cassette_switch; + + enum + { + BLK0 = 0, + BLK1, + BLK2, + BLK3, + BLK4, + BLK5, + BLK6, + BLK7 + }; + + + enum + { + RAM0 = 0, + RAM1, + RAM2, + RAM3, + RAM4, + RAM5, + RAM6, + RAM7 + }; + + + enum + { + IO0 = 4, + COLOR = 5, + IO2 = 6, + IO3 = 7 + }; +}; QUICKLOAD_LOAD_MEMBER( vic20_state, cbm_vc20 ) @@ -481,14 +616,10 @@ READ8_MEMBER( vic20_state::via2_pa_r ) UINT8 data = 0xff; - if (!BIT(m_key_col, 0)) data &= m_row0->read(); - if (!BIT(m_key_col, 1)) data &= m_row1->read(); - if (!BIT(m_key_col, 2)) data &= m_row2->read(); - if (!BIT(m_key_col, 3)) data &= m_row3->read(); - if (!BIT(m_key_col, 4)) data &= m_row4->read(); - if (!BIT(m_key_col, 5)) data &= m_row5->read(); - if (!BIT(m_key_col, 6)) data &= m_row6->read(); - if (!BIT(m_key_col, 7)) data &= m_row7->read(); + for (int i = 0; i < 8; i++) + { + if (!BIT(m_key_col, i)) data &= m_row[i]->read(); + } return data; } diff --git a/src/mame/drivers/vidbrain.cpp b/src/mame/drivers/vidbrain.cpp index 8d9e64a9c1b..3152f953e56 100644 --- a/src/mame/drivers/vidbrain.cpp +++ b/src/mame/drivers/vidbrain.cpp @@ -103,14 +103,11 @@ READ8_MEMBER( vidbrain_state::keyboard_r ) UINT8 data = m_joy_r->read(); - if (BIT(m_keylatch, 0)) data |= m_io00->read(); - if (BIT(m_keylatch, 1)) data |= m_io01->read(); - if (BIT(m_keylatch, 2)) data |= m_io02->read(); - if (BIT(m_keylatch, 3)) data |= m_io03->read(); - if (BIT(m_keylatch, 4)) data |= m_io04->read(); - if (BIT(m_keylatch, 5)) data |= m_io05->read(); - if (BIT(m_keylatch, 6)) data |= m_io06->read(); - if (BIT(m_keylatch, 7)) data |= m_io07->read(); + for (int i = 0; i < 8; i++) + { + if (BIT(m_keylatch, i)) data |= m_io[i]->read(); + } + if (!m_uv->kbd_r()) data |= m_uv201_31->read(); return data; diff --git a/src/mame/includes/bw2.h b/src/mame/includes/bw2.h index 041e8e4d5e5..2d0795f955e 100644 --- a/src/mame/includes/bw2.h +++ b/src/mame/includes/bw2.h @@ -31,31 +31,22 @@ class bw2_state : public driver_device { public: - bw2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_uart(*this, I8251_TAG), - m_fdc(*this, WD2797_TAG), - m_lcdc(*this, MSM6255_TAG), - m_pit(*this, I8253_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_exp(*this, BW2_EXPANSION_SLOT_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, WD2797_TAG":0"), - m_floppy1(*this, WD2797_TAG":1"), - m_floppy(nullptr), - m_rom(*this, Z80_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_video_ram(*this, "videoram") + bw2_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, Z80_TAG), + m_uart(*this, I8251_TAG), + m_fdc(*this, WD2797_TAG), + m_lcdc(*this, MSM6255_TAG), + m_pit(*this, I8253_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_exp(*this, BW2_EXPANSION_SLOT_TAG), + m_ram(*this, RAM_TAG), + m_floppy0(*this, WD2797_TAG":0"), + m_floppy1(*this, WD2797_TAG":1"), + m_floppy(nullptr), + m_rom(*this, Z80_TAG), + m_y(*this, "Y%u", 0), + m_video_ram(*this, "videoram") { } required_device m_maincpu; @@ -70,16 +61,7 @@ public: required_device m_floppy1; floppy_image_device *m_floppy; required_memory_region m_rom; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; + required_ioport_array<10> m_y; virtual void machine_start() override; diff --git a/src/mame/includes/c128.h b/src/mame/includes/c128.h deleted file mode 100644 index 03d72b42db5..00000000000 --- a/src/mame/includes/c128.h +++ /dev/null @@ -1,253 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __C128__ -#define __C128__ - -#include "emu.h" -#include "bus/cbmiec/cbmiec.h" -#include "bus/c64/exp.h" -#include "bus/vic20/user.h" -#include "bus/pet/cass.h" -#include "bus/vcs_ctrl/ctrl.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "imagedev/snapquik.h" -#include "cpu/m6502/m8502.h" -#include "machine/mos6526.h" -#include "machine/mos8722.h" -#include "machine/pla.h" -#include "machine/ram.h" -#include "sound/mos6581.h" -#include "video/mc6845.h" -#include "video/mos6566.h" - -#define Z80A_TAG "u10" -#define M8502_TAG "u6" -#define MOS8563_TAG "u22" -#define MOS8564_TAG "u21" -#define MOS8566_TAG "u21" -#define MOS6581_TAG "u5" -#define MOS6526_1_TAG "u1" -#define MOS6526_2_TAG "u4" -#define MOS8721_TAG "u11" -#define MOS8722_TAG "u7" -#define SCREEN_VIC_TAG "screen" -#define SCREEN_VDC_TAG "screen80" -#define CONTROL1_TAG "joy1" -#define CONTROL2_TAG "joy2" -#define PET_USER_PORT_TAG "user" - -class c128_state : public driver_device -{ -public: - c128_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, Z80A_TAG), - m_subcpu(*this, M8502_TAG), - m_mmu(*this, MOS8722_TAG), - m_pla(*this, MOS8721_TAG), - m_vdc(*this, MOS8563_TAG), - m_vic(*this, MOS8564_TAG), - m_sid(*this, MOS6581_TAG), - m_cia1(*this, MOS6526_1_TAG), - m_cia2(*this, MOS6526_2_TAG), - m_iec(*this, CBM_IEC_TAG), - m_joy1(*this, CONTROL1_TAG), - m_joy2(*this, CONTROL2_TAG), - m_exp(*this, C64_EXPANSION_SLOT_TAG), - m_user(*this, PET_USER_PORT_TAG), - m_ram(*this, RAM_TAG), - m_cassette(*this, PET_DATASSETTE_PORT_TAG), - m_from(*this, "from"), - m_rom(*this, M8502_TAG), - m_charom(*this, "charom"), - m_color_ram(*this, "color_ram"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_k0(*this, "K0"), - m_k1(*this, "K1"), - m_k2(*this, "K2"), - m_lock(*this, "LOCK"), - m_caps(*this, "CAPS"), - m_40_80(*this, "40_80"), - m_z80en(0), - m_loram(1), - m_hiram(1), - m_charen(1), - m_game(1), - m_exrom(1), - m_va14(1), - m_va15(1), - m_clrbank(0), - m_cnt1(1), - m_sp1(1), - m_iec_data_out(1), - m_restore(1), - m_cia1_irq(CLEAR_LINE), - m_cia2_irq(CLEAR_LINE), - m_vic_irq(CLEAR_LINE), - m_exp_irq(CLEAR_LINE), - m_exp_nmi(CLEAR_LINE), - m_cass_rd(1), - m_iec_srq(1), - m_vic_k(0x07), - m_caps_lock(1) - { } - - required_device m_maincpu; - required_device m_subcpu; - required_device m_mmu; - required_device m_pla; - required_device m_vdc; - required_device m_vic; - required_device m_sid; - required_device m_cia1; - required_device m_cia2; - required_device m_iec; - required_device m_joy1; - required_device m_joy2; - required_device m_exp; - required_device m_user; - required_device m_ram; - required_device m_cassette; - required_device m_from; - required_memory_region m_rom; - required_memory_region m_charom; - optional_shared_ptr m_color_ram; - required_ioport m_row0; - required_ioport m_row1; - required_ioport m_row2; - required_ioport m_row3; - required_ioport m_row4; - required_ioport m_row5; - required_ioport m_row6; - required_ioport m_row7; - required_ioport m_k0; - required_ioport m_k1; - required_ioport m_k2; - required_ioport m_lock; - required_ioport m_caps; - required_ioport m_40_80; - - virtual void machine_start() override; - virtual void machine_reset() override; - - inline void check_interrupts(); - int read_pla(offs_t offset, offs_t ca, offs_t vma, int ba, int rw, int aec, int z80io, int ms3, int ms2, int ms1, int ms0); - UINT8 read_memory(address_space &space, offs_t offset, offs_t vma, int ba, int aec, int z80io); - void write_memory(address_space &space, offs_t offset, offs_t vma, UINT8 data, int ba, int aec, int z80io); - inline void update_iec(); - - DECLARE_READ8_MEMBER( z80_r ); - DECLARE_WRITE8_MEMBER( z80_w ); - DECLARE_READ8_MEMBER( z80_io_r ); - DECLARE_WRITE8_MEMBER( z80_io_w ); - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_READ8_MEMBER( vic_videoram_r ); - DECLARE_READ8_MEMBER( vic_colorram_r ); - - DECLARE_WRITE_LINE_MEMBER( mmu_z80en_w ); - DECLARE_WRITE_LINE_MEMBER( mmu_fsdir_w ); - DECLARE_READ_LINE_MEMBER( mmu_game_r ); - DECLARE_READ_LINE_MEMBER( mmu_exrom_r ); - DECLARE_READ_LINE_MEMBER( mmu_sense40_r ); - - DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); - DECLARE_WRITE8_MEMBER( vic_k_w ); - - DECLARE_READ8_MEMBER( sid_potx_r ); - DECLARE_READ8_MEMBER( sid_poty_r ); - - DECLARE_WRITE_LINE_MEMBER( cia1_irq_w ); - DECLARE_WRITE_LINE_MEMBER( cia1_cnt_w ); - DECLARE_WRITE_LINE_MEMBER( cia1_sp_w ); - DECLARE_READ8_MEMBER( cia1_pa_r ); - DECLARE_WRITE8_MEMBER( cia1_pa_w ); - DECLARE_READ8_MEMBER( cia1_pb_r ); - DECLARE_WRITE8_MEMBER( cia1_pb_w ); - - DECLARE_WRITE_LINE_MEMBER( cia2_irq_w ); - DECLARE_READ8_MEMBER( cia2_pa_r ); - DECLARE_WRITE8_MEMBER( cia2_pa_w ); - - DECLARE_READ8_MEMBER( cpu_r ); - DECLARE_WRITE8_MEMBER( cpu_w ); - - DECLARE_WRITE_LINE_MEMBER( iec_srq_w ); - DECLARE_WRITE_LINE_MEMBER( iec_data_w ); - - DECLARE_READ8_MEMBER( exp_dma_cd_r ); - DECLARE_WRITE8_MEMBER( exp_dma_cd_w ); - DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); - DECLARE_WRITE_LINE_MEMBER( exp_nmi_w ); - DECLARE_WRITE_LINE_MEMBER( exp_dma_w ); - DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); - - DECLARE_WRITE_LINE_MEMBER( write_restore ); - DECLARE_INPUT_CHANGED_MEMBER( caps_lock ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_c64 ); - - DECLARE_READ8_MEMBER( cia2_pb_r ); - DECLARE_WRITE8_MEMBER( cia2_pb_w ); - - DECLARE_WRITE_LINE_MEMBER( write_user_pa2 ) { m_user_pa2 = state; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb0 ) { if (state) m_user_pb |= 1; else m_user_pb &= ~1; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb1 ) { if (state) m_user_pb |= 2; else m_user_pb &= ~2; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb2 ) { if (state) m_user_pb |= 4; else m_user_pb &= ~4; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb3 ) { if (state) m_user_pb |= 8; else m_user_pb &= ~8; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb4 ) { if (state) m_user_pb |= 16; else m_user_pb &= ~16; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb5 ) { if (state) m_user_pb |= 32; else m_user_pb &= ~32; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb6 ) { if (state) m_user_pb |= 64; else m_user_pb &= ~64; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb7 ) { if (state) m_user_pb |= 128; else m_user_pb &= ~128; } - - // memory state - int m_z80en; - int m_loram; - int m_hiram; - int m_charen; - int m_game; - int m_exrom; - int m_reset; - - // video state - int m_va14; - int m_va15; - int m_clrbank; - - // fast serial state - int m_cnt1; - int m_sp1; - int m_iec_data_out; - - // interrupt state - int m_restore; - int m_cia1_irq; - int m_cia2_irq; - int m_vic_irq; - int m_exp_irq; - int m_exp_nmi; - int m_exp_dma; - int m_cass_rd; - int m_iec_srq; - - // keyboard state - UINT8 m_vic_k; - int m_caps_lock; - - int m_user_pa2; - int m_user_pb; -}; - - - -#endif diff --git a/src/mame/includes/c64.h b/src/mame/includes/c64.h deleted file mode 100644 index 2bf654f9080..00000000000 --- a/src/mame/includes/c64.h +++ /dev/null @@ -1,216 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __C64__ -#define __C64__ - -#include "emu.h" -#include "bus/cbmiec/cbmiec.h" -#include "bus/c64/exp.h" -#include "bus/vic20/user.h" -#include "bus/pet/cass.h" -#include "bus/vcs_ctrl/ctrl.h" -#include "cpu/m6502/m6510.h" -#include "imagedev/snapquik.h" -#include "machine/mos6526.h" -#include "machine/pla.h" -#include "machine/ram.h" -#include "sound/mos6581.h" -#include "video/mos6566.h" - -#define M6510_TAG "u7" -#define MOS6567_TAG "u19" -#define MOS6569_TAG "u19" -#define MOS6581_TAG "u18" -#define MOS6526_1_TAG "u1" -#define MOS6526_2_TAG "u2" -#define PLA_TAG "u17" -#define SCREEN_TAG "screen" -#define CONTROL1_TAG "joy1" -#define CONTROL2_TAG "joy2" -#define PET_USER_PORT_TAG "user" - -class c64_state : public driver_device -{ -public: - c64_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, M6510_TAG), - m_pla(*this, PLA_TAG), - m_vic(*this, MOS6569_TAG), - m_sid(*this, MOS6581_TAG), - m_cia1(*this, MOS6526_1_TAG), - m_cia2(*this, MOS6526_2_TAG), - m_iec(*this, CBM_IEC_TAG), - m_joy1(*this, CONTROL1_TAG), - m_joy2(*this, CONTROL2_TAG), - m_exp(*this, C64_EXPANSION_SLOT_TAG), - m_user(*this, PET_USER_PORT_TAG), - m_ram(*this, RAM_TAG), - m_cassette(*this, PET_DATASSETTE_PORT_TAG), - m_color_ram(*this, "color_ram"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_lock(*this, "LOCK"), - m_loram(1), - m_hiram(1), - m_charen(1), - m_va14(1), - m_va15(1), - m_restore(1), - m_cia1_irq(CLEAR_LINE), - m_cia2_irq(CLEAR_LINE), - m_vic_irq(CLEAR_LINE), - m_exp_irq(CLEAR_LINE), - m_exp_nmi(CLEAR_LINE) - { } - - // ROM - UINT8 *m_basic; - UINT8 *m_kernal; - UINT8 *m_charom; - - required_device m_maincpu; - required_device m_pla; - required_device m_vic; - required_device m_sid; - required_device m_cia1; - required_device m_cia2; - optional_device m_iec; - required_device m_joy1; - required_device m_joy2; - required_device m_exp; - required_device m_user; - required_device m_ram; - optional_device m_cassette; - optional_shared_ptr m_color_ram; - optional_ioport m_row0; - optional_ioport m_row1; - optional_ioport m_row2; - optional_ioport m_row3; - optional_ioport m_row4; - optional_ioport m_row5; - optional_ioport m_row6; - optional_ioport m_row7; - optional_ioport m_lock; - - virtual void machine_start() override; - virtual void machine_reset() override; - - void check_interrupts(); - int read_pla(offs_t offset, offs_t va, int rw, int aec, int ba); - UINT8 read_memory(address_space &space, offs_t offset, offs_t va, int aec, int ba); - void write_memory(address_space &space, offs_t offset, UINT8 data, int aec, int ba); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_READ8_MEMBER( vic_videoram_r ); - DECLARE_READ8_MEMBER( vic_colorram_r ); - DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); - - DECLARE_READ8_MEMBER( sid_potx_r ); - DECLARE_READ8_MEMBER( sid_poty_r ); - - DECLARE_WRITE_LINE_MEMBER( cia1_irq_w ); - DECLARE_READ8_MEMBER( cia1_pa_r ); - DECLARE_WRITE8_MEMBER( cia1_pa_w ); - DECLARE_READ8_MEMBER( cia1_pb_r ); - DECLARE_WRITE8_MEMBER( cia1_pb_w ); - - DECLARE_WRITE_LINE_MEMBER( cia2_irq_w ); - DECLARE_READ8_MEMBER( cia2_pa_r ); - DECLARE_WRITE8_MEMBER( cia2_pa_w ); - - DECLARE_READ8_MEMBER( cpu_r ); - DECLARE_WRITE8_MEMBER( cpu_w ); - - DECLARE_WRITE_LINE_MEMBER( write_restore ); - DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); - DECLARE_WRITE_LINE_MEMBER( exp_nmi_w ); - DECLARE_WRITE_LINE_MEMBER( exp_dma_w ); - DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_c64 ); - - DECLARE_READ8_MEMBER( cia2_pb_r ); - DECLARE_WRITE8_MEMBER( cia2_pb_w ); - - DECLARE_WRITE_LINE_MEMBER( write_user_pa2 ) { m_user_pa2 = state; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb0 ) { if (state) m_user_pb |= 1; else m_user_pb &= ~1; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb1 ) { if (state) m_user_pb |= 2; else m_user_pb &= ~2; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb2 ) { if (state) m_user_pb |= 4; else m_user_pb &= ~4; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb3 ) { if (state) m_user_pb |= 8; else m_user_pb &= ~8; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb4 ) { if (state) m_user_pb |= 16; else m_user_pb &= ~16; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb5 ) { if (state) m_user_pb |= 32; else m_user_pb &= ~32; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb6 ) { if (state) m_user_pb |= 64; else m_user_pb &= ~64; } - DECLARE_WRITE_LINE_MEMBER( write_user_pb7 ) { if (state) m_user_pb |= 128; else m_user_pb &= ~128; } - - // memory state - int m_loram; - int m_hiram; - int m_charen; - - // video state - int m_va14; - int m_va15; - - // interrupt state - int m_restore; - int m_cia1_irq; - int m_cia2_irq; - int m_vic_irq; - int m_exp_irq; - int m_exp_nmi; - int m_exp_dma; - - int m_user_pa2; - int m_user_pb; -}; - - -class sx64_state : public c64_state -{ -public: - sx64_state(const machine_config &mconfig, device_type type, const char *tag) - : c64_state(mconfig, type, tag) - { } - - DECLARE_READ8_MEMBER( cpu_r ); - DECLARE_WRITE8_MEMBER( cpu_w ); -}; - - -class c64c_state : public c64_state -{ -public: - c64c_state(const machine_config &mconfig, device_type type, const char *tag) - : c64_state(mconfig, type, tag) - { } -}; - - -class c64gs_state : public c64c_state -{ -public: - c64gs_state(const machine_config &mconfig, device_type type, const char *tag) - : c64c_state(mconfig, type, tag) - { } - - DECLARE_READ8_MEMBER( cpu_r ); - DECLARE_WRITE8_MEMBER( cpu_w ); - - DECLARE_READ8_MEMBER( cia1_pa_r ); - DECLARE_READ8_MEMBER( cia1_pb_r ); -}; - - - -#endif diff --git a/src/mame/includes/cbm2.h b/src/mame/includes/cbm2.h deleted file mode 100644 index 78ddb7824da..00000000000 --- a/src/mame/includes/cbm2.h +++ /dev/null @@ -1,327 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __P500__ -#define __P500__ - -#include "emu.h" -#include "bus/cbm2/exp.h" -#include "bus/cbm2/user.h" -#include "bus/ieee488/ieee488.h" -#include "bus/pet/cass.h" -#include "bus/vcs_ctrl/ctrl.h" -#include "cpu/m6502/m6509.h" -#include "cpu/i86/i86.h" -#include "machine/cbm_snqk.h" -#include "machine/6525tpi.h" -#include "machine/ds75160a.h" -#include "machine/ds75161a.h" -#include "machine/mos6526.h" -#include "machine/mos6551.h" -#include "machine/pic8259.h" -#include "machine/pla.h" -#include "machine/ram.h" -#include "sound/dac.h" -#include "sound/mos6581.h" -#include "video/mc6845.h" -#include "video/mos6566.h" - -#define M6509_TAG "u13" -#define PLA1_TAG "u78" -#define PLA2_TAG "u88" -#define MOS6567_TAG "u23" -#define MOS6569_TAG "u23" -#define MC68B45_TAG "u10" -#define MOS6581_TAG "u4" -#define MOS6525_1_TAG "u20" -#define MOS6525_2_TAG "u102" -#define MOS6551A_TAG "u19" -#define MOS6526_TAG "u2" -#define DS75160A_TAG "u3" -#define DS75161A_TAG "u7" -#define SCREEN_TAG "screen" -#define CONTROL1_TAG "joy1" -#define CONTROL2_TAG "joy2" -#define RS232_TAG "rs232" - -#define EXT_I8088_TAG "ext_u1" -#define EXT_I8087_TAG "ext_u4" -#define EXT_I8259A_TAG "ext_u3" -#define EXT_MOS6526_TAG "ext_u15" -#define EXT_MOS6525_TAG "ext_u16" - -class cbm2_state : public driver_device -{ -public: - cbm2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, M6509_TAG), - m_pla1(*this, PLA1_TAG), - m_crtc(*this, MC68B45_TAG), - m_palette(*this, "palette"), - m_sid(*this, MOS6581_TAG), - m_tpi1(*this, MOS6525_1_TAG), - m_tpi2(*this, MOS6525_2_TAG), - m_acia(*this, MOS6551A_TAG), - m_cia(*this, MOS6526_TAG), - m_ieee1(*this, DS75160A_TAG), - m_ieee2(*this, DS75161A_TAG), - m_joy1(*this, CONTROL1_TAG), - m_joy2(*this, CONTROL2_TAG), - m_exp(*this, CBM2_EXPANSION_SLOT_TAG), - m_user(*this, CBM2_USER_PORT_TAG), - m_ram(*this, RAM_TAG), - m_cassette(*this, PET_DATASSETTE_PORT_TAG), - m_ieee(*this, IEEE488_TAG), - m_ext_cpu(*this, EXT_I8088_TAG), - m_ext_pic(*this, EXT_I8259A_TAG), - m_ext_cia(*this, EXT_MOS6526_TAG), - m_ext_tpi(*this, EXT_MOS6525_TAG), - m_basic(*this, "basic"), - m_kernal(*this, "kernal"), - m_charom(*this, "charom"), - m_buffer_ram(*this, "buffer_ram"), - m_extbuf_ram(*this, "extbuf_ram"), - m_video_ram(*this, "video_ram"), - m_pa0(*this, "PA0"), - m_pa1(*this, "PA1"), - m_pa2(*this, "PA2"), - m_pa3(*this, "PA3"), - m_pa4(*this, "PA4"), - m_pa5(*this, "PA5"), - m_pa6(*this, "PA6"), - m_pa7(*this, "PA7"), - m_pb0(*this, "PB0"), - m_pb1(*this, "PB1"), - m_pb2(*this, "PB2"), - m_pb3(*this, "PB3"), - m_pb4(*this, "PB4"), - m_pb5(*this, "PB5"), - m_pb6(*this, "PB6"), - m_pb7(*this, "PB7"), - m_lock(*this, "LOCK"), - m_dramon(1), - m_video_ram_size(0x800), - m_graphics(1), - m_todclk(0), - m_tpi1_irq(CLEAR_LINE), - m_acia_irq(CLEAR_LINE), - m_user_irq(CLEAR_LINE), - m_tpi2_pa(0), - m_tpi2_pb(0) - { } - - required_device m_maincpu; - required_device m_pla1; - optional_device m_crtc; - optional_device m_palette; - required_device m_sid; - required_device m_tpi1; - required_device m_tpi2; - required_device m_acia; - required_device m_cia; - required_device m_ieee1; - required_device m_ieee2; - required_device m_joy1; - required_device m_joy2; - required_device m_exp; - required_device m_user; - required_device m_ram; - required_device m_cassette; - required_device m_ieee; - optional_device m_ext_cpu; - optional_device m_ext_pic; - optional_device m_ext_cia; - optional_device m_ext_tpi; - required_memory_region m_basic; - required_memory_region m_kernal; - required_memory_region m_charom; - optional_shared_ptr m_buffer_ram; - optional_shared_ptr m_extbuf_ram; - optional_shared_ptr m_video_ram; - required_ioport m_pa0; - required_ioport m_pa1; - required_ioport m_pa2; - required_ioport m_pa3; - required_ioport m_pa4; - required_ioport m_pa5; - required_ioport m_pa6; - required_ioport m_pa7; - required_ioport m_pb0; - required_ioport m_pb1; - required_ioport m_pb2; - required_ioport m_pb3; - required_ioport m_pb4; - required_ioport m_pb5; - required_ioport m_pb6; - required_ioport m_pb7; - required_ioport m_lock; - - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - - DECLARE_MACHINE_START( cbm2 ); - DECLARE_MACHINE_START( cbm2_ntsc ); - DECLARE_MACHINE_START( cbm2_pal ); - DECLARE_MACHINE_START( cbm2x_ntsc ); - DECLARE_MACHINE_START( cbm2x_pal ); - DECLARE_MACHINE_RESET( cbm2 ); - - virtual void read_pla(offs_t offset, int ras, int cas, int refen, int eras, int ecas, - int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *rasseg1, int *rasseg2, int *rasseg3, int *rasseg4); - - void bankswitch(offs_t offset, int eras, int ecas, int refen, int cas, int ras, int *sysioen, int *dramen, - int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *buframcs, int *extbufcs, int *vidramcs, - int *diskromcs, int *csbank1, int *csbank2, int *csbank3, int *basiccs, int *knbcs, int *kernalcs, - int *crtccs, int *cs1, int *sidcs, int *extprtcs, int *ciacs, int *aciacs, int *tript1cs, int *tript2cs); - - UINT8 read_keyboard(); - void set_busy2(int state); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_READ8_MEMBER( ext_read ); - DECLARE_WRITE8_MEMBER( ext_write ); - - DECLARE_READ8_MEMBER( sid_potx_r ); - DECLARE_READ8_MEMBER( sid_poty_r ); - - DECLARE_WRITE_LINE_MEMBER( tpi1_irq_w ); - DECLARE_READ8_MEMBER( tpi1_pa_r ); - DECLARE_WRITE8_MEMBER( tpi1_pa_w ); - DECLARE_READ8_MEMBER( tpi1_pb_r ); - DECLARE_WRITE8_MEMBER( tpi1_pb_w ); - DECLARE_WRITE_LINE_MEMBER( tpi1_ca_w ); - DECLARE_WRITE_LINE_MEMBER( tpi1_cb_w ); - - DECLARE_WRITE8_MEMBER( tpi2_pa_w ); - DECLARE_WRITE8_MEMBER( tpi2_pb_w ); - DECLARE_READ8_MEMBER( tpi2_pc_r ); - - DECLARE_READ8_MEMBER( cia_pa_r ); - DECLARE_WRITE8_MEMBER( cia_pa_w ); - DECLARE_READ8_MEMBER( cia_pb_r ); - - DECLARE_READ8_MEMBER( ext_tpi_pb_r ); - DECLARE_WRITE8_MEMBER( ext_tpi_pb_w ); - DECLARE_WRITE8_MEMBER( ext_tpi_pc_w ); - - DECLARE_WRITE_LINE_MEMBER( ext_cia_irq_w ); - DECLARE_READ8_MEMBER( ext_cia_pb_r ); - DECLARE_WRITE8_MEMBER( ext_cia_pb_w ); - - DECLARE_WRITE_LINE_MEMBER( user_irq_w ); - - MC6845_UPDATE_ROW( crtc_update_row ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( cbmb ); - // memory state - int m_dramon; - int m_busen1; - int m_busy2; - - // video state - size_t m_video_ram_size; - int m_graphics; - int m_ntsc; - - // interrupt state - int m_todclk; - int m_tpi1_irq; - int m_acia_irq; - int m_user_irq; - - // keyboard state; - UINT8 m_tpi2_pa; - UINT8 m_tpi2_pb; - UINT8 m_cia_pa; - - UINT8 m_ext_cia_pb; - UINT8 m_ext_tpi_pb; - - // timers - emu_timer *m_todclk_timer; -}; - - -class cbm2hp_state : public cbm2_state -{ -public: - cbm2hp_state(const machine_config &mconfig, device_type type, const char *tag) - : cbm2_state(mconfig, type, tag) - { } - - virtual void read_pla(offs_t offset, int ras, int cas, int refen, int eras, int ecas, - int *casseg1, int *casseg2, int *casseg3, int *casseg4, int *rasseg1, int *rasseg2, int *rasseg3, int *rasseg4) override; - - DECLARE_READ8_MEMBER( tpi2_pc_r ); -}; - - -class p500_state : public cbm2_state -{ -public: - p500_state(const machine_config &mconfig, device_type type, const char *tag) - : cbm2_state(mconfig, type, tag), - m_pla2(*this, PLA2_TAG), - m_vic(*this, MOS6569_TAG), - m_color_ram(*this, "color_ram"), - m_statvid(1), - m_vicdotsel(1), - m_vicbnksel(0x03), - m_vic_irq(CLEAR_LINE) - { } - - required_device m_pla2; - required_device m_vic; - optional_shared_ptr m_color_ram; - - DECLARE_MACHINE_START( p500 ); - DECLARE_MACHINE_START( p500_ntsc ); - DECLARE_MACHINE_START( p500_pal ); - DECLARE_MACHINE_RESET( p500 ); - - void read_pla1(offs_t offset, int busy2, int clrnibcsb, int procvid, int refen, int ba, int aec, int srw, - int *datxen, int *dramxen, int *clrniben, int *segf, int *_64kcasen, int *casenb, int *viddaten, int *viddat_tr); - - void read_pla2(offs_t offset, offs_t va, int ba, int vicen, int ae, int segf, int bank0, - int *clrnibcsb, int *extbufcs, int *discromcs, int *buframcs, int *charomcs, int *procvid, int *viccs, int *vidmatcs); - - void bankswitch(offs_t offset, offs_t va, int srw, int ba, int ae, int busy2, int refen, - int *datxen, int *dramxen, int *clrniben, int *_64kcasen, int *casenb, int *viddaten, int *viddat_tr, - int *clrnibcs, int *extbufcs, int *discromcs, int *buframcs, int *charomcs, int *viccs, int *vidmatcs, - int *csbank1, int *csbank2, int *csbank3, int *basiclocs, int *basichics, int *kernalcs, - int *cs1, int *sidcs, int *extprtcs, int *ciacs, int *aciacs, int *tript1cs, int *tript2cs, int *aec, int *vsysaden); - - UINT8 read_memory(address_space &space, offs_t offset, offs_t va, int ba, int ae); - void write_memory(address_space &space, offs_t offset, UINT8 data, int ba, int ae); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_READ8_MEMBER( vic_videoram_r ); - DECLARE_READ8_MEMBER( vic_colorram_r ); - DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); - - DECLARE_WRITE_LINE_MEMBER( tpi1_irq_w ); - DECLARE_WRITE_LINE_MEMBER( tpi1_ca_w ); - DECLARE_WRITE_LINE_MEMBER( tpi1_cb_w ); - - DECLARE_READ8_MEMBER( tpi2_pc_r ); - DECLARE_WRITE8_MEMBER( tpi2_pc_w ); - - DECLARE_WRITE_LINE_MEMBER( user_irq_w ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( p500 ); - // video state - int m_statvid; - int m_vicdotsel; - int m_vicbnksel; - - // interrupt state - int m_vic_irq; -}; - - - -#endif diff --git a/src/mame/includes/ep64.h b/src/mame/includes/ep64.h deleted file mode 100644 index 85c0ae27a97..00000000000 --- a/src/mame/includes/ep64.h +++ /dev/null @@ -1,96 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -/********************************************************************** - - Enterprise Sixty Four / One Two Eight emulation - -**********************************************************************/ - -#pragma once - -#ifndef __EP64__ -#define __EP64__ - -#include "audio/dave.h" -#include "bus/rs232/rs232.h" -#include "bus/ep64/exp.h" -#include "cpu/z80/z80.h" -#include "imagedev/cassette.h" -#include "bus/centronics/ctronics.h" -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" -#include "machine/ram.h" -#include "video/nick.h" - -#define Z80_TAG "u1" -#define DAVE_TAG "u3" -#define NICK_TAG "u4" -#define CENTRONICS_TAG "centronics" -#define RS232_TAG "rs232" -#define CASSETTE1_TAG "cassette1" -#define CASSETTE2_TAG "cassette2" -#define SCREEN_TAG "screen" - -class ep64_state : public driver_device -{ -public: - ep64_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_dave(*this, DAVE_TAG), - m_nick(*this, NICK_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_rs232(*this, RS232_TAG), - m_cassette1(*this, CASSETTE1_TAG), - m_cassette2(*this, CASSETTE2_TAG), - m_cart(*this, "cartslot"), - m_ram(*this, RAM_TAG), - m_rom(*this, Z80_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9") - { } - - required_device m_maincpu; - required_device m_dave; - required_device m_nick; - required_device m_centronics; - required_device m_rs232; - required_device m_cassette1; - required_device m_cassette2; - required_device m_cart; - required_device m_ram; - required_memory_region m_rom; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - - virtual void machine_start() override; - virtual void machine_reset() override; - - DECLARE_READ8_MEMBER( rd0_r ); - DECLARE_WRITE8_MEMBER( wr0_w ); - DECLARE_READ8_MEMBER( rd1_r ); - DECLARE_WRITE8_MEMBER( wr2_w ); - - UINT8 m_key; - - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - int m_centronics_busy; -}; - -#endif diff --git a/src/mame/includes/kyocera.h b/src/mame/includes/kyocera.h index 43a1c835670..1b3f792a5fa 100644 --- a/src/mame/includes/kyocera.h +++ b/src/mame/includes/kyocera.h @@ -55,38 +55,30 @@ class kc85_state : public driver_device { public: - kc85_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, I8085_TAG), - m_rtc(*this, UPD1990A_TAG), - m_uart(*this, IM6402_TAG), - m_lcdc0(*this, HD44102_0_TAG), - m_lcdc1(*this, HD44102_1_TAG), - m_lcdc2(*this, HD44102_2_TAG), - m_lcdc3(*this, HD44102_3_TAG), - m_lcdc4(*this, HD44102_4_TAG), - m_lcdc5(*this, HD44102_5_TAG), - m_lcdc6(*this, HD44102_6_TAG), - m_lcdc7(*this, HD44102_7_TAG), - m_lcdc8(*this, HD44102_8_TAG), - m_lcdc9(*this, HD44102_9_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_opt_cart(*this, "opt_cartslot"), - m_ram(*this, RAM_TAG), - m_rs232(*this, RS232_TAG), - m_rom(*this, I8085_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_battery(*this, "BATTERY") + kc85_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, I8085_TAG), + m_rtc(*this, UPD1990A_TAG), + m_uart(*this, IM6402_TAG), + m_lcdc0(*this, HD44102_0_TAG), + m_lcdc1(*this, HD44102_1_TAG), + m_lcdc2(*this, HD44102_2_TAG), + m_lcdc3(*this, HD44102_3_TAG), + m_lcdc4(*this, HD44102_4_TAG), + m_lcdc5(*this, HD44102_5_TAG), + m_lcdc6(*this, HD44102_6_TAG), + m_lcdc7(*this, HD44102_7_TAG), + m_lcdc8(*this, HD44102_8_TAG), + m_lcdc9(*this, HD44102_9_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_opt_cart(*this, "opt_cartslot"), + m_ram(*this, RAM_TAG), + m_rs232(*this, RS232_TAG), + m_rom(*this, I8085_TAG), + m_y(*this, "Y%u", 0), + m_battery(*this, "BATTERY") { } required_device m_maincpu; @@ -109,15 +101,7 @@ public: required_device m_ram; required_device m_rs232; required_memory_region m_rom; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; + required_ioport_array<9> m_y; required_ioport m_battery; virtual void machine_start() override; @@ -199,28 +183,20 @@ public: class tandy200_state : public driver_device { public: - tandy200_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, I8085_TAG), - m_rtc(*this, RP5C01A_TAG), - m_lcdc(*this, HD61830_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_cent_data_out(*this, "cent_data_out"), - m_speaker(*this, "speaker"), - m_cassette(*this, "cassette"), - m_opt_cart(*this, "opt_cartslot"), - m_ram(*this, RAM_TAG), - m_rs232(*this, RS232_TAG), - m_rom(*this, I8085_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8") + tandy200_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, I8085_TAG), + m_rtc(*this, RP5C01A_TAG), + m_lcdc(*this, HD61830_TAG), + m_centronics(*this, CENTRONICS_TAG), + m_cent_data_out(*this, "cent_data_out"), + m_speaker(*this, "speaker"), + m_cassette(*this, "cassette"), + m_opt_cart(*this, "opt_cartslot"), + m_ram(*this, RAM_TAG), + m_rs232(*this, RS232_TAG), + m_rom(*this, I8085_TAG), + m_y(*this, "Y%u", 0) { } required_device m_maincpu; @@ -234,15 +210,7 @@ public: required_device m_ram; required_device m_rs232; required_memory_region m_rom; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; + required_ioport_array<9> m_y; virtual void machine_start() override; memory_region *m_opt_region; diff --git a/src/mame/includes/mc1000.h b/src/mame/includes/mc1000.h deleted file mode 100644 index 32ba93e2fe0..00000000000 --- a/src/mame/includes/mc1000.h +++ /dev/null @@ -1,118 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#ifndef __MC1000__ -#define __MC1000__ - - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "imagedev/cassette.h" -#include "video/mc6845.h" -#include "video/mc6847.h" -#include "sound/ay8910.h" -#include "bus/centronics/ctronics.h" -#include "machine/rescap.h" -#include "machine/ram.h" - -#define SCREEN_TAG "screen" -#define Z80_TAG "u13" -#define AY8910_TAG "u21" -#define MC6845_TAG "mc6845" -#define MC6847_TAG "u19" -#define CENTRONICS_TAG "centronics" - -#define MC1000_MC6845_VIDEORAM_SIZE 0x800 -#define MC1000_MC6847_VIDEORAM_SIZE 0x1800 - -class mc1000_state : public driver_device -{ -public: - mc1000_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_vdg(*this, MC6847_TAG), - m_crtc(*this, MC6845_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_cassette(*this, "cassette"), - m_ram(*this, RAM_TAG), - m_rom(*this, Z80_TAG), - m_mc6845_video_ram(*this, "mc6845_vram"), - m_mc6847_video_ram(*this, "mc6847_vram"), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_joya(*this, "JOYA"), - m_joyb(*this, "JOYB"), - m_modifiers(*this, "MODIFIERS"), - m_joyakeymap(*this, "JOYAKEYMAP"), - m_joybkeymap(*this, "JOYBKEYMAP") - { } - - required_device m_maincpu; - required_device m_vdg; - optional_device m_crtc; - required_device m_centronics; - required_device m_cassette; - required_device m_ram; - required_memory_region m_rom; - required_shared_ptr m_mc6845_video_ram; - required_shared_ptr m_mc6847_video_ram; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_joya; - required_ioport m_joyb; - required_ioport m_modifiers; - required_ioport m_joyakeymap; - required_ioport m_joybkeymap; - - virtual void machine_start() override; - virtual void machine_reset() override; - - DECLARE_READ8_MEMBER( printer_r ); - DECLARE_WRITE8_MEMBER( printer_w ); - DECLARE_WRITE8_MEMBER( mc6845_ctrl_w ); - DECLARE_WRITE8_MEMBER( mc6847_attr_w ); - DECLARE_WRITE_LINE_MEMBER( fs_w ); - DECLARE_WRITE_LINE_MEMBER( hs_w ); - DECLARE_READ8_MEMBER( videoram_r ); - DECLARE_WRITE8_MEMBER( keylatch_w ); - DECLARE_READ8_MEMBER( keydata_r ); - DIRECT_UPDATE_MEMBER(mc1000_direct_update_handler); - - void bankswitch(); - - /* cpu state */ - int m_ne555_int; - - /* memory state */ - int m_rom0000; - int m_mc6845_bank; - int m_mc6847_bank; - - /* keyboard state */ - int m_keylatch; - - /* video state */ - int m_hsync; - int m_vsync; - UINT8 m_mc6847_attr; - - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); - int m_centronics_busy; - - DECLARE_DRIVER_INIT(mc1000); - TIMER_DEVICE_CALLBACK_MEMBER(ne555_tick); -}; - -#endif diff --git a/src/mame/includes/newbrain.h b/src/mame/includes/newbrain.h index d2f4384ece7..c3a4cef333e 100644 --- a/src/mame/includes/newbrain.h +++ b/src/mame/includes/newbrain.h @@ -40,22 +40,7 @@ public: m_ram(*this, RAM_TAG), m_rom(*this, Z80_TAG), m_char_rom(*this, "chargen"), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_y8(*this, "Y8"), - m_y9(*this, "Y9"), - m_y10(*this, "Y10"), - m_y11(*this, "Y11"), - m_y12(*this, "Y12"), - m_y13(*this, "Y13"), - m_y14(*this, "Y14"), - m_y15(*this, "Y15"), + m_y(*this, "Y%u", 0), m_pwrup(0), m_userint(1), m_clkint(1), @@ -122,22 +107,7 @@ protected: required_device m_ram; required_memory_region m_rom; required_memory_region m_char_rom; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_y8; - required_ioport m_y9; - required_ioport m_y10; - required_ioport m_y11; - required_ioport m_y12; - required_ioport m_y13; - required_ioport m_y14; - required_ioport m_y15; + required_ioport_array<16> m_y; int m_clk; int m_tvp; diff --git a/src/mame/includes/pet.h b/src/mame/includes/pet.h deleted file mode 100644 index d4572a99c05..00000000000 --- a/src/mame/includes/pet.h +++ /dev/null @@ -1,284 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __PET__ -#define __PET__ - -#include "emu.h" -#include "bus/ieee488/c8050.h" -#include "bus/ieee488/ieee488.h" -#include "bus/pet/cass.h" -#include "bus/pet/exp.h" -#include "bus/pet/user.h" -#include "cpu/m6502/m6502.h" -#include "machine/6522via.h" -#include "machine/6821pia.h" -#include "imagedev/snapquik.h" -#include "machine/pla.h" -#include "machine/ram.h" -#include "sound/speaker.h" -#include "video/mc6845.h" - -#include "bus/generic/slot.h" -#include "bus/generic/carts.h" - -#define M6502_TAG "f3" -#define M6522_TAG "a5" -#define M6520_1_TAG "g8" -#define M6520_2_TAG "b8" -#define MC6845_TAG "ub13" -#define SCREEN_TAG "screen" -#define PLA1_TAG "ue6" -#define PLA2_TAG "ue5" -#define PET_USER_PORT_TAG "user" - -class pet_state : public driver_device -{ -public: - pet_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, M6502_TAG), - m_via(*this, M6522_TAG), - m_pia1(*this, M6520_1_TAG), - m_pia2(*this, M6520_2_TAG), - m_crtc(*this, MC6845_TAG), - m_ieee(*this, IEEE488_TAG), - m_palette(*this, "palette"), - m_cassette(*this, PET_DATASSETTE_PORT_TAG), - m_cassette2(*this, PET_DATASSETTE_PORT2_TAG), - m_exp(*this, PET_EXPANSION_SLOT_TAG), - m_user(*this, PET_USER_PORT_TAG), - m_speaker(*this, "speaker"), - m_cart_9000(*this, "cart_9000"), - m_cart_a000(*this, "cart_a000"), - m_cart_b000(*this, "cart_b000"), - m_ram(*this, RAM_TAG), - m_rom(*this, M6502_TAG), - m_char_rom(*this, "charom"), - m_video_ram(*this, "video_ram"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_row8(*this, "ROW8"), - m_row9(*this, "ROW9"), - m_lock(*this, "LOCK"), - m_key(0), - m_sync(0), - m_graphic(0), - m_blanktv(0), - m_via_irq(CLEAR_LINE), - m_pia1a_irq(CLEAR_LINE), - m_pia1b_irq(CLEAR_LINE), - m_pia2a_irq(CLEAR_LINE), - m_pia2b_irq(CLEAR_LINE), - m_exp_irq(CLEAR_LINE), - m_user_diag(1) - { } - - required_device m_maincpu; - required_device m_via; - required_device m_pia1; - required_device m_pia2; - optional_device m_crtc; - required_device m_ieee; - required_device m_palette; - required_device m_cassette; - required_device m_cassette2; - required_device m_exp; - required_device m_user; - optional_device m_speaker; - optional_device m_cart_9000; - optional_device m_cart_a000; - optional_device m_cart_b000; - required_device m_ram; - required_memory_region m_rom; - required_memory_region m_char_rom; - optional_shared_ptr m_video_ram; - required_ioport m_row0; - required_ioport m_row1; - required_ioport m_row2; - required_ioport m_row3; - required_ioport m_row4; - required_ioport m_row5; - required_ioport m_row6; - required_ioport m_row7; - required_ioport m_row8; - required_ioport m_row9; - required_ioport m_lock; - - DECLARE_MACHINE_START( pet ); - DECLARE_MACHINE_START( pet2001 ); - DECLARE_MACHINE_RESET( pet ); - DECLARE_MACHINE_START( pet40 ); - DECLARE_MACHINE_RESET( pet40 ); - - MC6845_BEGIN_UPDATE( pet_begin_update ); - MC6845_UPDATE_ROW( pet40_update_row ); - - UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - - void check_interrupts(); - void update_speaker(); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_WRITE_LINE_MEMBER( via_irq_w ); - DECLARE_WRITE8_MEMBER( via_pa_w ); - DECLARE_READ8_MEMBER( via_pb_r ); - DECLARE_WRITE8_MEMBER( via_pb_w ); - DECLARE_WRITE_LINE_MEMBER( via_ca2_w ); - DECLARE_WRITE_LINE_MEMBER( via_cb2_w ); - - DECLARE_WRITE_LINE_MEMBER( pia1_irqa_w ); - DECLARE_WRITE_LINE_MEMBER( pia1_irqb_w ); - DECLARE_READ8_MEMBER( pia1_pa_r ); - DECLARE_READ8_MEMBER( pia1_pb_r ); - DECLARE_WRITE8_MEMBER( pia1_pa_w ); - DECLARE_WRITE_LINE_MEMBER( pia1_ca2_w ); - - DECLARE_WRITE_LINE_MEMBER( pia2_irqa_w ); - DECLARE_WRITE_LINE_MEMBER( pia2_irqb_w ); - - DECLARE_WRITE_LINE_MEMBER( user_diag_w ); - - TIMER_DEVICE_CALLBACK_MEMBER( sync_tick ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_pet ); - - enum - { - SEL0 = 0, - SEL1, - SEL2, - SEL3, - SEL4, - SEL5, - SEL6, - SEL7, - SEL8, - SEL9, - SELA, - SELB, - SELC, - SELD, - SELE, - SELF - }; - - // keyboard state - UINT8 m_key; - - // video state - int m_sync; - int m_graphic; - int m_blanktv; - int m_video_ram_size; - - // sound state - int m_via_cb2; - int m_pia1_pa7; - - UINT8 m_via_pa; - - // interrupt state - int m_via_irq; - int m_pia1a_irq; - int m_pia1b_irq; - int m_pia2a_irq; - int m_pia2b_irq; - int m_exp_irq; - int m_user_diag; -}; - - -class pet2001b_state : public pet_state -{ -public: - pet2001b_state(const machine_config &mconfig, device_type type, const char *tag) : - pet_state(mconfig, type, tag) - { } - - DECLARE_READ8_MEMBER( pia1_pb_r ); -}; - - -class pet80_state : public pet2001b_state -{ -public: - pet80_state(const machine_config &mconfig, device_type type, const char *tag) : - pet2001b_state(mconfig, type, tag) - { } - - DECLARE_MACHINE_START( pet80 ); - DECLARE_MACHINE_RESET( pet80 ); - - MC6845_UPDATE_ROW( pet80_update_row ); - MC6845_UPDATE_ROW( cbm8296_update_row ); -}; - - -class superpet_state : public pet80_state -{ -public: - superpet_state(const machine_config &mconfig, device_type type, const char *tag) - : pet80_state(mconfig, type, tag) - { } -}; - - -class cbm8096_state : public pet80_state -{ -public: - cbm8096_state(const machine_config &mconfig, device_type type, const char *tag) : - pet80_state(mconfig, type, tag) - { } -}; - - -class cbm8296_state : public pet80_state -{ -public: - cbm8296_state(const machine_config &mconfig, device_type type, const char *tag) : - pet80_state(mconfig, type, tag), - m_basic_rom(*this, "basic"), - m_editor_rom(*this, "editor"), - m_ue5_rom(*this, "ue5_eprom"), - m_ue6_rom(*this, "ue6_eprom"), - m_pla1(*this, PLA1_TAG), - m_pla2(*this, PLA2_TAG) - { } - - required_memory_region m_basic_rom; - required_memory_region m_editor_rom; - required_memory_region m_ue5_rom; - required_memory_region m_ue6_rom; - required_device m_pla1; - required_device m_pla2; - - DECLARE_MACHINE_START( cbm8296 ); - DECLARE_MACHINE_RESET( cbm8296 ); - - void read_pla1(offs_t offset, int phi2, int brw, int noscreen, int noio, int ramsela, int ramsel9, int ramon, int norom, - int &cswff, int &cs9, int &csa, int &csio, int &cse, int &cskb, int &fa12, int &casena1); - void read_pla2(offs_t offset, int phi2, int brw, int casena1, int &endra, int &noscreen, int &casena2, int &fa15); - - void read_pla1_eprom(offs_t offset, int phi2, int brw, int noscreen, int noio, int ramsela, int ramsel9, int ramon, int norom, - int &cswff, int &cs9, int &csa, int &csio, int &cse, int &cskb, int &fa12, int &casena1); - void read_pla2_eprom(offs_t offset, int phi2, int brw, int casena1, int &endra, int &noscreen, int &casena2, int &fa15); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - UINT8 m_cr; -}; - - - -#endif diff --git a/src/mame/includes/plus4.h b/src/mame/includes/plus4.h deleted file mode 100644 index fbd590c9601..00000000000 --- a/src/mame/includes/plus4.h +++ /dev/null @@ -1,173 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __PLUS4__ -#define __PLUS4__ - -#include "emu.h" -#include "bus/cbmiec/cbmiec.h" -#include "bus/pet/cass.h" -#include "bus/plus4/exp.h" -#include "bus/plus4/user.h" -#include "bus/vcs_ctrl/ctrl.h" -#include "cpu/m6502/m7501.h" -#include "imagedev/snapquik.h" -#include "machine/mos6529.h" -#include "machine/mos6551.h" -#include "machine/mos8706.h" -#include "machine/pla.h" -#include "machine/ram.h" -#include "sound/mos7360.h" - -#define MOS7501_TAG "u2" -#define MOS7360_TAG "u1" -#define MOS6551_TAG "u3" -#define MOS6529_USER_TAG "u5" -#define MOS6529_KB_TAG "u27" -#define T6721A_TAG "t6721a" -#define MOS8706_TAG "mos8706" -#define PLA_TAG "u19" -#define SCREEN_TAG "screen" -#define CONTROL1_TAG "joy1" -#define CONTROL2_TAG "joy2" -#define PET_USER_PORT_TAG "user" - -class plus4_state : public driver_device -{ -public: - plus4_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, MOS7501_TAG), - m_pla(*this, PLA_TAG), - m_ted(*this, MOS7360_TAG), - m_acia(*this, MOS6551_TAG), - m_spi_user(*this, MOS6529_USER_TAG), - m_spi_kb(*this, MOS6529_KB_TAG), - m_vslsi(*this, MOS8706_TAG), - m_iec(*this, CBM_IEC_TAG), - m_joy1(*this, CONTROL1_TAG), - m_joy2(*this, CONTROL2_TAG), - m_exp(*this, PLUS4_EXPANSION_SLOT_TAG), - m_user(*this, PET_USER_PORT_TAG), - m_ram(*this, RAM_TAG), - m_cassette(*this, PET_DATASSETTE_PORT_TAG), - m_kernal(*this, "kernal"), - m_function(*this, "function"), - m_c2(*this, "c2"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_lock(*this, "LOCK"), - m_addr(0), - m_ted_irq(CLEAR_LINE), - m_acia_irq(CLEAR_LINE), - m_exp_irq(CLEAR_LINE) - { } - - required_device m_maincpu; - required_device m_pla; - required_device m_ted; - optional_device m_acia; - optional_device m_spi_user; - required_device m_spi_kb; - optional_device m_vslsi; - required_device m_iec; - required_device m_joy1; - required_device m_joy2; - required_device m_exp; - optional_device m_user; - required_device m_ram; - required_device m_cassette; - required_memory_region m_kernal; - optional_memory_region m_function; - optional_memory_region m_c2; - required_ioport m_row0; - required_ioport m_row1; - required_ioport m_row2; - required_ioport m_row3; - required_ioport m_row4; - required_ioport m_row5; - required_ioport m_row6; - required_ioport m_row7; - required_ioport m_lock; - - virtual void machine_start() override; - virtual void machine_reset() override; - - void check_interrupts(); - void bankswitch(offs_t offset, int phi0, int mux, int ras, int *scs, int *phi2, int *user, int *_6551, int *addr_clk, int *keyport, int *kernal); - UINT8 read_memory(address_space &space, offs_t offset, int ba, int scs, int phi2, int user, int _6551, int addr_clk, int keyport, int kernal); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - DECLARE_READ8_MEMBER( ted_videoram_r ); - - DECLARE_READ8_MEMBER( cpu_r ); - DECLARE_WRITE8_MEMBER( cpu_w ); - - DECLARE_WRITE_LINE_MEMBER( ted_irq_w ); - DECLARE_READ8_MEMBER( ted_k_r ); - - DECLARE_WRITE_LINE_MEMBER( write_kb0 ) { if (state) m_kb |= 1; else m_kb &= ~1; } - DECLARE_WRITE_LINE_MEMBER( write_kb1 ) { if (state) m_kb |= 2; else m_kb &= ~2; } - DECLARE_WRITE_LINE_MEMBER( write_kb2 ) { if (state) m_kb |= 4; else m_kb &= ~4; } - DECLARE_WRITE_LINE_MEMBER( write_kb3 ) { if (state) m_kb |= 8; else m_kb &= ~8; } - DECLARE_WRITE_LINE_MEMBER( write_kb4 ) { if (state) m_kb |= 16; else m_kb &= ~16; } - DECLARE_WRITE_LINE_MEMBER( write_kb5 ) { if (state) m_kb |= 32; else m_kb &= ~32; } - DECLARE_WRITE_LINE_MEMBER( write_kb6 ) { if (state) m_kb |= 64; else m_kb &= ~64; } - DECLARE_WRITE_LINE_MEMBER( write_kb7 ) { if (state) m_kb |= 128; else m_kb &= ~128; } - - DECLARE_WRITE_LINE_MEMBER( acia_irq_w ); - - DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_c16 ); - - enum - { - CS0_BASIC = 0, - CS0_FUNCTION_LO, - CS0_C1_LOW, - CS0_C2_LOW - }; - - enum - { - CS1_KERNAL = 0, - CS1_FUNCTION_HI, - CS1_C1_HIGH, - CS1_C2_HIGH - }; - - // memory state - UINT8 m_addr; - - // interrupt state - int m_ted_irq; - int m_acia_irq; - int m_exp_irq; - - // keyboard state - UINT8 m_kb; -}; - - -class c16_state : public plus4_state -{ -public: - c16_state(const machine_config &mconfig, device_type type, const char *tag) - : plus4_state(mconfig, type, tag) - { } - - DECLARE_READ8_MEMBER( cpu_r ); -}; - - - -#endif diff --git a/src/mame/includes/ql.h b/src/mame/includes/ql.h deleted file mode 100644 index 3e0d2d082ee..00000000000 --- a/src/mame/includes/ql.h +++ /dev/null @@ -1,141 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder, Phill Harvey-Smith -#pragma once - -#ifndef __QL__ -#define __QL__ - -#include "emu.h" -#include "bus/ql/exp.h" -#include "bus/ql/rom.h" -#include "bus/rs232/rs232.h" -#include "cpu/m68000/m68000.h" -#include "cpu/mcs48/mcs48.h" -#include "machine/microdrv.h" -#include "machine/qimi.h" -#include "machine/ram.h" -#include "machine/zx8302.h" -#include "sound/speaker.h" -#include "video/zx8301.h" - -#define SCREEN_TAG "screen" - -#define M68008_TAG "ic18" -#define I8749_TAG "ic24" -#define I8051_TAG "i8051" -#define ZX8301_TAG "ic22" -#define ZX8302_TAG "ic23" -#define RS232_A_TAG "ser1" -#define RS232_B_TAG "ser2" -#define QIMI_TAG "qimi" - -#define X1 XTAL_15MHz -#define X2 XTAL_32_768kHz -#define X3 XTAL_4_436MHz -#define X4 XTAL_11MHz - -class ql_state : public driver_device -{ -public: - ql_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, M68008_TAG), - m_ipc(*this, I8749_TAG), - m_zx8301(*this, ZX8301_TAG), - m_zx8302(*this, ZX8302_TAG), - m_speaker(*this, "speaker"), - m_mdv1(*this, MDV_1), - m_mdv2(*this, MDV_2), - m_ser1(*this, RS232_A_TAG), - m_ser2(*this, RS232_A_TAG), - m_ram(*this, RAM_TAG), - m_exp(*this, "exp"), - m_cart(*this, "rom"), - m_qimi(*this, QIMI_TAG), - m_rom(*this, M68008_TAG), - m_y0(*this, "Y0"), - m_y1(*this, "Y1"), - m_y2(*this, "Y2"), - m_y3(*this, "Y3"), - m_y4(*this, "Y4"), - m_y5(*this, "Y5"), - m_y6(*this, "Y6"), - m_y7(*this, "Y7"), - m_joy0(*this, "JOY0"), - m_joy1(*this, "JOY1"), - m_config(*this, "config"), - m_extintl(CLEAR_LINE), - m_keylatch(0), - m_ipl(0), - m_comdata_to_ipc(0), - m_baudx4(0), - m_qimi_enabled(false), - m_qimi_extint(CLEAR_LINE) - { } - - required_device m_maincpu; - required_device m_ipc; - required_device m_zx8301; - required_device m_zx8302; - required_device m_speaker; - required_device m_mdv1; - required_device m_mdv2; - required_device m_ser1; - required_device m_ser2; - required_device m_ram; - required_device m_exp; - required_device m_cart; - optional_device m_qimi; - required_memory_region m_rom; - required_ioport m_y0; - required_ioport m_y1; - required_ioport m_y2; - required_ioport m_y3; - required_ioport m_y4; - required_ioport m_y5; - required_ioport m_y6; - required_ioport m_y7; - required_ioport m_joy0; - required_ioport m_joy1; - required_ioport m_config; - - virtual void machine_start() override; - virtual void machine_reset() override; - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_WRITE8_MEMBER( ipc_w ); - DECLARE_WRITE8_MEMBER( ipc_port1_w ); - DECLARE_WRITE8_MEMBER( ipc_port2_w ); - DECLARE_READ8_MEMBER( ipc_port2_r ); - DECLARE_READ8_MEMBER( ipc_t1_r ); - DECLARE_READ8_MEMBER( ipc_bus_r ); - DECLARE_WRITE_LINE_MEMBER( ql_baudx4_w ); - DECLARE_WRITE_LINE_MEMBER( ql_comdata_w ); - DECLARE_WRITE_LINE_MEMBER( zx8302_mdselck_w ); - DECLARE_WRITE_LINE_MEMBER( zx8302_mdrdw_w ); - DECLARE_WRITE_LINE_MEMBER( zx8302_erase_w ); - DECLARE_WRITE_LINE_MEMBER( zx8302_raw1_w ); - DECLARE_READ_LINE_MEMBER( zx8302_raw1_r ); - DECLARE_WRITE_LINE_MEMBER( zx8302_raw2_w ); - DECLARE_READ_LINE_MEMBER( zx8302_raw2_r ); - DECLARE_WRITE_LINE_MEMBER( exp_extintl_w ); - DECLARE_WRITE_LINE_MEMBER( qimi_extintl_w ); - - void update_interrupt(); - - int m_extintl; - - // IPC - UINT8 m_keylatch; - int m_ipl; - int m_comdata_to_ipc; - int m_baudx4; - - // QIMI - bool m_qimi_enabled; - int m_qimi_extint; -}; - -#endif diff --git a/src/mame/includes/vic10.h b/src/mame/includes/vic10.h deleted file mode 100644 index efcaeeaded0..00000000000 --- a/src/mame/includes/vic10.h +++ /dev/null @@ -1,113 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __VIC10__ -#define __VIC10__ - -#include "emu.h" -#include "bus/pet/cass.h" -#include "bus/vic10/exp.h" -#include "bus/vcs_ctrl/ctrl.h" -#include "cpu/m6502/m6510.h" -#include "machine/mos6526.h" -#include "machine/ram.h" -#include "sound/dac.h" -#include "sound/mos6581.h" -#include "video/mos6566.h" - -#define M6510_TAG "u3" -#define MOS6566_TAG "u2" -#define MOS6581_TAG "u6" -#define MOS6526_TAG "u9" -#define SCREEN_TAG "screen" -#define TIMER_C1531_TAG "c1531" -#define CONTROL1_TAG "joy1" -#define CONTROL2_TAG "joy2" - -class vic10_state : public driver_device -{ -public: - vic10_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, M6510_TAG), - m_vic(*this, MOS6566_TAG), - m_sid(*this, MOS6581_TAG), - m_cia(*this, MOS6526_TAG), - m_joy1(*this, CONTROL1_TAG), - m_joy2(*this, CONTROL2_TAG), - m_exp(*this, VIC10_EXPANSION_SLOT_TAG), - m_ram(*this, RAM_TAG), - m_cassette(*this, PET_DATASSETTE_PORT_TAG), - m_color_ram(*this, "color_ram"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_restore(*this, "RESTORE"), - m_lock(*this, "LOCK"), - m_cia_irq(CLEAR_LINE), - m_vic_irq(CLEAR_LINE), - m_exp_irq(CLEAR_LINE) - { } - - required_device m_maincpu; - required_device m_vic; - required_device m_sid; - required_device m_cia; - required_device m_joy1; - required_device m_joy2; - required_device m_exp; - required_device m_ram; - optional_device m_cassette; - optional_shared_ptr m_color_ram; - required_ioport m_row0; - required_ioport m_row1; - required_ioport m_row2; - required_ioport m_row3; - required_ioport m_row4; - required_ioport m_row5; - required_ioport m_row6; - required_ioport m_row7; - required_ioport m_restore; - required_ioport m_lock; - - virtual void machine_start() override; - virtual void machine_reset() override; - - void check_interrupts(); - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_WRITE_LINE_MEMBER( vic_irq_w ); - DECLARE_READ8_MEMBER( vic_videoram_r ); - DECLARE_READ8_MEMBER( vic_colorram_r ); - - DECLARE_READ8_MEMBER( sid_potx_r ); - DECLARE_READ8_MEMBER( sid_poty_r ); - - DECLARE_WRITE_LINE_MEMBER( cia_irq_w ); - DECLARE_READ8_MEMBER( cia_pa_r ); - DECLARE_READ8_MEMBER( cia_pb_r ); - DECLARE_WRITE8_MEMBER( cia_pb_w ); - - DECLARE_READ8_MEMBER( cpu_r ); - DECLARE_WRITE8_MEMBER( cpu_w ); - - DECLARE_WRITE_LINE_MEMBER( exp_irq_w ); - DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); - - // interrupt state - int m_cia_irq; - int m_vic_irq; - int m_exp_irq; -}; - - - -#endif diff --git a/src/mame/includes/vic20.h b/src/mame/includes/vic20.h deleted file mode 100644 index f90108165aa..00000000000 --- a/src/mame/includes/vic20.h +++ /dev/null @@ -1,159 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Curt Coder -#pragma once - -#ifndef __VIC20__ -#define __VIC20__ - -#include "emu.h" -#include "bus/cbmiec/cbmiec.h" -#include "bus/pet/cass.h" -#include "bus/vcs_ctrl/ctrl.h" -#include "bus/vic20/exp.h" -#include "bus/vic20/user.h" -#include "cpu/m6502/m6510.h" -#include "machine/6522via.h" -#include "machine/cbm_snqk.h" -#include "machine/ram.h" -#include "sound/dac.h" -#include "sound/mos6560.h" - -#define M6502_TAG "ue10" -#define M6522_1_TAG "uab3" -#define M6522_2_TAG "uab1" -#define M6560_TAG "ub7" -#define M6561_TAG "ub7" -#define IEC_TAG "iec" -#define SCREEN_TAG "screen" -#define CONTROL1_TAG "joy1" -#define PET_USER_PORT_TAG "user" - -class vic20_state : public driver_device -{ -public: - vic20_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, M6502_TAG), - m_via1(*this, M6522_1_TAG), - m_via2(*this, M6522_2_TAG), - m_vic(*this, M6560_TAG), - m_iec(*this, CBM_IEC_TAG), - m_joy(*this, CONTROL1_TAG), - m_exp(*this, VIC20_EXPANSION_SLOT_TAG), - m_user(*this, PET_USER_PORT_TAG), - m_cassette(*this, PET_DATASSETTE_PORT_TAG), - m_ram(*this, RAM_TAG), - m_basic(*this, "basic"), - m_kernal(*this, "kernal"), - m_charom(*this, "charom"), - m_color_ram(*this, "color_ram"), - m_row0(*this, "ROW0"), - m_row1(*this, "ROW1"), - m_row2(*this, "ROW2"), - m_row3(*this, "ROW3"), - m_row4(*this, "ROW4"), - m_row5(*this, "ROW5"), - m_row6(*this, "ROW6"), - m_row7(*this, "ROW7"), - m_restore(*this, "RESTORE"), - m_lock(*this, "LOCK") - { } - - required_device m_maincpu; - required_device m_via1; - required_device m_via2; - required_device m_vic; - required_device m_iec; - required_device m_joy; - required_device m_exp; - required_device m_user; - required_device m_cassette; - required_device m_ram; - required_region_ptr m_basic; - required_region_ptr m_kernal; - required_region_ptr m_charom; - required_shared_ptr m_color_ram; - required_ioport m_row0; - required_ioport m_row1; - required_ioport m_row2; - required_ioport m_row3; - required_ioport m_row4; - required_ioport m_row5; - required_ioport m_row6; - required_ioport m_row7; - required_ioport m_restore; - required_ioport m_lock; - - virtual void machine_start() override; - virtual void machine_reset() override; - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - DECLARE_READ8_MEMBER( vic_videoram_r ); - - DECLARE_WRITE_LINE_MEMBER( write_light_pen ); - DECLARE_WRITE_LINE_MEMBER( write_user_joy0 ); - DECLARE_WRITE_LINE_MEMBER( write_user_joy1 ); - DECLARE_WRITE_LINE_MEMBER( write_user_joy2 ); - DECLARE_WRITE_LINE_MEMBER( write_user_light_pen ); - DECLARE_WRITE_LINE_MEMBER( write_user_cassette_switch ); - - DECLARE_READ8_MEMBER( via1_pa_r ); - DECLARE_WRITE8_MEMBER( via1_pa_w ); - DECLARE_WRITE8_MEMBER( via1_pb_w ); - - DECLARE_READ8_MEMBER( via2_pa_r ); - DECLARE_READ8_MEMBER( via2_pb_r ); - DECLARE_WRITE8_MEMBER( via2_pb_w ); - DECLARE_WRITE_LINE_MEMBER( via2_ca2_w ); - DECLARE_WRITE_LINE_MEMBER( via2_cb2_w ); - - DECLARE_WRITE_LINE_MEMBER( exp_reset_w ); - - DECLARE_QUICKLOAD_LOAD_MEMBER( cbm_vc20 ); - // keyboard state - int m_key_col; - int m_light_pen; - int m_user_joy0; - int m_user_joy1; - int m_user_joy2; - int m_user_light_pen; - int m_user_cassette_switch; - - enum - { - BLK0 = 0, - BLK1, - BLK2, - BLK3, - BLK4, - BLK5, - BLK6, - BLK7 - }; - - - enum - { - RAM0 = 0, - RAM1, - RAM2, - RAM3, - RAM4, - RAM5, - RAM6, - RAM7 - }; - - - enum - { - IO0 = 4, - COLOR = 5, - IO2 = 6, - IO3 = 7 - }; -}; - -#endif diff --git a/src/mame/includes/vidbrain.h b/src/mame/includes/vidbrain.h index cb3905ff674..f9c8aa789cc 100644 --- a/src/mame/includes/vidbrain.h +++ b/src/mame/includes/vidbrain.h @@ -25,32 +25,25 @@ class vidbrain_state : public driver_device { public: - vidbrain_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, F3850_TAG), - m_smi(*this, F3853_TAG), - m_uv(*this, UV201_TAG), - m_discrete(*this, DISCRETE_TAG), - m_dac(*this, DAC_TAG), - m_exp(*this, VIDEOBRAIN_EXPANSION_SLOT_TAG), - m_io00(*this, "IO00"), - m_io01(*this, "IO01"), - m_io02(*this, "IO02"), - m_io03(*this, "IO03"), - m_io04(*this, "IO04"), - m_io05(*this, "IO05"), - m_io06(*this, "IO06"), - m_io07(*this, "IO07"), - m_uv201_31(*this, "UV201-31"), - m_joy_r(*this, "JOY-R"), - m_joy1_x(*this, "JOY1-X"), - m_joy1_y(*this, "JOY1-Y"), - m_joy2_x(*this, "JOY2-X"), - m_joy2_y(*this, "JOY2-Y"), - m_joy3_x(*this, "JOY3-X"), - m_joy3_y(*this, "JOY3-Y"), - m_joy4_x(*this, "JOY4-X"), - m_joy4_y(*this, "JOY4-Y") + vidbrain_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, F3850_TAG), + m_smi(*this, F3853_TAG), + m_uv(*this, UV201_TAG), + m_discrete(*this, DISCRETE_TAG), + m_dac(*this, DAC_TAG), + m_exp(*this, VIDEOBRAIN_EXPANSION_SLOT_TAG), + m_io(*this, "IO%02u", 0), + m_uv201_31(*this, "UV201-31"), + m_joy_r(*this, "JOY-R"), + m_joy1_x(*this, "JOY1-X"), + m_joy1_y(*this, "JOY1-Y"), + m_joy2_x(*this, "JOY2-X"), + m_joy2_y(*this, "JOY2-Y"), + m_joy3_x(*this, "JOY3-X"), + m_joy3_y(*this, "JOY3-Y"), + m_joy4_x(*this, "JOY4-X"), + m_joy4_y(*this, "JOY4-Y") { } required_device m_maincpu; @@ -59,14 +52,7 @@ public: required_device m_discrete; required_device m_dac; required_device m_exp; - required_ioport m_io00; - required_ioport m_io01; - required_ioport m_io02; - required_ioport m_io03; - required_ioport m_io04; - required_ioport m_io05; - required_ioport m_io06; - required_ioport m_io07; + required_ioport_array<8> m_io; required_ioport m_uv201_31; required_ioport m_joy_r; required_ioport m_joy1_x;