mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
i8089.c: device skeleton
This commit is contained in:
parent
624ff85a3b
commit
633d639623
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1251,6 +1251,8 @@ src/emu/machine/generic.c svneol=native#text/plain
|
||||
src/emu/machine/generic.h svneol=native#text/plain
|
||||
src/emu/machine/i2cmem.c svneol=native#text/plain
|
||||
src/emu/machine/i2cmem.h svneol=native#text/plain
|
||||
src/emu/machine/i8089.c svneol=native#text/plain
|
||||
src/emu/machine/i8089.h svneol=native#text/plain
|
||||
src/emu/machine/i8155.c svneol=native#text/plain
|
||||
src/emu/machine/i8155.h svneol=native#text/plain
|
||||
src/emu/machine/i8212.c svneol=native#text/plain
|
||||
|
103
src/emu/machine/i8089.c
Normal file
103
src/emu/machine/i8089.c
Normal file
@ -0,0 +1,103 @@
|
||||
/***************************************************************************
|
||||
|
||||
Intel 8089 I/O Processor
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "i8089.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// MACROS/CONSTANTS
|
||||
//**************************************************************************
|
||||
|
||||
#define VERBOSE 1
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
const device_type I8089 = &device_creator<i8089_device>;
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// i8089_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
i8089_device::i8089_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, I8089, "Intel 8089", tag, owner, clock, "i8089", __FILE__),
|
||||
m_write_sintr1(*this),
|
||||
m_write_sintr2(*this)
|
||||
{
|
||||
}
|
||||
|
||||
void i8089_device::static_set_cputag(device_t &device, const char *tag)
|
||||
{
|
||||
i8089_device &i8089 = downcast<i8089_device &>(device);
|
||||
i8089.m_cputag = tag;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void i8089_device::device_start()
|
||||
{
|
||||
// resolve callbacks
|
||||
m_write_sintr1.resolve_safe();
|
||||
m_write_sintr2.resolve_safe();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void i8089_device::device_reset()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// EXTERNAL INPUTS
|
||||
//**************************************************************************
|
||||
|
||||
WRITE_LINE_MEMBER( i8089_device::ca_w )
|
||||
{
|
||||
if (VERBOSE)
|
||||
logerror("%s('%s'): ca_w: %u\n", shortname(), basetag(), state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( i8089_device::sel_w )
|
||||
{
|
||||
if (VERBOSE)
|
||||
logerror("%s('%s'): sel_w: %u\n", shortname(), basetag(), state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( i8089_device::drq1_w )
|
||||
{
|
||||
if (VERBOSE)
|
||||
logerror("%s('%s'): drq1_w: %u\n", shortname(), basetag(), state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( i8089_device::drq2_w )
|
||||
{
|
||||
if (VERBOSE)
|
||||
logerror("%s('%s'): drq2_w: %u\n", shortname(), basetag(), state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( i8089_device::ext1_w )
|
||||
{
|
||||
if (VERBOSE)
|
||||
logerror("%s('%s'): ext1_w: %u\n", shortname(), basetag(), state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( i8089_device::ext2_w )
|
||||
{
|
||||
if (VERBOSE)
|
||||
logerror("%s('%s'): ext2_w: %u\n", shortname(), basetag(), state);
|
||||
}
|
75
src/emu/machine/i8089.h
Normal file
75
src/emu/machine/i8089.h
Normal file
@ -0,0 +1,75 @@
|
||||
/***************************************************************************
|
||||
|
||||
Intel 8089 I/O Processor
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __I8089_H__
|
||||
#define __I8089_H__
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define MCFG_I8089_ADD(_tag, _clock, _cputag) \
|
||||
MCFG_DEVICE_ADD(_tag, I8089, _clock) \
|
||||
i8089_device::static_set_cputag(*device, _cputag); \
|
||||
|
||||
#define MCFG_I8089_SINTR1(_sintr1) \
|
||||
downcast<i8089_device *>(device)->set_sintr1_callback(DEVCB2_##_sintr1);
|
||||
|
||||
#define MCFG_I8089_SINTR2(_sintr2) \
|
||||
downcast<i8089_device *>(device)->set_sintr2_callback(DEVCB2_##_sintr2);
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// ======================> i8089_device
|
||||
|
||||
class i8089_device : public device_t
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
i8089_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
// callbacks
|
||||
template<class _sintr1> void set_sintr1_callback(_sintr1 sintr1) { m_write_sintr1.set_callback(sintr1); }
|
||||
template<class _sintr2> void set_sintr2_callback(_sintr2 sintr2) { m_write_sintr2.set_callback(sintr2); }
|
||||
|
||||
// input lines
|
||||
DECLARE_WRITE_LINE_MEMBER( ca_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( sel_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( drq1_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( drq2_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( ext1_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( ext2_w );
|
||||
|
||||
// inline configuration
|
||||
static void static_set_cputag(device_t &device, const char *tag);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
private:
|
||||
devcb2_write_line m_write_sintr1;
|
||||
devcb2_write_line m_write_sintr2;
|
||||
|
||||
// internal state
|
||||
const char *m_cputag;
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
extern const device_type I8089;
|
||||
|
||||
|
||||
#endif /* __I8089_H__ */
|
@ -465,6 +465,15 @@ ifneq ($(filter I2CMEM,$(MACHINES)),)
|
||||
MACHINEOBJS += $(MACHINEOBJ)/i2cmem.o
|
||||
endif
|
||||
|
||||
#-------------------------------------------------
|
||||
#
|
||||
#@src/emu/machine/i8089.h,MACHINES += I8089
|
||||
#-------------------------------------------------
|
||||
|
||||
ifneq ($(filter I8089,$(MACHINES)),)
|
||||
MACHINEOBJS += $(MACHINEOBJ)/i8089.o
|
||||
endif
|
||||
|
||||
#-------------------------------------------------
|
||||
#
|
||||
#@src/emu/machine/i8155.h,MACHINES += I8155
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "emu.h"
|
||||
#include "cpu/i86/i86.h"
|
||||
#include "machine/ram.h"
|
||||
#include "machine/i8089.h"
|
||||
#include "machine/pit8253.h"
|
||||
#include "machine/i8255.h"
|
||||
#include "machine/pic8259.h"
|
||||
@ -34,6 +35,7 @@ public:
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_ram(*this, RAM_TAG),
|
||||
m_iop(*this, "ic71"),
|
||||
m_sn(*this, "ic7"),
|
||||
m_crtc(*this, "ic30"),
|
||||
m_ppi(*this, "ic17"),
|
||||
@ -55,6 +57,7 @@ public:
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<ram_device> m_ram;
|
||||
required_device<i8089_device> m_iop;
|
||||
required_device<sn76489_device> m_sn;
|
||||
required_device<mc6845_device> m_crtc;
|
||||
required_device<i8255_device> m_ppi;
|
||||
@ -69,6 +72,8 @@ public:
|
||||
|
||||
required_shared_ptr<UINT16> m_screen_buffer;
|
||||
|
||||
DECLARE_WRITE8_MEMBER( i8089_ca1_w );
|
||||
DECLARE_WRITE8_MEMBER( i8089_ca2_w );
|
||||
DECLARE_READ8_MEMBER( apricot_sysctrl_r );
|
||||
DECLARE_WRITE8_MEMBER( apricot_sysctrl_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( timer_out1 );
|
||||
@ -100,6 +105,20 @@ public:
|
||||
I/O
|
||||
***************************************************************************/
|
||||
|
||||
WRITE8_MEMBER( apricot_state::i8089_ca1_w )
|
||||
{
|
||||
m_iop->sel_w(0);
|
||||
m_iop->ca_w(1);
|
||||
m_iop->ca_w(0);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( apricot_state::i8089_ca2_w )
|
||||
{
|
||||
m_iop->sel_w(1);
|
||||
m_iop->ca_w(1);
|
||||
m_iop->ca_w(0);
|
||||
}
|
||||
|
||||
READ8_MEMBER( apricot_state::apricot_sysctrl_r )
|
||||
{
|
||||
UINT8 data = 0;
|
||||
@ -172,7 +191,7 @@ static Z80SIO_INTERFACE( apricot_z80sio_intf )
|
||||
DEVCB_DEVICE_LINE_MEMBER("rs232", serial_port_device, tx),
|
||||
DEVCB_DEVICE_LINE_MEMBER("rs232", rs232_port_device, dtr_w),
|
||||
DEVCB_DEVICE_LINE_MEMBER("rs232", rs232_port_device, rts_w),
|
||||
DEVCB_NULL, // wait/ready: i8089 data request channel 2
|
||||
DEVCB_DEVICE_LINE_MEMBER("ic71", i8089_device, drq2_w),
|
||||
DEVCB_NULL,
|
||||
|
||||
// channel b
|
||||
@ -217,12 +236,12 @@ static const centronics_interface apricot_centronics_intf =
|
||||
void apricot_state::wd2793_intrq_w(bool state)
|
||||
{
|
||||
m_pic->ir4_w(state);
|
||||
// i8089 external terminate channel 1
|
||||
m_iop->ext1_w(state);
|
||||
}
|
||||
|
||||
void apricot_state::wd2793_drq_w(bool state)
|
||||
{
|
||||
// i8089 data request channel 1
|
||||
m_iop->drq1_w(state);
|
||||
}
|
||||
|
||||
static SLOT_INTERFACE_START( apricot_floppies )
|
||||
@ -333,8 +352,8 @@ static ADDRESS_MAP_START( apricot_io, AS_IO, 16, apricot_state )
|
||||
AM_RANGE(0x60, 0x67) AM_DEVREADWRITE8("ic15", z80sio0_device, ba_cd_r, ba_cd_w, 0x00ff)
|
||||
AM_RANGE(0x68, 0x69) AM_MIRROR(0x04) AM_DEVWRITE8("ic30", mc6845_device, address_w, 0x00ff)
|
||||
AM_RANGE(0x6a, 0x6b) AM_MIRROR(0x04) AM_DEVREADWRITE8("ic30", mc6845_device, register_r, register_w, 0x00ff)
|
||||
// AM_RANGE(0x70, 0x71) AM_MIRROR(0x04) 8089 channel attention 1
|
||||
// AM_RANGE(0x72, 0x73) AM_MIRROR(0x04) 8089 channel attention 2
|
||||
AM_RANGE(0x70, 0x71) AM_MIRROR(0x04) AM_WRITE8(i8089_ca1_w, 0x00ff)
|
||||
AM_RANGE(0x72, 0x73) AM_MIRROR(0x04) AM_WRITE8(i8089_ca2_w, 0x00ff)
|
||||
AM_RANGE(0x78, 0x7f) AM_NOP /* unavailable */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -353,7 +372,9 @@ static MACHINE_CONFIG_START( apricot, apricot_state )
|
||||
MCFG_CPU_PROGRAM_MAP(apricot_mem)
|
||||
MCFG_CPU_IO_MAP(apricot_io)
|
||||
|
||||
// MCFG_CPU_ADD("ic71", I8089, XTAL_15MHz / 3)
|
||||
MCFG_I8089_ADD("ic71", XTAL_15MHz / 3, "maincpu")
|
||||
MCFG_I8089_SINTR1(DEVWRITELINE("ic31", pic8259_device, ir0_w))
|
||||
MCFG_I8089_SINTR2(DEVWRITELINE("ic31", pic8259_device, ir1_w))
|
||||
|
||||
// video hardware
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
|
@ -357,6 +357,7 @@ MACHINES += ER2055
|
||||
MACHINES += ER59256
|
||||
MACHINES += F3853
|
||||
MACHINES += I2CMEM
|
||||
MACHINES += I8089
|
||||
MACHINES += I8155
|
||||
MACHINES += I8212
|
||||
MACHINES += I8214
|
||||
|
Loading…
Reference in New Issue
Block a user