/***************************************************************************

        Morrow Tricep

        12/05/2009 Skeleton driver.

****************************************************************************/
#define ADDRESS_MAP_MODERN

#include "emu.h"
#include "cpu/m68000/m68000.h"
#include "machine/terminal.h"


class tricep_state : public driver_device
{
public:
	tricep_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag),
	m_maincpu(*this, "maincpu"),
	m_terminal(*this, TERMINAL_TAG)
	{ }

	required_device<cpu_device> m_maincpu;
	required_device<device_t> m_terminal;
	DECLARE_READ16_MEMBER(tricep_terminal_r);
	DECLARE_WRITE16_MEMBER(tricep_terminal_w);
	DECLARE_WRITE8_MEMBER(kbd_put);
	UINT16* m_p_ram;
};



READ16_MEMBER( tricep_state::tricep_terminal_r )
{
	return 0xffff;
}

WRITE16_MEMBER( tricep_state::tricep_terminal_w )
{
	terminal_write(m_terminal, 0, data >> 8);
}

static ADDRESS_MAP_START(tricep_mem, AS_PROGRAM, 16, tricep_state)
	ADDRESS_MAP_UNMAP_HIGH
	AM_RANGE(0x00000000, 0x0007ffff) AM_RAM AM_BASE(m_p_ram)
	AM_RANGE(0x00fd0000, 0x00fd1fff) AM_ROM AM_REGION("user1",0)
	AM_RANGE(0x00ff0028, 0x00ff0029) AM_READWRITE(tricep_terminal_r,tricep_terminal_w)
ADDRESS_MAP_END

/* Input ports */
static INPUT_PORTS_START( tricep )
INPUT_PORTS_END


static MACHINE_RESET(tricep)
{
	tricep_state *state = machine.driver_data<tricep_state>();
	UINT8* user1 = machine.region("user1")->base();

	memcpy((UINT8*)state->m_p_ram,user1,0x2000);

	machine.device("maincpu")->reset();
}

WRITE8_MEMBER( tricep_state::kbd_put )
{
}

static GENERIC_TERMINAL_INTERFACE( terminal_intf )
{
	DEVCB_DRIVER_MEMBER(tricep_state, kbd_put)
};

static MACHINE_CONFIG_START( tricep, tricep_state )
	/* basic machine hardware */
	MCFG_CPU_ADD("maincpu",M68000, XTAL_8MHz)
	MCFG_CPU_PROGRAM_MAP(tricep_mem)

	MCFG_MACHINE_RESET(tricep)

	/* video hardware */
	MCFG_FRAGMENT_ADD( generic_terminal )
	MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
MACHINE_CONFIG_END

/* ROM definition */
ROM_START( tricep )
	ROM_REGION( 0x2000, "user1", ROMREGION_ERASEFF )
	ROM_LOAD16_BYTE( "tri2.4_odd.u37",  0x0000, 0x1000, CRC(31eb2dcf) SHA1(2d9df9262ee1096d0398505e10d209201ac49a5d))
	ROM_LOAD16_BYTE( "tri2.4_even.u36", 0x0001, 0x1000, CRC(4414dcdc) SHA1(00a3d293617dc691748ae85b6ccdd6723daefc0a))
ROM_END

/* Driver */

/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    COMPANY       FULLNAME       FLAGS */
COMP( 1985, tricep, 0,      0,       tricep,    tricep,  0,  "Morrow Designs", "Tricep", GAME_NOT_WORKING | GAME_NO_SOUND)
