adding a basic machine driver for the Patinho Feio and setting up build system for the driver and the CPU module

This commit is contained in:
Felipe Corrêa da Silva Sanches 2015-11-28 09:59:12 -02:00
parent d1abdea08c
commit 0618c642ba
7 changed files with 125 additions and 25 deletions

View File

@ -1435,6 +1435,22 @@ if (CPUS["PDP1"]~=null or _OPTIONS["with-tools"]) then
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/pdp1/tx0dasm.cpp")
end
--------------------------------------------------
-- PATINHO FEIO - Escola Politecnica - USP (Brazil)
--@src/devices/cpu/patinhofeio/patinho_feio.h,CPUS["PATINHOFEIO"] = true
--------------------------------------------------
if (CPUS["PATINHOFEIO"]~=null) then
files {
MAME_DIR .. "src/devices/cpu/patinhofeio/patinho_feio.cpp",
MAME_DIR .. "src/devices/cpu/patinhofeio/patinho_feio.h",
}
end
if (CPUS["PATINHOFEIO"]~=null or _OPTIONS["with-tools"]) then
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/patinhofeio/patinho_feio_dasm.cpp")
end
--------------------------------------------------
-- Motorola PowerPC series
--@src/devices/cpu/powerpc/ppc.h,CPUS["POWERPC"] = true

View File

@ -91,6 +91,7 @@ CPUS["APEXC"] = true
CPUS["CP1610"] = true
CPUS["F8"] = true
CPUS["LH5801"] = true
CPUS["PATINHOFEIO"] = true
CPUS["PDP1"] = true
CPUS["SATURN"] = true
CPUS["SC61860"] = true
@ -852,6 +853,7 @@ function linkProjects_mame_mess(_target, _subtarget)
"ultratec",
"unisonic",
"unisys",
"usp",
"veb",
"vidbrain",
"videoton",
@ -2845,6 +2847,11 @@ files {
MAME_DIR .. "src/mame/drivers/univac.cpp",
}
createMESSProjects(_target, _subtarget, "usp")
files {
MAME_DIR .. "src/mame/drivers/patinho_feio.cpp",
}
createMESSProjects(_target, _subtarget, "veb")
files {
MAME_DIR .. "src/mame/drivers/chessmst.cpp",

View File

@ -1,27 +1,34 @@
// license:GPL2+
// license:GPL-2.0+
// copyright-holders:Felipe Sanches
/*
Patinho Feio
CPU emulation for Patinho Feio, the first computer designed and manufactured in Brazil
*/
#include "emu.h"
#include "debugger.h"
#include "patinho_feio.h"
#define CI m_ci //The program counter is called "contador de instrucoes" in portuguese
#define CI m_ci //The program counter is called "contador de instrucoes" in portuguese
#define ACC m_acc
#define ADDRESS_MASK_4K 0xFFF
#define INCREMENT_CI_4K (CI = (CI+1) & ADDRESS_MASK_4K)
const device_type PATINHO_FEIO = &device_creator<patinho_feio_device>;
const device_type PATINHO_FEIO = &device_creator<patinho_feio_cpu_device>;
patinho_feio_device::patinho_feio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: cpu_device(mconfig, PATINHO_FEIO, "PATINHO FEIO", tag, owner, clock, "patinho_feio_cpu", __FILE__)
//Internal 4kbytes of RAM
static ADDRESS_MAP_START(prog_8bit, AS_PROGRAM, 8, patinho_feio_cpu_device)
AM_RANGE(0x0000, 0x0fff) AM_RAM
ADDRESS_MAP_END
patinho_feio_cpu_device::patinho_feio_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: cpu_device(mconfig, PATINHO_FEIO, "PATINHO FEIO", tag, owner, clock, "patinho_feio_cpu", __FILE__),
m_program_config("program", ENDIANNESS_LITTLE, 8, 12, 0, ADDRESS_MAP_NAME(prog_8bit)),
m_icount(0)
{
}
void patinho_feio_device::device_start()
void patinho_feio_cpu_device::device_start()
{
m_ci = 0;
m_acc = 0;
@ -32,24 +39,28 @@ void patinho_feio_device::device_start()
save_item(NAME(m_acc));
// Register state for debugger
state_add( PATINHO_FEIO_PC, "CI", m_pc ).mask(0xFFF);
state_add( PATINHO_FEIO_CI, "CI", m_ci ).mask(0xFFF);
state_add( PATINHO_FEIO_ACC, "ACC", m_acc ).mask(0xFF);
m_icountptr = &m_icount;
m_run = true;
}
void patinho_feio_device::device_reset()
void patinho_feio_cpu_device::device_reset()
{
}
/* execute instructions on this CPU until icount expires */
void patinho_feio_device::execute_run()
void patinho_feio_cpu_device::execute_run()
{
do
{
debugger_instruction_hook(this, CI);
if ((! m_run)){
m_icount = 0; /* if processor is stopped, just burn cycles */
} else {
debugger_instruction_hook(this, CI);
execute_instruction();
m_icount --;
}
@ -59,13 +70,13 @@ void patinho_feio_device::execute_run()
/* execute one instruction */
void patinho_feio_device::execute_instruction()
void patinho_feio_cpu_device::execute_instruction()
{
// char opcode = patinho_feio_read(CI);
INCREMENT_CI_4K;
}
offs_t patinho_feio_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
offs_t patinho_feio_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
{
extern CPU_DISASSEMBLE( patinho_feio );
return CPU_DISASSEMBLE_NAME(patinho_feio)(this, buffer, pc, oprom, opram, options);

View File

@ -1,4 +1,4 @@
// license:GPL2+
// license:GPL-2.0+
// copyright-holders:Felipe Sanches
#pragma once
@ -8,14 +8,14 @@
/* register IDs */
enum
{
PATINHOFEIO_CI=1, PATINHOFEIO_ACC
PATINHO_FEIO_CI=1, PATINHO_FEIO_ACC
};
class patinho_feio_device : public cpu_device
class patinho_feio_cpu_device : public cpu_device
{
public:
// construction/destruction
patinho_feio_device(const machine_config &mconfig, const char *_tag, device_t *_owner, UINT32 _clock);
patinho_feio_cpu_device(const machine_config &mconfig, const char *_tag, device_t *_owner, UINT32 _clock);
protected:
virtual void execute_run();
@ -25,13 +25,13 @@ protected:
/* processor registers */
int m_acc; /* accumulator (8 bits) */
int m_ci; /* program counter (12 bits) (CI stands for "Contador de Instrucao")*/
int m_ci; /* program counter (12 bits)
(CI stands for "Contador de Instrucao") */
/* processor state flip-flops */
unsigned int m_run; /* processor is running */
bool m_run; /* processor is running */
int m_address_mask; /* address mask */
int m_ir_mask; /* IR mask */
int m_icount;
address_space *m_program;
@ -42,14 +42,14 @@ protected:
// device_execute_interface overrides
virtual UINT32 execute_min_cycles() const { return 1; }
virtual UINT32 execute_max_cycles() const { return 3; }
virtual UINT32 execute_max_cycles() const { return 2; }
// device_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; }
// device_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const { return 4; }
virtual UINT32 disasm_max_opcode_bytes() const { return 4; }
virtual UINT32 disasm_min_opcode_bytes() const { return 1; }
virtual UINT32 disasm_max_opcode_bytes() const { return 2; }
private:
void execute_instruction();

View File

@ -1,4 +1,4 @@
// license:GPL2+
// license:GPL-2.0+
// copyright-holders:Felipe Sanches
#include "emu.h"
#include "cpu/patinhofeio/patinho_feio.h"

View File

@ -0,0 +1,63 @@
// license:GPL-2.0+
// copyright-holders:Felipe Sanches
/*
Patinho Feio
*/
#include "emu.h"
#include "cpu/patinhofeio/patinho_feio.h"
class patinho_feio_state : public driver_device
{
public:
patinho_feio_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
//,m_maincpu(*this, "maincpu")
{ }
DECLARE_DRIVER_INIT(patinho_feio);
// virtual void machine_start();
// virtual void machine_reset();
// required_device<patinho_feio_cpu_device> m_maincpu;
};
/*
driver init function
*/
DRIVER_INIT_MEMBER(patinho_feio_state, patinho_feio)
{
}
static INPUT_PORTS_START( patinho_feio )
// PORT_START("PANEL") /* various operator control panel switches */
// PORT_BIT(?, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("control panel key") PORT_CODE(KEYCODE_?)
// PORT_BIT(?, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("control panel key") PORT_CODE(KEYCODE_?)
// PORT_BIT(?, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("control panel key") PORT_CODE(KEYCODE_?)
// PORT_BIT(?, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("control panel key") PORT_CODE(KEYCODE_?)
// PORT_BIT(?, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("control panel key") PORT_CODE(KEYCODE_?)
// PORT_BIT(?, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("control panel key") PORT_CODE(KEYCODE_?)
// PORT_BIT(?, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("control panel key") PORT_CODE(KEYCODE_?)
// PORT_BIT(?, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("control panel key") PORT_CODE(KEYCODE_?)
INPUT_PORTS_END
//Internal 4kbytes of RAM
static ADDRESS_MAP_START(patinho_program_map, AS_PROGRAM, 8, patinho_feio_state)
AM_RANGE(0x0000, 0x0fff) AM_ROM
ADDRESS_MAP_END
static MACHINE_CONFIG_START( patinho_feio, patinho_feio_state )
/* basic machine hardware */
/* CPU @ approx. 500 kHz (memory cycle time is 2usec) */
MCFG_CPU_ADD("maincpu", PATINHO_FEIO, 500000)
MCFG_CPU_PROGRAM_MAP(patinho_program_map)
MACHINE_CONFIG_END
ROM_START(patinho)
/*CPU memory space*/
ROM_REGION(0x01000,"maincpu", ROMREGION_ERASEFF)
/* Load this into th internal RAM... */
ROM_LOAD("apendice_g__hexam.bin", 0x000, 0x0d5, CRC(c6addc59) SHA1(126bc97247eac45c58708eaac216c2438e9e4af9) )
ROM_END
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */
COMP( 1972, patinho, 0, 0, patinho_feio, patinho_feio, patinho_feio_state, patinho_feio, "Escola Politecnica - Universidade de Sao Paulo", "Patinho Feio" , MACHINE_NO_SOUND_HW | MACHINE_NOT_WORKING)

View File

@ -1774,6 +1774,9 @@ tmc600s2
//osc1000b
nano
// Escola Politecnica da USP (Brazil)
patinho // 1972 Patinho Feio
// MIT
tx0_64kw // April 1956 MIT TX-0 (64kw RAM)
tx0_8kw // 1962 MIT TX-0 (8kw RAM)