summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/pc_lpt.h
blob: e6f5c2aafb2df155fe336822099ed734498c5116 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/***************************************************************************

    IBM-PC printer interface

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

#ifndef __PC_LPT_H__
#define __PC_LPT_H__

#include "isa.h"
#include "machine/ctronics.h"
#include "cntr_covox.h"


/***************************************************************************
    TYPE DEFINITIONS
***************************************************************************/

struct pc_lpt_interface
{
	devcb_write_line m_out_irq;
};

/***************************************************************************
    DEVICE CONFIGURATION MACROS
***************************************************************************/

class pc_lpt_device : public device_t,
								public pc_lpt_interface
{
public:
	pc_lpt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	~pc_lpt_device() {}

	DECLARE_READ8_MEMBER( read );
	DECLARE_WRITE8_MEMBER( write );

	DECLARE_READ8_MEMBER( data_r );
	DECLARE_WRITE8_MEMBER( data_w );
	DECLARE_READ8_MEMBER( status_r );
	DECLARE_READ8_MEMBER( control_r );
	DECLARE_WRITE8_MEMBER( control_w );

	DECLARE_WRITE_LINE_MEMBER( ack_w );

protected:
	// device-level overrides
	virtual void device_config_complete();
	virtual void device_start();
	virtual void device_reset();
	virtual machine_config_constructor device_mconfig_additions() const;

private:
	// internal state
	centronics_device *m_centronics;

	devcb_resolved_write_line m_out_irq_func;

	UINT8 m_data;

	int m_ack;

	/* control latch */
	int m_strobe;
	int m_autofd;
	int m_init;
	int m_select;
	int m_irq_enabled;
};

extern const device_type PC_LPT;


#define MCFG_PC_LPT_ADD(_tag, _intf) \
	MCFG_DEVICE_ADD(_tag, PC_LPT, 0) \
	MCFG_DEVICE_CONFIG(_intf)

#define MCFG_PC_LPT_REMOVE(_tag) \
	MCFG_DEVICE_REMOVE(_tag)


//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************

// ======================> isa8_lpt_device

class isa8_lpt_device :
		public device_t,
		public device_isa8_card_interface
{
public:
		// construction/destruction
		isa8_lpt_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 ioport_constructor device_input_ports() const;

		bool is_primary() { return m_is_primary; }
protected:
		// device-level overrides
		virtual void device_start();
		virtual void device_reset();
private:
		// internal state
		bool m_is_primary;
};


// device type definition
extern const device_type ISA8_LPT;

#endif /* __PC_LPT__ */