mirror of
https://github.com/holub/mame
synced 2025-07-04 01:18:59 +03:00
unkts: Hook up new skeleton CPU device
This commit is contained in:
parent
f04b5e9f23
commit
6c1e5da058
@ -3671,10 +3671,17 @@ if opt_tool(CPUS, "MN1610") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
-- Altera Nios II (disassembler only)
|
-- Altera Nios II
|
||||||
--@src/devices/cpu/nios2/nios2.h,CPUS["NIOS2"] = true
|
--@src/devices/cpu/nios2/nios2.h,CPUS["NIOS2"] = true
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
|
|
||||||
|
if CPUS["NIOS2"] then
|
||||||
|
files {
|
||||||
|
MAME_DIR .. "src/devices/cpu/nios2/nios2.cpp",
|
||||||
|
MAME_DIR .. "src/devices/cpu/nios2/nios2.h",
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
if opt_tool(CPUS, "NIOS2") then
|
if opt_tool(CPUS, "NIOS2") then
|
||||||
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/nios2/nios2dasm.cpp")
|
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/nios2/nios2dasm.cpp")
|
||||||
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/nios2/nios2dasm.h")
|
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/nios2/nios2dasm.h")
|
||||||
|
62
src/devices/cpu/nios2/nios2.cpp
Normal file
62
src/devices/cpu/nios2/nios2.cpp
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
// license:BSD-3-Clause
|
||||||
|
// copyright-holders:AJR
|
||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
Altera Nios II soft processor
|
||||||
|
|
||||||
|
Currently this device is just a stub with no actual execution core.
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "emu.h"
|
||||||
|
#include "nios2.h"
|
||||||
|
#include "nios2dasm.h"
|
||||||
|
|
||||||
|
// device type definition
|
||||||
|
DEFINE_DEVICE_TYPE(NIOS2, nios2_device, "nios2", "Altera Nios II Processor")
|
||||||
|
|
||||||
|
nios2_device::nios2_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||||
|
: cpu_device(mconfig, NIOS2, tag, owner, clock)
|
||||||
|
, m_program_config("program", ENDIANNESS_LITTLE, 32, 32, 0)
|
||||||
|
{
|
||||||
|
std::fill(std::begin(m_gpr), std::end(m_gpr), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<util::disasm_interface> nios2_device::create_disassembler()
|
||||||
|
{
|
||||||
|
return std::make_unique<nios2_disassembler>();
|
||||||
|
}
|
||||||
|
|
||||||
|
device_memory_interface::space_config_vector nios2_device::memory_space_config() const
|
||||||
|
{
|
||||||
|
return space_config_vector {
|
||||||
|
std::make_pair(AS_PROGRAM, &m_program_config)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
void nios2_device::device_start()
|
||||||
|
{
|
||||||
|
space(AS_PROGRAM).cache(m_cache);
|
||||||
|
|
||||||
|
set_icountptr(m_icount);
|
||||||
|
|
||||||
|
state_add(NIOS2_PC, "PC", m_pc);
|
||||||
|
state_add(STATE_GENPC, "GENPC", m_pc).noshow();
|
||||||
|
state_add(STATE_GENPCBASE, "CURPC", m_pc).noshow();
|
||||||
|
for (int i = 1; i < 32; i++)
|
||||||
|
state_add(NIOS2_R1 + i - 1, util::string_format("r%d", i).c_str(), m_gpr[i]);
|
||||||
|
|
||||||
|
save_item(NAME(m_gpr));
|
||||||
|
save_item(NAME(m_pc));
|
||||||
|
}
|
||||||
|
|
||||||
|
void nios2_device::device_reset()
|
||||||
|
{
|
||||||
|
m_pc = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void nios2_device::execute_run()
|
||||||
|
{
|
||||||
|
debugger_instruction_hook(m_pc);
|
||||||
|
m_icount = 0;
|
||||||
|
}
|
51
src/devices/cpu/nios2/nios2.h
Normal file
51
src/devices/cpu/nios2/nios2.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
// license:BSD-3-Clause
|
||||||
|
// copyright-holders:AJR
|
||||||
|
|
||||||
|
#ifndef MAME_CPU_NIOS2_NIOS2_H
|
||||||
|
#define MAME_CPU_NIOS2_NIOS2_H
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class nios2_device : public cpu_device
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum {
|
||||||
|
NIOS2_R1 = 1, NIOS2_R2, NIOS2_R3, NIOS2_R4, NIOS2_R5, NIOS2_R6, NIOS2_R7,
|
||||||
|
NIOS2_R8, NIOS2_R9, NIOS2_R10, NIOS2_R11, NIOS2_R12, NIOS2_R13, NIOS2_R14, NIOS2_R15,
|
||||||
|
NIOS2_R16, NIOS2_R17, NIOS2_R18, NIOS2_R19, NIOS2_R20, NIOS2_R21, NIOS2_R22, NIOS2_R23,
|
||||||
|
NIOS2_R24, NIOS2_R25, NIOS2_R26, NIOS2_R27, NIOS2_R28, NIOS2_R29, NIOS2_R30, NIOS2_R31,
|
||||||
|
NIOS2_PC,
|
||||||
|
};
|
||||||
|
|
||||||
|
// construction/destruction
|
||||||
|
nios2_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// device-level overrides
|
||||||
|
virtual void device_start() override;
|
||||||
|
virtual void device_reset() override;
|
||||||
|
|
||||||
|
// device_execute_interface overrides
|
||||||
|
virtual void execute_run() 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_program_config;
|
||||||
|
memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache m_cache;
|
||||||
|
|
||||||
|
// internal registers
|
||||||
|
u32 m_gpr[32];
|
||||||
|
u32 m_pc;
|
||||||
|
s32 m_icount;
|
||||||
|
};
|
||||||
|
|
||||||
|
// device type definition
|
||||||
|
DECLARE_DEVICE_TYPE(NIOS2, nios2_device)
|
||||||
|
|
||||||
|
#endif // MAME_CPU_NIOS2_NIOS2_H
|
@ -15,14 +15,14 @@ M4T28 TimeKeeper
|
|||||||
IS42S16 SDRAM
|
IS42S16 SDRAM
|
||||||
2x RAMs (type not readable)
|
2x RAMs (type not readable)
|
||||||
|
|
||||||
It seems the game is run by a soft CPU core programmed in the FPGA.
|
It seems the game is run by a Nios II soft CPU core programmed in the FPGA.
|
||||||
The main CPU ROMs contains strings in English (system stuff) and Spanish (game strings).
|
The main CPU ROMs contains strings in English (system stuff) and Spanish (game strings).
|
||||||
Manufacturer is unknown. There is an Azkoyen string in ROM, but it's probably the bill validator manufacturer.
|
Manufacturer is unknown. There is an Azkoyen string in ROM, but it's probably the bill validator manufacturer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
|
|
||||||
#include "cpu/h8/h8s2320.h"
|
#include "cpu/nios2/nios2.h"
|
||||||
|
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "speaker.h"
|
#include "speaker.h"
|
||||||
@ -55,6 +55,7 @@ uint32_t truesys_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma
|
|||||||
|
|
||||||
void truesys_state::main_map(address_map &map)
|
void truesys_state::main_map(address_map &map)
|
||||||
{
|
{
|
||||||
|
map(0x00000000, 0x0007ffff).rom().region("maincpu", 0); // also mirrored at 0x00800000, 0x01000000, 0x01800000, etc.?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ INPUT_PORTS_END
|
|||||||
void truesys_state::unkts(machine_config &config)
|
void truesys_state::unkts(machine_config &config)
|
||||||
{
|
{
|
||||||
// basic machine hardware
|
// basic machine hardware
|
||||||
H8S2328(config, m_maincpu, 32_MHz_XTAL); // TODO: there's no actual CPU, it appears to be run from the FPGA
|
NIOS2(config, m_maincpu, 32'000'000); // there's no actual CPU, it appears to be run from the FPGA
|
||||||
m_maincpu->set_addrmap(AS_PROGRAM, &truesys_state::main_map);
|
m_maincpu->set_addrmap(AS_PROGRAM, &truesys_state::main_map);
|
||||||
|
|
||||||
// PIC16F874. TODO: not emulated
|
// PIC16F874. TODO: not emulated
|
||||||
|
Loading…
Reference in New Issue
Block a user