mirror of
https://github.com/holub/mame
synced 2025-06-06 04:43:45 +03:00
and again (nw)
This commit is contained in:
parent
fae704cc31
commit
ee7c90c3a4
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -658,6 +658,10 @@ src/emu/bus/centronics/covox.c svneol=native#text/plain
|
||||
src/emu/bus/centronics/covox.h svneol=native#text/plain
|
||||
src/emu/bus/centronics/ctronics.c svneol=native#text/plain
|
||||
src/emu/bus/centronics/ctronics.h svneol=native#text/plain
|
||||
src/emu/bus/centronics/dsjoy.c svneol=native#text/plain
|
||||
src/emu/bus/centronics/dsjoy.h svneol=native#text/plain
|
||||
src/emu/bus/centronics/image.c svneol=native#text/plain
|
||||
src/emu/bus/centronics/image.h svneol=native#text/plain
|
||||
src/emu/bus/comx35/clm.c svneol=native#text/plain
|
||||
src/emu/bus/comx35/clm.h svneol=native#text/plain
|
||||
src/emu/bus/comx35/eprom.c svneol=native#text/plain
|
||||
|
48
src/emu/bus/centronics/dsjoy.c
Normal file
48
src/emu/bus/centronics/dsjoy.c
Normal file
@ -0,0 +1,48 @@
|
||||
// license:MAME
|
||||
// copyright-holders:smf
|
||||
|
||||
#include "dsjoy.h"
|
||||
|
||||
const device_type DEMPA_SHINBUNSHA_JOYSTICK = &device_creator<dempa_shinbunsha_joystick_device>;
|
||||
|
||||
dempa_shinbunsha_joystick_device::dempa_shinbunsha_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, DEMPA_SHINBUNSHA_JOYSTICK, "Dempa Shinbunsha Joystick", tag, owner, clock, "dempa_shinbunsha_joystick", __FILE__),
|
||||
device_centronics_peripheral_interface( mconfig, *this ),
|
||||
m_lptjoy(*this, "lptjoy"),
|
||||
m_data(0xff),
|
||||
m_perror(1)
|
||||
{
|
||||
}
|
||||
|
||||
void dempa_shinbunsha_joystick_device::device_start()
|
||||
{
|
||||
save_item(NAME(m_data));
|
||||
save_item(NAME(m_perror));
|
||||
}
|
||||
|
||||
void dempa_shinbunsha_joystick_device::update_perror()
|
||||
{
|
||||
int perror = (~m_data & ~m_lptjoy->read() & 0x3f) == 0;
|
||||
|
||||
if (m_perror != perror)
|
||||
{
|
||||
m_perror = perror;
|
||||
|
||||
output_perror(perror);
|
||||
}
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( dempa_shinbunsha_joystick )
|
||||
PORT_START("lptjoy")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_NAME("LPT Joystick Right") PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_NAME("LPT Joystick Left") PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_NAME("LPT Joystick Up") PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_NAME("LPT Joystick Down") PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("LPT Joystick Button 2") PORT_PLAYER(1)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("LPT Joystick Button 1") PORT_PLAYER(1)
|
||||
INPUT_PORTS_END
|
||||
|
||||
ioport_constructor dempa_shinbunsha_joystick_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME( dempa_shinbunsha_joystick );
|
||||
}
|
47
src/emu/bus/centronics/dsjoy.h
Normal file
47
src/emu/bus/centronics/dsjoy.h
Normal file
@ -0,0 +1,47 @@
|
||||
// license:MAME
|
||||
// copyright-holders:smf
|
||||
/***************************************************************************
|
||||
|
||||
Dempa Shinbunsha Joystick
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __CENTRONICS_DSJOY_H__
|
||||
#define __CENTRONICS_DSJOY_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ctronics.h"
|
||||
|
||||
class dempa_shinbunsha_joystick_device : public device_t,
|
||||
public device_centronics_peripheral_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
dempa_shinbunsha_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
virtual ioport_constructor device_input_ports() const;
|
||||
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_data0 ) { if (state) m_data |= 0x01; else m_data &= ~0x01; update_perror(); }
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_data1 ) { if (state) m_data |= 0x02; else m_data &= ~0x02; update_perror(); }
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_data2 ) { if (state) m_data |= 0x04; else m_data &= ~0x04; update_perror(); }
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_data3 ) { if (state) m_data |= 0x08; else m_data &= ~0x08; update_perror(); }
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_data4 ) { if (state) m_data |= 0x10; else m_data &= ~0x10; update_perror(); }
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_data5 ) { if (state) m_data |= 0x20; else m_data &= ~0x20; update_perror(); }
|
||||
|
||||
private:
|
||||
required_ioport m_lptjoy;
|
||||
|
||||
void update_perror();
|
||||
|
||||
UINT8 m_data;
|
||||
int m_perror;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
extern const device_type DEMPA_SHINBUNSHA_JOYSTICK;
|
||||
|
||||
#endif
|
140
src/emu/bus/centronics/image.c
Normal file
140
src/emu/bus/centronics/image.c
Normal file
@ -0,0 +1,140 @@
|
||||
#include "emu.h"
|
||||
#include "image.h"
|
||||
|
||||
//**************************************************************************
|
||||
// CENTRONICS PRINTER DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
// device type definition
|
||||
const device_type CENTRONICS_PRINTER_IMAGE = &device_creator<centronics_printer_image_device>;
|
||||
|
||||
/*****************************************************************************
|
||||
PRINTER INTERFACE
|
||||
*****************************************************************************/
|
||||
const struct printer_interface centronics_printer_config =
|
||||
{
|
||||
DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, centronics_printer_image_device, printer_online)
|
||||
};
|
||||
|
||||
static MACHINE_CONFIG_FRAGMENT( centronics_printer )
|
||||
MCFG_PRINTER_ADD("printer")
|
||||
MCFG_DEVICE_CONFIG(centronics_printer_config)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
IMPLEMENTATION
|
||||
***************************************************************************/
|
||||
//-------------------------------------------------
|
||||
// centronics_printer_image_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
centronics_printer_image_device::centronics_printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, CENTRONICS_PRINTER_IMAGE, "Centronics Printer", tag, owner, clock, "centronics_printer", __FILE__),
|
||||
device_centronics_peripheral_interface( mconfig, *this )
|
||||
{
|
||||
}
|
||||
//-------------------------------------------------
|
||||
// machine_config_additions - device-specific
|
||||
// machine configurations
|
||||
//-------------------------------------------------
|
||||
|
||||
machine_config_constructor centronics_printer_image_device::device_mconfig_additions() const
|
||||
{
|
||||
return MACHINE_CONFIG_NAME( centronics_printer );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
printer_online - callback that
|
||||
sets us busy when the printer goes offline
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE_LINE_MEMBER(centronics_printer_image_device::printer_online)
|
||||
{
|
||||
output_perror(!state);
|
||||
}
|
||||
|
||||
void centronics_printer_image_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case TIMER_ACK:
|
||||
output_ack(param);
|
||||
|
||||
if (param == FALSE)
|
||||
{
|
||||
/* data is now ready, output it */
|
||||
m_printer->output(m_data);
|
||||
|
||||
/* ready to receive more data, return BUSY to low */
|
||||
timer_set(attotime::from_usec(7), TIMER_BUSY, FALSE);
|
||||
}
|
||||
break;
|
||||
|
||||
case TIMER_BUSY:
|
||||
m_busy = param;
|
||||
output_busy(m_busy);
|
||||
|
||||
if (param == TRUE)
|
||||
{
|
||||
/* timer to turn ACK low to receive data */
|
||||
timer_set(attotime::from_usec(10), TIMER_ACK, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* timer to return ACK to high state */
|
||||
timer_set(attotime::from_usec(5), TIMER_ACK, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void centronics_printer_image_device::device_start()
|
||||
{
|
||||
m_owner = dynamic_cast<centronics_device *>(owner());
|
||||
|
||||
/* get printer device */
|
||||
m_printer = subdevice<printer_image_device>("printer");
|
||||
|
||||
/* register for state saving */
|
||||
save_item(NAME(m_strobe));
|
||||
save_item(NAME(m_data));
|
||||
save_item(NAME(m_busy));
|
||||
}
|
||||
|
||||
void centronics_printer_image_device::device_reset()
|
||||
{
|
||||
m_busy = FALSE;
|
||||
output_busy(m_busy);
|
||||
output_fault(1);
|
||||
output_ack(1);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
centronics_strobe_w - signal that data is
|
||||
ready
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE_LINE_MEMBER( centronics_printer_image_device::input_strobe )
|
||||
{
|
||||
/* look for a high -> low transition */
|
||||
if (m_strobe == TRUE && state == FALSE && m_busy == FALSE)
|
||||
{
|
||||
/* STROBE has gone low, data is ready */
|
||||
timer_set(attotime::zero, TIMER_BUSY, TRUE);
|
||||
}
|
||||
|
||||
m_strobe = state;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
centronics_prime_w - initialize and reset
|
||||
printer (centronics mode)
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE_LINE_MEMBER(centronics_printer_image_device::input_init)
|
||||
{
|
||||
/* reset printer if line is low */
|
||||
if (state == FALSE)
|
||||
device_reset();
|
||||
}
|
58
src/emu/bus/centronics/image.h
Normal file
58
src/emu/bus/centronics/image.h
Normal file
@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __CENTRONICS_PRINTER_H__
|
||||
#define __CENTRONICS_PRINTER_H__
|
||||
|
||||
#include "ctronics.h"
|
||||
#include "imagedev/printer.h"
|
||||
|
||||
// ======================> centronics_printer_image_device
|
||||
|
||||
class centronics_printer_image_device : public device_t,
|
||||
public device_centronics_peripheral_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
centronics_printer_image_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
// optional information overrides
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_strobe );
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_data0 ) { if (state) m_data |= 0x01; else m_data &= ~0x01; }
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_data1 ) { if (state) m_data |= 0x02; else m_data &= ~0x02; }
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_data2 ) { if (state) m_data |= 0x04; else m_data &= ~0x04; }
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_data3 ) { if (state) m_data |= 0x08; else m_data &= ~0x08; }
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_data4 ) { if (state) m_data |= 0x10; else m_data &= ~0x10; }
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_data5 ) { if (state) m_data |= 0x20; else m_data &= ~0x20; }
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_data6 ) { if (state) m_data |= 0x40; else m_data &= ~0x40; }
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_data7 ) { if (state) m_data |= 0x80; else m_data &= ~0x80; }
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( input_init );
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( printer_online );
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
|
||||
private:
|
||||
|
||||
enum
|
||||
{
|
||||
TIMER_ACK,
|
||||
TIMER_BUSY
|
||||
};
|
||||
|
||||
int m_strobe;
|
||||
UINT8 m_data;
|
||||
int m_busy;
|
||||
|
||||
printer_image_device *m_printer;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
extern const device_type CENTRONICS_PRINTER_IMAGE;
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user