Add disassembler and skeleton CPU device for CompactRISC CR16B architecture

vtech_unk1.cpp: Driver moved to glcx.cpp (nw)
This commit is contained in:
AJR 2019-07-05 19:00:52 -04:00
parent f0478fdbb8
commit 30afb4579d
11 changed files with 1339 additions and 20 deletions

View File

@ -2933,3 +2933,20 @@ if (CPUS["F2MC16"]~=null or _OPTIONS["with-tools"]) then
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/f2mc16/f2mc16dasm.cpp")
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/f2mc16/f2mc16dasm.h")
end
--------------------------------------------------
-- National Semiconductor CR16B
--@src/devices/cpu/cr16b/cr16bdasm.h,CPUS["CR16B"] = true
--------------------------------------------------
if (CPUS["CR16B"]~=null) then
files {
MAME_DIR .. "src/devices/cpu/cr16b/cr16b.cpp",
MAME_DIR .. "src/devices/cpu/cr16b/cr16b.h",
}
end
if (CPUS["CR16B"]~=null or _OPTIONS["with-tools"]) then
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/cr16b/cr16bdasm.cpp")
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/cr16b/cr16bdasm.h")
end

View File

@ -136,6 +136,7 @@ CPUS["DSPP"] = true
CPUS["HPC"] = true
--CPUS["RII"] = true
--CPUS["BCP"] = true
--CPUS["CR16B"] = true
--------------------------------------------------
-- specify available sound cores

View File

@ -145,6 +145,7 @@ CPUS["DSPV"] = true
CPUS["RII"] = true
CPUS["BCP"] = true
CPUS["F2MC16"] = true
CPUS["CR16B"] = true
--------------------------------------------------
-- specify available sound cores; some of these are
@ -3730,7 +3731,7 @@ files {
MAME_DIR .. "src/mame/drivers/gamemachine.cpp",
MAME_DIR .. "src/mame/drivers/geniusiq.cpp",
MAME_DIR .. "src/mame/drivers/geniusjr.cpp",
MAME_DIR .. "src/mame/drivers/vtech_unk1.cpp",
MAME_DIR .. "src/mame/drivers/glcx.cpp",
MAME_DIR .. "src/mame/drivers/vtech_unk2.cpp",
MAME_DIR .. "src/mame/drivers/vtech_eu3a12.cpp",
MAME_DIR .. "src/mame/drivers/iqunlim.cpp",

View File

@ -0,0 +1,107 @@
// license:BSD-3-Clause
// copyright-holders:AJR
/***************************************************************************
National Semiconductor CompactRISC CR16B
Currently this device is just a stub with no actual execution core.
***************************************************************************/
#include "emu.h"
#include "cr16b.h"
#include "cr16bdasm.h"
// device type definitions
DEFINE_DEVICE_TYPE(CR16B, cr16b_device, "cr16b", "CompactRISC CR16B")
cr16b_device::cr16b_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, address_map_constructor map)
: cpu_device(mconfig, type, tag, owner, clock)
, m_space_config("program", ENDIANNESS_LITTLE, 16, 21, 0, map)
, m_space(nullptr)
, m_cache(nullptr)
, m_regs{0}
, m_pc(0)
, m_isp(0)
, m_intbase(0)
, m_psr(0)
, m_cfg(0)
, m_dcr(0)
, m_dsr(0)
, m_car(0)
, m_icount(0)
{
}
// TODO: figure out some actual device types instead
cr16b_device::cr16b_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: cr16b_device(mconfig, CR16B, tag, owner, clock, address_map_constructor())
{
}
std::unique_ptr<util::disasm_interface> cr16b_device::create_disassembler()
{
return std::make_unique<cr16b_disassembler>();
}
device_memory_interface::space_config_vector cr16b_device::memory_space_config() const
{
return space_config_vector {
std::make_pair(AS_PROGRAM, &m_space_config),
};
}
void cr16b_device::device_start()
{
m_space = &space(AS_PROGRAM);
m_cache = m_space->cache<1, 0, ENDIANNESS_LITTLE>();
set_icountptr(m_icount);
state_add(CR16_PC, "PC", m_pc).mask(0x1ffffe);
state_add(STATE_GENPC, "GENPC", m_pc).callimport().noshow();
state_add(STATE_GENPCBASE, "CURPC", m_pc).callimport().noshow();
state_add(CR16_ISP, "ISP", m_isp).mask(0x00ffff).formatstr("%06X");
state_add(CR16_INTBASE, "INTBASE", m_intbase).mask(0x1ffffe);
state_add(CR16_PSR, "PSR", m_psr).mask(0x0ee7).formatstr("%04X");
for (int i = 0; i < 13; i++)
state_add(CR16_R0 + i, string_format("R%d", i).c_str(), m_regs[i]);
state_add(CR16_R13, "ERA", m_regs[13]);
state_add(CR16_R14, "RA", m_regs[14]);
state_add(CR16_R15, "SP", m_regs[15]);
save_item(NAME(m_regs));
save_item(NAME(m_pc));
save_item(NAME(m_isp));
save_item(NAME(m_intbase));
save_item(NAME(m_psr));
save_item(NAME(m_cfg));
save_item(NAME(m_dcr));
save_item(NAME(m_dsr));
save_item(NAME(m_car));
}
void cr16b_device::device_reset()
{
// Save old values of PC and PSR in R0 and R1
m_regs[0] = (m_pc & 0x01fffe) >> 1;
m_regs[1] = (m_pc & 0x1e0000) >> 5 | (m_psr & 0x0fff);
// Reset internal registers
m_pc = 0;
m_cfg = 0;
m_dcr = 0;
m_psr = 0x0200; // PSR.E = 1
}
void cr16b_device::execute_run()
{
debugger_instruction_hook(m_pc);
m_icount = 0;
}
void cr16b_device::execute_set_input(int inputnum, int state)
{
// TODO
}

View File

@ -0,0 +1,63 @@
// license:BSD-3-Clause
// copyright-holders:AJR
#ifndef MAME_CPU_CR16B_CR16B_H
#define MAME_CPU_CR16B_CR16B_H 1
#pragma once
class cr16b_device : public cpu_device
{
public:
cr16b_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
enum {
CR16_PC, CR16_ISP, CR16_INTBASE,
CR16_PSR, CR16_CFG, CR16_DCR, CR16_DSR, CR16_CAR,
CR16_R0, CR16_R1, CR16_R2, CR16_R3,
CR16_R4, CR16_R5, CR16_R6, CR16_R7,
CR16_R8, CR16_R9, CR16_R10, CR16_R11,
CR16_R12, CR16_R13, CR16_R14, CR16_R15
};
protected:
// construction/destruction
cr16b_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, address_map_constructor map);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
// device_execute_interface overrides
virtual void execute_run() override;
virtual void execute_set_input(int inputnum, int state) override;
// device_disasm_interface overrides
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
private:
// address space
address_space_config m_space_config;
address_space *m_space;
memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_cache;
// internal state
u16 m_regs[16];
u32 m_pc;
u32 m_isp;
u32 m_intbase;
u16 m_psr;
u16 m_cfg;
u16 m_dcr;
u16 m_dsr;
u32 m_car;
s32 m_icount;
};
DECLARE_DEVICE_TYPE(CR16B, cr16b_device)
#endif // MAME_CPU_CR16B_CR16B_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,66 @@
// license:BSD-3-Clause
// copyright-holders:AJR
#ifndef MAME_CPU_CR16B_CR16BDASM_H
#define MAME_CPU_CR16B_CR16BDASM_H 1
#pragma once
class cr16b_disassembler : public util::disasm_interface
{
public:
// construction/destruction
cr16b_disassembler();
// disassembler overrides
virtual u32 opcode_alignment() const override;
virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params) override;
protected:
enum cr16_arch
{
CR16A,
CR16B
};
cr16b_disassembler(cr16_arch arch);
// internal helpers
void format_reg(std::ostream &stream, u8 reg);
void format_rpair(std::ostream &stream, u8 reg);
virtual void format_rproc(std::ostream &stream, u8 reg);
void format_short_imm(std::ostream &stream, u8 imm);
void format_short_imm_unsigned(std::ostream &stream, u8 imm, bool i);
void format_short_imm_decimal(std::ostream &stream, u8 imm);
void format_medium_imm(std::ostream &stream, u16 imm, bool i);
void format_medium_imm_decimal(std::ostream &stream, u16 imm);
void format_imm21(std::ostream &stream, u32 imm);
void format_disp5(std::ostream &stream, u8 disp);
void format_disp16(std::ostream &stream, u16 disp);
void format_disp18(std::ostream &stream, u32 disp);
void format_abs18(std::ostream &stream, u32 addr);
void format_pc_disp5(std::ostream &stream, offs_t pc, u8 disp);
void format_pc_disp9(std::ostream &stream, offs_t pc, u16 disp);
void format_pc_disp17(std::ostream &stream, offs_t pc, u32 disp);
void format_pc_disp21(std::ostream &stream, offs_t pc, u32 disp);
void format_excp_vector(std::ostream &stream, u8 vec);
private:
// static tables
static const char *const s_cc[14];
// architecture version
const cr16_arch m_arch;
};
class cr16a_disassembler : public cr16b_disassembler
{
public:
// construction/destruction
cr16a_disassembler();
protected:
virtual void format_rproc(std::ostream &stream, u8 reg) override;
};
#endif // MAME_CPU_CR16B_CR16BDASM_H

View File

@ -1,8 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Sandro Ronco
// Unknown CPU type
// gl6600cx uses a NSC1028 system-on-a-chip designed by National Semiconductor specifically for VTech
// http://web.archive.org/web/19991127134657/http://www.national.com/news/item/0,1735,425,00.html
@ -46,33 +44,45 @@ TMP47C241MG = TCLS-47 series 4-bit CPU with 2048x8 internal ROM
*/
#include "emu.h"
#include "cpu/cr16b/cr16b.h"
#include "screen.h"
class gl8008cx_state : public driver_device
class glcx_state : public driver_device
{
public:
gl8008cx_state(const machine_config &mconfig, device_type type, const char *tag)
glcx_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
{ }
void gl8008cx(machine_config &config);
void glcx(machine_config &config);
private:
virtual uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void mem_map(address_map &map);
required_device<cr16b_device> m_maincpu;
};
uint32_t gl8008cx_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
uint32_t glcx_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
return 0;
}
static INPUT_PORTS_START( gl8008cx )
void glcx_state::mem_map(address_map &map)
{
map(0x000000, 0x1fffff).rom().region("maincpu", 0);
}
static INPUT_PORTS_START( glcx )
INPUT_PORTS_END
void gl8008cx_state::gl8008cx(machine_config &config)
void glcx_state::glcx(machine_config &config)
{
/* basic machine hardware */
// UNKNOWN(config, "maincpu", unknown); // CPU type is unknown, epoxy blob
CR16B(config, m_maincpu, 10000000); // FIXME: determine exact type and clock
m_maincpu->set_addrmap(AS_PROGRAM, &glcx_state::mem_map);
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@ -80,7 +90,7 @@ void gl8008cx_state::gl8008cx(machine_config &config)
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
screen.set_size(512, 256);
screen.set_visarea(0, 512-1, 0, 256-1);
screen.set_screen_update(FUNC(gl8008cx_state::screen_update));
screen.set_screen_update(FUNC(glcx_state::screen_update));
}
ROM_START( gl6600cx )
@ -105,6 +115,6 @@ ROM_START( bs9009cx )
ROM_END
COMP( 1999, gl6600cx, 0, 0, gl8008cx, gl8008cx, gl8008cx_state, empty_init, "Video Technology", "Genius Leader 6600 CX (Germany)", MACHINE_IS_SKELETON )
COMP( 1999, gl8008cx, 0, 0, gl8008cx, gl8008cx, gl8008cx_state, empty_init, "Video Technology", "Genius Leader 8008 CX (Germany)", MACHINE_IS_SKELETON)
COMP( 1999, bs9009cx, 0, 0, gl8008cx, gl8008cx, gl8008cx_state, empty_init, "Video Technology", "BrainStation 9009 CXL (Germany)", MACHINE_IS_SKELETON)
COMP( 1999, gl6600cx, 0, 0, glcx, glcx, glcx_state, empty_init, "Video Technology", "Genius Leader 6600 CX (Germany)", MACHINE_IS_SKELETON )
COMP( 1999, gl8008cx, 0, 0, glcx, glcx, glcx_state, empty_init, "Video Technology", "Genius Leader 8008 CX (Germany)", MACHINE_IS_SKELETON)
COMP( 1999, bs9009cx, 0, 0, glcx, glcx, glcx_state, empty_init, "Video Technology", "BrainStation 9009 CXL (Germany)", MACHINE_IS_SKELETON)

View File

@ -14279,6 +14279,11 @@ glass10 // (c) 1993 - Ref 931021
glass10a // (c) 1993 - Ref 931021 shows "Break Edition" on a real PCB
glasskr // (c) 1994 - Ref 931021 shows 1994 version, Anime girls, unprotected
@source:glcx.cpp
bs9009cx // 1999 BrainStation 9009 CXL (Germany)
gl6600cx // 1999 Genius Leader 6600 CX (Germany)
gl8008cx // 1999 Genius Leader 8008 CX (Germany)
@source:globalfr.cpp
gl_coc // Carry On Clubbin' (Global)
gl_coc29 //
@ -39299,11 +39304,6 @@ laser700 // 1984? Laser 700
@source:vtech_eu3a12.cpp
vreadere
@source:vtech_unk1.cpp
bs9009cx // 1999 BrainStation 9009 CXL (Germany)
gl6600cx // 1999 Genius Leader 6600 CX (Germany)
gl8008cx // 1999 Genius Leader 8008 CX (Germany)
@source:vtech_unk2.cpp
glmmc // 199? Genius Master Mega Color

View File

@ -294,6 +294,7 @@ genpc.cpp
gimix.cpp
gizmondo.cpp
glasgow.cpp
glcx.cpp
gmaster.cpp
goupil.cpp
gp2x.cpp
@ -900,7 +901,6 @@ vta2000.cpp
vtech1.cpp
vtech2.cpp
vtech_eu3a12.cpp
vtech_unk1.cpp
vtech_unk2.cpp
wangpc.cpp
wicat.cpp

View File

@ -38,6 +38,7 @@ using util::BIT;
#include "cpu/cop400/cop444ds.h"
#include "cpu/cosmac/cosdasm.h"
#include "cpu/cp1610/1610dasm.h"
#include "cpu/cr16b/cr16bdasm.h"
#include "cpu/cubeqcpu/cubedasm.h"
#include "cpu/dsp16/dsp16dis.h"
#include "cpu/dsp32/dsp32dis.h"
@ -338,6 +339,8 @@ static const dasm_table_entry dasm_table[] =
{ "cop444", le, 0, []() -> util::disasm_interface * { return new cop444_disassembler; } },
{ "cop424", le, 0, []() -> util::disasm_interface * { return new cop424_disassembler; } },
{ "cp1610", be, -1, []() -> util::disasm_interface * { return new cp1610_disassembler; } },
{ "cr16a", le, 0, []() -> util::disasm_interface * { return new cr16a_disassembler; } },
{ "cr16b", le, 0, []() -> util::disasm_interface * { return new cr16b_disassembler; } },
{ "cquestlin", be, -3, []() -> util::disasm_interface * { return new cquestlin_disassembler; } },
{ "cquestrot", be, -3, []() -> util::disasm_interface * { return new cquestrot_disassembler; } },
{ "cquestsnd", be, -3, []() -> util::disasm_interface * { return new cquestsnd_disassembler; } },