diff options
-rw-r--r-- | scripts/src/cpu.lua | 17 | ||||
-rw-r--r-- | src/devices/cpu/gigatron/gigatron.cpp | 129 | ||||
-rw-r--r-- | src/devices/cpu/gigatron/gigatron.h | 62 | ||||
-rw-r--r-- | src/devices/cpu/gigatron/gigatrondasm.cpp | 17 | ||||
-rw-r--r-- | src/devices/cpu/gigatron/gigatrondasm.h | 24 | ||||
-rw-r--r-- | src/mame/drivers/gigatron.cpp | 50 | ||||
-rw-r--r-- | src/mame/mame.lst | 3 | ||||
-rw-r--r-- | src/mame/mess.flt | 1 |
8 files changed, 303 insertions, 0 deletions
diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua index b030e4958bd..d67ce4c706c 100644 --- a/scripts/src/cpu.lua +++ b/scripts/src/cpu.lua @@ -2982,6 +2982,22 @@ if (CPUS["CR16B"]~=null or _OPTIONS["with-tools"]) then end -------------------------------------------------- +-- Gigatron +--@src/devices/cpu/gigatron.h,CPUS["GTRON"] = true +-------------------------------------------------- + +if (CPUS["GTRON"]~=null) then + files { + MAME_DIR .. "src/devices/cpu/gigatron/gigatron.cpp", + MAME_DIR .. "src/devices/cpu/gigatron/gigatron.h", + } +end + +if (CPUS["GTRON"]~=null or _OPTIONS["with-tools"]) then + table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/gigatron/gigatrondasm.cpp") + table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/gigatron/gigatrondasm.h") +end + -- Motorola DSP56000 --@src/devices/cpu/dsp56000/dsp56000.h,CPUS["DSP56000"] = true -------------------------------------------------- @@ -3081,4 +3097,5 @@ end if (CPUS["RX01"]~=null or _OPTIONS["with-tools"]) then table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/rx01/rx01dasm.cpp") table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/rx01/rx01dasm.h") + end diff --git a/src/devices/cpu/gigatron/gigatron.cpp b/src/devices/cpu/gigatron/gigatron.cpp new file mode 100644 index 00000000000..4eb9e3c9858 --- /dev/null +++ b/src/devices/cpu/gigatron/gigatron.cpp @@ -0,0 +1,129 @@ +// license:BSD-3-Clause +// copyright-holders:Sterophonick +/***************************************************************************** + * + * Skeleton device for Gigatron CPU Core + * + *****************************************************************************/ + +#include "emu.h" +#include "gigatron.h" +#include "debugger.h" + + +DEFINE_DEVICE_TYPE(GTRON, gigatron_cpu_device, "gigatron", "GTRON") + + +/* FLAGS */ +#if 0 +#define S 0x80 +#define Z 0x40 +#define OV 0x20 +#define C 0x10 +#endif + + +#define gigatron_readop(A) m_program->read_dword(A) +#define gigatron_readmem16(A) m_data->read_dword(A) +#define gigatron_writemem16(A,B) m_data->write_dword((A),B) + + +/*********************************** + * illegal opcodes + ***********************************/ +void gigatron_cpu_device::gigatron_illegal() +{ + logerror("gigatron illegal opcode at 0x%04x\n", m_pc); + m_icount -= 1; +} + +/* Execute cycles */ +void gigatron_cpu_device::execute_run() +{ + uint16_t opcode; + + do + { + debugger_instruction_hook(this, m_pc); + + opcode = gigatron_readop(m_pc); + m_pc++; + + switch( opcode ) + { + default: + gigatron_illegal(); + break; + } + + } while( m_icount > 0 ); +} + + +void gigatron_cpu_device::device_start() +{ + m_program = &space(AS_PROGRAM); + m_data = &space(AS_DATA); + + save_item(NAME(m_pc)); + save_item(NAME(m_flags)); + + // Register state for debugger + state_add( GTRON_R0, "PC", m_pc ).formatstr("%02X"); + state_add( STATE_GENPC, "GENPC", m_r[7] ).noshow(); + state_add( STATE_GENPCBASE, "CURPC", m_r[7] ).noshow(); + state_add( STATE_GENFLAGS, "GENFLAGS", m_flags ).noshow(); + + m_icountptr = &m_icount; +} + +#if 0 +void gigatron_cpu_device::execute_set_input(int irqline, int state) +{ + switch(irqline) + { + case GTRON_INT_INTRM: // level-sensitive + m_intrm_pending = ((ASSERT_LINE == state) || (HOLD_LINE == state)); + m_intrm_state = (ASSERT_LINE == state); + break; + case GTRON_RESET: // edge-sensitive + if (CLEAR_LINE != state) + m_reset_pending = 1; + m_reset_state = (ASSERT_LINE == state); + break; + case GTRON_INT_INTR: // edge-sensitive + if (CLEAR_LINE != state) + m_intr_pending = 1; + m_intr_state = (ASSERT_LINE == state); + break; + } +} +#endif + +gigatron_cpu_device::gigatron_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : cpu_device(mconfig, GTRON, tag, owner, clock) + , m_program_config("program", ENDIANNESS_BIG, 8, 32, -1) + , m_data_config("data", ENDIANNESS_BIG, 8, 32, 0) +{ +} + + +void gigatron_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) const +{ + switch (entry.index()) + { + case STATE_GENFLAGS: + str = util::string_format("%c%c%c%c", + m_flags & 0x80 ? 'S':'.', + m_flags & 0x40 ? 'Z':'.', + m_flags & 0x20 ? 'V':'.', + m_flags & 0x10 ? 'C':'.'); + break; + } +} + + +offs_t gigatron_cpu_device::disassemble(char *buffer, offs_t pc, const uint32_t *oprom, const uint32_t *opram, uint32_t options) +{ + return CPU_DISASSEMBLE_NAME(gigatron)(this, buffer, pc, opcodes, params, options); +} diff --git a/src/devices/cpu/gigatron/gigatron.h b/src/devices/cpu/gigatron/gigatron.h new file mode 100644 index 00000000000..4f4b73da26c --- /dev/null +++ b/src/devices/cpu/gigatron/gigatron.h @@ -0,0 +1,62 @@ +// license:BSD-3-Clause +// copyright-holders:Sterophonick +/***************************************************************************** + * + * Skeleton Device for Gigatron CPU Core + * + *****************************************************************************/ + +#ifndef MAME_CPU_GTRON_H +#define MAME_CPU_GTRON_H + +#pragma once + +enum +{ + GTRON_R0=1, GTRON_R1, GTRON_R2, GTRON_R3, + GTRON_R4, GTRON_R5, GTRON_R6, GTRON_R7 +}; + + +class gigatron_cpu_device : public cpu_device +{ +public: + // construction/destruction + gigatron_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // device_execute_interface overrides + virtual uint32_t execute_min_cycles() const noexcept override { return 1; } + virtual uint32_t execute_max_cycles() const noexcept override { return 7; } + virtual uint32_t execute_input_lines() const noexcept override { return 0; } + virtual void execute_run() override; + virtual void execute_set_input(int inputnum, int state) override; + + // device_state_interface overrides + virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; + + +private: + address_space_config m_program_config; + + uint8_t m_pc; /* registers */ + uint8_t m_flags; /* flags */ + address_space *m_program; + address_space *m_data; + int m_icount; + + void gigatron_illegal(); + +}; + + +DECLARE_DEVICE_TYPE(GTRON, gigatron_cpu_device) + + + +#endif // MAME_CPU_GTRON_H + diff --git a/src/devices/cpu/gigatron/gigatrondasm.cpp b/src/devices/cpu/gigatron/gigatrondasm.cpp new file mode 100644 index 00000000000..100f8d7e984 --- /dev/null +++ b/src/devices/cpu/gigatron/gigatrondasm.cpp @@ -0,0 +1,17 @@ +// license:BSD-3-Clause +// copyright-holders:Sterophonick + +// Gigatron Disassembler + +#include "emu.h" +#include "gigatrondasm.h" + +u32 gigatron_disassembler::opcode_alignment() const +{ + return 0; +} + +offs_t gigatron_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) +{ + return 0; +} diff --git a/src/devices/cpu/gigatron/gigatrondasm.h b/src/devices/cpu/gigatron/gigatrondasm.h new file mode 100644 index 00000000000..a1e590c0be8 --- /dev/null +++ b/src/devices/cpu/gigatron/gigatrondasm.h @@ -0,0 +1,24 @@ +// license:BSD-3-Clause +// copyright-holders:Sterophonick + +// Gigatron disassembler + +#ifndef MAME_CPU_GIGATRON_GIGATRONDASM_H +#define MAME_CPU_GIGATRON_GIGATRONDASM_H + +#pragma once + +class gigatron_disassembler : public util::disasm_interface +{ +public: + gigatron_disassembler() = default; + virtual ~gigatron_disassembler() = default; + + virtual u32 opcode_alignment() const override; + virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) override; + +private: +}; + +#endif + diff --git a/src/mame/drivers/gigatron.cpp b/src/mame/drivers/gigatron.cpp new file mode 100644 index 00000000000..c14df7cbafd --- /dev/null +++ b/src/mame/drivers/gigatron.cpp @@ -0,0 +1,50 @@ +// license:BSD-3-Clause +// copyright-holders:Sterophonick +/*************************************************************************** + + Skeleton driver for Gigatron TTL Microcomputer + Driver by Sterophonick + +***************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +//#include "cpu/gigatron/gigatron.h" +#include "machine/nvram.h" +#include "speaker.h" + +#define MAIN_CLOCK 6250000 + +class gigatron_state : public driver_device +{ +public: + gigatron_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + { + } + + void gigatron(machine_config &config); + +private: + + required_device<cpu_device> m_maincpu; +}; + +static INPUT_PORTS_START(gigatron) +INPUT_PORTS_END + +void gigatron_state::gigatron(machine_config &config) +{ + M6502(config, m_maincpu, MAIN_CLOCK); // actually its own custom cpu but i cant get it to work + //GTRON(config, m_maincpu, MAIN_CLOCK); + SPEAKER(config, "mono").front_center(); + +} + +ROM_START( gigatron ) + ROM_REGION( 0x00000, "maincpu", 0 ) + ROM_LOAD( "gigatron.rom", 0x0000, 0x20000, CRC(78995109) SHA1(2395fc48e64099836111f5aeca39ddbf4650ea4e) ) +ROM_END + +GAME(199?, gigatron, 0, gigatron, gigatron, gigatron_state, empty_init, ROT0, "Marcel van Kervinck", "Gigatron TTL Microcomputer", MACHINE_IS_SKELETON_MECHANICAL)
\ No newline at end of file diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 9544e385a91..4ebeb7f1368 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -14620,6 +14620,9 @@ touryuu // (c) 200? Yuki Enterprise giclasex giclassvr +@source:gigatron.cpp +gigatron // (c) 2018 Marcel van Kervinck + @source:gijoe.cpp gijoe // GX069 (c) 1991 (World) gijoea // GX069 (c) 1991 (Asia) diff --git a/src/mame/mess.flt b/src/mame/mess.flt index 6e93f240a99..7d393b43b05 100644 --- a/src/mame/mess.flt +++ b/src/mame/mess.flt @@ -315,6 +315,7 @@ geneve.cpp geniusiq.cpp geniusjr.cpp genpc.cpp +gigatron.cpp gimix.cpp gkidabc.cpp gizmondo.cpp |