summaryrefslogblamecommitdiffstatshomepage
path: root/src/devices/machine/i80130.cpp
blob: 8758d7854fb67743653122119f959f566f9e61d4 (plain) (tree)
1
2
3
4
5
6
7
8
9





                                                                       

                                                                       
                








                                                                            
                                                             

 

                                             
                                                             
 
 

                                            
                                                                                 

                                                                                                          
 
 

                                    
                          








































                                                                        














                                                    
                                                              





                                                   
                                                 

                                                   
                                                       
                                          
                                                                       


                                          
                                                                             
                            
                                                                           
                            
                                                                          


                  








                                                                            
                                                                                                             
                                                       







                                       






























                                                   
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************

    Intel 80130 iRMX Operating System Processor emulation

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

#include "emu.h"
#include "i80130.h"



//**************************************************************************
//  DEVICE DEFINITIONS
//**************************************************************************

// device type definition
DEFINE_DEVICE_TYPE(I80130, i80130_device, "i80130", "I80130")


void i80130_device::rom_map(address_map &map)
{
	//AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION("rom", 0)
}

void i80130_device::io_map(address_map &map)
{
	map(0x00, 0x0f).rw(FUNC(i80130_device::io_r), FUNC(i80130_device::io_w));
	//AM_RANGE(0x00, 0x01) AM_MIRROR(0x2) AM_DEVREADWRITE8("pic", pic8259_device, read, write, 0x00ff)
	//AM_RANGE(0x08, 0x0f) AM_DEVREADWRITE8("pit", pit8254_device, read, write, 0x00ff)
}

READ16_MEMBER( i80130_device::io_r )
{
	uint16_t data = 0;

	switch (offset)
	{
	case 0: case 1:
		if (ACCESSING_BITS_0_7)
		{
			data = m_pic->read(space, offset & 0x01);
		}
		break;

	case 4: case 5: case 6: case 7:
		if (ACCESSING_BITS_0_7)
		{
			data = m_pit->read(space, offset & 0x03);
		}
		break;
	}

	return data;
}

WRITE16_MEMBER( i80130_device::io_w )
{
	switch (offset)
	{
	case 0: case 1:
		if (ACCESSING_BITS_0_7)
		{
			m_pic->write(space, offset & 0x01, data & 0xff);
		}
		break;

	case 4: case 5: case 6: case 7:
		if (ACCESSING_BITS_0_7)
		{
			m_pit->write(space, offset & 0x03, data & 0xff);
		}
		break;
	}
}


//-------------------------------------------------
//  ROM( i80130 )
//-------------------------------------------------

ROM_START( i80130 )
	ROM_REGION16_LE( 0x4000, "rom", 0 )
	ROM_LOAD( "80130", 0x0000, 0x4000, NO_DUMP )
ROM_END


//-------------------------------------------------
//  rom_region - device-specific ROM region
//-------------------------------------------------

const tiny_rom_entry *i80130_device::device_rom_region() const
{
	return ROM_NAME( i80130 );
}


//-------------------------------------------------
//  device_add_mconfig - add device configuration
//-------------------------------------------------

MACHINE_CONFIG_START(i80130_device::device_add_mconfig)
	MCFG_DEVICE_ADD("pic", PIC8259, 0)
	MCFG_PIC8259_OUT_INT_CB(WRITELINE(*this, i80130_device, irq_w))

	MCFG_DEVICE_ADD("pit", PIT8254, 0)
	MCFG_PIT8253_CLK0(0)
	MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, i80130_device, systick_w))
	MCFG_PIT8253_CLK1(0)
	MCFG_PIT8253_OUT1_HANDLER(WRITELINE(*this, i80130_device, delay_w))
	MCFG_PIT8253_CLK2(0)
	MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, i80130_device, baud_w))
MACHINE_CONFIG_END



//**************************************************************************
//  LIVE DEVICE
//**************************************************************************

//-------------------------------------------------
//  i80130_device - constructor
//-------------------------------------------------

i80130_device::i80130_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: device_t(mconfig, I80130, tag, owner, clock),
		m_pic(*this, "pic"),
		m_pit(*this, "pit"),
		m_write_irq(*this),
		m_write_ack(*this),
		m_write_lir(*this),
		m_write_systick(*this),
		m_write_delay(*this),
		m_write_baud(*this)
{
}


//-------------------------------------------------
//  device_start - device-specific startup
//-------------------------------------------------

void i80130_device::device_start()
{
	// resolve callbacks
	m_write_irq.resolve_safe();
	m_write_ack.resolve_safe();
	m_write_lir.resolve_safe();
	m_write_systick.resolve_safe();
	m_write_delay.resolve_safe();
	m_write_baud.resolve_safe();
}


//-------------------------------------------------
//  device_reset - device-specific reset
//-------------------------------------------------

void i80130_device::device_reset()
{
	// set PIT clocks
	m_pit->set_clockin(0, clock());
	m_pit->set_clockin(1, clock());
	m_pit->set_clockin(2, clock());
}