Previous 15994 Revisions Next

r4313 Friday 20th February, 2009 at 13:06:04 UTC by Dirk Best
[MTX512] Updated to use the new centronics interface
[docs]messnew.txt
[src/mess/drivers]mtx.c
[src/mess/includes]mtx.h
[src/mess/machine]mtx.c

src/mess/includes/mtx.h
r4312r4313
44
55*************************************************************************/
66
7#ifndef MTX_H_
8#define MTX_H_
7#ifndef __MTX_H__
8#define __MTX_H__
99
1010#include "devices/snapquik.h"
1111#include "machine/z80ctc.h"
r4312r4313
3737/* Printer */
3838READ8_HANDLER( mtx_strobe_r );
3939READ8_HANDLER( mtx_prt_r );
40WRITE8_HANDLER( mtx_prt_w );
4140
4241/* Keyboard */
4342WRITE8_HANDLER( mtx_sense_w );
r4312r4313
5756WRITE8_DEVICE_HANDLER( mtx_dart_control_w );
5857
5958
60#endif /*MTX_H_*/
59#endif /* __MTX_H__ */
src/mess/machine/mtx.c
r4312r4313
77**************************************************************************/
88
99
10/* Core includes */
1110#include "driver.h"
1211#include "includes/mtx.h"
13
14/* Components */
1512#include "cpu/z80/z80.h"
1613#include "machine/z80ctc.h"
1714#include "machine/z80dart.h"
1815#include "video/tms9928a.h"
19
20/* Devices */
21#include "devices/printer.h"
16#include "machine/ctronics.h"
2217#include "devices/snapquik.h"
2318
2419
25#define MTX_PRT_BUSY      1
26#define MTX_PRT_NOERROR      2
27#define MTX_PRT_EMPTY      4
28#define MTX_PRT_SELECTED   8
2920
30
31
3221/*************************************
3322 *
3423 *  Global variables
r4312r4313
3726
3827static UINT8 key_sense;
3928
40static char mtx_prt_strobe = 0;
41static char mtx_prt_data = 0;
4229
4330
44
4531/*************************************
4632 *
4733 *  TMS9929A video chip
r4312r4313
126112 *
127113 *************************************/
128114
129static const device_config *mtx_printer_image(running_machine *machine)
130{
131   return devtag_get_device(machine, PRINTER, "printer");
132}
133
134115READ8_HANDLER( mtx_strobe_r )
135116{
136   if (mtx_prt_strobe == 0)
137      printer_output(mtx_printer_image(space->machine), mtx_prt_data);
117   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
138118
139   mtx_prt_strobe = 1;
119   /* set STROBE low */
120   centronics_strobe_w(printer, FALSE);
140121
141   return 0;
122   return 0xff;
142123}
143124
144125
145126READ8_HANDLER( mtx_prt_r )
146127{
147   mtx_prt_strobe = 0;
128   const device_config *printer = devtag_get_device(space->machine, CENTRONICS, "centronics");
129   UINT8 result = 0;
148130
149   return MTX_PRT_NOERROR | (printer_is_ready(mtx_printer_image(space->machine))
150         ? MTX_PRT_SELECTED : 0);
151}
131   /* reset STROBE to high */
132   centronics_strobe_w(printer, TRUE);
152133
153WRITE8_HANDLER( mtx_prt_w )
154{
155   mtx_prt_data = data;
134   /* fill in centronics printer status */
135   result |= centronics_busy_r(printer) << 0;
136   result |= centronics_fault_r(printer) << 1;
137   result |= !centronics_pe_r(printer) << 2;
138   result |= centronics_vcc_r(printer) << 3;
139
140   return result;
156141}
157142
158143
159144
145
160146/*************************************
161147 *
162148 *  Keyboard
src/mess/drivers/mtx.c
r4312r4313
1616**************************************************************************/
1717
1818
19/* Core includes */
2019#include "driver.h"
2120#include "includes/mtx.h"
22
23/* Components */
2421#include "cpu/z80/z80.h"
2522#include "cpu/z80/z80daisy.h"
2623#include "machine/z80ctc.h"
2724#include "video/tms9928a.h"
2825#include "sound/sn76496.h"
29
30/* Devices */
31#include "devices/printer.h"
26#include "machine/ctronics.h"
3227#include "devices/snapquik.h"
3328
3429
r4312r4313
6459   AM_RANGE(0x01, 0x01) AM_READWRITE(TMS9928A_vram_r, TMS9928A_vram_w)
6560   AM_RANGE(0x02, 0x02) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w)
6661   AM_RANGE(0x03, 0x03) AM_READWRITE(mtx_cst_r, mtx_cst_w)
67   AM_RANGE(0x04, 0x04) AM_READWRITE(mtx_prt_r, mtx_prt_w)
62   AM_RANGE(0x04, 0x04) AM_READ(mtx_prt_r) AM_DEVWRITE(CENTRONICS, "centronics", centronics_data_w)
6863   AM_RANGE(0x05, 0x05) AM_READWRITE(mtx_key_lo_r, mtx_sense_w)
6964   AM_RANGE(0x06, 0x06) AM_READ(mtx_key_hi_r)
7065   AM_RANGE(0x06, 0x06) AM_DEVWRITE(SOUND, "sn76489a", sn76496_w)
r4312r4313
273268   MDRV_TIMER_ADD_PERIODIC("z80ctc_c1c2", ctc_c1_c2_tick, HZ(4000000/13))
274269
275270   /* printer */
276   MDRV_PRINTER_ADD("printer")
271   MDRV_CENTRONICS_ADD("centronics", standard_centronics)
277272
278273   /* snapshot */
279274   MDRV_SNAPSHOT_ADD(mtx, "mtb", 0.5)
docs/messnew.txt
r4312r4313
5252
5353- [MTX512] Connected CTC channels 0-2 to clock sources. (bug #781) [Curt Coder]
5454
55- [MTX512] Updated to use the new centronics interface.  [Dirk Best]
56
5557- [NC100/NC200] Updated to use the new centronics interface and fixed
5658  printing.  [Dirk Best]
5759

Previous 15994 Revisions Next


© 1998-2018 The MESS Team