Previous 15994 Revisions Next

r14536 Sunday 19th February, 2012 at 16:44:59 UTC by Miodrag Milanović
Converted ins8250 to use diserial [Carl]

Added null_modem and serial_terminal as slot devices [Carl]
[src/emu]diserial.c diserial.h
[src/emu/imagedev]bitbngr.c bitbngr.h
[src/emu/machine]ins8250.c ins8250.h microtch.c microtch.h pc16552d.c pc16552d.h
[src/mame/drivers]adp.c cd32.c magtouch.c meritm.c pcat_nit.c tmaster.c
[src/mame/includes]cd32.h
[src/mess]mess.mak
[src/mess/drivers]68ksbc.c altair.c amstr_pc.c avigo.c basic52.c bebox.c bullet.c ccs2422.c ccs2810.c cm1800.c czk80.c d6809.c dectalk.c digel804.c dms86.c dual68.c exp85.c h19.c h89.c horizon.c ht68k.c imds.c ip22.c ipc.c isbc.c jupiter.c mccpm.c microdec.c mits680b.c mpz80.c msbc1.c ob68k1a.c okean240.c pc.c pc1512.c pcw16.c pdp11.c pes.c pimps.c portfoli.c qtsbc.c rvoice.c sacstate.c sage2.c sgi_ip2.c sun1.c super6.c svi318.c swtpc.c systec.c tricep.c tsispch.c vector4.c votrpss.c votrtnt.c xor100.c zexall.c zrt80.c zsbc3.c
[src/mess/includes]pc.h pc1512.h portfoli.h
[src/mess/machine]bebox.c isa.c isa.h isa_com.c isa_com.h null_modem.c* null_modem.h* pc.c pc_mouse.c pc_mouse.h s100_wunderbus.c s100_wunderbus.h ser_mouse.c ser_mouse.h serial.c serial.h svi318.c teleprinter.c terminal.c terminal.h

src/mame/includes/cd32.h
r14535r14536
88#define __CUBOCD32_H__
99
1010#include "includes/amiga.h"
11#include "machine/microtch.h"
1112
1213class cd32_state : public amiga_state
1314{
1415public:
1516   cd32_state(const machine_config &mconfig, device_type type, const char *tag)
16      : amiga_state(mconfig, type, tag) { }
17      : amiga_state(mconfig, type, tag),
18        m_microtouch(*this, "microtouch")
19      { }
1720
21   required_device<microtouch_device> m_microtouch;
22   
23   DECLARE_WRITE8_MEMBER(microtouch_tx);
1824   UINT16 m_potgo_value;
1925   int m_cd32_shifter[2];
2026   void (*m_input_hack)(running_machine &machine);
src/mame/drivers/adp.c
r14535r14536
157157public:
158158   adp_state(const machine_config &mconfig, device_type type, const char *tag)
159159      : driver_device(mconfig, type, tag),
160        m_h63484(*this, "h63484")
160        m_h63484(*this, "h63484"),
161        m_microtouch(*this, "microtouch")
161162      { }
162163
163164   required_device<h63484_device> m_h63484;
164
165   required_device<microtouch_device> m_microtouch;
166   
167   DECLARE_WRITE8_MEMBER(microtouch_tx);
165168   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
166169
167170   /* misc */
r14535r14536
262265{
263266   adp_state *state = device->machine().driver_data<adp_state>();
264267   device_set_input_line_and_vector(state->m_maincpu, 4, HOLD_LINE, vector);
265};
268}
266269
267270static void duart_tx( device_t *device, int channel, UINT8 data )
268271{
272   adp_state *state = device->machine().driver_data<adp_state>();
269273   if (channel == 0)
270274   {
271      microtouch_rx(1, &data);
275      state->m_microtouch->rx(*memory_nonspecific_space(device->machine()), 0, data);
272276   }
273};
277}
274278
275static void microtouch_tx( running_machine &machine, UINT8 data )
279WRITE8_MEMBER( adp_state::microtouch_tx )
276280{
277   adp_state *state = machine.driver_data<adp_state>();
278   duart68681_rx_data(state->m_duart, 0, data);
281   duart68681_rx_data(m_duart, 0, data);
279282}
280283
281284static UINT8 duart_input( device_t *device )
r14535r14536
283286   return input_port_read(device->machine(), "DSW1");
284287}
285288
289static const microtouch_interface adb_microtouch_config =
290{
291   DEVCB_DRIVER_MEMBER(adp_state, microtouch_tx),
292   NULL
293};
294
286295static MACHINE_START( skattv )
287296{
288297   adp_state *state = machine.driver_data<adp_state>();
289   microtouch_init(machine, microtouch_tx, 0);
290298
291299   state->m_maincpu = machine.device("maincpu");
292300   state->m_duart = machine.device("duart68681");
r14535r14536
530538#endif
531539
532540static INPUT_PORTS_START( skattv )
533   PORT_INCLUDE(microtouch)
534
535541   PORT_START("DSW1")
536542   PORT_BIT( 0x0001, IP_ACTIVE_HIGH,  IPT_COIN5    )
537543   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_COIN6    )
r14535r14536
661667   MCFG_MACHINE_RESET(skattv)
662668
663669   MCFG_DUART68681_ADD( "duart68681", XTAL_8_664MHz / 2, skattv_duart68681_config )
670   MCFG_MICROTOUCH_ADD( "microtouch", adb_microtouch_config )
664671
665672   MCFG_SCREEN_ADD("screen", RASTER)
666673   MCFG_SCREEN_REFRESH_RATE(60)
r14535r14536
692699   MCFG_MACHINE_RESET(skattv)
693700
694701   MCFG_DUART68681_ADD( "duart68681", XTAL_8_664MHz / 2, skattv_duart68681_config )
702   MCFG_MICROTOUCH_ADD( "microtouch", adb_microtouch_config )
695703
696704   MCFG_SCREEN_ADD("screen", RASTER)
697705   MCFG_SCREEN_REFRESH_RATE(60)
r14535r14536
719727   MCFG_CPU_PROGRAM_MAP(backgamn_mem)
720728
721729   MCFG_DUART68681_ADD( "duart68681", XTAL_8_664MHz / 2, skattv_duart68681_config )
730   MCFG_MICROTOUCH_ADD( "microtouch", adb_microtouch_config )
722731
723732   MCFG_MACHINE_START(skattv)
724733   MCFG_MACHINE_RESET(skattv)
src/mame/drivers/meritm.c
r14535r14536
129129   meritm_state(const machine_config &mconfig, device_type type, const char *tag)
130130      : driver_device(mconfig, type, tag),
131131        m_v9938_0(*this, "v9938_0"),
132        m_v9938_1(*this, "v9938_1") { }
132        m_v9938_1(*this, "v9938_1"),
133        m_microtouch(*this, "microtouch") { }
133134
135   DECLARE_WRITE8_MEMBER(microtouch_tx);
134136   UINT8* m_ram;
135137   device_t *m_z80pio[2];
136138   int m_vint;
r14535r14536
144146   ds1204_t m_ds1204;
145147   required_device<v9938_device> m_v9938_0;
146148   required_device<v9938_device> m_v9938_1;
149   required_device<microtouch_device> m_microtouch;
147150};
148151
149152
r14535r14536
271274 *
272275 *************************************/
273276
274static void pc16650d_tx_callback(int channel, int count, UINT8* data)
277static void pc16650d_tx_callback(running_machine &machine, int channel, int count, UINT8* data)
275278{
276   microtouch_rx(count, data);
277};
279   meritm_state *state = machine.driver_data<meritm_state>();
280   for(int i = 0; i < count; i++)
281      state->m_microtouch->rx(*memory_nonspecific_space(machine), 0, data[i]);
282}
278283
279static void meritm_microtouch_tx_callback(running_machine &machine, UINT8 data)
284WRITE8_MEMBER(meritm_state::microtouch_tx)
280285{
281   pc16552d_rx_data(machine, 0, 0, data);
282};
286   pc16552d_rx_data(space.machine(), 0, 0, data);
287}
283288
284289/*************************************
285290 *
286291 *  Microtouch touch coordinate transformation
287292 *
288293 *************************************/
289static int meritm_touch_coord_transform(running_machine &machine, int *touch_x, int *touch_y)
294MICROTOUCH_TOUCH(meritm_touch_coord_transform)
290295{
291296   int xscr = (int)((double)(*touch_x)/0x4000*544);
292297   int yscr = (int)((double)(*touch_y)/0x4000*480);
r14535r14536
311316   return 1;
312317}
313318
319static const microtouch_interface meritm_microtouch_config =
320{
321   DEVCB_DRIVER_MEMBER(meritm_state, microtouch_tx),
322   meritm_touch_coord_transform
323};
324
314325/*************************************
315326 *
316327 *  Video
r14535r14536
627638 *************************************/
628639
629640static INPUT_PORTS_START(meritm_crt260)
630   PORT_INCLUDE(microtouch)
631
632641   PORT_START("PIO1_PORTA")
633642   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
634643   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
r14535r14536
9971006{
9981007   MACHINE_START_CALL(meritm_crt250_questions);
9991008   pc16552d_init(machine, 0, UART_CLK, NULL, pc16650d_tx_callback);
1000   microtouch_init(machine, meritm_microtouch_tx_callback, meritm_touch_coord_transform);
10011009}
10021010
10031011static MACHINE_START(meritm_crt260)
r14535r14536
10141022   meritm_switch_banks(machine);
10151023   MACHINE_START_CALL(merit_common);
10161024   pc16552d_init(machine, 0, UART_CLK, NULL, pc16650d_tx_callback);
1017   microtouch_init(machine, meritm_microtouch_tx_callback, meritm_touch_coord_transform);
10181025   state_save_register_global(machine, state->m_bank);
10191026   state_save_register_global(machine, state->m_psd_a15);
10201027   state_save_register_global_pointer(machine, state->m_ram, 0x8000);
r14535r14536
10891096   MCFG_SOUND_ADD("aysnd", AY8910, SYSTEM_CLK/12)
10901097   MCFG_SOUND_CONFIG(ay8910_config)
10911098   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
1099
1100   MCFG_MICROTOUCH_ADD("microtouch", meritm_microtouch_config)
10921101MACHINE_CONFIG_END
10931102
10941103static MACHINE_CONFIG_DERIVED( meritm_crt250_questions, meritm_crt250 )
src/mame/drivers/cd32.c
r14535r14536
3535#include "includes/cd32.h"
3636#include "sound/cdda.h"
3737#include "imagedev/chd_cd.h"
38#include "machine/microtch.h"
3938#include "machine/amigafdc.h"
4039
4140#define CD32PAL_XTAL_X1   XTAL_28_37516MHz
r14535r14536
760759   I2CMEM_SLAVE_ADDRESS, NVRAM_PAGE_SIZE, NVRAM_SIZE
761760};
762761
762static const microtouch_interface cd32_microtouch_config =
763{
764   DEVCB_DRIVER_MEMBER(cd32_state, microtouch_tx),
765   NULL
766};
767
763768static MACHINE_CONFIG_START( cd32base, cd32_state )
764769
765770   /* basic machine hardware */
r14535r14536
800805   MCFG_MOS8520_ADD("cia_0", AMIGA_68EC020_PAL_CLOCK / 10, cia_0_intf)
801806   MCFG_MOS8520_ADD("cia_1", AMIGA_68EC020_PAL_CLOCK / 10, cia_1_intf)
802807
808   MCFG_MICROTOUCH_ADD( "microtouch", cd32_microtouch_config )
809
803810   /* fdc */
804811   MCFG_AMIGA_FDC_ADD("fdc", AMIGA_68000_NTSC_CLOCK)
805812MACHINE_CONFIG_END
r14535r14536
13751382
13761383static INPUT_PORTS_START( odeontw2 )
13771384//  PORT_INCLUDE( cd32 )
1378   PORT_INCLUDE( microtouch )
1379
13801385   PORT_START("CIA0PORTA")
13811386   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
13821387
r14535r14536
14401445
14411446static void serial_w(running_machine &machine, UINT16 data)
14421447{
1448   cd32_state *state = machine.driver_data<cd32_state>();
14431449   UINT8 data8 = data & 0xff;
14441450   if ( data8 != 0x00 )
1445      microtouch_rx(1, &data8);
1451      state->m_microtouch->rx(*memory_nonspecific_space(machine), 0, data8);
14461452}
14471453
1448static void microtouch_tx(running_machine &machine, UINT8 data)
1454WRITE8_MEMBER (cd32_state::microtouch_tx)
14491455{
1450   amiga_serial_in_w(machine, data);
1456   amiga_serial_in_w(machine(), data);
14511457}
14521458
14531459static DRIVER_INIT( odeontw2 )
r14535r14536
14721478
14731479   /* input hack */
14741480   state->m_input_hack = NULL;
1475
1476   /* touch screen */
1477   microtouch_init(machine, microtouch_tx, NULL);
14781481}
14791482
14801483/***************************************************************************************************/
src/mame/drivers/pcat_nit.c
r14535r14536
9696{
9797public:
9898   pcat_nit_state(const machine_config &mconfig, device_type type, const char *tag)
99      : driver_device(mconfig, type, tag) { }
99      : driver_device(mconfig, type, tag),
100        m_uart(*this, "ns16450_0"),
101        m_microtouch(*this, "microtouch")
102      { }
100103
101104   UINT8 *m_banked_nvram;
105   required_device<ns16450_device> m_uart;
106   required_device<microtouch_serial_device> m_microtouch;
107
108   DECLARE_WRITE_LINE_MEMBER(microtouch_out);
109   DECLARE_WRITE_LINE_MEMBER(microtouch_in);
102110};
103111
104
105static void pcat_nit_microtouch_tx_callback(running_machine &machine, UINT8 data)
112WRITE_LINE_MEMBER(pcat_nit_state::microtouch_out)
106113{
107   ins8250_receive(machine.device("ns16450_0"), data);
108};
114   m_microtouch->rx(state);
115}
109116
110static INS8250_TRANSMIT( pcat_nit_com_transmit )
117WRITE_LINE_MEMBER(pcat_nit_state::microtouch_in)
111118{
112   UINT8 data8 = data;
113   microtouch_rx(1, &data8);
119   m_uart->rx_w(state);
114120}
115121
116122static WRITE_LINE_DEVICE_HANDLER( at_com_interrupt_1 )
r14535r14536
120126
121127static const ins8250_interface pcat_nit_com0_interface =
122128{
123   1843200,
129   DEVCB_DRIVER_LINE_MEMBER(pcat_nit_state, microtouch_out),
130   DEVCB_NULL,
131   DEVCB_NULL,
124132   DEVCB_LINE(at_com_interrupt_1),
125   pcat_nit_com_transmit,
126   NULL,
127   NULL
133   DEVCB_NULL,
134   DEVCB_NULL
128135};
129136
137static const microtouch_serial_interface pcat_nit_microtouch_interface =
138{
139   DEVCB_DRIVER_LINE_MEMBER(pcat_nit_state, microtouch_in)
140};
141
130142/*************************************
131143 *
132144 *  ROM banking
r14535r14536
194206   AM_IMPORT_FROM(pcat32_io_common)
195207   AM_RANGE(0x0278, 0x027f) AM_READ8(pcat_nit_io_r, 0xffffffff) AM_WRITENOP
196208   AM_RANGE(0x0280, 0x0283) AM_READNOP
197   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ns16450_0", ins8250_r, ins8250_w, 0xffffffff)
209   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8_MODERN("ns16450_0", ns16450_device, ins8250_r, ins8250_w, 0xffffffff)
198210ADDRESS_MAP_END
199211
200212static INPUT_PORTS_START( pcat_nit )
201   PORT_INCLUDE(microtouch)
202
203213   PORT_START("IN0")
204214   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Clear") PORT_CODE(KEYCODE_C)
205215   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_SERVICE)
r14535r14536
224234   memory_configure_bank(machine, "rombank", 0, 0x80, machine.region("game_prg")->base(), 0x8000 );
225235   memory_set_bank(machine, "rombank", 0);
226236
227   microtouch_init(machine, pcat_nit_microtouch_tx_callback, NULL);
237   //microtouch_init(machine, pcat_nit_microtouch_tx_callback, NULL);
228238}
229239
230240static MACHINE_CONFIG_START( pcat_nit, pcat_nit_state )
r14535r14536
245255
246256//  MCFG_FRAGMENT_ADD( at_kbdc8042 )
247257   MCFG_FRAGMENT_ADD( pcat_common )
248   MCFG_NS16450_ADD( "ns16450_0", pcat_nit_com0_interface )
258   MCFG_NS16450_ADD( "ns16450_0", pcat_nit_com0_interface, XTAL_1_8432MHz )
259   MCFG_MICROTOUCH_SERIAL_ADD( "microtouch", pcat_nit_microtouch_interface, 9600 ) // rate?
249260
250261   MCFG_NVRAM_ADD_0FILL("nvram")
251262
src/mame/drivers/magtouch.c
r14535r14536
8585{
8686public:
8787   magtouch_state(const machine_config &mconfig, device_type type, const char *tag)
88      : driver_device(mconfig, type, tag) { }
88      : driver_device(mconfig, type, tag),
89        m_uart(*this, "ns16450_0"),
90        m_microtouch(*this, "microtouch")
91   { }
8992
93   required_device<ns16450_device> m_uart;
94   required_device<microtouch_serial_device> m_microtouch;
95
96   DECLARE_WRITE_LINE_MEMBER(microtouch_out);
97   DECLARE_WRITE_LINE_MEMBER(microtouch_in);
9098};
9199
92100
r14535r14536
96104 *
97105 *************************************/
98106
99static void magtouch_microtouch_tx_callback(running_machine &machine, UINT8 data)
107WRITE_LINE_MEMBER(magtouch_state::microtouch_out)
100108{
101   ins8250_receive(machine.device("ns16450_0"), data);
102};
109   m_microtouch->rx(state);
110}
103111
104static INS8250_TRANSMIT( magtouch_com_transmit )
112WRITE_LINE_MEMBER(magtouch_state::microtouch_in)
105113{
106   UINT8 data8 = data;
107   microtouch_rx(1, &data8);
114   m_uart->rx_w(state);
108115}
109116
110117static WRITE_LINE_DEVICE_HANDLER( at_com_interrupt_1 )
r14535r14536
114121
115122static const ins8250_interface magtouch_com0_interface =
116123{
117   1843200,
124   DEVCB_DRIVER_LINE_MEMBER(magtouch_state, microtouch_out),
125   DEVCB_NULL,
126   DEVCB_NULL,
118127   DEVCB_LINE(at_com_interrupt_1),
119   magtouch_com_transmit,
120   NULL,
121   NULL
128   DEVCB_NULL,
129   DEVCB_NULL
122130};
123131
132static const microtouch_serial_interface magtouch_microtouch_interface =
133{
134   DEVCB_DRIVER_LINE_MEMBER(magtouch_state, microtouch_in)
135};
136
124137/*************************************
125138 *
126139 *  ROM banking
r14535r14536
161174static ADDRESS_MAP_START( magtouch_io, AS_IO, 32 )
162175   AM_IMPORT_FROM(pcat32_io_common)
163176   AM_RANGE(0x02e0, 0x02e7) AM_READWRITE8(magtouch_io_r, magtouch_io_w, 0xffffffff)
164   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ns16450_0", ins8250_r, ins8250_w, 0xffffffff)
177   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8_MODERN("ns16450_0", ns16450_device, ins8250_r, ins8250_w, 0xffffffff)
165178ADDRESS_MAP_END
166179
167180static INPUT_PORTS_START( magtouch )
168   PORT_INCLUDE(microtouch)
169
170181   PORT_START("IN0")
171182   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Clear") PORT_CODE(KEYCODE_C)
172183   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_SERVICE)
r14535r14536
191202   memory_configure_bank(machine, "rombank", 0, 0x80, machine.region("game_prg")->base(), 0x8000 );
192203   memory_set_bank(machine, "rombank", 0);
193204
194   microtouch_init(machine, magtouch_microtouch_tx_callback, NULL);
205//   microtouch_init(machine, magtouch_microtouch_tx_callback, NULL);
195206}
196207
197208static MACHINE_CONFIG_START( magtouch, magtouch_state )
r14535r14536
212223
213224//  MCFG_FRAGMENT_ADD( at_kbdc8042 )
214225   MCFG_FRAGMENT_ADD( pcat_common )
215   MCFG_NS16450_ADD( "ns16450_0", magtouch_com0_interface )
216
226   MCFG_NS16450_ADD( "ns16450_0", magtouch_com0_interface, XTAL_1_8432MHz )
227   MCFG_MICROTOUCH_SERIAL_ADD( "microtouch", magtouch_microtouch_interface, 9600 ) // rate?
217228MACHINE_CONFIG_END
218229
219230
src/mame/drivers/tmaster.c
r14535r14536
121121public:
122122   tmaster_state(const machine_config &mconfig, device_type type, const char *tag)
123123      : driver_device(mconfig, type, tag),
124      m_maincpu(*this,"maincpu")
124      m_maincpu(*this,"maincpu"),
125      m_microtouch(*this,"microtouch")
125126      { }
126127
128   DECLARE_WRITE8_MEMBER(microtouch_tx);
129
127130   int m_okibank;
128131   UINT8 m_rtc_ram[8];
129132   bitmap_ind16 m_bitmap[2][2];
r14535r14536
141144   device_t *m_duart68681;
142145
143146   required_device<cpu_device> m_maincpu;
147   optional_device<microtouch_device> m_microtouch;
144148};
145149
146150
r14535r14536
179183
180184static void duart_tx(device_t *device, int channel, UINT8 data)
181185{
186   tmaster_state *state = device->machine().driver_data<tmaster_state>();
182187   if ( channel == 0 )
183188   {
184      microtouch_rx(1, &data);
189      state->m_microtouch->rx(*memory_nonspecific_space(device->machine()), 0, data);
185190   }
186191};
187192
188static void microtouch_tx(running_machine &machine, UINT8 data)
193WRITE8_MEMBER( tmaster_state::microtouch_tx )
189194{
190   tmaster_state *state = machine.driver_data<tmaster_state>();
191   duart68681_rx_data(state->m_duart68681, 0, data);
195   duart68681_rx_data(m_duart68681, 0, data);
192196}
193197
198static const microtouch_interface tmaster_microtouch_config =
199{
200   DEVCB_DRIVER_MEMBER(tmaster_state, microtouch_tx),
201   NULL
202};
194203
195204/***************************************************************************
196205
r14535r14536
766775
767776***************************************************************************/
768777static INPUT_PORTS_START( tm )
769   PORT_INCLUDE( microtouch )
770
771778   PORT_START("COIN")
772779   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN5 )   // "M. Coin 1 Input"
773780   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN6 )   // "M. Coin 2 Input"
r14535r14536
788795INPUT_PORTS_END
789796
790797static INPUT_PORTS_START( tmaster )
791   PORT_INCLUDE( microtouch )
792
793798   PORT_START("COIN")
794799   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )   // "M. Coin 1 Input"
795800   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )   // "M. Coin 2 Input"
r14535r14536
863868
864869***************************************************************************/
865870
866static MACHINE_START( tmaster )
867{
868   microtouch_init(machine, microtouch_tx, 0);
869}
870
871871static MACHINE_RESET( tmaster )
872872{
873873   tmaster_state *state = machine.driver_data<tmaster_state>();
r14535r14536
904904   MCFG_CPU_PROGRAM_MAP(tmaster_map)
905905   MCFG_TIMER_ADD_SCANLINE("scantimer", tm3k_interrupt, "screen", 0, 1)
906906
907   MCFG_MACHINE_START(tmaster)
908907   MCFG_MACHINE_RESET(tmaster)
909908
910909   MCFG_DUART68681_ADD( "duart68681", XTAL_8_664MHz / 2 /*??*/, tmaster_duart68681_config )
910   MCFG_MICROTOUCH_ADD( "microtouch", tmaster_microtouch_config )
911911
912912   MCFG_NVRAM_ADD_0FILL("nvram")
913913
src/emu/imagedev/bitbngr.c
r14535r14536
303303
304304void bitbanger_device::device_start(void)
305305{
306   const bitbanger_config *config = (const bitbanger_config *) static_config();
307
308306   /* output config */
309307   m_build_count = 0;
310308   m_output_timer = timer_alloc(TIMER_OUTPUT);
r14535r14536
316314   m_input_buffer_cursor = 0;
317315
318316   /* defaults */
319   m_mode = config->m_default_mode;
320   m_baud = config->m_default_baud;
321   m_tune = config->m_default_tune;
317   m_mode = m_default_mode;
318   m_baud = m_default_baud;
319   m_tune = m_default_tune;
322320   m_current_baud = attotime::from_hz(baud_value());
323321
324322   /* callback */
325   m_input_callback.resolve(config->m_input_callback, *this);
323   m_input_func.resolve(m_input_callback, *this);
326324}
327325
328326
r14535r14536
333331
334332void bitbanger_device::device_config_complete(void)
335333{
334   const _bitbanger_config *intf = reinterpret_cast<const _bitbanger_config *>(static_config());
335   if(intf != NULL)
336   {
337      *static_cast<_bitbanger_config *>(this) = *intf;
338   }
339   else
340   {
341      memset(&m_input_callback, 0, sizeof(m_input_callback));
342      m_default_mode = 0;
343      m_default_baud = 0;
344      m_default_tune = 0;
345   }
336346   update_names();
337347}
338348
r14535r14536
433443   if (m_current_input != line)
434444   {
435445      m_current_input = line;
436      if (!m_input_callback.isnull())
437      {
438         m_input_callback(line ? ASSERT_LINE : CLEAR_LINE);
439      }
446      m_input_func(line ? ASSERT_LINE : CLEAR_LINE);
440447   }
441448}
442449
src/emu/imagedev/bitbngr.h
r14535r14536
8484
8585
8686class bitbanger_device :   public device_t,
87                     public device_image_interface
87                     public device_image_interface,
88                     public _bitbanger_config
8889{
8990public:
9091   // construction/destruction
r14535r14536
145146   // variables
146147   emu_timer *               m_output_timer;
147148   emu_timer *               m_input_timer;
148   devcb_resolved_write_line   m_input_callback;
149   devcb_resolved_write_line   m_input_func;
149150   int                     m_output_value;
150151   int                     m_build_count;
151152   int                     m_build_byte;
src/emu/diserial.c
r14535r14536
7676   int previous_bit;
7777
7878   //LOG(("receive register receive bit: %1x\n",bit));
79   previous_bit = m_rcv_register_data & 1;
79   previous_bit = (m_rcv_register_data & 0x8000) && 1;
8080
8181   /* shift previous bit 7 out */
82   m_rcv_register_data = m_rcv_register_data<<1;
82   m_rcv_register_data = m_rcv_register_data>>1;
8383   /* shift new bit in */
84   m_rcv_register_data = (m_rcv_register_data & 0xfffe) | bit;
84   m_rcv_register_data = (m_rcv_register_data & 0x7fff) | (bit<<15);
8585   /* update bit count received */
8686   m_rcv_bit_count_received++;
8787
r14535r14536
123123
124124void device_serial_interface::receive_register_extract()
125125{
126   unsigned long data_shift;
127126   UINT8 data;
128127
129128   receive_register_reset();
130129
131   data_shift = 0;
132
133   /* if parity is even or odd, there should be a parity bit in the stream! */
134   if (m_df_parity!=SERIAL_PARITY_NONE)
135   {
136      data_shift++;
137   }
138
139   data_shift+=m_df_stop_bit_count;
140
141130   /* strip off stop bits and parity */
142   data = m_rcv_register_data>>data_shift;
131   data = m_rcv_register_data>>(16-m_rcv_bit_count);
143132
144133   /* mask off other bits so data byte has 0's in unused bits */
145   data = data & (0x0ff
146      >>
147      (8-(m_df_word_length)));
134   data &= ~(0xff<<m_df_word_length);
148135
149136   m_rcv_byte_received  = data;
150137
138   if(m_df_parity == SERIAL_PARITY_NONE)
139      return;
140
141   //unsigned char computed_parity;
142   //unsigned char parity_received;
143
144   /* get state of parity bit received */
145   //parity_received = (m_rcv_register_data>>m_df_word length) & 0x01;
146
151147   /* parity enable? */
152148   switch (m_df_parity)
153149   {
154      case SERIAL_PARITY_NONE:
155         break;
156
157150      /* check parity */
158151      case SERIAL_PARITY_ODD:
159152      case SERIAL_PARITY_EVEN:
160153      {
161         //unsigned char computed_parity;
162         //unsigned char parity_received;
163
164         /* get state of parity bit received */
165         //parity_received = (m_rcv_register_data>>m_df_stop_bit_count) & 0x01;
166
167154         /* compute parity for received bits */
168155         //computed_parity = serial_helper_get_parity(data);
169156
r14535r14536
182169
183170      }
184171      break;
172      case SERIAL_PARITY_MARK:
173      case SERIAL_PARITY_SPACE:
174         //computed_parity = parity_received;
175         break;
185176   }
186177}
187178
r14535r14536
225216      int databit;
226217
227218      /* get bit from data */
228      databit = (transmit_data>>(m_df_word_length-1)) & 0x01;
219      databit = transmit_data & 0x01;
229220      /* add bit to formatted byte */
230221      transmit_register_add_bit(databit);
231      transmit_data = transmit_data<<1;
222      transmit_data = transmit_data>>1;
232223   }
233224
234225   /* parity */
235226   if (m_df_parity!=SERIAL_PARITY_NONE)
236227   {
237228      /* odd or even parity */
238      unsigned char parity;
229      unsigned char parity = 0;
230      switch(m_df_parity)
231      {
232      case SERIAL_PARITY_EVEN:
233      case SERIAL_PARITY_ODD:
239234
240      /* get parity */
241      /* if parity = 0, data has even parity - i.e. there is an even number of one bits in the data */
242      /* if parity = 1, data has odd parity - i.e. there is an odd number of one bits in the data */
243      parity = serial_helper_get_parity(data_byte);
244
235         /* get parity */
236         /* if parity = 0, data has even parity - i.e. there is an even number of one bits in the data */
237         /* if parity = 1, data has odd parity - i.e. there is an odd number of one bits in the data */
238         parity = serial_helper_get_parity(data_byte);
239         break;
240      case SERIAL_PARITY_MARK:
241         parity = 1;
242         break;
243      case SERIAL_PARITY_SPACE:
244         parity = 0;
245         break;
246      }
245247      transmit_register_add_bit(parity);
246248   }
247249
r14535r14536
258260{
259261   int bit;
260262
261   bit = (m_tra_register_data>>
262      (m_tra_bit_count - 1 -
263      m_tra_bit_count_transmitted)) & 0x01;
263   bit = (m_tra_register_data>>(m_tra_bit_count-1-m_tra_bit_count_transmitted))&1;
264264
265265   m_tra_bit_count_transmitted++;
266266
src/emu/diserial.h
r14535r14536
1919{
2020   SERIAL_PARITY_NONE,      /* no parity. a parity bit will not be in the transmitted/received data */
2121   SERIAL_PARITY_ODD,      /* odd parity */
22   SERIAL_PARITY_EVEN      /* even parity */
22   SERIAL_PARITY_EVEN,      /* even parity */
23   SERIAL_PARITY_MARK,      /* one parity */
24   SERIAL_PARITY_SPACE      /* zero parity */
2325};
2426
2527/*
src/emu/machine/pc16552d.c
r14535r14536
5555   PC16552D_CHANNEL ch[2];
5656   int frequency;
5757   void (* irq_handler)(running_machine &machine, int channel, int value);
58   void (* tx_callback)(int channel, int count, UINT8* data);
58   void (* tx_callback)(running_machine &machine, int channel, int count, UINT8* data);
5959} PC16552D_REGS;
6060
6161#define MAX_PC16552D_CHIPS      4
r14535r14536
151151   ch = &duart[chip].ch[channel];
152152
153153   if (duart[chip].tx_callback)
154      duart[chip].tx_callback(channel, ch->tx_fifo_num, ch->tx_fifo);
154      duart[chip].tx_callback(machine, channel, ch->tx_fifo_num, ch->tx_fifo);
155155
156156   ch->tx_fifo_num = 0;
157157
r14535r14536
387387
388388/*****************************************************************************/
389389
390void pc16552d_init(running_machine &machine, int chip, int frequency, void (* irq_handler)(running_machine &machine, int channel, int value), void (* tx_callback)(int channel, int count, UINT8* data))
390void pc16552d_init(running_machine &machine, int chip, int frequency, void (* irq_handler)(running_machine &machine, int channel, int value), void (* tx_callback)(running_machine &machine, int channel, int count, UINT8* data))
391391{
392392   memset(&duart[chip], 0, sizeof(PC16552D_REGS));
393393
src/emu/machine/pc16552d.h
r14535r14536
11#ifndef PC16552D_H
22#define PC16552D_H
33
4void pc16552d_init(running_machine &machine, int chip, int frequency, void (* irq_handler)(running_machine &machine, int channel, int value), void (* tx_callback)(int channel, int count, UINT8* data));
4void pc16552d_init(running_machine &machine, int chip, int frequency, void (* irq_handler)(running_machine &machine, int channel, int value), void (* tx_callback)(running_machine &machine, int channel, int count, UINT8* data));
55void pc16552d_rx_data(running_machine &machine, int chip, int channel, UINT8 data);
66
77READ8_HANDLER(pc16552d_0_r);
src/emu/machine/ins8250.c
r14535r14536
7373
7474**********************************************************************/
7575
76#include "emu.h"
7776#include "machine/ins8250.h"
7877
78const device_type INS8250 = &device_creator<ins8250_device>;
79const device_type NS16450 = &device_creator<ns16450_device>;
80const device_type NS16550 = &device_creator<ns16550_device>;
7981
80#define LOG(LEVEL,N,M,A)  \
81   do { \
82      if(LEVEL>=N) \
83      { \
84         if( M ) \
85            logerror("%-24s",(char*)M ); \
86         logerror A; \
87      } \
88   } while (0)
82ins8250_uart_device::ins8250_uart_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock)
83      : device_t(mconfig, type, name, tag, owner, clock),
84        device_serial_interface(mconfig, *this)
85{
86}
8987
88ins8250_device::ins8250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
89      : ins8250_uart_device(mconfig, INS8250, "ins8250", tag, owner, clock)
90{
91   m_device_type = TYPE_INS8250;
92}
9093
91/* device types */
92enum {
93   TYPE_INS8250 = 0,
94   TYPE_INS8250A,
95   TYPE_NS16450,
96   TYPE_NS16550,
97   TYPE_NS16550A,
98   TYPE_PC16550D,
94ns16450_device::ns16450_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
95      : ins8250_uart_device(mconfig, NS16450, "ns16450", tag, owner, clock)
96{
97   m_device_type = TYPE_NS16450;
98}
9999
100   NUM_TYPES
101};
100ns16550_device::ns16550_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
101      : ins8250_uart_device(mconfig, NS16550, "ns16550", tag, owner, clock)
102{
103   m_device_type = TYPE_NS16550;
104}
102105
103
104/* device tags */
105static const char * const device_tags[NUM_TYPES] = { "ins8250", "ins8250a", "ns16450", "ns16550", "ns16550a", "pc16550d" };
106
107
108#define VERBOSE_COM 0
109#define COM_LOG(n,m,a) LOG(VERBOSE_COM,n,m,a)
110
111typedef struct {
112   devcb_resolved_write_line   out_intr_func;
113   const ins8250_interface *interface;
114   int   device_type;
115
116   UINT8 thr;  /* 0 -W transmitter holding register */
117   UINT8 rbr; /* 0 R- receiver buffer register */
118   UINT8 ier;  /* 1 RW interrupt enable register */
119   UINT8 dll;  /* 0 RW divisor latch lsb (if DLAB = 1) */
120   UINT8 dlm;  /* 1 RW divisor latch msb (if DLAB = 1) */
121   UINT8 iir;  /* 2 R- interrupt identification register */
122   UINT8 lcr;  /* 3 RW line control register (bit 7: DLAB) */
123   UINT8 mcr;  /* 4 RW modem control register */
124   UINT8 lsr;  /* 5 R- line status register */
125   UINT8 msr;  /* 6 R- modem status register */
126   UINT8 scr;  /* 7 RW scratch register */
127
128/* holds int pending state for com */
129   UINT8 int_pending;
130
131   // sending circuit
132   struct {
133      int active;
134      UINT8 data;
135      double time;
136   } send;
137} ins8250_t;
138
139106/* int's pending */
140107#define COM_INT_PENDING_RECEIVED_DATA_AVAILABLE   0x0001
141108#define COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY 0x0002
142109#define COM_INT_PENDING_RECEIVER_LINE_STATUS 0x0004
143110#define COM_INT_PENDING_MODEM_STATUS_REGISTER 0x0008
144111
145
146INLINE ins8250_t *get_safe_token(device_t *device)
147{
148   assert( device != NULL );
149   assert( ( device->type() == INS8250 ) ||
150         ( device->type() == INS8250A ) ||
151         ( device->type() == NS16450 ) ||
152         ( device->type() == NS16550 ) ||
153         ( device->type() == NS16550A ) ||
154         ( device->type() == PC16550D ) );
155   return (ins8250_t *)downcast<legacy_device_base *>(device)->token();
156}
157
158
159/* setup iir with the priority id */
160static void ins8250_setup_iir(device_t *device)
161{
162   ins8250_t   *ins8250 = get_safe_token(device);
163
164   ins8250->iir &= ~(0x04|0x02);
165
166   /* highest to lowest */
167   if (ins8250->ier & ins8250->int_pending & COM_INT_PENDING_RECEIVER_LINE_STATUS)
168   {
169      ins8250->iir |=0x04|0x02;
170      return;
171   }
172
173   if (ins8250->ier & ins8250->int_pending & COM_INT_PENDING_RECEIVED_DATA_AVAILABLE)
174   {
175      ins8250->iir |=0x04;
176      return;
177   }
178
179   if (ins8250->ier & ins8250->int_pending & COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY)
180   {
181      ins8250->iir |=0x02;
182      return;
183   }
184
185   /* modem status has both bits clear */
186}
187
188
189112/* ints will continue to be set for as long as there are ints pending */
190static void ins8250_update_interrupt(device_t *device)
113void ins8250_uart_device::update_interrupt()
191114{
192   ins8250_t   *ins8250 = get_safe_token(device);
193115   int state;
194116
195117   /* if any bits are set and are enabled */
196   if (((ins8250->int_pending&ins8250->ier) & 0x0f) != 0)
118   if (((m_int_pending & m_regs.ier) & 0x0f) != 0)
197119   {
198120      /* trigger next highest priority int */
199121
200122      /* set int */
201123      state = 1;
202      ins8250_setup_iir(device);
124      m_regs.iir &= ~(0x04|0x02);
203125
126      /* highest to lowest */
127      if (m_regs.ier & m_int_pending & COM_INT_PENDING_RECEIVER_LINE_STATUS)
128         m_regs.iir |=0x04|0x02;
129      else if (m_regs.ier & m_int_pending & COM_INT_PENDING_RECEIVED_DATA_AVAILABLE)
130         m_regs.iir |=0x04;
131      else if (m_regs.ier & m_int_pending & COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY)
132         m_regs.iir |=0x02;
133
204134      /* int pending */
205      ins8250->iir &= ~0x01;
135      m_regs.iir &= ~0x01;
206136   }
207137   else
208138   {
r14535r14536
210140      state = 0;
211141
212142      /* no ints pending */
213      ins8250->iir |= 0x01;
143      m_regs.iir |= 0x01;
214144      /* priority level */
215      ins8250->iir &= ~(0x04|0x02);
145      m_regs.iir &= ~(0x04|0x02);
216146   }
217147
218148   /* set or clear the int */
219   ins8250->out_intr_func(state);
149   m_out_int_func(state);
220150}
221151
222
223
224152/* set pending bit and trigger int */
225static void ins8250_trigger_int(device_t *device, int flag)
153void ins8250_uart_device::trigger_int(int flag)
226154{
227   ins8250_t   *ins8250 = get_safe_token(device);
228
229   ins8250->int_pending |= flag;
230   ins8250_update_interrupt(device);
155   m_int_pending |= flag;
156   update_interrupt();
231157}
232158
233
234
235159/* clear pending bit, if any ints are pending, then int will be triggered, otherwise it
236160will be cleared */
237static void ins8250_clear_int(device_t *device, int flag)
161void ins8250_uart_device::clear_int(int flag)
238162{
239   ins8250_t   *ins8250 = get_safe_token(device);
163   m_int_pending &= ~flag;
164   update_interrupt();
165}
240166
241   ins8250->int_pending &= ~flag;
242   ins8250_update_interrupt(device);
167void ins8250_uart_device::update_clock()
168{
169   int baud;
170   if(m_regs.dl == 0)
171   {
172      m_timer->adjust(attotime::never);
173      return;
174   }
175   baud = clock()/(m_regs.dl*16);
176   m_timer->adjust(attotime::zero, 0, attotime::from_hz(baud));
243177}
244178
245
246WRITE8_DEVICE_HANDLER( ins8250_w )
179WRITE8_MEMBER( ins8250_uart_device::ins8250_w )
247180{
248    static const char P[] = "NONENHNL";  /* names for parity select */
249   ins8250_t   *ins8250 = get_safe_token(device);
250    int tmp;
181   int tmp;
251182
252183   switch (offset)
253184   {
254185      case 0:
255         if (ins8250->lcr & 0x80)
186         if (m_regs.lcr & 0x80)
256187         {
257            ins8250->dll = data;
258            tmp = ins8250->dlm * 256 + ins8250->dll;
259            COM_LOG(1,"COM_dll_w",("COM \"%s\" $%02x: [$%04x = %d baud]\n", device->tag(),
260                data, tmp, (tmp)?(int)(ins8250->interface->clockin/16/tmp):0));
188            m_regs.dl = (m_regs.dl & 0xff00) | data;
189            update_clock();
261190         }
262191         else
263192         {
264            ins8250->thr = data;
265            COM_LOG(2,"COM_thr_w",("COM $%02x\n", data));
266
267            if ( ins8250->mcr & 0x10 )
193            m_regs.thr = data;
194            m_regs.lsr &= ~0x60;
195            if ( m_regs.mcr & 0x10 )
268196            {
269               ins8250->lsr |= 1;
270               ins8250->rbr = data;
271               ins8250_trigger_int( device, COM_INT_PENDING_RECEIVED_DATA_AVAILABLE );
197               m_regs.lsr |= 1;
198               m_regs.rbr = data;
199               trigger_int(COM_INT_PENDING_RECEIVED_DATA_AVAILABLE);
272200            }
273
274            if ( ins8250->interface->transmit )
275               ins8250->interface->transmit(device, ins8250->thr);
276
277            /* writing to thr will clear the int */
278            ins8250_clear_int(device, COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY);
279201         }
280202         break;
281203      case 1:
282         if (ins8250->lcr & 0x80)
204         if (m_regs.lcr & 0x80)
283205         {
284            ins8250->dlm = data;
285            tmp = ins8250->dlm * 256 + ins8250->dll;
286                COM_LOG(1,"COM_dlm_w",("COM \"%s\" $%02x: [$%04x = %d baud]\n", device->tag(),
287               data, tmp, (tmp)?(int)(ins8250->interface->clockin/16/tmp):0));
206            m_regs.dl = (m_regs.dl & 0xff) | (data << 8);
207            update_clock();
288208         }
289209         else
290210         {
291            ins8250->ier = data;
292            COM_LOG(2,"COM_ier_w",("COM \"%s\" $%02x: enable int on RX %d, THRE %d, RLS %d, MS %d\n", device->tag(),
293               data, data&1, (data>>1)&1, (data>>2)&1, (data>>3)&1));
294            COM_LOG(2,"COM_ier_w",("COM \"%s\" lsr = $%02x, int_pending = $%02x\n", device->tag(), ins8250->lsr, ins8250->int_pending ));
295            ins8250_update_interrupt(device);
211            m_regs.ier = data;
212            update_interrupt();
296213         }
297214            break;
298215      case 2:
299         COM_LOG(1,"COM_fcr_w",("COM \"%s\" $%02x (16550 only)\n", device->tag(), data));
300216            break;
301217      case 3:
302         ins8250->lcr = data;
303         COM_LOG(1,"COM_lcr_w",("COM \"%s\" $%02x word length %d, stop bits %d, parity %c, break %d, DLAB %d\n", device->tag(),
304            data, 5+(data&3), 1+((data>>2)&1), P[(data>>3)&7], (data>>6)&1, (data>>7)&1));
305            break;
218         m_regs.lcr = data;
219         switch ((m_regs.lcr>>3) & 7)
220         {
221         case 1:
222            tmp = SERIAL_PARITY_ODD;
223            break;
224         case 3:
225            tmp = SERIAL_PARITY_EVEN;
226            break;
227         case 5:
228            tmp = SERIAL_PARITY_MARK;
229            break;
230         case 7:
231            tmp = SERIAL_PARITY_SPACE;
232            break;
233         default:
234            tmp = SERIAL_PARITY_NONE;
235            break;
236         }
237         // if 5 data bits and stb = 1, stop bits is supposed to be 1.5
238         set_data_frame((m_regs.lcr & 3) + 5, (m_regs.lcr & 4)?2:1, tmp);
239         break;
306240      case 4:
307         if ( ( ins8250->mcr & 0x1f ) != ( data & 0x1f ) )
241         if ( ( m_regs.mcr & 0x1f ) != ( data & 0x1f ) )
308242         {
309            ins8250->mcr = data & 0x1f;
310            COM_LOG(1,"COM_mcr_w",("COM \"%s\" $%02x DTR %d, RTS %d, OUT1 %d, OUT2 %d, loopback %d\n", device->tag(),
311               data, data&1, (data>>1)&1, (data>>2)&1, (data>>3)&1, (data>>4)&1));
312            if (ins8250->interface->handshake_out)
313               ins8250->interface->handshake_out(device,data);
243            m_regs.mcr = data & 0x1f;
314244
315            if ( ins8250->mcr & 0x10 )      /* loopback test */
245            if ( m_regs.mcr & 0x10 )      /* loopback test */
316246            {
317               data = ( ( ins8250->mcr & 0x0c ) << 4 ) | ( ( ins8250->mcr & 0x01 ) << 5 ) | ( ( ins8250->mcr & 0x02 ) << 3 );
318               if ( ( ins8250->msr & 0x20 ) != ( data & 0x20 ) )
319               {
247               data = ( ( m_regs.mcr & 0x0c ) << 4 ) | ( ( m_regs.mcr & 0x01 ) << 5 ) | ( ( m_regs.mcr & 0x02 ) << 3 );
248               if ( ( m_regs.msr & 0x20 ) != ( data & 0x20 ) )
320249                  data |= 0x02;
321               }
322               if ( ( ins8250->msr & 0x10 ) != ( data & 0x10 ) )
323               {
250               if ( ( m_regs.msr & 0x10 ) != ( data & 0x10 ) )
324251                  data |= 0x01;
325               }
326               if ( ( ins8250->msr & 0x40 ) && ! ( data & 0x40 ) )
327               {
252               if ( ( m_regs.msr & 0x40 ) && ! ( data & 0x40 ) )
328253                  data |= 0x04;
329               }
330               if ( ( ins8250->msr & 0x80 ) != ( data & 0x80 ) )
331               {
254               if ( ( m_regs.msr & 0x80 ) != ( data & 0x80 ) )
332255                  data |= 0x08;
333               }
334               ins8250->msr = data;
256               m_regs.msr = data;
335257            }
258            else
259            {
260               m_out_dtr_func(m_regs.mcr & 1);
261               m_out_rts_func((m_regs.mcr & 2) && 1);
262               m_out_out1_func((m_regs.mcr & 4) && 1);
263               m_out_out2_func((m_regs.mcr & 8) && 1);
264            }
336265         }
337266            break;
338267      case 5:
r14535r14536
341270              bits 5 - 0, you could cause an interrupt if the appropriate IER bit
342271              is set.
343272            */
344         COM_LOG(1,"COM_lsr_w",("COM \"%s\" $%02x\n", device->tag(), data ));
273         m_regs.lsr = data;
345274
346         ins8250->lsr = data;
347
348275         tmp = 0;
349         tmp |= ( ins8250->lsr & 0x01 ) ? COM_INT_PENDING_RECEIVED_DATA_AVAILABLE : 0;
350         tmp |= ( ins8250->lsr & 0x1e ) ? COM_INT_PENDING_RECEIVER_LINE_STATUS : 0;
351         tmp |= ( ins8250->lsr & 0x20 ) ? COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY : 0;
352         ins8250_trigger_int( device, tmp );
276         tmp |= ( m_regs.lsr & 0x01 ) ? COM_INT_PENDING_RECEIVED_DATA_AVAILABLE : 0;
277         tmp |= ( m_regs.lsr & 0x1e ) ? COM_INT_PENDING_RECEIVER_LINE_STATUS : 0;
278         tmp |= ( m_regs.lsr & 0x20 ) ? COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY : 0;
279         trigger_int(tmp);
353280
354281         break;
355282      case 6:
r14535r14536
358285              bits 3 - 0, you could cause an interrupt if the appropriate IER bit
359286              is set.
360287             */
361         COM_LOG(1,"COM_msr_w",("COM \"%s\" $%02x\n", device->tag(), data ));
288         m_regs.msr = data;
362289
363         ins8250->msr = data;
364
365         if ( ins8250->msr & 0x0f )
366         {
367            ins8250_trigger_int( device, COM_INT_PENDING_MODEM_STATUS_REGISTER );
368         }
290         if ( m_regs.msr & 0x0f )
291            trigger_int(COM_INT_PENDING_MODEM_STATUS_REGISTER);
369292         break;
370293      case 7:
371         ins8250->scr = data;
372         COM_LOG(2,"COM_scr_w",("COM \"%s\" $%02x\n", device->tag(), data));
294         m_regs.scr = data;
373295            break;
374296   }
375
376   if (ins8250->interface->refresh_connected)
377      ins8250->interface->refresh_connected(device);
378297}
379298
380
381
382READ8_DEVICE_HANDLER( ins8250_r )
299READ8_MEMBER( ins8250_uart_device::ins8250_r )
383300{
384   ins8250_t   *ins8250 = get_safe_token(device);
385301   int data = 0x0ff;
386302
387303   switch (offset)
388304   {
389305      case 0:
390         if (ins8250->lcr & 0x80)
391         {
392            data = ins8250->dll;
393            COM_LOG(1,"COM_dll_r",("COM \"%s\" $%02x\n", device->tag(), data));
394         }
306         if (m_regs.lcr & 0x80)
307            data = (m_regs.dl & 0xff);
395308         else
396309         {
397            data = ins8250->rbr;
398            if( ins8250->lsr & 0x01 )
399            {
400               ins8250->lsr &= ~0x01;      /* clear data ready status */
401               COM_LOG(2,"COM_rbr_r",("COM \"%s\" $%02x\n", device->tag(), data));
402            }
310            data = m_regs.rbr;
311            if( m_regs.lsr & 0x01 )
312               m_regs.lsr &= ~0x01;      /* clear data ready status */
403313
404            ins8250_clear_int(device, COM_INT_PENDING_RECEIVED_DATA_AVAILABLE);
314            clear_int(COM_INT_PENDING_RECEIVED_DATA_AVAILABLE);
405315         }
406316         break;
407317      case 1:
408         if (ins8250->lcr & 0x80)
409         {
410            data = ins8250->dlm;
411            COM_LOG(1,"COM_dlm_r",("COM \"%s\" $%02x\n", device->tag(), data));
412         }
318         if (m_regs.lcr & 0x80)
319            data = (m_regs.dl >> 8);
413320         else
414         {
415            data = ins8250->ier & 0x0f;
416            COM_LOG(2,"COM_ier_r",("COM \"%s\" $%02x\n", device->tag(), data));
417            }
321            data = m_regs.ier & 0x0f;
418322            break;
419323      case 2:
420         data = ins8250->iir;
421         COM_LOG(2,"COM_iir_r",("COM \"%s\" $%02x\n", device->tag(), data));
324         data = m_regs.iir;
422325         /* The documentation says that reading this register will
423326            clear the int if this is the source of the int */
424         if ( ins8250->ier & COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY )
425         {
426            ins8250_clear_int(device, COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY);
427         }
327         if ( m_regs.ier & COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY )
328            clear_int(COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY);
428329            break;
429330      case 3:
430         data = ins8250->lcr;
431         COM_LOG(2,"COM_lcr_r",("COM \"%s\" $%02x\n", device->tag(), data));
331         data = m_regs.lcr;
432332            break;
433333      case 4:
434         data = ins8250->mcr;
435         COM_LOG(2,"COM_mcr_r",("COM \"%s\" $%02x\n", device->tag(), data));
334         data = m_regs.mcr;
436335            break;
437336      case 5:
337         data = m_regs.lsr;
338         if( m_regs.lsr & 0x1f )
339            m_regs.lsr &= 0xe1; /* clear FE, PE and OE and BREAK bits */
438340
439#if 0
440         if (ins8250->send.active && (machine.time()-ins8250->send.time>uart_byte_time(n)))
441         {
442            // currently polling is enough for pc1512
443            ins8250->lsr |= 0x40; /* set TSRE */
444            ins8250->send.active = 0;
445            if ( ins8250->mcr & 0x10 )
446            {
447               ins8250->lsr |= 1;
448               ins8250->rbr = ins8250->send.data;
449            }
450         }
451#endif
452         ins8250->lsr |= 0x60; /* set THRE */
453         data = ins8250->lsr;
454         if( ins8250->lsr & 0x1f )
455         {
456            ins8250->lsr &= 0xe1; /* clear FE, PE and OE and BREAK bits */
457            COM_LOG(2,"COM_lsr_r",("COM \"%s\" $%02x, DR %d, OE %d, PE %d, FE %d, BREAK %d, THRE %d, TSRE %d\n", device->tag(),
458               data, data&1, (data>>1)&1, (data>>2)&1, (data>>3)&1, (data>>4)&1, (data>>5)&1, (data>>6)&1));
459         }
460
461341         /* reading line status register clears int */
462         ins8250_clear_int(device, COM_INT_PENDING_RECEIVER_LINE_STATUS);
342         clear_int(COM_INT_PENDING_RECEIVER_LINE_STATUS);
463343            break;
464344      case 6:
465         data = ins8250->msr;
466         ins8250->msr &= 0xf0; /* reset delta values */
467         COM_LOG(2,"COM_msr_r",("COM \"%s\" $%02x\n", device->tag(), data));
345         data = m_regs.msr;
346         m_regs.msr &= 0xf0; /* reset delta values */
468347
469348         /* reading msr clears int */
470         ins8250_clear_int(device, COM_INT_PENDING_MODEM_STATUS_REGISTER);
349         clear_int(COM_INT_PENDING_MODEM_STATUS_REGISTER);
471350
472351         break;
473352      case 7:
474         data = ins8250->scr;
475         COM_LOG(2,"COM_scr_r",("COM \"%s\" $%02x\n", device->tag(), data));
353         data = m_regs.scr;
476354            break;
477355   }
478
479   if (ins8250->interface->refresh_connected)
480      ins8250->interface->refresh_connected(device);
481
482356    return data;
483357}
484358
485
486
487void ins8250_receive(device_t *device, int data)
359void ins8250_uart_device::update_msr(int bit, UINT8 state)
488360{
489   ins8250_t   *ins8250 = get_safe_token(device);
490
491    /* check if data rate 1200 baud is set */
492   if( ins8250->dlm != 0x00 || ins8250->dll != 0x60 )
493        ins8250->lsr |= 0x08; /* set framing error */
494
495    /* if data not yet serviced */
496   if( ins8250->lsr & 0x01 )
497      ins8250->lsr |= 0x02; /* set overrun error */
498
499    /* put data into receiver buffer register */
500    ins8250->rbr = data;
501
502    /* set data ready status */
503    ins8250->lsr |= 0x01;
504
505   /* set pending state for this interrupt. */
506   ins8250_trigger_int(device, COM_INT_PENDING_RECEIVED_DATA_AVAILABLE);
507
508
509//  /* OUT2 + received line data avail interrupt enabled? */
510//  if( (COM_mcr[n] & 0x08) && (COM_ier[n] & 0x01) )
511//  {
512//      if (com_interface.interrupt)
513//          com_interface.interrupt(4-(n&1), 1);
514//
515//  }
516}
517
518/**************************************************************************
519 *  change the modem status register
520 **************************************************************************/
521void ins8250_handshake_in(device_t *device, int new_msr)
522{
523   ins8250_t   *ins8250 = get_safe_token(device);
524
525   /* no change in modem status bits? */
526   if( ((ins8250->msr ^ new_msr) & 0xf0) == 0 )
361   UINT8 mask = (1<<bit);
362   if((m_regs.msr & mask) == (state<<bit))
527363      return;
528
529   /* set delta status bits 0..3 and new modem status bits 4..7 */
530    ins8250->msr = (((ins8250->msr ^ new_msr) >> 4) & 0x0f) | (new_msr & 0xf0);
531
532   ins8250_trigger_int(device, COM_INT_PENDING_MODEM_STATUS_REGISTER);
533
534//  /* set up interrupt information register */
535  //  COM_iir[n] &= ~(0x06 | 0x01);
536
537//    /* OUT2 + modem status interrupt enabled? */
538//  if( (COM_mcr[n] & 0x08) && (COM_ier[n] & 0x08) )
539//  {
540//      if (com_interface.interrupt)
541//          com_interface.interrupt(4-(n&1), 1);
542//  }
364   m_regs.msr = (m_regs.msr & ~mask) | (mask & (state<<bit));
365   m_regs.msr = (m_regs.msr & ~(mask << 4)) | (1<<(bit+4));
366   trigger_int(COM_INT_PENDING_MODEM_STATUS_REGISTER);
543367}
544368
545
546static void common_start( device_t *device, int device_type )
369WRITE_LINE_MEMBER(ins8250_uart_device::dcd_w)
547370{
548   ins8250_t   *ins8250 = get_safe_token(device);
549
550   ins8250->interface = (const ins8250_interface*)device->static_config();
551   ins8250->device_type = device_type;
552
553   ins8250->out_intr_func.resolve(ins8250->interface->out_intr_cb, *device);
371   update_msr(3, (state&&1));
554372}
555373
556
557static DEVICE_START( ins8250 )
374WRITE_LINE_MEMBER(ins8250_uart_device::dsr_w)
558375{
559   common_start( device, TYPE_INS8250 );
376   update_msr(1, (state&&1));
560377}
561378
562
563static DEVICE_START( ins8250a )
379WRITE_LINE_MEMBER(ins8250_uart_device::ri_w)
564380{
565   common_start( device, TYPE_INS8250A );
381   update_msr(2, (state&&1));
566382}
567383
568
569static DEVICE_START( ns16450 )
384WRITE_LINE_MEMBER(ins8250_uart_device::cts_w)
570385{
571   common_start( device, TYPE_NS16450 );
386   update_msr(0, (state&&1));
572387}
573388
574
575static DEVICE_START( ns16550 )
389void ins8250_uart_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
576390{
577   common_start( device, TYPE_NS16550 );
578}
579
580
581static DEVICE_START( ns16550a )
582{
583   common_start( device, TYPE_NS16550A );
584}
585
586
587static DEVICE_START( pc16550d )
588{
589   common_start( device, TYPE_PC16550D );
590}
591
592
593static DEVICE_RESET( ins8250 )
594{
595   ins8250_t   *ins8250 = get_safe_token(device);
596
597   ins8250->ier = 0;
598   ins8250->iir = 1;
599   ins8250->lcr = 0;
600   ins8250->mcr = 0;
601   ins8250->lsr = (1<<5) | (1<<6);
602
603   ins8250->send.active=0;
604
605   /* refresh with reset state of register */
606   if (ins8250->interface->refresh_connected)
607      ins8250->interface->refresh_connected(device);
608}
609
610
611DEVICE_GET_INFO( ins8250 )
612{
613   switch ( state )
391   receive_register_update_bit(m_rx_line);
392   if(is_receive_register_full())
614393   {
615      /* --- the following bits of info are returned as 64-bit signed integers --- */
616      case DEVINFO_INT_TOKEN_BYTES:            info->i = sizeof(ins8250_t);            break;
617      case DEVINFO_INT_INLINE_CONFIG_BYTES:      info->i = 0;                        break;
618
619      /* --- the following bits of info are returned as pointers to data or functions --- */
620      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(ins8250);   break;
621      case DEVINFO_FCT_STOP:                  /* nothing */                        break;
622      case DEVINFO_FCT_RESET:                  info->reset = DEVICE_RESET_NAME(ins8250);   break;
623
624      /* --- the following bits of info are returned as NULL-terminated strings --- */
625      case DEVINFO_STR_NAME:                  strcpy(info->s, "National Semiconductor INS8250/INS8250B");   break;
626      case DEVINFO_STR_FAMILY:               strcpy(info->s, "INS8250");               break;
627      case DEVINFO_STR_VERSION:               strcpy(info->s, "1.00");               break;
628      case DEVINFO_STR_SOURCE_FILE:            strcpy(info->s, __FILE__);               break;
629      case DEVINFO_STR_CREDITS:               strcpy(info->s, "Copyright the MESS Team");   break;
394      if(m_regs.lsr & 0x01)
395      {
396         m_regs.lsr |= 0x02; //overrun
397         trigger_int(COM_INT_PENDING_RECEIVER_LINE_STATUS);
398      }
399      else
400      {
401         m_regs.lsr |= 0x01;
402         receive_register_extract();
403         m_regs.rbr = get_received_char();
404         trigger_int(COM_INT_PENDING_RECEIVED_DATA_AVAILABLE);
405      }
406      receive_register_reset();
630407   }
631}
632408
633
634DEVICE_GET_INFO( ins8250a )
635{
636   switch ( state )
409   if(is_transmit_register_empty())
637410   {
638      /* --- the following bits of info are returned as 64-bit signed integers --- */
639      case DEVINFO_STR_NAME:                  strcpy(info->s, "National Semiconductor INS8250A/INS82C50A");   break;
640
641      /* --- the following bits of info are returned as pointers to data or functions --- */
642      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(ins8250a);   break;
643
644      default:                           DEVICE_GET_INFO_CALL(ins8250);            break;
411      if(!(m_regs.lsr & 0x20))
412      {
413         transmit_register_setup(m_regs.thr);
414         m_regs.lsr &= ~0x40;
415         m_regs.lsr |= 0x20;
416         trigger_int(COM_INT_PENDING_TRANSMITTER_HOLDING_REGISTER_EMPTY);
417      }
418      else
419         m_regs.lsr |= 0x40;
645420   }
421   else
422      m_out_tx_func(transmit_register_get_data_bit());
646423}
647424
648
649DEVICE_GET_INFO( ns16450 )
425void ins8250_uart_device::device_start()
650426{
651   switch ( state )
652   {
653      /* --- the following bits of info are returned as 64-bit signed integers --- */
654      case DEVINFO_STR_NAME:                  strcpy(info->s, "National Semiconductor NS16450/PC16450");   break;
427   m_out_tx_func.resolve(m_out_tx_cb, *this);
428   m_out_dtr_func.resolve(m_out_dtr_cb, *this);
429   m_out_rts_func.resolve(m_out_rts_cb, *this);
430   m_out_int_func.resolve(m_out_int_cb, *this);
431   m_out_out1_func.resolve(m_out_out1_cb, *this);
432   m_out_out2_func.resolve(m_out_out2_cb, *this);
655433
656      /* --- the following bits of info are returned as pointers to data or functions --- */
657      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(ns16450);   break;
658
659      default:                           DEVICE_GET_INFO_CALL(ins8250);            break;
660   }
434   m_timer = timer_alloc();
661435}
662436
663
664DEVICE_GET_INFO( ns16550 )
437void ins8250_uart_device::device_reset()
665438{
666   switch ( state )
667   {
668      /* --- the following bits of info are returned as 64-bit signed integers --- */
669      case DEVINFO_STR_NAME:                  strcpy(info->s, "National Semiconductor NS16550/PC16550");   break;
670
671      /* --- the following bits of info are returned as pointers to data or functions --- */
672      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(ns16550);   break;
673
674      default:                           DEVICE_GET_INFO_CALL(ins8250);            break;
675   }
439   memset(&m_regs, '\0', sizeof(m_regs));
440   m_regs.ier = 0;
441   m_regs.iir = 1;
442   m_regs.lcr = 0;
443   m_regs.mcr = 0;
444   m_regs.lsr = (1<<5) | (1<<6);
445   m_int_pending = 0;
446   m_rx_line = 0;
447   m_timer->adjust(attotime::never);
448   receive_register_reset();
449   transmit_register_reset();
450   m_out_rts_func(0);
451   m_out_dtr_func(0);
452   m_out_out1_func(0);
453   m_out_out2_func(0);
676454}
677455
678
679DEVICE_GET_INFO( ns16550a )
456void ins8250_uart_device::device_config_complete()
680457{
681   switch ( state )
458   const ins8250_interface *intf = reinterpret_cast<const ins8250_interface *>(static_config());
459   if(intf != NULL)
682460   {
683      /* --- the following bits of info are returned as 64-bit signed integers --- */
684      case DEVINFO_STR_NAME:                  strcpy(info->s, "National Semiconductor NS16550A/PC16550A");   break;
685
686      /* --- the following bits of info are returned as pointers to data or functions --- */
687      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(ns16550a);   break;
688
689      default:                           DEVICE_GET_INFO_CALL(ins8250);            break;
461      *static_cast<ins8250_interface *>(this) = *intf;
690462   }
691}
692
693
694DEVICE_GET_INFO( pc16550d )
695{
696   switch ( state )
463   else
697464   {
698      /* --- the following bits of info are returned as 64-bit signed integers --- */
699      case DEVINFO_STR_NAME:                  strcpy(info->s, "National Semiconductor PC16550D");   break;
700
701      /* --- the following bits of info are returned as pointers to data or functions --- */
702      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(pc16550d);   break;
703
704      default:                           DEVICE_GET_INFO_CALL(ins8250);            break;
465      memset(&m_out_tx_cb, 0, sizeof(m_out_tx_cb));
466      memset(&m_out_dtr_cb, 0, sizeof(m_out_dtr_cb));
467      memset(&m_out_rts_cb, 0, sizeof(m_out_rts_cb));
468      memset(&m_out_int_cb, 0, sizeof(m_out_int_cb));
469      memset(&m_out_out1_cb, 0, sizeof(m_out_out1_cb));
470      memset(&m_out_out2_cb, 0, sizeof(m_out_out2_cb));
705471   }
706472}
707
708
709
710DEFINE_LEGACY_DEVICE(INS8250, ins8250);
711DEFINE_LEGACY_DEVICE(INS8250A, ins8250a);
712DEFINE_LEGACY_DEVICE(NS16450, ns16450);
713DEFINE_LEGACY_DEVICE(NS16550, ns16550);
714DEFINE_LEGACY_DEVICE(NS16550A, ns16550a);
715DEFINE_LEGACY_DEVICE(PC16550D, pc16550d);
src/emu/machine/ins8250.h
r14535r14536
77#ifndef __INS8250_H_
88#define __INS8250_H_
99
10#include "devlegcy.h"
10#include "emu.h"
1111
12DECLARE_LEGACY_DEVICE(INS8250, ins8250);
13DECLARE_LEGACY_DEVICE(INS8250A, ins8250a);
14DECLARE_LEGACY_DEVICE(NS16450, ns16450);
15DECLARE_LEGACY_DEVICE(NS16550, ns16550);
16DECLARE_LEGACY_DEVICE(NS16550A, ns16550a);
17DECLARE_LEGACY_DEVICE(PC16550D, pc16550d);
12/***************************************************************************
13    CLASS DEFINITIONS
14***************************************************************************/
15struct ins8250_interface
16{
17   devcb_write_line   m_out_tx_cb;
18   devcb_write_line   m_out_dtr_cb;
19   devcb_write_line   m_out_rts_cb;
20   devcb_write_line   m_out_int_cb;
21   devcb_write_line   m_out_out1_cb;
22   devcb_write_line   m_out_out2_cb;
23};
1824
19#define UART8250_HANDSHAKE_OUT_DTR            0x01
20#define UART8250_HANDSHAKE_OUT_RTS            0x02
25class ins8250_uart_device : public device_t,
26                     public device_serial_interface,
27                     public ins8250_interface
28{
29public:
30   ins8250_uart_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock);
31   DECLARE_WRITE8_MEMBER( ins8250_w );
32   DECLARE_READ8_MEMBER( ins8250_r );
33   DECLARE_WRITE_LINE_MEMBER( dcd_w );
34   DECLARE_WRITE_LINE_MEMBER( dsr_w );
35   DECLARE_WRITE_LINE_MEMBER( ri_w );
36   DECLARE_WRITE_LINE_MEMBER( cts_w );
37   DECLARE_WRITE_LINE_MEMBER( rx_w ) { m_rx_line = state; }
38   void input_callback(UINT8 state) { m_input_state = state; }
2139
22#define UART8250_HANDSHAKE_IN_DSR            0x020
23#define UART8250_HANDSHAKE_IN_CTS            0x010
24#define UART8250_INPUTS_RING_INDICATOR         0x0040
25#define UART8250_INPUTS_DATA_CARRIER_DETECT      0x0080
40protected:
41   virtual void device_start();
42   virtual void device_config_complete();
43   virtual void device_reset();
44   enum {
45         TYPE_INS8250 = 0,
46         TYPE_INS8250A,
47         TYPE_NS16450,
48         TYPE_NS16550,
49         TYPE_NS16550A,
50         TYPE_PC16550D,
51   };
52   int   m_device_type;
53private:
54   struct {
55      UINT8 thr;  /* 0 -W transmitter holding register */
56      UINT8 rbr;  /* 0 R- receiver buffer register */
57      UINT8 ier;  /* 1 RW interrupt enable register */
58      UINT16 dl;  /* 0/1 RW divisor latch (if DLAB = 1) */
59      UINT8 iir;  /* 2 R- interrupt identification register */
60      UINT8 lcr;  /* 3 RW line control register (bit 7: DLAB) */
61      UINT8 mcr;  /* 4 RW modem control register */
62      UINT8 lsr;  /* 5 R- line status register */
63      UINT8 msr;  /* 6 R- modem status register */
64      UINT8 scr;  /* 7 RW scratch register */
65   } m_regs;
66   UINT8 m_int_pending;
67   UINT8 m_rx_line;
2668
69   devcb_resolved_write_line   m_out_tx_func;
70   devcb_resolved_write_line   m_out_dtr_func;
71   devcb_resolved_write_line   m_out_rts_func;
72   devcb_resolved_write_line   m_out_int_func;
73   devcb_resolved_write_line   m_out_out1_func;
74   devcb_resolved_write_line   m_out_out2_func;
2775
28/***************************************************************************
29    TYPE DEFINITIONS
30***************************************************************************/
76   void update_interrupt();
77   void update_clock();
78   void trigger_int(int flag);
79   void clear_int(int flag);
80   void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
81   void update_msr(int bit, UINT8 state);
3182
32typedef void (*ins8250_transmit_func)(device_t *device, int data);
33typedef void (*ins8250_handshake_out_func)(device_t *device, int data);
34typedef void (*ins8250_refresh_connect_func)(device_t *device);
83   emu_timer *m_timer;
84};
3585
36#define INS8250_TRANSMIT(name)         void name(device_t *device, int data)
37#define INS8250_HANDSHAKE_OUT(name)      void name(device_t *device, int data)
38#define INS8250_REFRESH_CONNECT(name)   void name(device_t *device)
86class ins8250_device : public ins8250_uart_device
87{
88public:
89   ins8250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
90};
3991
40typedef struct
92class ns16450_device : public ins8250_uart_device
4193{
42   long clockin;
43   devcb_write_line            out_intr_cb;
94public:
95   ns16450_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
96};
4497
45   ins8250_transmit_func         transmit;
46   ins8250_handshake_out_func      handshake_out;
98class ns16550_device : public ins8250_uart_device
99{
100public:
101   ns16550_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
102};
47103
48   // refresh object connected to this port
49   ins8250_refresh_connect_func   refresh_connected;
50} ins8250_interface;
104extern const device_type INS8250;
105extern const device_type NS16450;
106extern const device_type NS16550;
51107
52
53108/***************************************************************************
54109    DEVICE CONFIGURATION MACROS
55110***************************************************************************/
56111
57#define MCFG_INS8250_ADD(_tag, _intrf) \
58   MCFG_DEVICE_ADD(_tag, INS8250, 0) \
112#define MCFG_INS8250_ADD(_tag, _intrf, _clock) \
113   MCFG_DEVICE_ADD(_tag, INS8250, _clock) \
59114   MCFG_DEVICE_CONFIG(_intrf)
60115
61116
62#define MCFG_NS16450_ADD(_tag, _intrf) \
63   MCFG_DEVICE_ADD(_tag, NS16450, 0) \
117#define MCFG_NS16450_ADD(_tag, _intrf, _clock) \
118   MCFG_DEVICE_ADD(_tag, NS16450, _clock) \
64119   MCFG_DEVICE_CONFIG(_intrf)
65120
66121
67#define MCFG_NS16550_ADD(_tag, _intrf) \
68   MCFG_DEVICE_ADD(_tag, NS16550, 0) \
122#define MCFG_NS16550_ADD(_tag, _intrf, _clock) \
123   MCFG_DEVICE_ADD(_tag, NS16550, _clock) \
69124   MCFG_DEVICE_CONFIG(_intrf)
70125
71
72/***************************************************************************
73    FUNCTION PROTOTYPES
74***************************************************************************/
75
76void ins8250_receive(device_t *device, int data);
77void ins8250_handshake_in(device_t *device, int new_msr);
78
79READ8_DEVICE_HANDLER( ins8250_r );
80WRITE8_DEVICE_HANDLER( ins8250_w );
81
82
83#endif /* __INS8250_H_ */
126#endif
src/emu/machine/microtch.c
r14535r14536
99
1010*/
1111
12#include "emu.h"
1312#include "microtch.h"
1413
1514#define LOG 0
1615
17enum MICROTOUCH_FORMAT
18{
19   FORMAT_UNKNOWN,
20   FORMAT_TABLET,
21   FORMAT_DECIMAL
22};
16const device_type MICROTOUCH = &device_creator<microtouch_device>;
2317
24ALLOW_SAVE_TYPE(MICROTOUCH_FORMAT);
25
26enum MICROTOUCH_MODE
18microtouch_device::microtouch_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock)
19   : device_t(mconfig, type, name, tag, owner, clock)
2720{
28   MODE_INACTIVE,
29   MODE_STREAM,
30   MODE_POINT
31};
21}
3222
33ALLOW_SAVE_TYPE(MICROTOUCH_MODE);
34
35static struct
23microtouch_device::microtouch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
24   : device_t(mconfig, MICROTOUCH, "Microtouch Touchscreen", tag, owner, clock)
3625{
37   UINT8      rx_buffer[16];
38   int         rx_buffer_ptr;
39   emu_timer*   timer;
40   UINT8      tx_buffer[16];
41   UINT8      tx_buffer_num;
42   UINT8      tx_buffer_ptr;
43   int         reset_done;
44   MICROTOUCH_FORMAT   format;
45   MICROTOUCH_MODE      mode;
46   int         last_touch_state;
47   int         last_x;
48   int         last_y;
49   microtouch_tx_func   tx_callback;
50   microtouch_touch_func   touch_callback;
51} microtouch;
26}
5227
53
54static int microtouch_check_command( const char* commandtocheck, int command_len, UINT8* command_data )
28int microtouch_device::check_command( const char* commandtocheck, int command_len, UINT8* command_data )
5529{
5630   if ( (command_len == (strlen(commandtocheck) + 2)) &&
5731       (command_data[0] == 0x01) &&
r14535r14536
6640   }
6741}
6842
69static void microtouch_send_format_table_packet(UINT8 flag, int x, int y)
43void microtouch_device::send_format_table_packet(UINT8 flag, int x, int y)
7044{
71   microtouch.tx_buffer[microtouch.tx_buffer_num++] = flag;
45   m_tx_buffer[m_tx_buffer_num++] = flag;
7246   // lower byte (7bits) of x coordinate
73   microtouch.tx_buffer[microtouch.tx_buffer_num++] = x & 0x7f;
47   m_tx_buffer[m_tx_buffer_num++] = x & 0x7f;
7448   // higher byte (7bits) of x coordinate
75   microtouch.tx_buffer[microtouch.tx_buffer_num++] = (x >> 7) & 0x7f;
49   m_tx_buffer[m_tx_buffer_num++] = (x >> 7) & 0x7f;
7650   // lower byte (7bits) of y coordinate
77   microtouch.tx_buffer[microtouch.tx_buffer_num++] = y & 0x7f;
51   m_tx_buffer[m_tx_buffer_num++] = y & 0x7f;
7852   // higher byte (7bits) of y coordinate
79   microtouch.tx_buffer[microtouch.tx_buffer_num++] = (y >> 7) & 0x7f;
80};
53   m_tx_buffer[m_tx_buffer_num++] = (y >> 7) & 0x7f;
54}
8155
82static void microtouch_send_format_decimal_packet(int x, int y)
56void microtouch_device::send_format_decimal_packet(int x, int y)
8357{
8458   int decx, decy;
8559
r14535r14536
9165      decy = 999;
9266
9367   // header byte
94   microtouch.tx_buffer[microtouch.tx_buffer_num++] = 0x01;
68   m_tx_buffer[m_tx_buffer_num++] = 0x01;
9569   // x coordinate in decimal mode
96   microtouch.tx_buffer[microtouch.tx_buffer_num++] = (decx / 100) + '0';
97   microtouch.tx_buffer[microtouch.tx_buffer_num++] = ((decx / 10) % 10) + '0';
98   microtouch.tx_buffer[microtouch.tx_buffer_num++] = (decx % 10) + '0';
70   m_tx_buffer[m_tx_buffer_num++] = (decx / 100) + '0';
71   m_tx_buffer[m_tx_buffer_num++] = ((decx / 10) % 10) + '0';
72   m_tx_buffer[m_tx_buffer_num++] = (decx % 10) + '0';
9973   // comma (separator)
100   microtouch.tx_buffer[microtouch.tx_buffer_num++] = ',';
74   m_tx_buffer[m_tx_buffer_num++] = ',';
10175   // y coordinate in decimal mode
102   microtouch.tx_buffer[microtouch.tx_buffer_num++] = (decy / 100) + '0';
103   microtouch.tx_buffer[microtouch.tx_buffer_num++] = ((decy / 10) % 10) + '0';
104   microtouch.tx_buffer[microtouch.tx_buffer_num++] = (decy % 10) + '0';
76   m_tx_buffer[m_tx_buffer_num++] = (decy / 100) + '0';
77   m_tx_buffer[m_tx_buffer_num++] = ((decy / 10) % 10) + '0';
78   m_tx_buffer[m_tx_buffer_num++] = (decy % 10) + '0';
10579   // terminator
106   microtouch.tx_buffer[microtouch.tx_buffer_num++] = 0x0d;
80   m_tx_buffer[m_tx_buffer_num++] = 0x0d;
10781}
10882
109static void microtouch_send_touch_packet(running_machine &machine)
83void microtouch_device::send_touch_packet()
11084{
111   int tx = input_port_read(machine, "TOUCH_X");
112   int ty = input_port_read(machine, "TOUCH_Y");
85   int tx = input_port_read(*this, "TOUCH_X");
86   int ty = input_port_read(*this, "TOUCH_Y");
11387
114   if ( microtouch.touch_callback == NULL ||
115       microtouch.touch_callback( machine, &tx, &ty ) != 0 )
88   if ( m_out_touch_cb == NULL ||
89       m_out_touch_cb( &tx, &ty ) != 0 )
11690   {
11791      ty = 0x4000 - ty;
11892
119      switch( microtouch.format )
93      switch( m_format )
12094      {
12195         case FORMAT_TABLET:
122            microtouch_send_format_table_packet(0xc8, tx, ty);
96            send_format_table_packet(0xc8, tx, ty);
12397            break;
12498         case FORMAT_DECIMAL:
125            microtouch_send_format_decimal_packet(tx, ty);
99            send_format_decimal_packet(tx, ty);
126100            break;
127101         case FORMAT_UNKNOWN:
128102            break;
129103      }
130      microtouch.last_touch_state = 1;
131      microtouch.last_x = tx;
132      microtouch.last_y = ty;
104      m_last_touch_state = 1;
105      m_last_x = tx;
106      m_last_y = ty;
133107   }
134108}
135109
136static TIMER_CALLBACK(microtouch_timer_callback)
110void microtouch_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
137111{
138   if ( microtouch.tx_buffer_ptr < microtouch.tx_buffer_num )
112   if ( m_tx_buffer_ptr < m_tx_buffer_num )
139113   {
140      microtouch.tx_callback( machine, microtouch.tx_buffer[microtouch.tx_buffer_ptr++] );
141      if ( microtouch.tx_buffer_ptr == microtouch.tx_buffer_num )
114      tx( m_tx_buffer[m_tx_buffer_ptr++] );
115      if ( m_tx_buffer_ptr == m_tx_buffer_num )
142116      {
143         microtouch.tx_buffer_ptr = microtouch.tx_buffer_num = 0;
117         m_tx_buffer_ptr = m_tx_buffer_num = 0;
144118      }
145119      return;
146120   }
147121
148   if ( (microtouch.reset_done == 0) ||
149       (microtouch.format == FORMAT_UNKNOWN) ||
150       (microtouch.mode != MODE_STREAM))
122   if ( (m_reset_done == 0) ||
123       (m_format == FORMAT_UNKNOWN) ||
124       (m_mode != MODE_STREAM))
151125   {
152126      return;
153127   }
154128
155129   // send format tablet packet
156   if ( input_port_read(machine, "TOUCH") & 0x01 )
130   if ( input_port_read(*this, "TOUCH") & 0x01 )
157131   {
158      microtouch_send_touch_packet(machine);
132      send_touch_packet();
159133   }
160134   else
161135   {
162      if ( microtouch.last_touch_state == 1 )
136      if ( m_last_touch_state == 1 )
163137      {
164         microtouch.last_touch_state = 0;
165         switch( microtouch.format )
138         m_last_touch_state = 0;
139         switch( m_format )
166140         {
167141            case FORMAT_TABLET:
168               microtouch_send_format_table_packet(0x88, microtouch.last_x, microtouch.last_y);
142               send_format_table_packet(0x88, m_last_x, m_last_y);
169143               break;
170144            case FORMAT_DECIMAL:
171               microtouch_send_format_decimal_packet(microtouch.last_x, microtouch.last_y);
145               send_format_decimal_packet(m_last_x, m_last_y);
172146               break;
173147            case FORMAT_UNKNOWN:
174148               break;
175149         }
176150      }
177151   }
178};
152}
179153
180void microtouch_init(running_machine &machine, microtouch_tx_func tx_cb, microtouch_touch_func touch_cb)
154void microtouch_device::device_config_complete()
181155{
182   memset(&microtouch, 0, sizeof(microtouch));
156   const microtouch_interface *intf = reinterpret_cast<const microtouch_interface *>(static_config());
157   if(intf != NULL)
158      *static_cast<microtouch_interface *>(this) = *intf;
159   else
160   {
161      memset(&m_out_tx_cb, 0, sizeof(m_out_tx_cb));
162      memset(&m_out_touch_cb, 0, sizeof(m_out_touch_cb));
163   }
164}
183165
184   microtouch.last_touch_state = -1;
185   microtouch.tx_callback = tx_cb;
186   microtouch.touch_callback = touch_cb;
166void microtouch_device::device_start()
167{
168   memset(m_rx_buffer, 0, sizeof(m_rx_buffer));
169   memset(m_tx_buffer, 0, sizeof(m_tx_buffer));
170   m_rx_buffer_ptr = 0;
171   m_tx_buffer_ptr = 0;
172   m_tx_buffer_num = 0;
173   m_reset_done = 0;
174   m_format = 0;
175   m_mode = 0;
176   m_last_x = 0;
177   m_last_y = 0;
178   m_last_touch_state = -1;
187179
188   microtouch.timer = machine.scheduler().timer_alloc(FUNC(microtouch_timer_callback));
189   microtouch.timer->adjust(attotime::from_hz(167*5), 0, attotime::from_hz(167*5));
180   m_timer = timer_alloc();
181   m_timer->adjust(attotime::from_hz(167*5), 0, attotime::from_hz(167*5));
190182
191   microtouch.format = FORMAT_UNKNOWN;
192   microtouch.mode = MODE_INACTIVE;
183   m_format = FORMAT_UNKNOWN;
184   m_mode = MODE_INACTIVE;
193185
194   state_save_register_item(machine, "microtouch", NULL, 0, microtouch.reset_done);
195   state_save_register_item(machine, "microtouch", NULL, 0, microtouch.last_touch_state);
196   state_save_register_item(machine, "microtouch", NULL, 0, microtouch.last_x);
197   state_save_register_item(machine, "microtouch", NULL, 0, microtouch.last_y);
198   state_save_register_item_array(machine, "microtouch", NULL, 0, microtouch.rx_buffer);
199   state_save_register_item(machine, "microtouch", NULL, 0, microtouch.rx_buffer_ptr);
200   state_save_register_item_array(machine, "microtouch", NULL, 0, microtouch.tx_buffer);
201   state_save_register_item(machine, "microtouch", NULL, 0, microtouch.tx_buffer_num);
202   state_save_register_item(machine, "microtouch", NULL, 0, microtouch.tx_buffer_ptr);
203   state_save_register_item(machine, "microtouch", NULL, 0, microtouch.format);
204   state_save_register_item(machine, "microtouch", NULL, 0, microtouch.mode);
205};
186   save_item(NAME(m_reset_done));
187   save_item(NAME(m_last_touch_state));
188   save_item(NAME(m_last_x));
189   save_item(NAME(m_last_y));
190   save_item(NAME(m_rx_buffer));
191   save_item(NAME(m_rx_buffer_ptr));
192   save_item(NAME(m_tx_buffer));
193   save_item(NAME(m_tx_buffer_num));
194   save_item(NAME(m_tx_buffer_ptr));
195   save_item(NAME(m_format));
196   save_item(NAME(m_mode));
197   m_out_tx_func.resolve(m_out_tx_cb, *this);
198}
206199
207200
208void microtouch_rx(int count, UINT8* data)
201WRITE8_MEMBER(microtouch_device::rx)
209202{
210   int i;
203   m_rx_buffer[m_rx_buffer_ptr] = data;
204   m_rx_buffer_ptr++;
205   if(m_rx_buffer_ptr == 16)
206      return;
211207
212   for ( i = 0; (i < count) && ((microtouch.rx_buffer_ptr + i) < 16); i++ )
208   if (m_rx_buffer_ptr > 0 && (m_rx_buffer[m_rx_buffer_ptr-1] == 0x0d))
213209   {
214      microtouch.rx_buffer[i+microtouch.rx_buffer_ptr] = data[i];
215      microtouch.rx_buffer_ptr++;
216   }
217
218   if (microtouch.rx_buffer_ptr > 0 && (microtouch.rx_buffer[microtouch.rx_buffer_ptr-1] == 0x0d))
219   {
220210      if (LOG)
221211      {
222212         char command[16];
223213         memset(command, 0, sizeof(command));
224         strncpy( command, (const char*)microtouch.rx_buffer + 1, microtouch.rx_buffer_ptr - 2 );
214         strncpy( command, (const char*)m_rx_buffer + 1, m_rx_buffer_ptr - 2 );
225215         logerror("Microtouch: received command %s\n", command);
226216      }
227217      // check command
228      if ( microtouch_check_command( "MS", microtouch.rx_buffer_ptr, microtouch.rx_buffer ) )
218      if ( check_command( "MS", m_rx_buffer_ptr, m_rx_buffer ) )
229219      {
230         microtouch.mode = MODE_STREAM;
220         m_mode = MODE_STREAM;
231221      }
232      else if ( microtouch_check_command( "MI", microtouch.rx_buffer_ptr, microtouch.rx_buffer ) )
222      else if ( check_command( "MI", m_rx_buffer_ptr, m_rx_buffer ) )
233223      {
234         microtouch.mode = MODE_INACTIVE;
224         m_mode = MODE_INACTIVE;
235225      }
236      else if ( microtouch_check_command( "MP", microtouch.rx_buffer_ptr, microtouch.rx_buffer ) )
226      else if ( check_command( "MP", m_rx_buffer_ptr, m_rx_buffer ) )
237227      {
238         microtouch.mode = MODE_POINT;
228         m_mode = MODE_POINT;
239229      }
240      else if ( microtouch_check_command( "R", microtouch.rx_buffer_ptr, microtouch.rx_buffer ) )
230      else if ( check_command( "R", m_rx_buffer_ptr, m_rx_buffer ) )
241231      {
242         microtouch.tx_buffer_num = 0;
243         microtouch.reset_done = 1;
232         m_tx_buffer_num = 0;
233         m_reset_done = 1;
244234      }
245      else if ( microtouch_check_command( "FT", microtouch.rx_buffer_ptr, microtouch.rx_buffer ) )
235      else if ( check_command( "FT", m_rx_buffer_ptr, m_rx_buffer ) )
246236      {
247         microtouch.format = FORMAT_TABLET;
237         m_format = FORMAT_TABLET;
248238      }
249      else if ( microtouch_check_command( "FD", microtouch.rx_buffer_ptr, microtouch.rx_buffer ) )
239      else if ( check_command( "FD", m_rx_buffer_ptr, m_rx_buffer ) )
250240      {
251         microtouch.format = FORMAT_DECIMAL;
241         m_format = FORMAT_DECIMAL;
252242      }
253      else if ( microtouch_check_command("OI", microtouch.rx_buffer_ptr, microtouch.rx_buffer ) )
243      else if ( check_command("OI", m_rx_buffer_ptr, m_rx_buffer ) )
254244      {
255245         // output identity - SMT3, ver 01.00
256         microtouch.tx_buffer[microtouch.tx_buffer_num++] = 0x01;
257         microtouch.tx_buffer[microtouch.tx_buffer_num++] = 'Q';
258         microtouch.tx_buffer[microtouch.tx_buffer_num++] = '1';
259         microtouch.tx_buffer[microtouch.tx_buffer_num++] = '0';
260         microtouch.tx_buffer[microtouch.tx_buffer_num++] = '1';
261         microtouch.tx_buffer[microtouch.tx_buffer_num++] = '0';
262         microtouch.tx_buffer[microtouch.tx_buffer_num++] = '0';
263         microtouch.tx_buffer[microtouch.tx_buffer_num++] = 0x0d;
264         microtouch.rx_buffer_ptr = 0;
246         m_tx_buffer[m_tx_buffer_num++] = 0x01;
247         m_tx_buffer[m_tx_buffer_num++] = 'Q';
248         m_tx_buffer[m_tx_buffer_num++] = '1';
249         m_tx_buffer[m_tx_buffer_num++] = '0';
250         m_tx_buffer[m_tx_buffer_num++] = '1';
251         m_tx_buffer[m_tx_buffer_num++] = '0';
252         m_tx_buffer[m_tx_buffer_num++] = '0';
253         m_tx_buffer[m_tx_buffer_num++] = 0x0d;
254         m_rx_buffer_ptr = 0;
265255         return;
266256      }
267257      // send response
268      microtouch.tx_buffer[microtouch.tx_buffer_num++] = 0x01;
269      microtouch.tx_buffer[microtouch.tx_buffer_num++] = 0x30;
270      microtouch.tx_buffer[microtouch.tx_buffer_num++] = 0x0d;
271      microtouch.rx_buffer_ptr = 0;
258      m_tx_buffer[m_tx_buffer_num++] = 0x01;
259      m_tx_buffer[m_tx_buffer_num++] = 0x30;
260      m_tx_buffer[m_tx_buffer_num++] = 0x0d;
261      m_rx_buffer_ptr = 0;
272262   }
273263};
274264
275static INPUT_CHANGED( microtouch_touch )
265INPUT_CHANGED_MEMBER( microtouch_device::touch )
276266{
277   if ( newval && ( microtouch.mode == MODE_POINT ) )
267   if ( newval && ( m_mode == MODE_POINT ) )
278268   {
279      microtouch_send_touch_packet( field.machine() );
269      send_touch_packet();
280270   }
281271}
282272
283INPUT_PORTS_START(microtouch)
273static INPUT_PORTS_START(microtouch)
284274   PORT_START("TOUCH")
285   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME( "Touch screen" ) PORT_CHANGED( microtouch_touch, 0 )
275   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME( "Touch screen" ) PORT_CHANGED_MEMBER( DEVICE_SELF,microtouch_device, touch, 0 )
286276   PORT_START("TOUCH_X")
287277   PORT_BIT( 0x3fff, 0x2000, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(45) PORT_KEYDELTA(15)
288278   PORT_START("TOUCH_Y")
289279   PORT_BIT( 0x3fff, 0x2000, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(45) PORT_KEYDELTA(15)
290280INPUT_PORTS_END
291281
282ioport_constructor microtouch_device::device_input_ports() const
283{
284   return INPUT_PORTS_NAME(microtouch);
285}
286
287const device_type MICROTOUCH_SERIAL = &device_creator<microtouch_serial_device>;
288
289microtouch_serial_device::microtouch_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
290   : microtouch_device(mconfig, MICROTOUCH_SERIAL, "Microtouch Serial Touchscreen", tag, owner, clock),
291     device_serial_interface(mconfig, *this)
292{
293}
294
295void microtouch_serial_device::device_config_complete()
296{
297   const microtouch_serial_interface *intf = reinterpret_cast<const microtouch_serial_interface *>(static_config());
298   if(intf != NULL)
299      *static_cast<microtouch_serial_interface *>(this) = *intf;
300   else
301   {
302      memset(&m_out_stx_cb, 0, sizeof(m_out_stx_cb));
303   }
304   memset(&(microtouch_interface::m_out_tx_cb), 0, sizeof(microtouch_interface::m_out_tx_cb));
305   memset(&m_out_touch_cb, 0, sizeof(m_out_touch_cb));
306}
307
308void microtouch_serial_device::device_start()
309{
310   microtouch_device::device_start();
311   m_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock()));
312   set_data_frame(8, 1, SERIAL_PARITY_NONE); //8N1?
313   m_out_stx_func.resolve(m_out_stx_cb, *this);
314   m_count = 0;
315   m_output_valid = false;
316
317   save_item(NAME(m_count));
318   save_item(NAME(m_output_valid));
319   save_item(NAME(m_output));
320   save_item(NAME(m_rx_line));
321}
322
323void microtouch_serial_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
324{
325   if(is_transmit_register_empty())
326   {
327      if(m_output_valid)
328      {
329         transmit_register_setup(m_output);
330         m_output_valid = false;
331      }
332   }
333   else
334      m_out_stx_func(transmit_register_get_data_bit());
335
336   receive_register_update_bit(m_rx_line);
337   if(is_receive_register_full())
338   {
339      receive_register_extract();
340      microtouch_device::rx(*memory_nonspecific_space(machine()), 0, get_received_char());
341      receive_register_reset();
342   }
343
344   if((m_count == 0) && (m_output_valid == false))
345      microtouch_device::device_timer(timer, id, param, ptr);
346
347   ++m_count %= 8;
348}
src/emu/machine/microtch.h
r14535r14536
11#ifndef _MICROTOUCH_H
22#define _MICROTOUCH_H
33
4INPUT_PORTS_EXTERN(microtouch);
4#include "emu.h"
55
6typedef void (*microtouch_tx_func)(running_machine &machine, UINT8 data);
7typedef int (*microtouch_touch_func)(running_machine &machine, int *touch_x, int *touch_y);
6typedef int (*microtouch_touch_func)(int *touch_x, int *touch_y);
7#define MICROTOUCH_TOUCH(name) int name(int *touch_x, int *touch_y)
88
9void microtouch_init(running_machine &machine, microtouch_tx_func tx_cb, microtouch_touch_func touch_cb);
10void microtouch_rx(int count, UINT8* data);
9struct microtouch_interface
10{
11   devcb_write8         m_out_tx_cb;
12   microtouch_touch_func   m_out_touch_cb;
13};
1114
15class microtouch_device :
16      public device_t,
17      public microtouch_interface
18{
19public:
20   microtouch_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock);
21   microtouch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
22
23   virtual ioport_constructor device_input_ports() const;
24   DECLARE_WRITE8_MEMBER(rx);
25   DECLARE_INPUT_CHANGED_MEMBER(touch);
26protected:
27   virtual void device_start();
28   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
29   virtual void device_config_complete();
30   virtual void tx(UINT8 data) { m_out_tx_func(0, data); }
31   emu_timer*   m_timer;
32private:
33   int check_command( const char* commandtocheck, int command_len, UINT8* command_data );
34   void send_format_table_packet(UINT8 flag, int x, int y);
35   void send_format_decimal_packet(int x, int y);
36   void send_touch_packet();
37
38   enum
39   {
40      FORMAT_UNKNOWN,
41      FORMAT_TABLET,
42      FORMAT_DECIMAL
43   };
44   enum
45   {
46      MODE_INACTIVE,
47      MODE_STREAM,
48      MODE_POINT
49   };
50   UINT8      m_rx_buffer[16];
51   int         m_rx_buffer_ptr;
52   UINT8      m_tx_buffer[16];
53   UINT8      m_tx_buffer_num;
54   UINT8      m_tx_buffer_ptr;
55   int         m_reset_done;
56   int         m_format;
57   int         m_mode;
58   int         m_last_touch_state;
59   int         m_last_x;
60   int         m_last_y;
61   devcb_resolved_write8 m_out_tx_func;
62};
63
64extern const device_type MICROTOUCH;
65
66#define MCFG_MICROTOUCH_ADD(_tag, _intrf) \
67   MCFG_DEVICE_ADD(_tag, MICROTOUCH, 0) \
68   MCFG_DEVICE_CONFIG(_intrf)
69
70struct microtouch_serial_interface
71{
72   devcb_write_line m_out_stx_cb;
73};
74
75class microtouch_serial_device
76   : public microtouch_device,
77     public device_serial_interface,
78     public microtouch_serial_interface
79{
80public:
81   microtouch_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
82
83   DECLARE_WRITE_LINE_MEMBER(rx) {m_rx_line = state;}
84protected:
85   virtual void device_start();
86   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
87   virtual void device_config_complete();
88   virtual void tx(UINT8 data) {m_output = data; m_output_valid = true;}
89   virtual void input_callback(UINT8 state) { m_input_state = state; }
90private:
91   int m_count;
92   bool m_output_valid;
93   UINT8 m_output;
94   UINT8 m_rx_line;
95   devcb_resolved_write_line m_out_stx_func;
96};
97
98extern const device_type MICROTOUCH_SERIAL;
99
100#define MCFG_MICROTOUCH_SERIAL_ADD(_tag, _intrf, _clock) \
101   MCFG_DEVICE_ADD(_tag, MICROTOUCH_SERIAL, _clock) \
102   MCFG_DEVICE_CONFIG(_intrf)
103
12104#endif //_MICROTOUCH_H
src/mess/machine/pc_mouse.c
r14535r14536
1/***************************************************************************
2
3    machine/pc_mouse.c
4
5    Code for emulating PC-style serial mouses
6
7***************************************************************************/
8
9#include "emu.h"
10#include "machine/ins8250.h"
11#include "machine/pc_mouse.h"
12
13
14static struct {
15
16   PC_MOUSE_PROTOCOL protocol;
17
18   device_t *ins8250;
19   int inputs;
20
21   UINT8 queue[256];
22   UINT8 head, tail, mb;
23
24   emu_timer *timer;
25
26} pc_mouse;
27
28static TIMER_CALLBACK(pc_mouse_scan);
29
30void pc_mouse_initialise(running_machine &machine)
31{
32   pc_mouse.head = pc_mouse.tail = 0;
33   pc_mouse.timer = machine.scheduler().timer_alloc(FUNC(pc_mouse_scan));
34   pc_mouse.inputs = 0;
35   pc_mouse.ins8250 = NULL;
36}
37
38void pc_mouse_set_serial_port(device_t *ins8250)
39{
40   if ( pc_mouse.ins8250 != ins8250 ) {
41      pc_mouse.ins8250 = ins8250;
42      ins8250_handshake_in(pc_mouse.ins8250, pc_mouse.inputs);
43   }
44}
45
46/* add data to queue */
47static void   pc_mouse_queue_data(int data)
48{
49   pc_mouse.queue[pc_mouse.head] = data;
50   pc_mouse.head++;
51   pc_mouse.head %= 256;
52}
53
54/**************************************************************************
55 *  Check for mouse moves and buttons. Build delta x/y packets
56 **************************************************************************/
57static TIMER_CALLBACK(pc_mouse_scan)
58{
59   static int ox = 0, oy = 0;
60   int nx,ny;
61   int dx, dy, nb;
62   int mbc;
63
64   /* Do not get deltas or send packets if queue is not empty (Prevents drifting) */
65   if (pc_mouse.head==pc_mouse.tail)
66   {
67      nx = input_port_read(machine, "pc_mouse_x");
68
69      dx = nx - ox;
70      if (dx<=-0x800) dx = nx + 0x1000 - ox; /* Prevent jumping */
71      if (dx>=0x800) dx = nx - 0x1000 - ox;
72      ox = nx;
73
74      ny = input_port_read(machine, "pc_mouse_y");
75
76      dy = ny - oy;
77      if (dy<=-0x800) dy = ny + 0x1000 - oy;
78      if (dy>=0x800) dy = ny - 0x1000 - oy;
79      oy = ny;
80
81      nb = input_port_read(machine, "pc_mouse_misc");
82      if ((nb & 0x80) != 0)
83      {
84         pc_mouse.protocol=TYPE_MOUSE_SYSTEMS;
85      }
86      else
87      {
88         pc_mouse.protocol=TYPE_MICROSOFT_MOUSE;
89      }
90      mbc = nb^pc_mouse.mb;
91      pc_mouse.mb = nb;
92
93      /* check if there is any delta or mouse buttons changed */
94      if ( (dx!=0) || (dy!=0) || (mbc!=0) )
95      {
96         switch (pc_mouse.protocol)
97         {
98
99         default:
100         case TYPE_MICROSOFT_MOUSE:
101            {
102               /* split deltas into packtes of -128..+127 max */
103               do
104               {
105                  UINT8 m0, m1, m2;
106                  int ddx = (dx < -128) ? -128 : (dx > 127) ? 127 : dx;
107                  int ddy = (dy < -128) ? -128 : (dy > 127) ? 127 : dy;
108                  m0 = 0x40 | ((nb << 4) & 0x30) | ((ddx >> 6) & 0x03) | ((ddy >> 4) & 0x0c);
109                  m1 = ddx & 0x3f;
110                  m2 = ddy & 0x3f;
111
112                  /* KT - changed to use a function */
113                  pc_mouse_queue_data(m0 | 0x40);
114                  pc_mouse_queue_data(m1 & 0x03f);
115                  pc_mouse_queue_data(m2 & 0x03f);
116                  if ((mbc & 0x04) != 0)  /* If button 3 changed send extra byte */
117                  {
118                  pc_mouse_queue_data( (nb & 0x04) << 3);
119                  }
120
121                  dx -= ddx;
122                  dy -= ddy;
123               } while( dx || dy );
124            }
125            break;
126
127            /* mouse systems mouse
128                from "PC Mouse information" by Tomi Engdahl */
129
130            /*
131                The data is sent in 5 byte packets in following format:
132                        D7      D6      D5      D4      D3      D2      D1      D0
133
134                1.      1       0       0       0       0       LB      CB      RB
135                2.      X7      X6      X5      X4      X3      X2      X1      X0
136                3.      Y7      Y6      Y5      Y4      Y3      Y4      Y1      Y0
137                4.      X7'     X6'     X5'     X4'     X3'     X2'     X1'     X0'
138                5.      Y7'     Y6'     Y5'     Y4'     Y3'     Y4'     Y1'     Y0'
139
140                LB is left button state (0=pressed, 1=released)
141                CB is center button state (0=pressed, 1=released)
142                RB is right button state (0=pressed, 1=released)
143                X7-X0 movement in X direction since last packet in signed byte
144                      format (-128..+127), positive direction right
145                Y7-Y0 movement in Y direction since last packet in signed byte
146                      format (-128..+127), positive direction up
147                X7'-X0' movement in X direction since sending of X7-X0 packet in signed byte
148                      format (-128..+127), positive direction right
149                Y7'-Y0' movement in Y direction since sending of Y7-Y0 in signed byte
150                      format (-128..+127), positive direction up
151
152                The last two bytes in the packet (bytes 4 and 5) contains information about movement data changes which have occurred after data butes 2 and 3 have been sent. */
153
154            case TYPE_MOUSE_SYSTEMS:
155            {
156
157               dy =-dy;
158
159               do
160               {
161                  int ddx = (dx < -128) ? -128 : (dx > 127) ? 127 : dx;
162                  int ddy = (dy < -128) ? -128 : (dy > 127) ? 127 : dy;
163
164                  /* KT - changed to use a function */
165                  pc_mouse_queue_data(0x080 | ((((nb & 0x04) >> 1) + ((nb & 0x02) << 1) + (nb & 0x01)) ^ 0x07));
166                  pc_mouse_queue_data(ddx);
167                  pc_mouse_queue_data(ddy);
168                  /* for now... */
169                  pc_mouse_queue_data(0);
170                  pc_mouse_queue_data(0);
171                  dx -= ddx;
172                  dy -= ddy;
173               } while( dx || dy );
174
175            }
176            break;
177         }
178      }
179   }
180
181   /* Send any data from this scan or any pending data from a previous scan */
182
183   if( pc_mouse.tail != pc_mouse.head )
184   {
185      int data;
186
187      data = pc_mouse.queue[pc_mouse.tail];
188      ins8250_receive(pc_mouse.ins8250, data);
189      pc_mouse.tail++;
190      pc_mouse.tail &= 255;
191   }
192}
193
194
195
196/**************************************************************************
197 *  Check for mouse control line changes and (de-)install timer
198 **************************************************************************/
199
200INS8250_HANDSHAKE_OUT( pc_mouse_handshake_in )
201{
202   if (device!=pc_mouse.ins8250) return;
203   if (!(data ^ pc_mouse.inputs)) {
204      ins8250_handshake_in(pc_mouse.ins8250, 0);
205      return;
206   }
207
208   if ((data & UART8250_HANDSHAKE_OUT_DTR) && (data & UART8250_HANDSHAKE_OUT_RTS))
209   {
210      /* RTS toggled */
211      if (!(pc_mouse.inputs & UART8250_HANDSHAKE_OUT_RTS) && (data & UART8250_HANDSHAKE_OUT_RTS))
212      {
213         /* reset mouse */
214         pc_mouse.head = pc_mouse.tail = pc_mouse.mb = 0;
215
216         if ((input_port_read(device->machine(), "pc_mouse_misc") & 0x80) == 0 )
217         {
218            /* Identify as Microsoft 3 Button Mouse */
219            pc_mouse.queue[pc_mouse.head] = 'M';
220            pc_mouse.head++;
221            pc_mouse.head %= 256;
222            pc_mouse.queue[pc_mouse.head] = '3';
223            pc_mouse.head++;
224            pc_mouse.head %= 256;
225         }
226      }
227      /* start a timer to scan the mouse input */
228      pc_mouse.timer->adjust(attotime::zero, 0, attotime::from_hz(240));
229   }
230   else
231   {
232      pc_mouse.timer->adjust(attotime::zero);
233      pc_mouse.head = pc_mouse.tail = 0;
234   }
235
236   pc_mouse.inputs=data;
237   // do not set DSR or CTS
238   ins8250_handshake_in(pc_mouse.ins8250, 0);
239}
240
241
242
243/**************************************************************************
244 *  Mouse INPUT_PORT declarations
245 **************************************************************************/
246
247INPUT_PORTS_START( pc_mouse_mousesystems )
248   PORT_START( "pc_mouse_misc" )
249   PORT_CONFNAME( 0x80, 0x80, "Mouse Protocol" )
250   PORT_CONFSETTING( 0x80, "Mouse Systems" )
251   PORT_CONFSETTING( 0x00, "Microsoft" )
252   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Left Button") PORT_CODE(MOUSECODE_BUTTON1)
253   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Middle Button") PORT_CODE(MOUSECODE_BUTTON3)
254   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Mouse Right Button") PORT_CODE(MOUSECODE_BUTTON2)
255
256   PORT_START( "pc_mouse_x" ) /* Mouse - X AXIS */
257   PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
258
259   PORT_START( "pc_mouse_y" ) /* Mouse - Y AXIS */
260   PORT_BIT( 0xfff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
261INPUT_PORTS_END
262
263
264
265INPUT_PORTS_START( pc_mouse_microsoft )
266   PORT_START( "pc_mouse_misc" )
267   PORT_CONFNAME( 0x80, 0x00, "Mouse Protocol" )
268   PORT_CONFSETTING( 0x00, "Microsoft" )
269   PORT_CONFSETTING( 0x80, "Mouse Systems" )
270   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Left Button") PORT_CODE(MOUSECODE_BUTTON1)
271   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Middle Button") PORT_CODE(MOUSECODE_BUTTON3)
272   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Mouse Right Button") PORT_CODE(MOUSECODE_BUTTON2)
273
274   PORT_START( "pc_mouse_x" ) /* Mouse - X AXIS */
275   PORT_BIT( 0xfff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
276
277   PORT_START( "pc_mouse_y" ) /* Mouse - Y AXIS */
278   PORT_BIT( 0xfff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
279INPUT_PORTS_END
280
281
282
283INPUT_PORTS_START( pc_mouse_none )
284   PORT_START( "pc_mouse_misc" )      /* IN12 */
285   PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
286   PORT_START( "pc_mouse_x" )      /* IN13 */
287   PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
288   PORT_START( "pc_mouse_y" )      /* IN14 */
289   PORT_BIT ( 0xffff, 0x0000, IPT_UNUSED )
290INPUT_PORTS_END
src/mess/machine/pc_mouse.h
r14535r14536
1/*****************************************************************************
2 *
3 * machine/pc_mouse.h
4 *
5 ****************************************************************************/
6
7#ifndef PC_MOUSE_H_
8#define PC_MOUSE_H_
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#include "machine/ins8250.h"
15
16typedef enum
17{
18   TYPE_MICROSOFT_MOUSE,
19   TYPE_MOUSE_SYSTEMS
20} PC_MOUSE_PROTOCOL;
21
22
23/*----------- defined in machine/pc_mouse.c -----------*/
24
25INS8250_HANDSHAKE_OUT( pc_mouse_handshake_in );
26
27// set base for input port
28void pc_mouse_set_serial_port(device_t *ins8250);
29void pc_mouse_initialise(running_machine &machine);
30
31INPUT_PORTS_EXTERN( pc_mouse_mousesystems );
32INPUT_PORTS_EXTERN( pc_mouse_microsoft );
33INPUT_PORTS_EXTERN( pc_mouse_none );
34
35
36#ifdef __cplusplus
37}
38#endif
39
40#endif /* PC_MOUSE_H_ */
src/mess/machine/s100_wunderbus.c
r14535r14536
6565//-------------------------------------------------
6666//  ins8250_interface ace1_intf
6767//-------------------------------------------------
68
68/*
6969static INS8250_TRANSMIT( ace1_transmit )
7070{
7171   s100_wunderbus_device *wunderbus = downcast<s100_wunderbus_device *>(device->owner());
7272
7373   wunderbus->m_s100->terminal_transmit_w(data);
7474}
75*/
76//-------------------------------------------------
77//  s100_terminal_w - terminal write
78//-------------------------------------------------
7579
80void s100_wunderbus_device::s100_terminal_w(UINT8 data)
81{
82//   ins8250_receive(m_ace1, data);
83}
84
7685static ins8250_interface ace1_intf =
7786{
78   XTAL_18_432MHz/10,
87   DEVCB_NULL,
88   DEVCB_NULL,
7989   DEVCB_DEVICE_LINE(I8259A_TAG, pic8259_ir3_w),
80   ace1_transmit,
81   NULL,
82   NULL
90   DEVCB_NULL,
91   DEVCB_NULL,
92   DEVCB_NULL
8393};
8494
8595
r14535r14536
8999
90100static ins8250_interface ace2_intf =
91101{
92   XTAL_18_432MHz/10,
102   DEVCB_NULL,
103   DEVCB_NULL,
93104   DEVCB_DEVICE_LINE(I8259A_TAG, pic8259_ir4_w),
94   NULL,
95   NULL,
96   NULL
105   DEVCB_NULL,
106   DEVCB_NULL,
107   DEVCB_NULL
97108};
98109
99110
r14535r14536
103114
104115static ins8250_interface ace3_intf =
105116{
106   XTAL_18_432MHz/10,
117   DEVCB_NULL,
118   DEVCB_NULL,
107119   DEVCB_DEVICE_LINE(I8259A_TAG, pic8259_ir5_w),
108   NULL,
109   NULL,
110   NULL
120   DEVCB_NULL,
121   DEVCB_NULL,
122   DEVCB_NULL
111123};
112124
113125
r14535r14536
137149
138150static MACHINE_CONFIG_FRAGMENT( s100_wunderbus )
139151   MCFG_PIC8259_ADD(I8259A_TAG, pic_intf)
140   MCFG_INS8250_ADD(INS8250_1_TAG, ace1_intf)
141   MCFG_INS8250_ADD(INS8250_2_TAG, ace2_intf)
142   MCFG_INS8250_ADD(INS8250_3_TAG, ace3_intf)
152   MCFG_INS8250_ADD(INS8250_1_TAG, ace1_intf, XTAL_18_432MHz/10)
153   MCFG_INS8250_ADD(INS8250_2_TAG, ace2_intf, XTAL_18_432MHz/10)
154   MCFG_INS8250_ADD(INS8250_3_TAG, ace3_intf, XTAL_18_432MHz/10)
143155   MCFG_UPD1990A_ADD(UPD1990C_TAG, XTAL_32_768kHz, rtc_intf)
144156MACHINE_CONFIG_END
145157
r14535r14536
403415         break;
404416
405417      case 1:
406         data = ins8250_r(m_ace1, offset & 0x07);
418         data = m_ace1->ins8250_r(*memory_nonspecific_space(machine()), offset & 0x07);
407419         break;
408420
409421      case 2:
410         data = ins8250_r(m_ace2, offset & 0x07);
422         data = m_ace2->ins8250_r(*memory_nonspecific_space(machine()), offset & 0x07);
411423         break;
412424
413425      case 3:
414         data = ins8250_r(m_ace3, offset & 0x07);
426         data = m_ace3->ins8250_r(*memory_nonspecific_space(machine()), offset & 0x07);
415427         break;
416428      }
417429   }
r14535r14536
526538         break;
527539
528540      case 1:
529         ins8250_w(m_ace1, offset & 0x07, data);
541         m_ace1->ins8250_w(*memory_nonspecific_space(machine()), offset & 0x07, data);
530542         break;
531543
532544      case 2:
533         ins8250_w(m_ace2, offset & 0x07, data);
545         m_ace2->ins8250_w(*memory_nonspecific_space(machine()), offset & 0x07, data);
534546         break;
535547
536548      case 3:
537         ins8250_w(m_ace3, offset & 0x07, data);
549         m_ace3->ins8250_w(*memory_nonspecific_space(machine()), offset & 0x07, data);
538550         break;
539551      }
540552   }
541553}
542554
543
544//-------------------------------------------------
545//  s100_terminal_w - terminal write
546//-------------------------------------------------
547
548void s100_wunderbus_device::s100_terminal_w(UINT8 data)
549{
550   ins8250_receive(m_ace1, data);
551}
src/mess/machine/s100_wunderbus.h
r14535r14536
4141   DECLARE_WRITE_LINE_MEMBER( pic_int_w );
4242   DECLARE_WRITE_LINE_MEMBER( rtc_tp_w );
4343   required_device<device_t> m_pic;
44   required_device<device_t> m_ace1;
45   required_device<device_t> m_ace2;
46   required_device<device_t> m_ace3;
44   required_device<ins8250_device> m_ace1;
45   required_device<ins8250_device> m_ace2;
46   required_device<ins8250_device> m_ace3;
4747   required_device<upd1990a_device> m_rtc;
4848
4949protected:
src/mess/machine/teleprinter.c
r14535r14536
244244
245245static TIMER_CALLBACK(keyboard_callback)
246246{
247   UINT8 new_code;
247248   teleprinter_state *term = get_safe_token((device_t *)ptr);
248   term->last_code = terminal_keyboard_handler(machine, term->teleprinter_keyboard_func, term->last_code, &term->scan_line, NULL, NULL, (device_t *)ptr);
249   new_code = terminal_keyboard_handler(machine, term->last_code, &term->scan_line, NULL, NULL, (device_t *)ptr);
250
251   if(new_code != term->last_code)
252      term->teleprinter_keyboard_func(0, new_code);
253   term->last_code = new_code;
249254}
250255
251256/***************************************************************************
src/mess/machine/serial.c
r14535r14536
66device_serial_port_interface::device_serial_port_interface(const machine_config &mconfig, device_t &device)
77   : device_slot_card_interface(mconfig, device)
88{
9   m_rdata = 0;
10   m_tdata = 0;
119   m_rbit = FALSE;
1210   m_tbit = FALSE;
1311}
r14535r14536
2321{
2422}
2523
24serial_port_device::serial_port_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
25   : device_t(mconfig, type, name, tag, owner, clock),
26     device_slot_interface(mconfig, *this),
27     m_dev(NULL)
28{
29}
30
2631serial_port_device::~serial_port_device()
2732{
2833}
r14535r14536
3641   }
3742   else
3843   {
39      memset(&m_out_rx8_cb, 0, sizeof(m_out_rx8_cb));
4044      memset(&m_out_rx_cb, 0, sizeof(m_out_rx_cb));
4145   }
4246   m_dev = dynamic_cast<device_serial_port_interface *>(get_card_device());
r14535r14536
4448
4549void serial_port_device::device_start()
4650{
47   m_out_rx8_func.resolve(m_out_rx8_cb, *this);
4851   m_out_rx_func.resolve(m_out_rx_cb, *this);
4952}
5053
r14535r14536
6669}
6770
6871rs232_port_device::rs232_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
69   : serial_port_device(mconfig, tag, owner, clock)
72   : serial_port_device(mconfig, RS232_PORT, "RS232 Port", tag, owner, clock)
7073{
7174}
7275
r14535r14536
8083   if (intf != NULL)
8184   {
8285      *static_cast<rs232_port_interface *>(this) = *intf;
83      memcpy(&(serial_port_interface::m_out_rx8_cb), &(rs232_port_interface::m_out_rx8_cb), sizeof(rs232_port_interface::m_out_rx8_cb));
8486      memcpy(&(serial_port_interface::m_out_rx_cb), &(rs232_port_interface::m_out_rx_cb), sizeof(rs232_port_interface::m_out_rx_cb));
8587   }
8688   else
8789   {
88      memset(&(serial_port_interface::m_out_rx8_cb), 0, sizeof(serial_port_interface::m_out_rx8_cb));
8990      memset(&(serial_port_interface::m_out_rx_cb), 0, sizeof(serial_port_interface::m_out_rx_cb));
9091      memset(&m_out_dcd_cb, 0, sizeof(m_out_dcd_cb));
9192      memset(&m_out_dsr_cb, 0, sizeof(m_out_dsr_cb));
r14535r14536
9394      memset(&m_out_cts_cb, 0, sizeof(m_out_cts_cb));
9495   }
9596   m_dev = dynamic_cast<device_rs232_port_interface *>(get_card_device());
97   serial_port_device::m_dev = dynamic_cast<device_serial_port_interface *>(get_card_device());
98   loopdtr = 0;
99   looprts = 0;
96100}
97101
98102void rs232_port_device::device_start()
r14535r14536
103107   m_out_ri_func.resolve(m_out_ri_cb, *this);
104108   m_out_cts_func.resolve(m_out_cts_cb, *this);
105109}
110
111// XXX:make loopback handshaking optional if needed
112WRITE_LINE_MEMBER( rs232_port_device::dtr_w )
113{
114   if(m_dev)
115      return m_dev->dtr_w(state);
116   
117   if(serial_port_device::m_dev)
118   {
119      loopdtr = state;
120      out_dcd(state);
121      out_dsr(state);
122   }
123}
124
125WRITE_LINE_MEMBER( rs232_port_device::rts_w )
126{
127   if(m_dev)
128      return m_dev->rts_w(state);
129   
130   if(serial_port_device::m_dev)
131   {
132      looprts = state;
133      out_cts(state);
134   }
135}
136
src/mess/machine/serial.h
r14535r14536
1515
1616struct serial_port_interface
1717{
18   devcb_write8      m_out_rx8_cb;
1918   devcb_write_line   m_out_rx_cb;
2019};
2120
r14535r14536
2524   device_serial_port_interface(const machine_config &mconfig, device_t &device);
2625   virtual ~device_serial_port_interface();
2726
28   virtual void tx8(UINT8 data) { m_tdata = data; }
29   virtual UINT8 rx8() { return m_rdata; }
3027   virtual void tx(UINT8 state) { m_tbit = state; }
31   virtual int rx() { return m_rbit; }
28   virtual UINT8 rx() { return m_rbit; }
3229protected:
33   UINT8 m_rdata;
3430   UINT8 m_rbit;
35   UINT8 m_tdata;
3631   UINT8 m_tbit;
3732};
3833
r14535r14536
4237{
4338public:
4439   serial_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
40   serial_port_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
4541   virtual ~serial_port_device();
4642
47   DECLARE_WRITE8_MEMBER( tx8 ) { if(m_dev) m_dev->tx8(data); }
48   DECLARE_READ8_MEMBER( rx8 )  { return (m_dev) ? m_dev->rx8() : 0; }
49   
5043   DECLARE_WRITE_LINE_MEMBER( tx ) { if(m_dev) m_dev->tx(state); }
5144   DECLARE_READ_LINE_MEMBER( rx )  { return (m_dev) ? m_dev->rx() : 0; }
5245   
53   void out_rx8(UINT8 data) { m_out_rx8_func(0, data); }
5446   void out_rx(UINT8 param)  { m_out_rx_func(param); }
5547protected:
5648   virtual void device_start();
5749   virtual void device_config_complete();
58
50   device_serial_port_interface *m_dev;
5951private:
60   devcb_resolved_write8 m_out_rx8_func;
6152   devcb_resolved_write_line m_out_rx_func;
62
63   device_serial_port_interface *m_dev;
6453};
6554
6655extern const device_type SERIAL_PORT;
6756
6857struct rs232_port_interface
6958{
70   devcb_write8      m_out_rx8_cb;
7159   devcb_write_line   m_out_rx_cb;
7260   devcb_write_line   m_out_dcd_cb;
7361   devcb_write_line   m_out_dsr_cb;
r14535r14536
10492   rs232_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
10593   virtual ~rs232_port_device();
10694
107   DECLARE_WRITE_LINE_MEMBER( dtr_w ) { if (m_dev) m_dev->dtr_w(state); }
108   DECLARE_WRITE_LINE_MEMBER( rts_w ) { if (m_dev) m_dev->rts_w(state); }
95   DECLARE_WRITE_LINE_MEMBER( dtr_w );
96   DECLARE_WRITE_LINE_MEMBER( rts_w );
10997
110   DECLARE_READ_LINE_MEMBER( dcd_r ) { return (m_dev) ? m_dev->dcd_r() : 0; }
111   DECLARE_READ_LINE_MEMBER( dsr_r ) { return (m_dev) ? m_dev->dsr_r() : 0; }
98   DECLARE_READ_LINE_MEMBER( dcd_r ) { return (m_dev) ? m_dev->dcd_r() : loopdtr; }
99   DECLARE_READ_LINE_MEMBER( dsr_r ) { return (m_dev) ? m_dev->dsr_r() : loopdtr; }
112100   DECLARE_READ_LINE_MEMBER( ri_r )  { return (m_dev) ? m_dev->ri_r() : 0; }
113   DECLARE_READ_LINE_MEMBER( cts_r ) { return (m_dev) ? m_dev->cts_r() : 0; }
101   DECLARE_READ_LINE_MEMBER( cts_r ) { return (m_dev) ? m_dev->cts_r() : looprts; }
114102
115103   void out_dcd(UINT8 param) { m_out_dcd_func(param); }
116104   void out_dsr(UINT8 param) { m_out_dsr_func(param); }
r14535r14536
120108protected:
121109   virtual void device_start();
122110   virtual void device_config_complete();
123
124private:
125111   device_rs232_port_interface *m_dev;
126
112private:
127113   devcb_resolved_write_line m_out_dcd_func;
128114   devcb_resolved_write_line m_out_dsr_func;
129115   devcb_resolved_write_line m_out_ri_func;
130116   devcb_resolved_write_line m_out_cts_func;
117   UINT8 loopdtr;
118   UINT8 looprts;
131119};
132120
133121extern const device_type RS232_PORT;
src/mess/machine/svi318.c
r14535r14536
4242      cputag_set_input_line(device->machine(), "maincpu", 0, (state ? HOLD_LINE : CLEAR_LINE));
4343   }
4444}
45
45#if 0
4646static INS8250_REFRESH_CONNECT( svi318_com_refresh_connected )
4747{
4848   /* Motorola MC14412 modem */
4949   ins8250_handshake_in(device, UART8250_HANDSHAKE_IN_CTS|UART8250_HANDSHAKE_IN_DSR|UART8250_INPUTS_RING_INDICATOR|UART8250_INPUTS_DATA_CARRIER_DETECT);
5050}
51
51#endif
5252const ins8250_interface svi318_ins8250_interface[2]=
5353{
5454   {
55      1000000,
55      DEVCB_NULL,
56      DEVCB_NULL,
57      DEVCB_NULL,
5658      DEVCB_LINE(svi318_ins8250_interrupt),
57      NULL,
58      NULL,
59      svi318_com_refresh_connected
59      DEVCB_NULL,
60      DEVCB_NULL
6061   },
6162   {
62      3072000,
63      DEVCB_NULL,
64      DEVCB_NULL,
65      DEVCB_NULL,
6366      DEVCB_LINE(svi318_ins8250_interrupt),
64      NULL,
65      NULL,
66      NULL
67      DEVCB_NULL,
68      DEVCB_NULL
6769   }
6870};
6971
r14535r14536
773775   svi318_state *state = space->machine().driver_data<svi318_state>();
774776   UINT8 data = 0xff;
775777   device_t *device;
778   ins8250_device *uart;
776779   centronics_device *centronics = space->machine().device<centronics_device>("centronics");
777780
778781   if (state->m_svi.bankLow == SVI_CART)
r14535r14536
794797   case 0x25:
795798   case 0x26:
796799   case 0x27:
797      device = space->machine().device("ins8250_0");
798      data = ins8250_r(device, offset & 7);
800      uart = space->machine().device<ins8250_device>("ins8250_0");
801      data = uart->ins8250_r(*space, offset & 7);
799802      break;
800803
801804   case 0x28:
r14535r14536
806809   case 0x2D:
807810   case 0x2E:
808811   case 0x2F:
809      device = space->machine().device("ins8250_1");
810      data = ins8250_r(device, offset & 7);
812      uart = space->machine().device<ins8250_device>("ins8250_1");
813      data = uart->ins8250_r(*space, offset & 7);
811814      break;
812815
813816   case 0x30:
r14535r14536
842845{
843846   svi318_state *state = space->machine().driver_data<svi318_state>();
844847   device_t *device;
848   ins8250_device *uart;
845849   centronics_device *centronics = space->machine().device<centronics_device>("centronics");
846850
847851   if (state->m_svi.bankLow == SVI_CART)
r14535r14536
867871   case 0x25:
868872   case 0x26:
869873   case 0x27:
870      device = space->machine().device("ins8250_0");
871      ins8250_w(device, offset & 7, data);
874      uart = space->machine().device<ins8250_device>("ins8250_0");
875      uart->ins8250_w(*space, offset & 7, data);
872876      break;
873877
874878   case 0x28:
r14535r14536
879883   case 0x2D:
880884   case 0x2E:
881885   case 0x2F:
882      device = space->machine().device("ins8250_1");
883      ins8250_w(device, offset & 7, data);
886      uart = space->machine().device<ins8250_device>("ins8250_1");
887      uart->ins8250_w(*space, offset & 7, data);
884888      break;
885889
886890   case 0x30:
src/mess/machine/isa_com.c
r14535r14536
44
55***************************************************************************/
66
7#include "emu.h"
87#include "isa_com.h"
9#include "machine/ins8250.h"
108#include "machine/ser_mouse.h"
9#include "machine/terminal.h"
10#include "machine/null_modem.h"
1111
1212/* called when a interrupt is set/cleared from com hardware */
1313static WRITE_LINE_DEVICE_HANDLER( pc_com_interrupt_1 )
r14535r14536
2222   com->m_isa->irq3_w(state);
2323}
2424
25static void pc_com_refresh_connected_common(device_t *uart, int n, int data)
25static void pc_com_tx(device_t *uart, UINT8 state, int n)
2626{
2727   isa8_com_device   *com  = downcast<isa8_com_device *>(uart->owner());
28   rs232_port_device *port = com->get_port(n);
29   
30   port->dtr_w(data & 1);
31   port->rts_w((data & 2) && 1);
32   ins8250_handshake_in(uart, (port->cts_r() << 4)|(port->dsr_r() << 5)|(port->ri_r() << 6)|(port->dcd_r() << 7));
28   com->get_port(n)->tx(state);
3329}
3430
35static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_0 ) { pc_com_refresh_connected_common( device, 0, data ); }
36static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_1 ) { pc_com_refresh_connected_common( device, 1, data ); }
37static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_2 ) { pc_com_refresh_connected_common( device, 2, data ); }
38static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_3 ) { pc_com_refresh_connected_common( device, 3, data ); }
31static void pc_com_dtr(device_t *uart, UINT8 state, int n)
32{
33   isa8_com_device   *com  = downcast<isa8_com_device *>(uart->owner());
34   com->get_port(n)->dtr_w(state);
35}
3936
40static void pc_com_tx(device_t *uart, UINT8 data, int n)
37static void pc_com_rts(device_t *uart, UINT8 state, int n)
4138{
4239   isa8_com_device   *com  = downcast<isa8_com_device *>(uart->owner());
43   com->get_port(n)->tx8(*memory_nonspecific_space(uart->machine()), 0, data);
40   com->get_port(n)->rts_w(state);
4441}
4542
46static INS8250_TRANSMIT( pc_com_tx_0 ) { pc_com_tx(device, data, 0); }
47static INS8250_TRANSMIT( pc_com_tx_1 ) { pc_com_tx(device, data, 1); }
48static INS8250_TRANSMIT( pc_com_tx_2 ) { pc_com_tx(device, data, 2); }
49static INS8250_TRANSMIT( pc_com_tx_3 ) { pc_com_tx(device, data, 3); }
43static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_0 ) { pc_com_tx(device, state, 0); }
44static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_0 ) { pc_com_dtr(device, state, 0); }
45static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_0 ) { pc_com_rts(device, state, 0); }
5046
51WRITE8_DEVICE_HANDLER( pc_com_rx_0 ) { ins8250_receive(downcast<isa8_com_device *>(device->owner())->get_uart(0), data); }
52WRITE8_DEVICE_HANDLER( pc_com_rx_1 ) { ins8250_receive(downcast<isa8_com_device *>(device->owner())->get_uart(1), data); }
53WRITE8_DEVICE_HANDLER( pc_com_rx_2 ) { ins8250_receive(downcast<isa8_com_device *>(device->owner())->get_uart(2), data); }
54WRITE8_DEVICE_HANDLER( pc_com_rx_3 ) { ins8250_receive(downcast<isa8_com_device *>(device->owner())->get_uart(3), data); }
47static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_1 ) { pc_com_tx(device, state, 1); }
48static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_1 ) { pc_com_dtr(device, state, 1); }
49static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_1 ) { pc_com_rts(device, state, 1); }
5550
51static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_2 ) { pc_com_tx(device, state, 2); }
52static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_2 ) { pc_com_dtr(device, state, 2); }
53static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_2 ) { pc_com_rts(device, state, 2); }
54
55static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_3 ) { pc_com_tx(device, state, 3); }
56static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_3 ) { pc_com_dtr(device, state, 3); }
57static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_3 ) { pc_com_rts(device, state, 3); }
58
59static void pc_com_rx(device_t *port, UINT8 state, int n)
60{
61   isa8_com_device *com  = downcast<isa8_com_device *>(port->owner());
62   com->get_uart(n)->rx_w(state);
63}
64
65static void pc_com_dcd(device_t *port, UINT8 state, int n)
66{
67   isa8_com_device *com  = downcast<isa8_com_device *>(port->owner());
68   com->get_uart(n)->dcd_w(state);
69}
70
71static void pc_com_dsr(device_t *port, UINT8 state, int n)
72{
73   isa8_com_device *com  = downcast<isa8_com_device *>(port->owner());
74   com->get_uart(n)->dsr_w(state);
75}
76
77static void pc_com_ri(device_t *port, UINT8 state, int n)
78{
79   isa8_com_device *com  = downcast<isa8_com_device *>(port->owner());
80   com->get_uart(n)->ri_w(state);
81}
82
83static void pc_com_cts(device_t *port, UINT8 state, int n)
84{
85   isa8_com_device *com  = downcast<isa8_com_device *>(port->owner());
86   com->get_uart(n)->cts_w(state);
87}
88
89static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_0 ) { pc_com_rx(device, state, 0); }
90static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_0 ) { pc_com_dcd(device, state, 0); }
91static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_0 ) { pc_com_dsr(device, state, 0); }
92static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_0 ) { pc_com_ri(device, state, 0); }
93static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_0 ) { pc_com_cts(device, state, 0); }
94
95static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_1 ) { pc_com_rx(device, state, 1); }
96static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_1 ) { pc_com_dcd(device, state, 1); }
97static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_1 ) { pc_com_dsr(device, state, 1); }
98static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_1 ) { pc_com_ri(device, state, 1); }
99static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_1 ) { pc_com_cts(device, state, 1); }
100
101static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_2 ) { pc_com_rx(device, state, 2); }
102static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_2 ) { pc_com_dcd(device, state, 2); }
103static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_2 ) { pc_com_dsr(device, state, 2); }
104static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_2 ) { pc_com_ri(device, state, 2); }
105static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_2 ) { pc_com_cts(device, state, 2); }
106
107static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_3 ) { pc_com_rx(device, state, 3); }
108static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_3 ) { pc_com_dcd(device, state, 3); }
109static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_3 ) { pc_com_dsr(device, state, 3); }
110static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_3 ) { pc_com_ri(device, state, 3); }
111static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_3 ) { pc_com_cts(device, state, 3); }
112
56113static const ins8250_interface genpc_com_interface[4]=
57114{
58115   {
59      1843200,
116      DEVCB_LINE(pc_com_tx_0),
117      DEVCB_LINE(pc_com_dtr_0),
118      DEVCB_LINE(pc_com_rts_0),
60119      DEVCB_LINE(pc_com_interrupt_1),
61      pc_com_tx_0,
62      pc_com_handshake_out_0,
63      NULL
120      DEVCB_NULL,
121      DEVCB_NULL
64122   },
65123   {
66      1843200,
124      DEVCB_LINE(pc_com_tx_1),
125      DEVCB_LINE(pc_com_dtr_1),
126      DEVCB_LINE(pc_com_rts_1),
67127      DEVCB_LINE(pc_com_interrupt_2),
68      pc_com_tx_1,
69      pc_com_handshake_out_1,
70      NULL
128      DEVCB_NULL,
129      DEVCB_NULL
71130   },
72131   {
73      1843200,
132      DEVCB_LINE(pc_com_tx_2),
133      DEVCB_LINE(pc_com_dtr_2),
134      DEVCB_LINE(pc_com_rts_2),
74135      DEVCB_LINE(pc_com_interrupt_1),
75      pc_com_tx_2,
76      pc_com_handshake_out_2,
77      NULL
136      DEVCB_NULL,
137      DEVCB_NULL
78138   },
79139   {
80      1843200,
140      DEVCB_LINE(pc_com_tx_3),
141      DEVCB_LINE(pc_com_dtr_3),
142      DEVCB_LINE(pc_com_rts_3),
81143      DEVCB_LINE(pc_com_interrupt_2),
82      pc_com_tx_3,
83      pc_com_handshake_out_3,
84      NULL
144      DEVCB_NULL,
145      DEVCB_NULL
85146   }
86147};
87148
88149static const rs232_port_interface serport_config[4] =
89150{
90151   {
91      DEVCB_HANDLER( pc_com_rx_0 ),
92      DEVCB_NULL,
93      DEVCB_NULL,
94      DEVCB_NULL,
95      DEVCB_NULL,
96      DEVCB_NULL
152      DEVCB_LINE( pc_com_rx_0 ),
153      DEVCB_LINE( pc_com_dcd_0 ),
154      DEVCB_LINE( pc_com_dsr_0 ),
155      DEVCB_LINE( pc_com_ri_0 ),
156      DEVCB_LINE( pc_com_cts_0 )
97157   },
98158   {
99      DEVCB_HANDLER( pc_com_rx_1 ),
100      DEVCB_NULL,
101      DEVCB_NULL,
102      DEVCB_NULL,
103      DEVCB_NULL,
104      DEVCB_NULL
159      DEVCB_LINE( pc_com_rx_1 ),
160      DEVCB_LINE( pc_com_dcd_1 ),
161      DEVCB_LINE( pc_com_dsr_1 ),
162      DEVCB_LINE( pc_com_ri_1 ),
163      DEVCB_LINE( pc_com_cts_1 )
105164   },
106165   {
107      DEVCB_HANDLER( pc_com_rx_2 ),
108      DEVCB_NULL,
109      DEVCB_NULL,
110      DEVCB_NULL,
111      DEVCB_NULL,
112      DEVCB_NULL
166      DEVCB_LINE( pc_com_rx_2 ),
167      DEVCB_LINE( pc_com_dcd_2 ),
168      DEVCB_LINE( pc_com_dsr_2 ),
169      DEVCB_LINE( pc_com_ri_2 ),
170      DEVCB_LINE( pc_com_cts_2 )
113171   },
114172   {
115      DEVCB_HANDLER( pc_com_rx_3 ),
116      DEVCB_NULL,
117      DEVCB_NULL,
118      DEVCB_NULL,
119      DEVCB_NULL,
120      DEVCB_NULL
173      DEVCB_LINE( pc_com_rx_3 ),
174      DEVCB_LINE( pc_com_dcd_3 ),
175      DEVCB_LINE( pc_com_dsr_3 ),
176      DEVCB_LINE( pc_com_ri_3 ),
177      DEVCB_LINE( pc_com_cts_3 )
121178   }
122179};
123180
124181static SLOT_INTERFACE_START(isa_com)
125182   SLOT_INTERFACE("microsoft_mouse", MSFT_SERIAL_MOUSE)
126   SLOT_INTERFACE("mouse_systems_mouse", MSYSTEM_SERIAL_MOUSE)
183   SLOT_INTERFACE("msystems_mouse", MSYSTEM_SERIAL_MOUSE)
184   SLOT_INTERFACE("serial_terminal", SERIAL_TERMINAL)
185   SLOT_INTERFACE("null_modem", NULL_MODEM)
127186SLOT_INTERFACE_END
128187
129188static MACHINE_CONFIG_FRAGMENT( com_config )
130   MCFG_INS8250_ADD( "uart_0", genpc_com_interface[0] )
131   MCFG_INS8250_ADD( "uart_1", genpc_com_interface[1] )
132   MCFG_INS8250_ADD( "uart_2", genpc_com_interface[2] )
133   MCFG_INS8250_ADD( "uart_3", genpc_com_interface[3] )
189   MCFG_INS8250_ADD( "uart_0", genpc_com_interface[0], XTAL_1_8432MHz )
190   MCFG_INS8250_ADD( "uart_1", genpc_com_interface[1], XTAL_1_8432MHz )
191   MCFG_INS8250_ADD( "uart_2", genpc_com_interface[2], XTAL_1_8432MHz )
192   MCFG_INS8250_ADD( "uart_3", genpc_com_interface[3], XTAL_1_8432MHz )
134193   MCFG_RS232_PORT_ADD( "serport0", serport_config[0], isa_com, "microsoft_mouse", NULL )
135194   MCFG_RS232_PORT_ADD( "serport1", serport_config[1], isa_com, NULL, NULL )
136   MCFG_RS232_PORT_ADD( "serport2", serport_config[3], isa_com, NULL, NULL )
137   MCFG_RS232_PORT_ADD( "serport3", serport_config[4], isa_com, NULL, NULL )
195   MCFG_RS232_PORT_ADD( "serport2", serport_config[2], isa_com, NULL, NULL )
196   MCFG_RS232_PORT_ADD( "serport3", serport_config[3], isa_com, NULL, NULL )
138197MACHINE_CONFIG_END
139198
140199//**************************************************************************
r14535r14536
181240void isa8_com_device::device_start()
182241{
183242   set_isa_device();
184   m_uart[0] = subdevice("uart_0");
185   m_uart[1] = subdevice("uart_1");
186   m_uart[2] = subdevice("uart_2");
187   m_uart[3] = subdevice("uart_3");
188   m_isa->install_device(m_uart[0], 0x03f8, 0x03ff, 0, 0, FUNC(ins8250_r), FUNC(ins8250_w) );
189   m_isa->install_device(m_uart[1], 0x02f8, 0x02ff, 0, 0, FUNC(ins8250_r), FUNC(ins8250_w) );
190   m_isa->install_device(m_uart[2], 0x03e8, 0x03ef, 0, 0, FUNC(ins8250_r), FUNC(ins8250_w) );
191   m_isa->install_device(m_uart[3], 0x02e8, 0x02ef, 0, 0, FUNC(ins8250_r), FUNC(ins8250_w) );
243   m_uart[0] = subdevice<ins8250_uart_device>("uart_0");
244   m_uart[1] = subdevice<ins8250_uart_device>("uart_1");
245   m_uart[2] = subdevice<ins8250_uart_device>("uart_2");
246   m_uart[3] = subdevice<ins8250_uart_device>("uart_3");
247   m_isa->install_device(0x03f8, 0x03ff, 0, 0, read8_delegate(FUNC(ins8250_device::ins8250_r), m_uart[0]), write8_delegate(FUNC(ins8250_device::ins8250_w), m_uart[0]) );
248   m_isa->install_device(0x02f8, 0x02ff, 0, 0, read8_delegate(FUNC(ins8250_device::ins8250_r), m_uart[1]), write8_delegate(FUNC(ins8250_device::ins8250_w), m_uart[1]) );
249   m_isa->install_device(0x03e8, 0x03ef, 0, 0, read8_delegate(FUNC(ins8250_device::ins8250_r), m_uart[2]), write8_delegate(FUNC(ins8250_device::ins8250_w), m_uart[2]) );
250   m_isa->install_device(0x02e8, 0x02ef, 0, 0, read8_delegate(FUNC(ins8250_device::ins8250_r), m_uart[3]), write8_delegate(FUNC(ins8250_device::ins8250_w), m_uart[3]) );
192251
193252   m_serport[0] = subdevice<rs232_port_device>("serport0");
194253   m_serport[1] = subdevice<rs232_port_device>("serport1");
r14535r14536
205264}
206265
207266static MACHINE_CONFIG_FRAGMENT( com_at_config )
208   MCFG_NS16450_ADD( "uart_0", genpc_com_interface[0] ) /* Verified: IBM P/N 6320947 Serial/Parallel card uses an NS16450N */
209   MCFG_NS16450_ADD( "uart_1", genpc_com_interface[1] )
210   MCFG_NS16450_ADD( "uart_2", genpc_com_interface[2] )
211   MCFG_NS16450_ADD( "uart_3", genpc_com_interface[3] )
267   MCFG_NS16450_ADD( "uart_0", genpc_com_interface[0], XTAL_1_8432MHz ) /* Verified: IBM P/N 6320947 Serial/Parallel card uses an NS16450N */
268   MCFG_NS16450_ADD( "uart_1", genpc_com_interface[1], XTAL_1_8432MHz )
269   MCFG_NS16450_ADD( "uart_2", genpc_com_interface[2], XTAL_1_8432MHz )
270   MCFG_NS16450_ADD( "uart_3", genpc_com_interface[3], XTAL_1_8432MHz )
212271   MCFG_RS232_PORT_ADD( "serport0", serport_config[0], isa_com, "microsoft_mouse", NULL )
213272   MCFG_RS232_PORT_ADD( "serport1", serport_config[1], isa_com, NULL, NULL )
214   MCFG_RS232_PORT_ADD( "serport2", serport_config[3], isa_com, NULL, NULL )
215   MCFG_RS232_PORT_ADD( "serport3", serport_config[4], isa_com, NULL, NULL )
273   MCFG_RS232_PORT_ADD( "serport2", serport_config[2], isa_com, NULL, NULL )
274   MCFG_RS232_PORT_ADD( "serport3", serport_config[3], isa_com, NULL, NULL )
216275MACHINE_CONFIG_END
217276
218277//**************************************************************************
src/mess/machine/isa_com.h
r14535r14536
66#include "emu.h"
77#include "machine/isa.h"
88#include "machine/serial.h"
9#include "machine/ins8250.h"
910
1011//**************************************************************************
1112//  TYPE DEFINITIONS
r14535r14536
2627      virtual machine_config_constructor device_mconfig_additions() const;
2728
2829      rs232_port_device *get_port(int port) { return m_serport[port]; }
29      device_t *get_uart(int dev) { return m_uart[dev]; }
30      ins8250_uart_device *get_uart(int dev) { return m_uart[dev]; }
3031protected:
3132        // device-level overrides
3233        virtual void device_start();
r14535r14536
3435
3536private:
3637        // internal state
37   device_t *m_uart[4];
38   ins8250_uart_device *m_uart[4];
3839   rs232_port_device *m_serport[4];
3940};
4041
src/mess/machine/bebox.c
r14535r14536
357357 *
358358 *************************************/
359359
360static INS8250_TRANSMIT( bebox_uart_transmit )
361{
362   if (LOG_UART)
363      logerror("bebox_uart_transmit(): data=0x%02X\n", data);
364}
365
366
367static INS8250_HANDSHAKE_OUT( bebox_uart_handshake )
368{
369   if (LOG_UART)
370      logerror("bebox_uart_handshake(): data=0x%02X\n", data);
371}
372
373
374360const ins8250_interface bebox_uart_inteface_0 =
375361{
376   0,
377362   DEVCB_NULL,
378   NULL,
379   NULL,
380   NULL
363   DEVCB_NULL,
364   DEVCB_NULL,
365   DEVCB_NULL,
366   DEVCB_NULL,
367   DEVCB_NULL
381368};
382369
383370const ins8250_interface bebox_uart_inteface_1 =
384371{
385   0,
386372   DEVCB_NULL,
387   NULL,
388   NULL,
389   NULL
373   DEVCB_NULL,
374   DEVCB_NULL,
375   DEVCB_NULL,
376   DEVCB_NULL,
377   DEVCB_NULL
390378};
391379
392380const ins8250_interface bebox_uart_inteface_2 =
393381{
394   0,
395382   DEVCB_NULL,
396   NULL,
397   NULL,
398   NULL
383   DEVCB_NULL,
384   DEVCB_NULL,
385   DEVCB_NULL,
386   DEVCB_NULL,
387   DEVCB_NULL
399388};
400389
401390const ins8250_interface bebox_uart_inteface_3 =
402391{
403   0,
404392   DEVCB_NULL,
405   bebox_uart_transmit,
406   bebox_uart_handshake,
407   NULL
393   DEVCB_NULL,
394   DEVCB_NULL,
395   DEVCB_NULL,
396   DEVCB_NULL,
397   DEVCB_NULL
408398};
409399
410400
src/mess/machine/pc.c
r14535r14536
2626
2727#include "machine/pit8253.h"
2828
29#include "machine/pc_mouse.h"
3029#include "machine/pckeybrd.h"
3130#include "machine/pc_lpt.h"
3231#include "machine/pc_fdc.h"
r14535r14536
357356   pic8259_ir3_w(st->m_pic8259, state);
358357}
359358
360/* called when com registers read/written - used to update peripherals that
361are connected */
362static void pc_com_refresh_connected_common(device_t *device, int n, int data)
359static void pc_com_tx(device_t *uart, UINT8 state, const char *portn)
363360{
364   /* mouse connected to this port? */
365   //if (input_port_read(device->machine(), "DSW2") & (0x80>>n))
366//      pc_mouse_handshake_in(device,data);
361   rs232_port_device *port = uart->owner()->subdevice<rs232_port_device>(portn);
362   port->tx(state);
367363}
368364
369static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_0 ) { pc_com_refresh_connected_common( device, 0, data ); }
370static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_1 ) { pc_com_refresh_connected_common( device, 1, data ); }
371static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_2 ) { pc_com_refresh_connected_common( device, 2, data ); }
372static INS8250_HANDSHAKE_OUT( pc_com_handshake_out_3 ) { pc_com_refresh_connected_common( device, 3, data ); }
365static void pc_com_dtr(device_t *uart, UINT8 state, const char *portn)
366{
367   rs232_port_device *port = uart->owner()->subdevice<rs232_port_device>(portn);
368   port->dtr_w(state);
369}
373370
371static void pc_com_rts(device_t *uart, UINT8 state, const char *portn)
372{
373   rs232_port_device *port = uart->owner()->subdevice<rs232_port_device>(portn);
374   port->rts_w(state);
375}
376
377static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_0 ) { pc_com_tx(device, state, "serport0"); }
378static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_0 ) { pc_com_dtr(device, state, "serport0"); }
379static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_0 ) { pc_com_rts(device, state, "serport0"); }
380
381static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_1 ) { pc_com_tx(device, state, "serport1"); }
382static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_1 ) { pc_com_dtr(device, state, "serport1"); }
383static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_1 ) { pc_com_rts(device, state, "serport1"); }
384
385static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_2 ) { pc_com_tx(device, state, "serport2"); }
386static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_2 ) { pc_com_dtr(device, state, "serport2"); }
387static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_2 ) { pc_com_rts(device, state, "serport2"); }
388
389static WRITE_LINE_DEVICE_HANDLER( pc_com_tx_3 ) { pc_com_tx(device, state, "serport3"); }
390static WRITE_LINE_DEVICE_HANDLER( pc_com_dtr_3 ) { pc_com_dtr(device, state, "serport3"); }
391static WRITE_LINE_DEVICE_HANDLER( pc_com_rts_3 ) { pc_com_rts(device, state, "serport3"); }
392
393static void pc_com_rx(device_t *port, UINT8 state, const char *uartn)
394{
395   ins8250_uart_device *uart = port->owner()->subdevice<ins8250_uart_device>(uartn);
396   uart->rx_w(state);
397}
398
399static void pc_com_dcd(device_t *port, UINT8 state, const char *uartn)
400{
401   ins8250_uart_device *uart = port->owner()->subdevice<ins8250_uart_device>(uartn);
402   uart->dcd_w(state);
403}
404
405static void pc_com_dsr(device_t *port, UINT8 state, const char *uartn)
406{
407   ins8250_uart_device *uart = port->owner()->subdevice<ins8250_uart_device>(uartn);
408   uart->dsr_w(state);
409}
410
411static void pc_com_ri(device_t *port, UINT8 state, const char *uartn)
412{
413   ins8250_uart_device *uart = port->owner()->subdevice<ins8250_uart_device>(uartn);
414   uart->ri_w(state);
415}
416
417static void pc_com_cts(device_t *port, UINT8 state, const char *uartn)
418{
419   ins8250_uart_device *uart = port->owner()->subdevice<ins8250_uart_device>(uartn);
420   uart->cts_w(state);
421}
422
423static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_0 ) { pc_com_rx(device, state, "ins8250_0"); }
424static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_0 ) { pc_com_dcd(device, state, "ins8250_0"); }
425static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_0 ) { pc_com_dsr(device, state, "ins8250_0"); }
426static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_0 ) { pc_com_ri(device, state, "ins8250_0"); }
427static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_0 ) { pc_com_cts(device, state, "ins8250_0"); }
428
429static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_1 ) { pc_com_rx(device, state, "ins8250_1"); }
430static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_1 ) { pc_com_dcd(device, state, "ins8250_1"); }
431static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_1 ) { pc_com_dsr(device, state, "ins8250_1"); }
432static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_1 ) { pc_com_ri(device, state, "ins8250_1"); }
433static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_1 ) { pc_com_cts(device, state, "ins8250_1"); }
434
435static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_2 ) { pc_com_rx(device, state, "ins8250_2"); }
436static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_2 ) { pc_com_dcd(device, state, "ins8250_2"); }
437static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_2 ) { pc_com_dsr(device, state, "ins8250_2"); }
438static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_2 ) { pc_com_ri(device, state, "ins8250_2"); }
439static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_2 ) { pc_com_cts(device, state, "ins8250_2"); }
440
441static WRITE_LINE_DEVICE_HANDLER( pc_com_rx_3 ) { pc_com_rx(device, state, "ins8250_3"); }
442static WRITE_LINE_DEVICE_HANDLER( pc_com_dcd_3 ) { pc_com_dcd(device, state, "ins8250_3"); }
443static WRITE_LINE_DEVICE_HANDLER( pc_com_dsr_3 ) { pc_com_dsr(device, state, "ins8250_3"); }
444static WRITE_LINE_DEVICE_HANDLER( pc_com_ri_3 ) { pc_com_ri(device, state, "ins8250_3"); }
445static WRITE_LINE_DEVICE_HANDLER( pc_com_cts_3 ) { pc_com_cts(device, state, "ins8250_3"); }
446
374447/* PC interface to PC-com hardware. Done this way because PCW16 also
375448uses PC-com hardware and doesn't have the same setup! */
376449const ins8250_interface ibm5150_com_interface[4]=
377450{
378451   {
379      1843200,
452      DEVCB_LINE(pc_com_tx_0),
453      DEVCB_LINE(pc_com_dtr_0),
454      DEVCB_LINE(pc_com_rts_0),
380455      DEVCB_LINE(pc_com_interrupt_1),
381      NULL,
382      pc_com_handshake_out_0,
383      NULL
456      DEVCB_NULL,
457      DEVCB_NULL
384458   },
385459   {
386      1843200,
460      DEVCB_LINE(pc_com_tx_1),
461      DEVCB_LINE(pc_com_dtr_1),
462      DEVCB_LINE(pc_com_rts_1),
387463      DEVCB_LINE(pc_com_interrupt_2),
388      NULL,
389      pc_com_handshake_out_1,
390      NULL
464      DEVCB_NULL,
465      DEVCB_NULL
391466   },
392467   {
393      1843200,
468      DEVCB_LINE(pc_com_tx_2),
469      DEVCB_LINE(pc_com_dtr_2),
470      DEVCB_LINE(pc_com_rts_2),
394471      DEVCB_LINE(pc_com_interrupt_1),
395      NULL,
396      pc_com_handshake_out_2,
397      NULL
472      DEVCB_NULL,
473      DEVCB_NULL
398474   },
399475   {
400      1843200,
476      DEVCB_LINE(pc_com_tx_3),
477      DEVCB_LINE(pc_com_dtr_3),
478      DEVCB_LINE(pc_com_rts_3),
401479      DEVCB_LINE(pc_com_interrupt_2),
402      NULL,
403      pc_com_handshake_out_3,
404      NULL
480      DEVCB_NULL,
481      DEVCB_NULL
405482   }
406483};
407484
485const rs232_port_interface ibm5150_serport_config[4] =
486{
487   {
488      DEVCB_LINE( pc_com_rx_0 ),
489      DEVCB_LINE( pc_com_dcd_0 ),
490      DEVCB_LINE( pc_com_dsr_0 ),
491      DEVCB_LINE( pc_com_ri_0 ),
492      DEVCB_LINE( pc_com_cts_0 )
493   },
494   {
495      DEVCB_LINE( pc_com_rx_1 ),
496      DEVCB_LINE( pc_com_dcd_1 ),
497      DEVCB_LINE( pc_com_dsr_1 ),
498      DEVCB_LINE( pc_com_ri_1 ),
499      DEVCB_LINE( pc_com_cts_1 )
500   },
501   {
502      DEVCB_LINE( pc_com_rx_2 ),
503      DEVCB_LINE( pc_com_dcd_2 ),
504      DEVCB_LINE( pc_com_dsr_2 ),
505      DEVCB_LINE( pc_com_ri_2 ),
506      DEVCB_LINE( pc_com_cts_2 )
507   },
508   {
509      DEVCB_LINE( pc_com_rx_3 ),
510      DEVCB_LINE( pc_com_dcd_3 ),
511      DEVCB_LINE( pc_com_dsr_3 ),
512      DEVCB_LINE( pc_com_ri_3 ),
513      DEVCB_LINE( pc_com_cts_3 )
514   }
515};
408516
409517/**********************************************************
410518 *
r14535r14536
9731081   /* MESS managed RAM */
9741082   if ( machine.device<ram_device>(RAM_TAG)->pointer() )
9751083      memory_set_bankptr( machine, "bank10", machine.device<ram_device>(RAM_TAG)->pointer() );
976
977   /* serial mouse */
978   //pc_mouse_initialise(machine);
9791084}
9801085
9811086
r14535r14536
11391244   st->m_ppi_shift_register = 0;
11401245   st->m_ppi_shift_enable = 0;
11411246
1142   //pc_mouse_set_serial_port( machine.device("ins8250_0") );
11431247   speaker_level_w( speaker, 0 );
11441248}
11451249
r14535r14536
11781282   st->m_ppi_data_signal = 0;
11791283   st->m_ppi_shift_register = 0;
11801284   st->m_ppi_shift_enable = 0;
1181   //pc_mouse_set_serial_port( machine.device("ins8250_0") );
11821285   speaker_level_w( speaker, 0 );
11831286
11841287   pcjr_keyb_init(machine);
src/mess/machine/ser_mouse.c
r14535r14536
1414
1515serial_mouse_device::serial_mouse_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock)
1616   : device_t(mconfig, type, name, tag, owner, clock),
17      device_rs232_port_interface(mconfig, *this)
17     device_rs232_port_interface(mconfig, *this),
18     device_serial_interface(mconfig, *this)
1819{
1920}
2021
r14535r14536
3334   m_owner = dynamic_cast<rs232_port_device *>(owner());
3435   m_timer = timer_alloc();
3536   m_enabled = false;
37   set_frame();
3638}
3739
3840void serial_mouse_device::device_reset()
3941{
40   m_head = m_tail = 0;
42   m_head = m_tail = m_count = 0;
43   tx(0);
44   m_dcd = 0;
45   m_owner->out_dcd(0);
46   m_dsr = 0;
47   m_owner->out_dsr(0);
48   m_ri = 0;
49   m_owner->out_ri(0);
50   m_cts = 0;
51   m_owner->out_cts(0);
4152}
4253
4354/**************************************************************************
r14535r14536
5162   int mbc;
5263
5364   /* Do not get deltas or send packets if queue is not empty (Prevents drifting) */
54   if (m_head==m_tail)
65   if ((m_head==m_tail) && (m_count == 0))
5566   {
5667      nx = input_port_read(*this, "ser_mouse_x");
5768
r14535r14536
7687         mouse_trans(dx, dy, nb, mbc);
7788   }
7889
79   if( m_tail != m_head )
90   ++m_count %= 8;
91
92   if(is_transmit_register_empty())
8093   {
81      UINT8 data = unqueue_data();
82      m_rdata = data;
83      m_owner->out_rx8(data);
94      if(m_tail != m_head)
95         transmit_register_setup(unqueue_data());
8496   }
97   else
98   {
99      m_rbit = transmit_register_get_data_bit();
100      m_owner->out_rx(m_rbit);
101   }
85102}
86103   
87104void microsoft_mouse_device::mouse_trans(int dx, int dy, int nb, int mbc)
r14535r14536
164181void serial_mouse_device::set_mouse_enable(bool state)
165182{
166183   if(state && !m_enabled)
167      m_timer->adjust(attotime::zero, 0, attotime::from_hz(240));
184      m_timer->adjust(attotime::zero, 0, attotime::from_hz(1200));
168185   else if(!state && m_enabled)
169186   {
170      m_timer->adjust(attotime::zero);
187      m_timer->adjust(attotime::never);
171188      m_head = m_tail = 0;
172189   }
173190   m_enabled = state;
src/mess/machine/ser_mouse.h
r14535r14536
1212
1313class serial_mouse_device :
1414      public device_t,
15      public device_rs232_port_interface
15      public device_rs232_port_interface,
16      public device_serial_interface
1617{
1718public:
1819   serial_mouse_device(const machine_config &mconfig, device_type type, const char* name, const char *tag, device_t *owner, UINT32 clock);
r14535r14536
2425   virtual void device_reset();
2526   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
2627   virtual void mouse_trans(int dx, int dy, int nb, int mbc) = 0;
28   virtual void set_frame() = 0;
2729   void set_mouse_enable(bool state);
2830   void queue_data(UINT8 data) {m_queue[m_head] = data; ++m_head %= 256;}
2931   UINT8 unqueue_data() {UINT8 ret = m_queue[m_tail]; ++m_tail %= 256; return ret;}
32   virtual void input_callback(UINT8 state) { m_input_state = state; }
3033private:
3134   UINT8 m_queue[256];
3235   UINT8 m_head, m_tail, m_mb;
r14535r14536
3437   emu_timer *m_timer;
3538   rs232_port_device *m_owner;
3639   bool m_enabled;
40   int m_count;
3741};
3842
3943class microsoft_mouse_device : public serial_mouse_device
r14535r14536
4347   virtual void dtr_w(UINT8 state) { m_dtr = state; check_state(); }
4448   virtual void rts_w(UINT8 state) { m_rts = state; check_state(); m_old_rts = state; }
4549protected:
50   virtual void set_frame() { set_data_frame(7, 1, SERIAL_PARITY_NONE); }
4651   virtual void mouse_trans(int dx, int dy, int nb, int mbc);
4752   virtual void device_reset() {m_old_rts = 0; serial_mouse_device::device_reset();}
4853private:
r14535r14536
5863   virtual void dtr_w(UINT8 state) { m_dtr = state; check_state(); }
5964   virtual void rts_w(UINT8 state) { m_rts = state; check_state(); }
6065protected:
66   virtual void set_frame() { set_data_frame(8, 1, SERIAL_PARITY_NONE); }
6167   virtual void mouse_trans(int dx, int dy, int nb, int mbc);
6268private:
6369   void check_state() { set_mouse_enable((m_dtr && m_rts)?true:false); }
src/mess/machine/terminal.c
r14535r14536
77enum
88{
99   START = 0,
10   STOP = 9
10   STOP = 9,
11   DONE = 10
1112};
1213
1314#define TERMINAL_WIDTH 80
r14535r14536
223224
224225   switch (term->tx_state)
225226   {
227   case DONE:
228      break;
226229   case STOP:
227230      data = 1;
231      term->tx_state++;
228232      break;
229233
230234   case START:
r14535r14536
313317/***************************************************************************
314318    VIDEO HARDWARE
315319***************************************************************************/
316static void generic_terminal_update(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect)
320static void generic_terminal_update(device_t *device, bitmap_rgb32 &bitmap, const rectangle &cliprect)
317321{
318322   terminal_state *term = get_safe_token(device);
319323   UINT8 options = input_port_read(*device, "TERM_CONF");
320324   UINT16 cursor = term->y_pos * TERMINAL_WIDTH + term->x_pos;
321325   UINT8 y,ra,chr,gfx;
322326   UINT16 sy=0,ma=0,x;
327   UINT32 font_color;
328   switch (options & 0x30)
329   {
330   case 0x10:
331      font_color = 0x00ff7e00;
332      break;
333   case 0x20:
334      font_color = 0x00ffffff;
335      break;
336   default:
337      font_color = 0x0000ff00;
338      break;
339   }
323340
324341   term->framecnt++;
325342
r14535r14536
327344   {
328345      for (ra = 0; ra < 10; ra++)
329346      {
330         UINT16  *p = &bitmap.pix16(sy++);
347         UINT32  *p = &bitmap.pix32(sy++);
331348
332349         for (x = ma; x < ma + TERMINAL_WIDTH; x++)
333350         {
r14535r14536
352369            }
353370
354371            /* Display a scanline of a character */
355            *p++ = BIT( gfx, 7 );
356            *p++ = BIT( gfx, 6 );
357            *p++ = BIT( gfx, 5 );
358            *p++ = BIT( gfx, 4 );
359            *p++ = BIT( gfx, 3 );
360            *p++ = BIT( gfx, 2 );
361            *p++ = BIT( gfx, 1 );
362            *p++ = BIT( gfx, 0 );
372            *p++ = (BIT( gfx, 7 ))?font_color:0;
373            *p++ = (BIT( gfx, 6 ))?font_color:0;
374            *p++ = (BIT( gfx, 5 ))?font_color:0;
375            *p++ = (BIT( gfx, 4 ))?font_color:0;
376            *p++ = (BIT( gfx, 3 ))?font_color:0;
377            *p++ = (BIT( gfx, 2 ))?font_color:0;
378            *p++ = (BIT( gfx, 1 ))?font_color:0;
379            *p++ = (BIT( gfx, 0 ))?font_color:0;
363380         }
364381      }
365382      ma+=TERMINAL_WIDTH;
r14535r14536
378395   return 0;
379396}
380397
381UINT8 terminal_keyboard_handler(running_machine &machine, devcb_resolved_write8 &callback, UINT8 last_code, UINT8 *scan_line, UINT8 *tx_shift, int *tx_state, device_t *device)
398UINT8 terminal_keyboard_handler(running_machine &machine, UINT8 last_code, UINT8 *scan_line, UINT8 *tx_shift, int *tx_state, device_t *device)
382399{
383400   static const char *const keynames[] = { "TERM_LINE0", "TERM_LINE1", "TERM_LINE2", "TERM_LINE3", "TERM_LINE4", "TERM_LINE5", "TERM_LINE6", "TERM_LINE7" };
384401   int i;
r14535r14536
468485            }
469486         }
470487         if (last_code != key_code ) {
471            callback(0, key_code);
472488            if (tx_shift) *tx_shift = key_code;
473489            if (tx_state) *tx_state = START;
474490         }
r14535r14536
485501
486502static TIMER_CALLBACK(keyboard_callback)
487503{
504   UINT8 new_code;
488505   terminal_state *term = get_safe_token((device_t *)ptr);
489   term->last_code = terminal_keyboard_handler(machine, term->terminal_keyboard_func, term->last_code, &term->scan_line, &term->tx_shift, &term->tx_state, (device_t *)ptr);
506   new_code = terminal_keyboard_handler(machine, term->last_code, &term->scan_line, &term->tx_shift, &term->tx_state, (device_t *)ptr);
507   if(term->last_code != new_code)
508      term->terminal_keyboard_func(0, new_code);
509   term->last_code = new_code;
490510}
491511
512static TIMER_CALLBACK(serial_callback)
513{
514   static int count = 0;
515   terminal_state *term = get_safe_token((device_t *)ptr);
516   if(term->tx_state == DONE) {
517      if(count == 0) {
518         term->last_code = terminal_keyboard_handler(machine, term->last_code, &term->scan_line, &term->tx_shift, &term->tx_state, (device_t *)ptr);
519      } else
520         ++count %= 8;
521   } else
522      term->terminal_keyboard_func(0, terminal_serial_r((device_t *)ptr));
523}
524
492525/***************************************************************************
493526    VIDEO HARDWARE
494527***************************************************************************/
495static VIDEO_START( terminal )
496{
497528
498}
499
500static SCREEN_UPDATE_IND16(terminal )
529static SCREEN_UPDATE_RGB32(terminal )
501530{
502   device_t *devconf = screen.machine().device(TERMINAL_TAG);
531   device_t *devconf = screen.owner();
503532   generic_terminal_update( devconf, bitmap, cliprect);
504533   return 0;
505534}
506535
507MACHINE_CONFIG_FRAGMENT( generic_terminal )
536static MACHINE_CONFIG_FRAGMENT( generic_terminal )
508537   MCFG_SCREEN_ADD(TERMINAL_SCREEN_TAG, RASTER)
509538   MCFG_SCREEN_REFRESH_RATE(50)
510539   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
511540   MCFG_SCREEN_SIZE(TERMINAL_WIDTH*8, TERMINAL_HEIGHT*10)
512541   MCFG_SCREEN_VISIBLE_AREA(0, TERMINAL_WIDTH*8-1, 0, TERMINAL_HEIGHT*10-1)
513542   MCFG_SCREEN_UPDATE_STATIC(terminal)
514
515   MCFG_PALETTE_LENGTH(2)
516   MCFG_PALETTE_INIT(monochrome_green)
517
518   MCFG_VIDEO_START(terminal)
519543MACHINE_CONFIG_END
520544
521545
r14535r14536
527551{
528552   terminal_state *term = get_safe_token(device);
529553   const terminal_interface *intf = get_interface(device);
554   if(dynamic_cast<serial_terminal_device *>(device->owner()))
555      term->terminal_keyboard_func.resolve(intf->terminal_keyboard_func, *device->owner());
556   else
557      term->terminal_keyboard_func.resolve(intf->terminal_keyboard_func, *device);
530558
531   term->terminal_keyboard_func.resolve(intf->terminal_keyboard_func, *device);
532
533   if (!term->terminal_keyboard_func.isnull())
559   if (device->clock())
560      device->machine().scheduler().timer_pulse(attotime::from_hz(device->clock()), FUNC(serial_callback), 0, (void*)device);
561   else if (!term->terminal_keyboard_func.isnull())
534562      device->machine().scheduler().timer_pulse(attotime::from_hz(2400), FUNC(keyboard_callback), 0, (void*)device);
535563}
536564
r14535r14536
682710   PORT_CONFNAME( 0x08, 0x08, "Invert")
683711   PORT_CONFSETTING(    0x00, DEF_STR(No))
684712   PORT_CONFSETTING(    0x08, DEF_STR(Yes))
713   PORT_CONFNAME( 0x30, 0x00, "Color")
714   PORT_CONFSETTING(    0x00, "Green")
715   PORT_CONFSETTING(    0x10, "Amber")
716   PORT_CONFSETTING(    0x20, "White")
685717INPUT_PORTS_END
686718
687719/*-------------------------------------------------
r14535r14536
702734      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(terminal);               break;
703735
704736      case DEVINFO_PTR_INPUT_PORTS:               info->ipt = INPUT_PORTS_NAME(generic_terminal);            break;
737      case DEVINFO_PTR_MACHINE_CONFIG:            info->machine_config = MACHINE_CONFIG_NAME(generic_terminal); break;
705738      /* --- the following bits of info are returned as NULL-terminated strings --- */
706739      case DEVINFO_STR_NAME:                     strcpy(info->s, "Generic Terminal");                  break;
707740      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Terminal");                        break;
r14535r14536
712745}
713746
714747DEFINE_LEGACY_DEVICE(GENERIC_TERMINAL, terminal);
748
749serial_terminal_device::serial_terminal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
750      : device_t(mconfig, SERIAL_TERMINAL, "Serial Terminal", tag, owner, clock),
751        device_serial_port_interface(mconfig, *this),
752        m_terminal(*this, TERMINAL_TAG)
753{
754}
755
756static const terminal_interface serial_terminal_terminal_interface = {
757      DEVCB_MEMBER(serial_terminal_device, serial_keyboard_func)
758};
759
760static MACHINE_CONFIG_FRAGMENT(serial_terminal_config)
761      MCFG_SERIAL_TERMINAL_ADD(TERMINAL_TAG, serial_terminal_terminal_interface, 9600)
762MACHINE_CONFIG_END
763
764const device_type SERIAL_TERMINAL = &device_creator<serial_terminal_device>;
765
766machine_config_constructor serial_terminal_device::device_mconfig_additions() const
767{
768      return MACHINE_CONFIG_NAME(serial_terminal_config);
769}
770
src/mess/machine/terminal.h
r14535r14536
11#ifndef __TERMINAL_H__
22#define __TERMINAL_H__
33
4#include "emu.h"
5#include "machine/serial.h"
46#include "devcb.h"
57
68/***************************************************************************
r14535r14536
3032#define MCFG_GENERIC_TERMINAL_REMOVE(_tag)      \
3133    MCFG_DEVICE_REMOVE(_tag)
3234
35#define MCFG_SERIAL_TERMINAL_ADD(_tag, _intrf, _baud) \
36   MCFG_DEVICE_ADD(_tag, GENERIC_TERMINAL, _baud) \
37   MCFG_DEVICE_CONFIG(_intrf)
3338
3439/***************************************************************************
3540    FUNCTION PROTOTYPES
r14535r14536
4045
4146WRITE8_DEVICE_HANDLER ( terminal_write );
4247
43MACHINE_CONFIG_EXTERN( generic_terminal );
44
4548INPUT_PORTS_EXTERN(generic_terminal);
4649
47UINT8 terminal_keyboard_handler(running_machine &machine, devcb_resolved_write8 &callback, UINT8 last_code, UINT8 *scan_line, UINT8 *tx_shift, int *tx_state, device_t *device);
50UINT8 terminal_keyboard_handler(running_machine &machine, UINT8 last_code, UINT8 *scan_line, UINT8 *tx_shift, int *tx_state, device_t *device);
4851
52
53class serial_terminal_device :
54      public device_t,
55      public device_serial_port_interface
56{
57public:
58   serial_terminal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
59   virtual machine_config_constructor device_mconfig_additions() const;
60   virtual void tx(UINT8 state) { terminal_serial_w(m_terminal, state); }
61   DECLARE_WRITE8_MEMBER(serial_keyboard_func) { m_rbit = data&&1; m_owner->out_rx(m_rbit); }
62protected:
63   virtual void device_start() { m_owner = dynamic_cast<serial_port_device *>(owner()); }
64private:
65   required_device<device_t> m_terminal;
66   serial_port_device *m_owner;
67};
68
69extern const device_type SERIAL_TERMINAL;
70
4971#endif /* __TERMINAL_H__ */
src/mess/machine/null_modem.c
r0r14536
1#include "machine/null_modem.h"
2
3const device_type NULL_MODEM = &device_creator<null_modem_device>;
4
5null_modem_device::null_modem_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
6   : device_t(mconfig, NULL_MODEM, "Null Modem", tag, owner, clock),
7     device_serial_port_interface(mconfig, *this),
8     m_bitbanger(*this, "bitbanger")
9{
10}
11
12static struct _bitbanger_config null_modem_image_config =
13{
14   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, null_modem_device, read),
15   BITBANGER_MODEM,
16   BITBANGER_9600,
17   BITBANGER_0PERCENT
18};
19
20static MACHINE_CONFIG_FRAGMENT(null_modem_config)
21   MCFG_BITBANGER_ADD("bitbanger", null_modem_image_config);
22MACHINE_CONFIG_END
23
24machine_config_constructor null_modem_device::device_mconfig_additions() const
25{
26   return MACHINE_CONFIG_NAME(null_modem_config);
27}
src/mess/machine/null_modem.h
r0r14536
1#ifndef NULL_MODEM_H_
2#define NULL_MODEM_H_
3
4#include "emu.h"
5#include "machine/serial.h"
6#include "imagedev/bitbngr.h"
7
8class null_modem_device :
9      public device_t,
10      public device_serial_port_interface
11{
12public:
13   null_modem_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
14   virtual machine_config_constructor device_mconfig_additions() const;
15   DECLARE_WRITE_LINE_MEMBER( read ) { m_rbit = state; m_owner->out_rx(state); }
16   virtual void tx(UINT8 state) { m_tbit = state; m_bitbanger->output(state); }
17protected:
18   virtual void device_start() { m_owner = dynamic_cast<serial_port_device *>(owner()); }
19private:
20   serial_port_device *m_owner;
21   required_device<bitbanger_device> m_bitbanger;
22};
23
24extern const device_type NULL_MODEM;
25#endif
src/mess/machine/isa.c
r14535r14536
346346   space->unmap_read(start, end, mask, mirror);
347347}
348348
349bool isa8_device::is_option_rom_space_available(offs_t start, int size)
350{
351   m_maincpu = machine().device(m_cputag);
352   address_space *space = m_maincpu->memory().space(AS_PROGRAM);
353   for(int i = 0; i < size; i += 4096) // 4KB granularity should be enough
354      if(space->get_read_ptr(start + i)) return false;
355   return true;
356}
357
349358// interrupt request from isa card
350359WRITE_LINE_MEMBER( isa8_device::irq2_w ) { m_out_irq2_func(state); }
351360WRITE_LINE_MEMBER( isa8_device::irq3_w ) { m_out_irq3_func(state); }
src/mess/machine/isa.h
r14535r14536
160160
161161   void unmap_bank(offs_t start, offs_t end, offs_t mask, offs_t mirror);
162162   void unmap_rom(offs_t start, offs_t end, offs_t mask, offs_t mirror);
163   bool is_option_rom_space_available(offs_t start, int size);
163164
164165   DECLARE_WRITE_LINE_MEMBER( irq2_w );
165166   DECLARE_WRITE_LINE_MEMBER( irq3_w );
src/mess/includes/pc1512.h
r14535r14536
8686   required_device<device_t> m_pit;
8787   required_device<mc146818_device> m_rtc;
8888   required_device<device_t> m_fdc;
89   required_device<device_t> m_uart;
89   required_device<ins8250_device> m_uart;
9090   required_device<ams40041_device> m_vdu;
9191   required_device<centronics_device> m_centronics;
9292   required_device<device_t> m_speaker;
src/mess/includes/portfoli.h
r14535r14536
4141   required_device<cpu_device> m_maincpu;
4242   required_device<hd61830_device> m_lcdc;
4343   required_device<i8255_device> m_ppi;
44   required_device<device_t> m_uart;
44   required_device<ins8250_device> m_uart;
4545   required_device<device_t> m_speaker;
4646   required_device<timer_device> m_timer_tick;
4747
src/mess/includes/pc.h
r14535r14536
1010#include "machine/ins8250.h"
1111#include "machine/i8255.h"
1212#include "machine/8237dma.h"
13#include "machine/serial.h"
14#include "machine/ser_mouse.h"
1315
1416class pc_state : public driver_device
1517{
r14535r14536
4951extern const struct pic8259_interface ibm5150_pic8259_config;
5052extern const struct pic8259_interface pcjr_pic8259_config;
5153extern const ins8250_interface ibm5150_com_interface[4];
54extern const rs232_port_interface ibm5150_serport_config[4];
5255extern const i8255_interface ibm5150_ppi8255_interface;
5356extern const i8255_interface ibm5160_ppi8255_interface;
5457extern const i8255_interface pc_ppi8255_interface;
src/mess/mess.mak
r14535r14536
515515   $(MESS_MACHINE)/ncr5390.o   \
516516   $(MESS_MACHINE)/pc_lpt.o   \
517517   $(MESS_MACHINE)/cntr_covox.o \
518   $(MESS_MACHINE)/pc_mouse.o   \
519518   $(MESS_MACHINE)/pcf8593.o   \
520519   $(MESS_MACHINE)/rs232.o      \
521520   $(MESS_MACHINE)/scsibus.o   \
r14535r14536
545544   $(MESS_FORMATS)/z80bin.o   \
546545   $(MESS_MACHINE)/n82077aa.o   \
547546   $(MESS_MACHINE)/mb8795.o   \
547   $(MESS_MACHINE)/null_modem.o   \
548548
549549
550550
src/mess/drivers/dectalk.c
r14535r14536
753753
754754    /* Y2 is a 3.579545 MHz xtal for the dtmf decoder chip */
755755
756   MCFG_FRAGMENT_ADD( generic_terminal )
757756   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG,dectalk_terminal_intf)
758757MACHINE_CONFIG_END
759758
src/mess/drivers/msbc1.c
r14535r14536
8484   MCFG_CPU_ADD(MC68000R12_TAG, M68000, XTAL_12_5MHz)
8585   MCFG_CPU_PROGRAM_MAP(msbc1_mem)
8686
87   /* video hardware */
88   MCFG_FRAGMENT_ADD( generic_terminal )
89
9087   // devices
9188   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
9289MACHINE_CONFIG_END
src/mess/drivers/pc1512.c
r14535r14536
559559   else if (addr >= 0x378 && addr <= 0x37b) { data = printer_r(space, offset & 0x03); decoded = true; }
560560   else if (addr >= 0x3b0 && addr <= 0x3df) { data = iga_r(space, addr - 0x3b0); decoded = true; }
561561   else if (addr >= 0x3f0 && addr <= 0x3f7) { data = fdc_r(space, offset & 0x07); decoded = true; }
562   else if (addr >= 0x3f8 && addr <= 0x3ff) { data = ins8250_r(m_uart, offset & 0x07); decoded = true; }
562   else if (addr >= 0x3f8 && addr <= 0x3ff) { data = m_uart->ins8250_r(space, offset & 0x07); decoded = true; }
563563
564564   if (decoded)
565565   {
r14535r14536
622622   AM_RANGE(0x378, 0x37b) AM_READWRITE8(printer_r, printer_w, 0xffff)
623623   AM_RANGE(0x3d0, 0x3df) AM_READWRITE8(vdu_r, vdu_w, 0xffff)
624624   AM_RANGE(0x3f0, 0x3f7) AM_READWRITE8(fdc_r, fdc_w, 0xffff)
625   AM_RANGE(0x3f8, 0x3ff) AM_DEVREADWRITE8_LEGACY(INS8250_TAG, ins8250_r, ins8250_w, 0xffff)
625   AM_RANGE(0x3f8, 0x3ff) AM_DEVREADWRITE8(INS8250_TAG, ins8250_device, ins8250_r, ins8250_w, 0xffff)
626626ADDRESS_MAP_END
627627
628628
r14535r14536
656656   AM_RANGE(0x378, 0x37b) AM_WRITE8(printer_w, 0xffff)
657657   AM_RANGE(0x3b0, 0x3df) AM_WRITE8(iga_w, 0xffff)
658658   AM_RANGE(0x3f0, 0x3f7) AM_WRITE8(fdc_w, 0xffff)
659   AM_RANGE(0x3f8, 0x3ff) AM_DEVWRITE8_LEGACY(INS8250_TAG, ins8250_w, 0xffff)
659   AM_RANGE(0x3f8, 0x3ff) AM_DEVWRITE8(INS8250_TAG, ins8250_device, ins8250_w, 0xffff)
660660ADDRESS_MAP_END
661661
662662
r14535r14536
11361136
11371137static const ins8250_interface uart_intf =
11381138{
1139   XTAL_1_8432MHz,
1139   DEVCB_NULL,
1140   DEVCB_NULL,
1141   DEVCB_NULL,
11401142   DEVCB_DEVICE_LINE(I8259A2_TAG, pic8259_ir4_w),
1141   NULL,
1142   NULL,
1143   NULL
1143   DEVCB_NULL,
1144   DEVCB_NULL
11441145};
11451146
11461147
r14535r14536
13651366   MCFG_PIT8253_ADD(I8253_TAG, pit_intf)
13661367   MCFG_MC146818_IRQ_ADD(MC146818_TAG, MC146818_STANDARD, rtc_intf)
13671368   MCFG_UPD765A_ADD(UPD765AC2_TAG, fdc_intf)
1368   MCFG_INS8250_ADD(INS8250_TAG, uart_intf)
1369   MCFG_INS8250_ADD(INS8250_TAG, uart_intf, XTAL_1_8432MHz)
13691370   MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, centronics_intf)
13701371   MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(floppy_intf)
13711372
r14535r14536
14091410   MCFG_PIT8253_ADD(I8253_TAG, pit_intf)
14101411   MCFG_MC146818_IRQ_ADD(MC146818_TAG, MC146818_STANDARD, rtc_intf)
14111412   MCFG_UPD765A_ADD(UPD765AC2_TAG, fdc_intf)
1412   MCFG_INS8250_ADD(INS8250_TAG, uart_intf)
1413   MCFG_INS8250_ADD(INS8250_TAG, uart_intf, XTAL_1_8432MHz)
14131414   MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, centronics_intf)
14141415   MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(floppy_intf)
14151416
src/mess/drivers/pes.c
r14535r14536
273273   MCFG_SOUND_ADD("tms5220", TMS5220C, 720000) /* 720Khz clock, 10khz output */
274274   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
275275
276   MCFG_FRAGMENT_ADD( generic_terminal )
277276   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG,pes_terminal_intf)
278277MACHINE_CONFIG_END
279278
src/mess/drivers/xor100.c
r14535r14536
582582   MCFG_CPU_PROGRAM_MAP(xor100_mem)
583583   MCFG_CPU_IO_MAP(xor100_io)
584584
585   /* video hardware */
586   MCFG_FRAGMENT_ADD( generic_terminal )
587
588585   /* devices */
589586   MCFG_I8251_ADD(I8251_A_TAG, /*XTAL_8MHz/2,*/ printer_8251_intf)
590587   MCFG_I8251_ADD(I8251_B_TAG, /*XTAL_8MHz/2,*/ terminal_8251_intf)
src/mess/drivers/imds.c
r14535r14536
101101//  MCFG_INS8250_ADD( "ins8250", imds_com_interface )
102102
103103   /* video hardware */
104   MCFG_FRAGMENT_ADD( generic_terminal )
105104   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
106105MACHINE_CONFIG_END
107106
src/mess/drivers/zexall.c
r14535r14536
150150   MCFG_MACHINE_RESET(zexall)
151151
152152   /* video hardware */
153   MCFG_FRAGMENT_ADD( generic_terminal )
154153   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, zexall_terminal_intf)
155154MACHINE_CONFIG_END
156155
src/mess/drivers/h89.c
r14535r14536
3434   { }
3535
3636   required_device<cpu_device> m_maincpu;
37   required_device<device_t> m_uart;
37   required_device<ins8250_device> m_uart;
3838
39   DECLARE_WRITE8_MEMBER( h89_kbd_put );
39   DECLARE_WRITE_LINE_MEMBER( h89_terminal_out );
40   DECLARE_WRITE8_MEMBER( h89_terminal_in );
4041   DECLARE_WRITE8_MEMBER( port_f2_w );
4142
4243   UINT8 m_port_f2;
r14535r14536
5758//  AM_RANGE(0xd0, 0xd7)    8250 UART DCE
5859//  AM_RANGE(0xd8, 0xdf)    8250 UART DTE
5960//  AM_RANGE(0xe0, 0xe7)    8250 UART LP
60   AM_RANGE(0xe8, 0xef)   AM_DEVREADWRITE_LEGACY("ins8250", ins8250_r, ins8250_w) // 8250 UART console
61   AM_RANGE(0xe8, 0xef)   AM_DEVREADWRITE("ins8250", ins8250_device, ins8250_r, ins8250_w) // 8250 UART console
6162//  AM_RANGE(0xf0, 0xf1)    front panel
6263   AM_RANGE(0xf2, 0xf2)   AM_WRITE(port_f2_w) AM_READ_PORT("SW501")
6364//  AM_RANGE(0xf8, 0xf9)    cassette
r14535r14536
109110   m_port_f2 = data;
110111}
111112
112WRITE8_MEMBER( h89_state::h89_kbd_put )
113WRITE_LINE_MEMBER( h89_state::h89_terminal_out )
113114{
114   ins8250_receive(m_uart, data);
115   device_t *terminal = machine().device(TERMINAL_TAG);
116   terminal_serial_w(terminal, state);
115117}
116118
117static INS8250_TRANSMIT(h89_terminal_w)
119WRITE8_MEMBER( h89_state::h89_terminal_in )
118120{
119   terminal_write(device->machine().device(TERMINAL_TAG), 0, data);
121   m_uart->rx_w(data&&1);
120122}
121123
122124static GENERIC_TERMINAL_INTERFACE( terminal_intf )
123125{
124   DEVCB_DRIVER_MEMBER(h89_state, h89_kbd_put)
126   DEVCB_DRIVER_MEMBER(h89_state, h89_terminal_in)
125127};
126128
127129static const ins8250_interface h89_ins8250_interface =
128130{
129   XTAL_12_288MHz / 4,         // clock
130   DEVCB_NULL,               // interrupt
131   h89_terminal_w,            // transmit func
132   NULL,                  // handshake out
133   NULL                  // refresh func
131   DEVCB_DRIVER_LINE_MEMBER(h89_state, h89_terminal_out),
132   DEVCB_NULL,
133   DEVCB_NULL,
134   DEVCB_NULL,
135   DEVCB_NULL,
136   DEVCB_NULL
134137};
135138
136139static MACHINE_CONFIG_START( h89, h89_state )
r14535r14536
154157   MCFG_PALETTE_INIT(black_and_white)
155158#endif
156159
157   MCFG_INS8250_ADD( "ins8250", h89_ins8250_interface )
160   MCFG_INS8250_ADD( "ins8250", h89_ins8250_interface, XTAL_1_8432MHz )
158161
159   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
160   MCFG_FRAGMENT_ADD( generic_terminal )
162   MCFG_SERIAL_TERMINAL_ADD(TERMINAL_TAG, terminal_intf, 9600)
161163
162164   MCFG_TIMER_ADD_PERIODIC("irq_timer", h89_irq_timer, attotime::from_hz(100))
163165MACHINE_CONFIG_END
src/mess/drivers/ip22.c
r14535r14536
4343#include "sound/cdda.h"
4444#include "machine/sgi.h"
4545#include "machine/pckeybrd.h"
46#include "machine/pc_mouse.h"
4746#include "machine/pc_lpt.h"
4847#include "includes/at.h"
4948#include "machine/8042kbdc.h"
r14535r14536
15501549   PORT_START("DSW1")   // unused IN2
15511550   PORT_START("DSW2")   // unused IN3
15521551   PORT_INCLUDE( at_keyboard )      /* IN4 - IN11 */
1553   PORT_INCLUDE( pc_mouse_microsoft )   /* IN12 - IN14 */
15541552INPUT_PORTS_END
15551553
15561554static void rtc_update(ip22_state *state)
src/mess/drivers/zsbc3.c
r14535r14536
110110   MCFG_MACHINE_RESET(zsbc3)
111111
112112   /* video hardware */
113   MCFG_FRAGMENT_ADD( generic_terminal )
114
115113   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
116114MACHINE_CONFIG_END
117115
src/mess/drivers/dual68.c
r14535r14536
9292   MCFG_MACHINE_RESET(dual68)
9393
9494   /* video hardware */
95   MCFG_FRAGMENT_ADD( generic_terminal )
9695   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG,terminal_intf)
9796MACHINE_CONFIG_END
9897
src/mess/drivers/d6809.c
r14535r14536
153153   MCFG_MACHINE_RESET(d6809)
154154
155155   /* video hardware */
156   MCFG_FRAGMENT_ADD( generic_terminal )
157156   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
158157MACHINE_CONFIG_END
159158
src/mess/drivers/isbc.c
r14535r14536
119119   MCFG_CPU_IO_MAP(isbc86_io)
120120
121121   /* video hardware */
122   MCFG_FRAGMENT_ADD( generic_terminal )
123122   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
124123MACHINE_CONFIG_END
125124
r14535r14536
130129   MCFG_CPU_IO_MAP(rpc86_io)
131130
132131   /* video hardware */
133   MCFG_FRAGMENT_ADD( generic_terminal )
134132   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
135133MACHINE_CONFIG_END
136134
r14535r14536
144142   MCFG_CPU_CONFIG(i286_address_mask)
145143
146144   /* video hardware */
147   MCFG_FRAGMENT_ADD( generic_terminal )
148145   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
149146MACHINE_CONFIG_END
150147
r14535r14536
156153   MCFG_CPU_CONFIG(i286_address_mask)
157154
158155   /* video hardware */
159   MCFG_FRAGMENT_ADD( generic_terminal )
160156   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
161157MACHINE_CONFIG_END
162158
src/mess/drivers/sacstate.c
r14535r14536
100100   MCFG_CPU_IO_MAP(sacstate_io)
101101
102102   /* video hardware */
103   MCFG_FRAGMENT_ADD( generic_terminal )
104103   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
105104MACHINE_CONFIG_END
106105
src/mess/drivers/qtsbc.c
r14535r14536
8787   MCFG_CPU_IO_MAP(qtsbc_io)
8888
8989   /* video hardware */
90   MCFG_FRAGMENT_ADD( generic_terminal )
9190   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
9291MACHINE_CONFIG_END
9392
src/mess/drivers/mits680b.c
r14535r14536
101101   MCFG_CPU_PROGRAM_MAP(mits680b_mem)
102102
103103   /* video hardware */
104   MCFG_FRAGMENT_ADD( generic_terminal )
105104   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
106105
107106   /* acia */
src/mess/drivers/votrpss.c
r14535r14536
204204   /* printer */
205205   //MCFG_PRINTER_ADD("printer")
206206
207   MCFG_FRAGMENT_ADD( generic_terminal )
208207   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, votrpss_terminal_intf)
209208MACHINE_CONFIG_END
210209
src/mess/drivers/ccs2422.c
r14535r14536
9595   MCFG_CPU_IO_MAP(ccs2422_io)
9696
9797   /* video hardware */
98   MCFG_FRAGMENT_ADD( generic_terminal )
9998   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
10099MACHINE_CONFIG_END
101100
src/mess/drivers/bullet.c
r14535r14536
11821182    MCFG_CPU_IO_MAP(bullet_io)
11831183   MCFG_CPU_CONFIG(daisy_chain)
11841184
1185    // video hardware
1186   MCFG_FRAGMENT_ADD( generic_terminal )
1187
11881185   // devices
11891186   MCFG_Z80CTC_ADD(Z80CTC_TAG, XTAL_16MHz/4, ctc_intf)
11901187   MCFG_TIMER_ADD_PERIODIC("ctc", ctc_tick, attotime::from_hz(XTAL_4_9152MHz/4))
r14535r14536
12131210    MCFG_CPU_IO_MAP(bulletf_io)
12141211   MCFG_CPU_CONFIG(daisy_chain)
12151212
1216    // video hardware
1217   MCFG_FRAGMENT_ADD( generic_terminal )
1218
12191213   // devices
12201214   MCFG_Z80CTC_ADD(Z80CTC_TAG, XTAL_16MHz/4, ctc_intf)
12211215   MCFG_TIMER_ADD_PERIODIC("ctc", ctc_tick, attotime::from_hz(XTAL_4_9152MHz/4))
src/mess/drivers/mccpm.c
r14535r14536
133133   MCFG_CPU_IO_MAP(mccpm_io)
134134
135135   /* video hardware */
136   MCFG_FRAGMENT_ADD( generic_terminal )
137136   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
138137MACHINE_CONFIG_END
139138
src/mess/drivers/systec.c
r14535r14536
108108   MCFG_MACHINE_RESET(systec)
109109
110110   /* video hardware */
111   MCFG_FRAGMENT_ADD( generic_terminal )
112111   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
113112MACHINE_CONFIG_END
114113
src/mess/drivers/ipc.c
r14535r14536
118118   MCFG_CPU_IO_MAP(ipc_io)
119119
120120   /* video hardware */
121   MCFG_FRAGMENT_ADD( generic_terminal )
122121   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
123122MACHINE_CONFIG_END
124123
src/mess/drivers/digel804.c
r14535r14536
550550   MCFG_MACHINE_RESET(digel804)
551551
552552   /* video hardware */
553   MCFG_FRAGMENT_ADD( generic_terminal )
554553   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, digel804_terminal_intf)
555554
556555   /* acia */
r14535r14536
572571   MCFG_MACHINE_RESET(digel804)
573572
574573   /* video hardware */
575   MCFG_FRAGMENT_ADD( generic_terminal )
576574   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, digel804_terminal_intf)
577575
578576   /* acia */
src/mess/drivers/tricep.c
r14535r14536
8080   MCFG_MACHINE_RESET(tricep)
8181
8282   /* video hardware */
83   MCFG_FRAGMENT_ADD( generic_terminal )
8483   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
8584MACHINE_CONFIG_END
8685
src/mess/drivers/svi318.c
r14535r14536
319319
320320   MCFG_I8255_ADD( "ppi8255", svi318_ppi8255_interface )
321321
322   MCFG_INS8250_ADD( "ins8250_0", svi318_ins8250_interface[0] )
323   MCFG_INS8250_ADD( "ins8250_1", svi318_ins8250_interface[1] )
322   MCFG_INS8250_ADD( "ins8250_0", svi318_ins8250_interface[0], 1000000 )
323   MCFG_INS8250_ADD( "ins8250_1", svi318_ins8250_interface[1], 3072000 )
324324
325325   /* Video hardware */
326326   MCFG_TMS9928A_ADD( "tms9928a", TMS9929A, svi318_tms9928a_interface )
r14535r14536
430430
431431   MCFG_I8255A_ADD( "ppi8255", svi318_ppi8255_interface )
432432
433   MCFG_INS8250_ADD( "ins8250_0", svi318_ins8250_interface[0] )
434   MCFG_INS8250_ADD( "ins8250_1", svi318_ins8250_interface[1] )
433   MCFG_INS8250_ADD( "ins8250_0", svi318_ins8250_interface[0], 1000000 )
434   MCFG_INS8250_ADD( "ins8250_1", svi318_ins8250_interface[1], 3072000 )
435435
436436   /* Video hardware */
437437   MCFG_DEFAULT_LAYOUT( layout_dualhsxs )
src/mess/drivers/sage2.c
r14535r14536
596596   MCFG_CPU_PROGRAM_MAP(sage2_mem)
597597
598598   // video hardware
599   MCFG_FRAGMENT_ADD(generic_terminal)
600599   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
601600
602601   // devices
src/mess/drivers/cm1800.c
r14535r14536
100100   MCFG_MACHINE_RESET(cm1800)
101101
102102   /* video hardware */
103   MCFG_FRAGMENT_ADD( generic_terminal )
104103   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
105104MACHINE_CONFIG_END
106105
src/mess/drivers/amstr_pc.c
r14535r14536
4444#include "machine/pc_joy.h"
4545#include "machine/pckeybrd.h"
4646#include "machine/pc_lpt.h"
47#include "machine/pc_mouse.h"
4847
4948#include "includes/amstr_pc.h"
5049
r14535r14536
9291   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r,               pc_page_w, 0xffff)
9392   AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc16le_JOY_r,               pc16le_JOY_w)
9493   AM_RANGE(0x0278, 0x027b) AM_READ(pc200_16le_port278_r) AM_DEVWRITE8("lpt_2", pc_lpt_w, 0x00ff)
95   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_r, ins8250_w, 0xffff)
96   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_r, ins8250_w, 0xffff)
94   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8_MODERN("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff)
95   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff)
9796   AM_RANGE(0x0378, 0x037b) AM_READ(pc200_16le_port378_r) AM_DEVWRITE8("lpt_1", pc_lpt_w, 0x00ff)
9897   AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_r, pc_lpt_w, 0x00ff)
99   AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8("ins8250_2", ins8250_r, ins8250_w, 0xffff)
98   AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8_MODERN("ins8250_2", ins8250_device, ins8250_r, ins8250_w, 0xffff)
10099   AM_RANGE(0x03f0, 0x03f7) AM_READWRITE8(pc_fdc_r,               pc_fdc_w, 0xffff)
101   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_r, ins8250_w, 0xffff)
100   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff)
102101ADDRESS_MAP_END
103102
104103static ADDRESS_MAP_START( pc200_map, AS_PROGRAM, 16 )
r14535r14536
120119   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r,               pc_page_w, 0xffff)
121120   AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc16le_JOY_r,               pc16le_JOY_w)
122121   AM_RANGE(0x0278, 0x027b) AM_READ(pc200_16le_port278_r) AM_DEVWRITE8("lpt_2", pc_lpt_w, 0x00ff)
123   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_r, ins8250_w, 0xffff)
124   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_r, ins8250_w, 0xffff)
122   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8_MODERN("ins8250_3", ins8250_device, ins8250_r,  ins8250_w, 0xffff)
123   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff)
125124   AM_RANGE(0x0378, 0x037b) AM_READ(pc200_16le_port378_r) AM_DEVWRITE8("lpt_1", pc_lpt_w, 0x00ff)
126125   AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_r, pc_lpt_w, 0x00ff)
127   AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8("ins8250_2", ins8250_r, ins8250_w, 0xffff)
126   AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8_MODERN("ins8250_2", ins8250_device, ins8250_r, ins8250_w, 0xffff)
128127   AM_RANGE(0x03f0, 0x03f7) AM_READWRITE8(pc_fdc_r,               pc_fdc_w, 0xffff)
129   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_r, ins8250_w, 0xffff)
128   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff)
130129ADDRESS_MAP_END
131130
132131
r14535r14536
188187   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
189188
190189   PORT_START("DSW2") /* IN3 */
191   PORT_DIPNAME( 0xf0, 0x00, "Serial mouse")
192   PORT_DIPSETTING(   0x80, "COM1" )
193   PORT_DIPSETTING(   0x40, "COM2" )
194   PORT_DIPSETTING(   0x20, "COM3" )
195   PORT_DIPSETTING(   0x10, "COM4" )
196   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
197190   PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)")
198191   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
199192   PORT_DIPSETTING(   0x08, DEF_STR( Yes ) )
r14535r14536
204197   PORT_BIT( 0x01, 0x01,   IPT_UNUSED )
205198
206199   PORT_INCLUDE( at_keyboard )      /* IN4 - IN11 */
207   PORT_INCLUDE( pc_mouse_microsoft )   /* IN12 - IN14 */
208200   PORT_INCLUDE( pc_joystick )         /* IN15 - IN19 */
209201
210202   PORT_START("VIDEO") /* IN20 */
r14535r14536
241233   NULL
242234};
243235
236SLOT_INTERFACE_START(amstr_com)
237   SLOT_INTERFACE("microsoft_mouse", MSFT_SERIAL_MOUSE)
238   SLOT_INTERFACE("mouse_systems_mouse", MSYSTEM_SERIAL_MOUSE)
239SLOT_INTERFACE_END
244240
245241#define MCFG_CPU_PC(mem, port, type, clock, vblankfunc)   \
246242   MCFG_CPU_ADD("maincpu", type, clock)            \
r14535r14536
282278
283279   MCFG_I8255_ADD( "ppi8255", pc_ppi8255_interface )
284280
285   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
286   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
287   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] )         /* TODO: Verify model */
288   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] )         /* TODO: Verify model */
281   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz )   /* TODO: Verify model */
282   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz )   /* TODO: Verify model */
283   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz )   /* TODO: Verify model */
284   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz )   /* TODO: Verify model */
285   MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], amstr_com, NULL, NULL )
286   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], amstr_com, NULL, NULL )
287   MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[3], amstr_com, NULL, NULL )
288   MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[4], amstr_com, NULL, NULL )
289289
290290   /* video hardware */
291291   MCFG_FRAGMENT_ADD( pcvideo_pc200 )
r14535r14536
348348
349349   MCFG_I8255_ADD( "ppi8255", pc_ppi8255_interface )
350350
351   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
352   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
353   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] )         /* TODO: Verify model */
354   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] )         /* TODO: Verify model */
351   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz )   /* TODO: Verify model */
352   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz )   /* TODO: Verify model */
353   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz )   /* TODO: Verify model */
354   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz )   /* TODO: Verify model */
355   MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], amstr_com, NULL, NULL )
356   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], amstr_com, NULL, NULL )
357   MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[3], amstr_com, NULL, NULL )
358   MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[4], amstr_com, NULL, NULL )
355359
356360   /* video hardware */
357361   MCFG_FRAGMENT_ADD( pcvideo_pc200 )
src/mess/drivers/ob68k1a.c
r14535r14536
343343    MCFG_CPU_ADD(MC68000L10_TAG, M68000, XTAL_10MHz)
344344    MCFG_CPU_PROGRAM_MAP(ob68k1a_mem)
345345
346    // video hardware
347   MCFG_FRAGMENT_ADD( generic_terminal )
348
349346   // devices
350347   MCFG_PIA6821_ADD(MC6821_0_TAG, pia0_intf)
351348   MCFG_PIA6821_ADD(MC6821_1_TAG, pia1_intf)
src/mess/drivers/czk80.c
r14535r14536
9898   MCFG_CPU_PROGRAM_MAP(czk80_mem)
9999   MCFG_CPU_IO_MAP(czk80_io)
100100
101   MCFG_FRAGMENT_ADD( generic_terminal )
102101   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
103102MACHINE_CONFIG_END
104103
src/mess/drivers/exp85.c
r14535r14536
208208    MCFG_CPU_IO_MAP(exp85_io)
209209   MCFG_CPU_CONFIG(exp85_i8085_config)
210210
211    /* video hardware */
212   MCFG_FRAGMENT_ADD( generic_terminal )
213
214211   /* sound hardware */
215212   MCFG_SPEAKER_STANDARD_MONO("mono")
216213   MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0)
src/mess/drivers/votrtnt.c
r14535r14536
174174   MCFG_SOUND_ADD("votrax", VOTRAX, 1700000) /* 1.70 MHz? needs verify */
175175   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
176176
177   MCFG_FRAGMENT_ADD( generic_terminal )
178177   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, votrtnt_terminal_intf)
179178   MCFG_TIMER_ADD_PERIODIC("votrtnt_timer", votrtnt_poll_votrax, attotime::from_hz(70) )
180179MACHINE_CONFIG_END
src/mess/drivers/pdp11.c
r14535r14536
327327   MCFG_MACHINE_RESET(pdp11)
328328
329329   /* video hardware */
330   MCFG_FRAGMENT_ADD( generic_terminal )
331330   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
332331MACHINE_CONFIG_END
333332
src/mess/drivers/dms86.c
r14535r14536
117117
118118   MCFG_MACHINE_RESET(dms86)
119119
120   MCFG_FRAGMENT_ADD( generic_terminal )
121120   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
122121MACHINE_CONFIG_END
123122
src/mess/drivers/okean240.c
r14535r14536
478478static MACHINE_CONFIG_DERIVED( okean240t, okean240 )
479479   MCFG_CPU_MODIFY("maincpu")
480480   MCFG_CPU_IO_MAP(okean240t_io)
481   MCFG_FRAGMENT_ADD( generic_terminal )
482481MACHINE_CONFIG_END
483482
484483/* ROM definition */
src/mess/drivers/sgi_ip2.c
r14535r14536
465465   MCFG_MACHINE_RESET(sgi_ip2)
466466
467467   /* video hardware */
468   MCFG_FRAGMENT_ADD( generic_terminal )
469468   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG,sgi_terminal_intf)
470469
471470    MCFG_DUART68681_ADD( "duart68681a", XTAL_3_6864MHz, sgi_ip2_duart68681a_config ) /* Y3 3.6864MHz Xtal ??? copy-over from dectalk */
src/mess/drivers/pcw16.c
r14535r14536
9797#include "machine/pckeybrd.h"   /* PC-AT keyboard */
9898#include "machine/pc_fdc.h"      /* change to superio later */
9999#include "machine/ins8250.h"   /* pc com port */
100#include "machine/pc_mouse.h"   /* pc serial mouse */
101100#include "sound/beep.h"         /* pcw/pcw16 beeper */
102101#include "machine/intelfsh.h"
103102
r14535r14536
801800         pcw16_keyboard_signal_byte_received(timer.machine(), data);
802801      }
803802   }
803   // TODO: fix
804   state->subdevice<ns16550_device>("ns16550_2")->ri_w(input_port_read(timer.machine(), "EXTRA") & 0x040);
804805}
805806
806807
r14535r14536
12581259   pcw16_refresh_ints(device->machine());
12591260}
12601261
1262static WRITE_LINE_DEVICE_HANDLER( pcw16_com_tx_0 ) { }
1263static WRITE_LINE_DEVICE_HANDLER( pcw16_com_dtr_0 ) { }
1264static WRITE_LINE_DEVICE_HANDLER( pcw16_com_rts_0 ) { }
12611265
1262static INS8250_REFRESH_CONNECT( pcw16_com_refresh_connected_1 ) {
1263#if 0
1264   pc_mouse_poll(0);
1265#endif
1266}
1266static WRITE_LINE_DEVICE_HANDLER( pcw16_com_tx_1 ) { }
1267static WRITE_LINE_DEVICE_HANDLER( pcw16_com_dtr_1 ) { }
1268static WRITE_LINE_DEVICE_HANDLER( pcw16_com_rts_1 ) { }
12671269
1268
1269static INS8250_REFRESH_CONNECT( pcw16_com_refresh_connected_2 )
1270{
1271   int new_inputs;
1272
1273   new_inputs = 0;
1274
1275   /* Power switch is connected to Ring indicator */
1276   if (input_port_read(device->machine(), "EXTRA") & 0x040)
1277   {
1278      new_inputs = UART8250_INPUTS_RING_INDICATOR;
1279   }
1280
1281   ins8250_handshake_in(device, new_inputs);
1282}
1283
12841270static const ins8250_interface pcw16_com_interface[2]=
12851271{
12861272   {
1287      1843200,
1273      DEVCB_LINE(pcw16_com_tx_0),
1274      DEVCB_LINE(pcw16_com_dtr_0),
1275      DEVCB_LINE(pcw16_com_rts_0),
12881276      DEVCB_LINE(pcw16_com_interrupt_1),
1289      NULL,
1290      pc_mouse_handshake_in,
1291      pcw16_com_refresh_connected_1
1277      DEVCB_NULL,
1278      DEVCB_NULL
12921279   },
12931280   {
1294      1843200,
1281      DEVCB_LINE(pcw16_com_tx_1),
1282      DEVCB_LINE(pcw16_com_dtr_1),
1283      DEVCB_LINE(pcw16_com_rts_1),
12951284      DEVCB_LINE(pcw16_com_interrupt_2),
1296      NULL,
1297      NULL,
1298      pcw16_com_refresh_connected_2
1285      DEVCB_NULL,
1286      DEVCB_NULL
12991287   }
13001288};
13011289
r14535r14536
13081296    AM_RANGE(0x01c, 0x01c) AM_READ(pcw16_superio_fdc_main_status_register_r)
13091297   AM_RANGE(0x01d, 0x01d) AM_READWRITE(pcw16_superio_fdc_data_r, pcw16_superio_fdc_data_w)
13101298   AM_RANGE(0x01f, 0x01f) AM_READWRITE(pcw16_superio_fdc_digital_input_register_r, pcw16_superio_fdc_datarate_w)
1311   AM_RANGE(0x020, 0x027) AM_DEVREADWRITE("ns16550_1", ins8250_r, ins8250_w)
1312   AM_RANGE(0x028, 0x02f) AM_DEVREADWRITE("ns16550_2", ins8250_r, ins8250_w)
1299   AM_RANGE(0x020, 0x027) AM_DEVREADWRITE_MODERN("ns16550_1", ns16550_device, ins8250_r, ins8250_w)
1300   AM_RANGE(0x028, 0x02f) AM_DEVREADWRITE_MODERN("ns16550_2", ns16550_device, ins8250_r, ins8250_w)
13131301   AM_RANGE(0x038, 0x03a) AM_DEVREADWRITE("lpt", pc_lpt_r, pc_lpt_w)
13141302   /* anne asic */
13151303   AM_RANGE(0x0e0, 0x0ef) AM_WRITE(pcw16_palette_w)
r14535r14536
13631351
13641352   pc_fdc_init(machine, &pcw16_fdc_interface);
13651353
1366   /* initialise mouse */
1367   //pc_mouse_initialise(machine);
1368   //pc_mouse_set_serial_port( machine.device("ns16550_0") );
1369
13701354   /* initialise keyboard */
13711355   at_keyboard_init(machine, AT_KEYBOARD_TYPE_AT);
13721356   at_keyboard_set_scan_code_set(3);
r14535r14536
13861370   PORT_DIPSETTING(0x0, DEF_STR( Off) )
13871371   PORT_DIPSETTING(0x40, DEF_STR( On) )
13881372
1389   PORT_INCLUDE( pc_mouse_mousesystems )   /* IN12 - IN14 */
1390
13911373   PORT_INCLUDE( at_keyboard )      /* IN4 - IN11 */
13921374INPUT_PORTS_END
13931375
r14535r14536
14191401
14201402   MCFG_MACHINE_START( pcw16 )
14211403
1422   MCFG_NS16550_ADD( "ns16550_1", pcw16_com_interface[0] )            /* TODO: Verify uart model */
1404   MCFG_NS16550_ADD( "ns16550_1", pcw16_com_interface[0], XTAL_1_8432MHz )      /* TODO: Verify uart model */
14231405
1424   MCFG_NS16550_ADD( "ns16550_2", pcw16_com_interface[1] )            /* TODO: Verify uart model */
1406   MCFG_NS16550_ADD( "ns16550_2", pcw16_com_interface[1], XTAL_1_8432MHz )      /* TODO: Verify uart model */
14251407
14261408    /* video hardware */
14271409   MCFG_SCREEN_ADD("screen", RASTER)
src/mess/drivers/ht68k.c
r14535r14536
166166   MCFG_MACHINE_RESET(ht68k)
167167
168168   /* video hardware */
169   MCFG_FRAGMENT_ADD( generic_terminal )
170169   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
171170
172171   MCFG_DUART68681_ADD( "duart68681", XTAL_8MHz / 2, ht68k_duart68681_config )
src/mess/drivers/microdec.c
r14535r14536
111111   MCFG_MACHINE_RESET(microdec)
112112
113113   /* video hardware */
114   MCFG_FRAGMENT_ADD( generic_terminal )
115114   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
116115
117116   MCFG_UPD765A_ADD("upd765", microdec_upd765_interface)
src/mess/drivers/rvoice.c
r14535r14536
373373   //MCFG_DEFAULT_LAYOUT(layout_dectalk) // hack to avoid screenless system crash
374374
375375   /* sound hardware */
376   MCFG_FRAGMENT_ADD( generic_terminal )
377376   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG,dectalk_terminal_intf)
378377
379378MACHINE_CONFIG_END
src/mess/drivers/basic52.c
r14535r14536
9090   MCFG_MACHINE_RESET(basic52)
9191
9292   /* video hardware */
93   MCFG_FRAGMENT_ADD( generic_terminal )
9493   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
9594
9695   MCFG_I8255_ADD("ppi8255", ppi8255_intf )
r14535r14536
105104   MCFG_MACHINE_RESET(basic52)
106105
107106   /* video hardware */
108   MCFG_FRAGMENT_ADD( generic_terminal )
109107   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
110108
111109   MCFG_I8255_ADD("ppi8255", ppi8255_intf )
src/mess/drivers/pimps.c
r14535r14536
9595   MCFG_CPU_IO_MAP(pimps_io)
9696
9797   /* video hardware */
98   MCFG_FRAGMENT_ADD( generic_terminal )
9998   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
10099MACHINE_CONFIG_END
101100
src/mess/drivers/vector4.c
r14535r14536
9898   MCFG_MACHINE_RESET(vector4)
9999
100100   /* video hardware */
101   MCFG_FRAGMENT_ADD( generic_terminal )
102101   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
103102MACHINE_CONFIG_END
104103
src/mess/drivers/portfoli.c
r14535r14536
721721
722722static const ins8250_interface i8250_intf =
723723{
724   XTAL_1_8432MHz,
724   DEVCB_NULL,
725   DEVCB_NULL,
726   DEVCB_NULL,
725727   DEVCB_DRIVER_LINE_MEMBER(portfolio_state, i8250_intrpt_w),
726   NULL,
727   NULL,
728   NULL
728   DEVCB_NULL,
729   DEVCB_NULL
729730};
730731
731732//-------------------------------------------------
r14535r14536
811812   switch (m_pid)
812813   {
813814   case PID_SERIAL:
814      io->install_legacy_readwrite_handler(*m_uart, 0x8070, 0x8077, FUNC(ins8250_r), FUNC(ins8250_w));
815      io->install_readwrite_handler(0x8070, 0x8077, read8_delegate(FUNC(ins8250_device::ins8250_r), (ins8250_device*)m_uart), write8_delegate(FUNC(ins8250_device::ins8250_w), (ins8250_device*)m_uart));
815816      break;
816817
817818   case PID_PARALLEL:
r14535r14536
858859   /* devices */
859860   MCFG_I8255A_ADD(M82C55A_TAG, ppi_intf)
860861   MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, centronics_intf)
861   MCFG_INS8250_ADD(M82C50A_TAG, i8250_intf) // should be MCFG_INS8250A_ADD
862   MCFG_INS8250_ADD(M82C50A_TAG, i8250_intf, XTAL_1_8432MHz) // should be MCFG_INS8250A_ADD
862863   MCFG_TIMER_ADD_PERIODIC("counter", counter_tick, attotime::from_hz(XTAL_32_768kHz/16384))
863864   MCFG_TIMER_ADD_PERIODIC(TIMER_TICK_TAG, system_tick, attotime::from_hz(XTAL_32_768kHz/32768))
864865
src/mess/drivers/68ksbc.c
r14535r14536
9898   MCFG_CPU_ADD("maincpu", M68000, 8000000) // text says 8MHz, schematic says 10MHz
9999   MCFG_CPU_PROGRAM_MAP(c68ksbc_mem)
100100
101   MCFG_FRAGMENT_ADD( generic_terminal )
102101   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
103102MACHINE_CONFIG_END
104103
src/mess/drivers/altair.c
r14535r14536
129129   MCFG_MACHINE_RESET(altair)
130130
131131   /* video hardware */
132   MCFG_FRAGMENT_ADD( generic_terminal )
133132   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
134133
135134   /* quickload */
src/mess/drivers/bebox.c
r14535r14536
6767   AM_RANGE(0x800000A0, 0x800000BF) AM_DEVREADWRITE8( "pic8259_slave", pic8259_r, pic8259_w, U64(0xffffffffffffffff) )
6868   AM_RANGE(0x800000C0, 0x800000DF) AM_READWRITE( bebox_dma8237_1_r, bebox_dma8237_1_w)
6969   AM_RANGE(0x800001F0, 0x800001F7) AM_READWRITE( bebox_800001F0_r, bebox_800001F0_w )
70   AM_RANGE(0x800002F8, 0x800002FF) AM_DEVREADWRITE8( "ns16550_1", ins8250_r, ins8250_w, U64(0xffffffffffffffff) )
71   AM_RANGE(0x80000380, 0x80000387) AM_DEVREADWRITE8( "ns16550_2", ins8250_r, ins8250_w, U64(0xffffffffffffffff) )
72   AM_RANGE(0x80000388, 0x8000038F) AM_DEVREADWRITE8( "ns16550_3", ins8250_r, ins8250_w, U64(0xffffffffffffffff) )
70   AM_RANGE(0x800002F8, 0x800002FF) AM_DEVREADWRITE8_MODERN( "ns16550_1", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) )
71   AM_RANGE(0x80000380, 0x80000387) AM_DEVREADWRITE8_MODERN( "ns16550_2", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) )
72   AM_RANGE(0x80000388, 0x8000038F) AM_DEVREADWRITE8_MODERN( "ns16550_3", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) )
7373   AM_RANGE(0x800003F0, 0x800003F7) AM_READWRITE( bebox_800003F0_r, bebox_800003F0_w )
74   AM_RANGE(0x800003F8, 0x800003FF) AM_DEVREADWRITE8( "ns16550_0", ins8250_r, ins8250_w, U64(0xffffffffffffffff) )
74   AM_RANGE(0x800003F8, 0x800003FF) AM_DEVREADWRITE8_MODERN( "ns16550_0",ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) )
7575   AM_RANGE(0x80000480, 0x8000048F) AM_READWRITE( bebox_80000480_r, bebox_80000480_w )
7676   AM_RANGE(0x80000CF8, 0x80000CFF) AM_DEVREADWRITE("pcibus", pci_64be_r, pci_64be_w )
7777   AM_RANGE(0x800042E8, 0x800042EF) AM_DEVWRITE8( "cirrus", cirrus_42E8_w, U64(0xffffffffffffffff) )
r14535r14536
143143
144144   MCFG_PIC8259_ADD( "pic8259_slave", bebox_pic8259_slave_config )
145145
146   MCFG_NS16550_ADD( "ns16550_0", bebox_uart_inteface_0 )         /* TODO: Verify model */
147   MCFG_NS16550_ADD( "ns16550_1", bebox_uart_inteface_1 )         /* TODO: Verify model */
148   MCFG_NS16550_ADD( "ns16550_2", bebox_uart_inteface_2 )         /* TODO: Verify model */
149   MCFG_NS16550_ADD( "ns16550_3", bebox_uart_inteface_3 )         /* TODO: Verify model */
146   MCFG_NS16550_ADD( "ns16550_0", bebox_uart_inteface_0, 0 )   /* TODO: Verify model */
147   MCFG_NS16550_ADD( "ns16550_1", bebox_uart_inteface_1, 0 )   /* TODO: Verify model */
148   MCFG_NS16550_ADD( "ns16550_2", bebox_uart_inteface_2, 0 )   /* TODO: Verify model */
149   MCFG_NS16550_ADD( "ns16550_3", bebox_uart_inteface_3, 0 )   /* TODO: Verify model */
150150
151151   /* video hardware */
152152   MCFG_FRAGMENT_ADD( pcvideo_vga )
src/mess/drivers/tsispch.c
r14535r14536
431431    //MCFG_SOUND_ADD("dac", DAC, 0) /* TODO: correctly figure out how the DAC works; apparently it is connected to the serial output of the upd7720, which will be "fun" to connect up */
432432    //MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
433433
434    MCFG_FRAGMENT_ADD( generic_terminal )
435434    MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG,tsispch_terminal_intf)
436435MACHINE_CONFIG_END
437436
src/mess/drivers/jupiter.c
r14535r14536
260260   MCFG_CPU_PROGRAM_MAP(jupiter_m6800_mem)
261261   MCFG_CPU_IO_MAP(jupiter_m6800_io)
262262
263   // video hardware
264   MCFG_FRAGMENT_ADD( generic_terminal )
265
266263   // devices
267264   MCFG_FD1771_ADD(INS1771N1_TAG, fdc_intf)
268265   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, jupiter2_terminal_intf)
src/mess/drivers/sun1.c
r14535r14536
138138   MCFG_CPU_PROGRAM_MAP(sun1_mem)
139139
140140   /* video hardware */
141   MCFG_FRAGMENT_ADD( generic_terminal )
142141   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
143142MACHINE_CONFIG_END
144143
src/mess/drivers/horizon.c
r14535r14536
8989   MCFG_MACHINE_RESET(horizon)
9090
9191   /* video hardware */
92   MCFG_FRAGMENT_ADD( generic_terminal )
9392   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
9493MACHINE_CONFIG_END
9594
src/mess/drivers/h19.c
r14535r14536
118118   ADDRESS_MAP_GLOBAL_MASK(0xff)
119119   AM_RANGE(0x00, 0x1F) AM_READ_PORT("S401")
120120   AM_RANGE(0x20, 0x3F) AM_READ_PORT("S402")
121   AM_RANGE(0x40, 0x47) AM_MIRROR(0x18) AM_DEVREADWRITE_LEGACY("ins8250", ins8250_r, ins8250_w )
121   AM_RANGE(0x40, 0x47) AM_MIRROR(0x18) AM_DEVREADWRITE("ins8250", ins8250_device, ins8250_r, ins8250_w )
122122   AM_RANGE(0x60, 0x60) AM_DEVWRITE("crtc", mc6845_device, address_w)
123123   AM_RANGE(0x61, 0x61) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
124124   AM_RANGE(0x80, 0x9F) AM_READ(h19_80_r)
r14535r14536
346346
347347static const ins8250_interface h19_ace_interface =
348348{
349   XTAL_12_288MHz / 4, // 3.072mhz clock which gets divided down for the various baud rates
349   DEVCB_NULL,
350   DEVCB_NULL,
351   DEVCB_NULL,
350352   DEVCB_LINE(h19_ace_irq), // interrupt
351   NULL, // transmit func
352   NULL, // handshake out
353   NULL // refresh func
353   DEVCB_NULL,
354   DEVCB_NULL
354355};
355356
356357static const mc6845_interface h19_crtc6845_interface =
r14535r14536
415416   MCFG_PALETTE_INIT(monochrome_green)
416417
417418   MCFG_MC6845_ADD("crtc", MC6845, XTAL_12_288MHz / 8, h19_crtc6845_interface) // clk taken from schematics
418   MCFG_INS8250_ADD( "ins8250", h19_ace_interface )
419   MCFG_INS8250_ADD( "ins8250", h19_ace_interface, XTAL_12_288MHz / 4) // 3.072mhz clock which gets divided down for the various baud rates
419420   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, h19_terminal_intf) // keyboard only
420421
421422   /* sound hardware */
src/mess/drivers/avigo.c
r14535r14536
227227
228228static const ins8250_interface avigo_com_interface =
229229{
230   1843200,
230   DEVCB_NULL,
231   DEVCB_NULL,
232   DEVCB_NULL,
231233   DEVCB_DRIVER_LINE_MEMBER(avigo_state, com_interrupt),
232   NULL,
233   NULL,
234   NULL
234   DEVCB_NULL,
235   DEVCB_NULL
235236};
236237
237238
r14535r14536
635636   AM_RANGE(0x010, 0x01f) AM_DEVREADWRITE("rtc", rp5c01_device, read, write)
636637   AM_RANGE(0x028, 0x028) AM_WRITE( speaker_w )
637638   AM_RANGE(0x02d, 0x02d) AM_READ( ad_data_r )
638   AM_RANGE(0x030, 0x037) AM_DEVREADWRITE_LEGACY("ns16550", ins8250_r, ins8250_w )
639   AM_RANGE(0x030, 0x037) AM_DEVREADWRITE("ns16550", ns16550_device, ins8250_r, ins8250_w )
639640ADDRESS_MAP_END
640641
641642
r14535r14536
885886   MCFG_CPU_IO_MAP(avigo_io)
886887   MCFG_QUANTUM_TIME(attotime::from_hz(60))
887888
888   MCFG_NS16550_ADD( "ns16550", avigo_com_interface )
889   MCFG_NS16550_ADD( "ns16550", avigo_com_interface, XTAL_1_8432MHz )
889890
890891   /* video hardware */
891892   MCFG_SCREEN_ADD("screen", LCD)
src/mess/drivers/mpz80.c
r14535r14536
758758   MCFG_CPU_PROGRAM_MAP(mpz80_mem)
759759   MCFG_CPU_IO_MAP(mpz80_io)
760760
761   // video hardware
762   MCFG_FRAGMENT_ADD( generic_terminal )
763
764761   // S-100
765762   MCFG_S100_BUS_ADD(Z80_TAG, s100_intf)
766763   MCFG_S100_SLOT_ADD("s100_1", mpz80_s100_cards, "mm65k16s", NULL)
src/mess/drivers/ccs2810.c
r14535r14536
119119
120120static const ins8250_interface ccs2810_com_interface =
121121{
122   1843200,
123122   DEVCB_NULL,
124   NULL,
125   NULL,
126   NULL
123   DEVCB_NULL,
124   DEVCB_NULL,
125   DEVCB_NULL,
126   DEVCB_NULL,
127   DEVCB_NULL
127128};
128129
129130static MACHINE_CONFIG_START( ccs2810, ccs2810_state )
r14535r14536
132133   MCFG_CPU_PROGRAM_MAP(ccs2810_mem)
133134   MCFG_CPU_IO_MAP(ccs2810_io)
134135
135   MCFG_INS8250_ADD( "ins8250", ccs2810_com_interface )
136   MCFG_INS8250_ADD( "ins8250", ccs2810_com_interface, XTAL_1_8432MHz )
136137
137138   /* video hardware */
138   MCFG_FRAGMENT_ADD( generic_terminal )
139139   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
140140MACHINE_CONFIG_END
141141
src/mess/drivers/super6.c
r14535r14536
569569   MCFG_CPU_IO_MAP(super6_io)
570570   MCFG_CPU_CONFIG(super6_daisy_chain)
571571
572   // video hardware
573   MCFG_FRAGMENT_ADD(generic_terminal)
574
575572   // devices
576573   MCFG_Z80CTC_ADD(Z80CTC_TAG, XTAL_24MHz/4, ctc_intf)
577574   MCFG_TIMER_ADD_PERIODIC("ctc", ctc_tick, attotime::from_hz(XTAL_24MHz/16))
src/mess/drivers/zrt80.c
r14535r14536
4040   required_device<cpu_device> m_maincpu;
4141   required_device<device_t> m_terminal;
4242   required_device<mc6845_device> m_crtc;
43   required_device<device_t> m_8250;
43   required_device<ins8250_device> m_8250;
4444   required_device<device_t> m_beep;
4545   DECLARE_READ8_MEMBER( zrt80_10_r );
4646   DECLARE_WRITE8_MEMBER( zrt80_30_w );
r14535r14536
9191static ADDRESS_MAP_START( zrt80_io, AS_IO, 8, zrt80_state)
9292   ADDRESS_MAP_UNMAP_HIGH
9393   ADDRESS_MAP_GLOBAL_MASK(0xff)
94   AM_RANGE(0x00, 0x07) AM_DEVREADWRITE_LEGACY("ins8250", ins8250_r, ins8250_w )
94   AM_RANGE(0x00, 0x07) AM_DEVREADWRITE("ins8250", ins8250_device, ins8250_r, ins8250_w )
9595   AM_RANGE(0x08, 0x08) AM_DEVWRITE("crtc", mc6845_device, address_w)
9696   AM_RANGE(0x09, 0x09) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w)
9797   AM_RANGE(0x10, 0x17) AM_READ(zrt80_10_r)
r14535r14536
247247
248248static const ins8250_interface zrt80_com_interface =
249249{
250   2457600,
250   DEVCB_NULL,
251   DEVCB_NULL,
251252   DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0),
252   NULL,
253   NULL,
254   NULL
253   DEVCB_NULL,
254   DEVCB_NULL,
255   DEVCB_NULL
255256};
256257
257258WRITE8_MEMBER( zrt80_state::kbd_put )
r14535r14536
308309
309310   /* Devices */
310311   MCFG_MC6845_ADD("crtc", MC6845, XTAL_20MHz / 8, zrt80_crtc6845_interface)
311   MCFG_INS8250_ADD( "ins8250", zrt80_com_interface )
312   MCFG_INS8250_ADD( "ins8250", zrt80_com_interface, 2457600 )
312313   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
313314MACHINE_CONFIG_END
314315
src/mess/drivers/swtpc.c
r14535r14536
111111   MCFG_MACHINE_RESET(swtpc)
112112
113113   /* video hardware */
114   MCFG_FRAGMENT_ADD( generic_terminal )
115114   MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf)
116115MACHINE_CONFIG_END
117116
src/mess/drivers/pc.c
r14535r14536
7878#include "machine/pc_joy.h"
7979#include "machine/pckeybrd.h"
8080#include "machine/pc_lpt.h"
81#include "machine/pc_mouse.h"
81#include "machine/serial.h"
8282
8383#include "includes/europc.h"
8484#include "includes/tandy1t.h"
r14535r14536
162162   AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc_JOY_r,            pc_JOY_w)
163163   AM_RANGE(0x0240, 0x0257) AM_READWRITE(pc_rtc_r,            pc_rtc_w)
164164   AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE("lpt_2", pc_lpt_r, pc_lpt_w)
165   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE("ins8250_3", ins8250_r, ins8250_w)
166   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_r, ins8250_w)
165   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE_MODERN("ins8250_3", ins8250_device, ins8250_r, ins8250_w)
166   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w)
167167   AM_RANGE(0x0340, 0x0357) AM_NOP /* anonymous bios should not recogniced realtimeclock */
168168   AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE("lpt_1", pc_lpt_r, pc_lpt_w)
169169   AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE("lpt_0", pc_lpt_r, pc_lpt_w)
170   AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE("ins8250_2", ins8250_r, ins8250_w)
170   AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE_MODERN("ins8250_2", ins8250_device, ins8250_r, ins8250_w)
171171   AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(pc_fdc_r,            pc_fdc_w)
172   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE("ins8250_0", ins8250_r, ins8250_w)
172   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w)
173173ADDRESS_MAP_END
174174
175175static ADDRESS_MAP_START(oliv_io, AS_IO, 8)
r14535r14536
189189   AM_RANGE(0x0240, 0x0257) AM_READWRITE(pc16le_rtc_r,            pc16le_rtc_w)
190190   AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE8("lpt_2", pc_lpt_r, pc_lpt_w, 0x00ff)
191191   AM_RANGE(0x02b0, 0x02bf) AM_RAM // needed for EC-18xx
192   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_r, ins8250_w, 0xffff)
193   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_r, ins8250_w, 0xffff)
192   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8_MODERN("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff)
193   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff)
194194   AM_RANGE(0x0340, 0x0357) AM_NOP /* anonymous bios should not recogniced realtimeclock */
195195   AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8("lpt_1", pc_lpt_r, pc_lpt_w, 0x00ff)
196196   AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_r, pc_lpt_w, 0x00ff)
197   AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8("ins8250_2", ins8250_r, ins8250_w, 0xffff)
197   AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8_MODERN("ins8250_2", ins8250_device, ins8250_r, ins8250_w, 0xffff)
198198   AM_RANGE(0x03f0, 0x03f7) AM_READWRITE8(pc_fdc_r,            pc_fdc_w, 0xffff)
199   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_r, ins8250_w, 0xffff)
199   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff)
200200ADDRESS_MAP_END
201201
202202
r14535r14536
225225   AM_RANGE(0x0240, 0x0257) AM_READWRITE(pc16le_rtc_r,            pc16le_rtc_w)
226226   AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE8("lpt_2", pc_lpt_r, pc_lpt_w, 0x00ff)
227227   AM_RANGE(0x02b0, 0x02bf) AM_RAM // needed for EC-18xx
228   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_r, ins8250_w, 0xffff)
229   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_r, ins8250_w, 0xffff)
228   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8_MODERN("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff)
229   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff)
230230   AM_RANGE(0x0340, 0x0357) AM_NOP /* anonymous bios should not recogniced realtimeclock */
231231   AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8("lpt_1", pc_lpt_r, pc_lpt_w, 0x00ff)
232232   AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_r, pc_lpt_w, 0x00ff)
233   AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8("ins8250_2", ins8250_r, ins8250_w, 0xffff)
233   AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8_MODERN("ins8250_2", ins8250_device, ins8250_r, ins8250_w, 0xffff)
234234   AM_RANGE(0x03f0, 0x03f7) AM_READWRITE8(pc_fdc_r,            pc_fdc_w, 0xffff)
235   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_r, ins8250_w, 0xffff)
235   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff)
236236ADDRESS_MAP_END
237237
238238
r14535r14536
257257   AM_RANGE(0x0250, 0x025f) AM_READWRITE(europc_jim_r,         europc_jim_w)
258258   AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE("lpt_2", pc_lpt_r, pc_lpt_w)
259259   AM_RANGE(0x02e0, 0x02e0) AM_READ     (europc_jim2_r)
260   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE("ins8250_3", ins8250_r, ins8250_w)
261   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_r, ins8250_w)
260   AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE_MODERN("ins8250_3", ins8250_device, ins8250_r, ins8250_w)
261   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w)
262262   AM_RANGE(0x0378, 0x037b) AM_DEVREADWRITE("lpt_1", pc_lpt_r, pc_lpt_w)
263263//  AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE("lpt_0", pc_lpt_r, pc_lpt_w)
264   AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE("ins8250_2", ins8250_r, ins8250_w)
264   AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE_MODERN("ins8250_2", ins8250_device, ins8250_r, ins8250_w)
265265   AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(pc_fdc_r,            pc_fdc_w)
266   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE("ins8250_0", ins8250_r, ins8250_w)
266   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w)
267267ADDRESS_MAP_END
268268
269269
r14535r14536
289289   AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r,            pc_page_w)
290290   AM_RANGE(0x00c0, 0x00c0) AM_DEVWRITE("sn76496",    sn76496_w)
291291   AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc_JOY_r,               pc_JOY_w)
292   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_r, ins8250_w)
292   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w)
293293   AM_RANGE(0x0378, 0x037f) AM_READWRITE(pc_t1t_p37x_r,         pc_t1t_p37x_w)
294294   AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE("lpt_0", pc_lpt_r, pc_lpt_w)
295295   AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(pc_fdc_r,               pc_fdc_w)
296   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE("ins8250_0", ins8250_r, ins8250_w)
296   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w)
297297ADDRESS_MAP_END
298298
299299
r14535r14536
319319   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r,            pc_page_w, 0xffff)
320320   AM_RANGE(0x00c0, 0x00c1) AM_DEVWRITE8("sn76496",   sn76496_w, 0xffff)
321321   AM_RANGE(0x0200, 0x0207) AM_READWRITE8(pc_JOY_r,               pc_JOY_w, 0xffff)
322   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_r, ins8250_w, 0xffff)
322   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff)
323323   AM_RANGE(0x0378, 0x037f) AM_READWRITE8(pc_t1t_p37x_r,         pc_t1t_p37x_w, 0xffff)
324324   AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_r, pc_lpt_w, 0xffff)
325325   AM_RANGE(0x03f0, 0x03f7) AM_READWRITE8(pc_fdc_r,               pc_fdc_w, 0xffff)
326   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_r, ins8250_w, 0xffff)
326   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff)
327327   AM_RANGE(0xffea, 0xffeb) AM_READWRITE8(tandy1000_bank_r, tandy1000_bank_w, 0xffff)
328328ADDRESS_MAP_END
329329
r14535r14536
350350   AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r,               pc_page_w, 0xffff)
351351   AM_RANGE(0x00c0, 0x00c1) AM_DEVWRITE8("sn76496",    sn76496_w, 0xffff)
352352   AM_RANGE(0x0200, 0x0207) AM_READWRITE8(pc_JOY_r,                    pc_JOY_w, 0xffff)
353   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_r, ins8250_w, 0xffff)
353   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff)
354354   AM_RANGE(0x0378, 0x037f) AM_READWRITE8(pc_t1t_p37x_r,           pc_t1t_p37x_w, 0xffff)
355355   AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_r, pc_lpt_w, 0xffff)
356356   AM_RANGE(0x03f0, 0x03f7) AM_READWRITE8(pc_fdc_r,                    pc_fdc_w, 0xffff)
357   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_r, ins8250_w, 0xffff)
357   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff)
358358ADDRESS_MAP_END
359359
360360
r14535r14536
381381   AM_RANGE(0x00c0, 0x00c0) AM_DEVWRITE("sn76496",    sn76496_w)
382382   AM_RANGE(0x00f0, 0x00f7) AM_READWRITE(pc_fdc_r,               pcjr_fdc_w)
383383   AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc_JOY_r,               pc_JOY_w)
384   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_r, ins8250_w)
384   AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE_MODERN("ins8250_1", ins8250_device, ins8250_r, ins8250_w)
385385   AM_RANGE(0x0378, 0x037f) AM_READWRITE(pc_t1t_p37x_r,         pc_t1t_p37x_w)
386386   AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE("lpt_0", pc_lpt_r, pc_lpt_w)
387   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE("ins8250_0", ins8250_r, ins8250_w)
387   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE_MODERN("ins8250_0", ins8250_device, ins8250_r, ins8250_w)
388388ADDRESS_MAP_END
389389
390390static ADDRESS_MAP_START(ibmpcjx_map, AS_PROGRAM, 8 )
r14535r14536
453453   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
454454
455455   PORT_START("DSW2") /* IN3 */
456   PORT_DIPNAME( 0xf0, 0x80, "Serial mouse")
457   PORT_DIPSETTING(   0x80, "COM1" )
458   PORT_DIPSETTING(   0x40, "COM2" )
459   PORT_DIPSETTING(   0x20, "COM3" )
460   PORT_DIPSETTING(   0x10, "COM4" )
461   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
462456   PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)")
463457   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
464458   PORT_DIPSETTING(   0x08, DEF_STR( Yes ) )
r14535r14536
469463   PORT_BIT( 0x01, 0x01,   IPT_UNUSED )
470464
471465   PORT_INCLUDE( kb_keytronic_pc )
472   PORT_INCLUDE( pc_mouse_microsoft )   /* IN12 - IN14 */
473466   PORT_INCLUDE( pc_joystick )         /* IN15 - IN19 */
474467   PORT_INCLUDE( pcvideo_cga )
475468INPUT_PORTS_END
r14535r14536
530523   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
531524
532525   PORT_START("DSW2") /* IN3 */
533   PORT_DIPNAME( 0xf0, 0x80, "Serial mouse")
534   PORT_DIPSETTING(   0x80, "COM1" )
535   PORT_DIPSETTING(   0x40, "COM2" )
536   PORT_DIPSETTING(   0x20, "COM3" )
537   PORT_DIPSETTING(   0x10, "COM4" )
538   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
539526   PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)")
540527   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
541528   PORT_DIPSETTING(   0x08, DEF_STR( Yes ) )
r14535r14536
546533   PORT_BIT( 0x01, 0x01,   IPT_UNUSED )
547534
548535   PORT_INCLUDE( kb_keytronic_pc )
549   PORT_INCLUDE( pc_mouse_microsoft )   /* IN12 - IN14 */
550536   PORT_INCLUDE( pc_joystick )         /* IN15 - IN19 */
551537   PORT_INCLUDE( pcvideo_cga )
552538INPUT_PORTS_END
r14535r14536
587573   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
588574
589575   PORT_START("DSW2") /* IN3 */
590   PORT_DIPNAME( 0xf0, 0x80, "Serial mouse")
591   PORT_DIPSETTING(   0x80, "COM1" )
592   PORT_DIPSETTING(   0x40, "COM2" )
593   PORT_DIPSETTING(   0x20, "COM3" )
594   PORT_DIPSETTING(   0x10, "COM4" )
595   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
596576   PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)")
597577   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
598578   PORT_DIPSETTING(   0x08, DEF_STR( Yes ) )
r14535r14536
604584
605585   EUROPC_KEYBOARD
606586
607   PORT_INCLUDE( pc_mouse_microsoft )   /* IN12 - IN14 */
608587   PORT_INCLUDE( pc_joystick )         /* IN15 - IN19 */
609588   PORT_INCLUDE( pcvideo_cga )
610589INPUT_PORTS_END
r14535r14536
665644   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
666645
667646   PORT_START("DSW2") /* IN3 */
668   PORT_DIPNAME( 0xf0, 0x80, "Serial mouse")
669   PORT_DIPSETTING(   0x80, "COM1" )
670   PORT_DIPSETTING(   0x40, "COM2" )
671   PORT_DIPSETTING(   0x20, "COM3" )
672   PORT_DIPSETTING(   0x10, "COM4" )
673   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
674647   PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)")
675648   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
676649   PORT_DIPSETTING(   0x08, DEF_STR( Yes ) )
r14535r14536
684657
685658//  PORT_INCLUDE( at_keyboard )     /* IN4 - IN11 */
686659    PORT_INCLUDE( kb_keytronic_pc )
687   PORT_INCLUDE( pc_mouse_microsoft )   /* IN12 - IN14 */
688660   PORT_INCLUDE( pc_joystick )         /* IN15 - IN19 */
689661   PORT_INCLUDE( pcvideo_cga )
690662INPUT_PORTS_END
r14535r14536
715687   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
716688
717689   PORT_START("DSW2") /* IN3 */
718   PORT_DIPNAME( 0xf0, 0x80, "Serial mouse")
719   PORT_DIPSETTING(   0x80, "COM1" )
720   PORT_DIPSETTING(   0x40, "COM2" )
721   PORT_DIPSETTING(   0x20, "COM3" )
722   PORT_DIPSETTING(   0x10, "COM4" )
723   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
724690   PORT_DIPNAME( 0x08, 0x08, "HDC1 (C800:0 port 320-323)")
725691   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
726692   PORT_DIPSETTING(   0x08, DEF_STR( Yes ) )
r14535r14536
731697   PORT_BIT( 0x01, 0x01,   IPT_UNUSED )
732698
733699   PORT_INCLUDE( t1000_keyboard )
734   PORT_INCLUDE( pc_mouse_microsoft )   /* IN12 - IN14 */
735700   PORT_INCLUDE( pc_joystick )         /* IN15 - IN19 */
736701INPUT_PORTS_END
737702
r14535r14536
756721   NULL
757722};
758723
724SLOT_INTERFACE_START(ibm5150_com)
725   SLOT_INTERFACE("microsoft_mouse", MSFT_SERIAL_MOUSE)
726   SLOT_INTERFACE("mouse_systems_mouse", MSYSTEM_SERIAL_MOUSE)
727SLOT_INTERFACE_END
728
759729static const kb_keytronic_interface pc_keytronic_intf =
760730{
761731   DEVCB_MEMORY_HANDLER("maincpu", IO, ibm5150_kb_set_clock_signal),
r14535r14536
834804
835805   MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface )
836806
837   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
838   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
839   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] )         /* TODO: Verify model */
840   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] )         /* TODO: Verify model */
807   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz )   /* TODO: Verify model */
808   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz )   /* TODO: Verify model */
809   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz )   /* TODO: Verify model */
810   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz )   /* TODO: Verify model */
811   MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL )
812   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL )
813   MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL )
814   MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL )
841815
842816   /* video hardware */
843817   MCFG_FRAGMENT_ADD( pcvideo_cga )
r14535r14536
882856
883857   MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface )
884858
885   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
886   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
887   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] )         /* TODO: Verify model */
888   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] )         /* TODO: Verify model */
859   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz )   /* TODO: Verify model */
860   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz )   /* TODO: Verify model */
861   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz )   /* TODO: Verify model */
862   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz )   /* TODO: Verify model */
863   MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL )
864   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL )
865   MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL )
866   MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL )
889867
890868   /* video hardware */
891869   MCFG_FRAGMENT_ADD( pcvideo_cga32k )
r14535r14536
959937
960938   MCFG_I8255_ADD( "ppi8255", pc_ppi8255_interface )
961939
962   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
963   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
964   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] )         /* TODO: Verify model */
965   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] )         /* TODO: Verify model */
940   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz )   /* TODO: Verify model */
941   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz )   /* TODO: Verify model */
942   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz )   /* TODO: Verify model */
943   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz )   /* TODO: Verify model */
944   MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL )
945   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL )
946   MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL )
947   MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL )
966948
967949   /* video hardware */
968950   MCFG_FRAGMENT_ADD( pcvideo_aga )
r14535r14536
1005987
1006988   MCFG_I8255_ADD( "ppi8255", pc_ppi8255_interface )
1007989
1008   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
1009   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
990   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz )   /* TODO: Verify model */
991   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz )   /* TODO: Verify model */
992   MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL )
993   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL )
1010994
1011995   /* video hardware */
1012996   MCFG_FRAGMENT_ADD( pcvideo_t1000 )
r14535r14536
10511035
10521036   MCFG_I8255_ADD( "ppi8255", pc_ppi8255_interface )
10531037
1054   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
1055   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
1038   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz )   /* TODO: Verify model */
1039   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz )   /* TODO: Verify model */
1040   MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL )
1041   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL )
10561042
10571043   /* video hardware */
10581044   MCFG_FRAGMENT_ADD( pcvideo_t1000 )
r14535r14536
10971083
10981084   MCFG_I8255_ADD( "ppi8255", pc_ppi8255_interface )
10991085
1100   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
1101   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
1086   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz )   /* TODO: Verify model */
1087   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz )   /* TODO: Verify model */
1088   MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL )
1089   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL )
11021090
11031091   /* video hardware */
11041092   MCFG_FRAGMENT_ADD( pcvideo_t1000 )
r14535r14536
11541142
11551143   MCFG_I8255_ADD( "ppi8255", pcjr_ppi8255_interface )
11561144
1157   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
1158   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
1145   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz )   /* TODO: Verify model */
1146   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz )   /* TODO: Verify model */
1147   MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL )
1148   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL )
11591149
11601150   /* video hardware */
11611151   MCFG_FRAGMENT_ADD( pcvideo_pcjr )
r14535r14536
12351225
12361226   MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface )
12371227
1238   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
1239   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
1240   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] )         /* TODO: Verify model */
1241   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] )         /* TODO: Verify model */
1228   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz )   /* TODO: Verify model */
1229   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz )   /* TODO: Verify model */
1230   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz )   /* TODO: Verify model */
1231   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz )   /* TODO: Verify model */
1232   MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL )
1233   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL )
1234   MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL )
1235   MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL )
12421236
12431237   /* video hardware */
12441238   MCFG_FRAGMENT_ADD( pcvideo_cga )
r14535r14536
12841278
12851279   MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface )
12861280
1287   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
1288   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
1289   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] )         /* TODO: Verify model */
1290   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] )         /* TODO: Verify model */
1281   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz )   /* TODO: Verify model */
1282   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz )   /* TODO: Verify model */
1283   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz )   /* TODO: Verify model */
1284   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz )   /* TODO: Verify model */
1285   MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL )
1286   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL )
1287   MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL )
1288   MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL )
12911289
12921290   /* video hardware */
12931291//  MCFG_FRAGMENT_ADD( pcvideo_ega ) // Put this back after ISA are added to this driver
r14535r14536
13321330
13331331   MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface )
13341332
1335   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
1336   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
1337   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] )         /* TODO: Verify model */
1338   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] )         /* TODO: Verify model */
1333   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz )   /* TODO: Verify model */
1334   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz )   /* TODO: Verify model */
1335   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz )   /* TODO: Verify model */
1336   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz )   /* TODO: Verify model */
1337   MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL )
1338   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL )
1339   MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL )
1340   MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL )
13391341
13401342   /* video hardware */
13411343   MCFG_FRAGMENT_ADD( pcvideo_poisk2 )
r14535r14536
13801382
13811383   MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface )
13821384
1383   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
1384   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
1385   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] )         /* TODO: Verify model */
1386   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] )         /* TODO: Verify model */
1385   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz )   /* TODO: Verify model */
1386   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz )   /* TODO: Verify model */
1387   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz )   /* TODO: Verify model */
1388   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz )   /* TODO: Verify model */
1389   MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL )
1390   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL )
1391   MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL )
1392   MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL )
13871393
13881394   /* video hardware */
13891395   MCFG_FRAGMENT_ADD( pcvideo_cga )
r14535r14536
14281434
14291435   MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface )
14301436
1431   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
1432   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
1433   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] )         /* TODO: Verify model */
1434   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] )         /* TODO: Verify model */
1437   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz )   /* TODO: Verify model */
1438   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz )   /* TODO: Verify model */
1439   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz )   /* TODO: Verify model */
1440   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz )   /* TODO: Verify model */
1441   MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL )
1442   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL )
1443   MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL )
1444   MCFG_RS232_PORT_ADD( "serport3", ibm5150_serport_config[3], ibm5150_com, NULL, NULL )
14351445
14361446   /* video hardware */
14371447   MCFG_FRAGMENT_ADD( pcvideo_cga )
r14535r14536
14761486
14771487   MCFG_I8255_ADD( "ppi8255", ibm5160_ppi8255_interface )
14781488
1479   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0] )         /* TODO: Verify model */
1480   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1] )         /* TODO: Verify model */
1481   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2] )         /* TODO: Verify model */
1482   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3] )         /* TODO: Verify model */
1489   MCFG_INS8250_ADD( "ins8250_0", ibm5150_com_interface[0], XTAL_1_8432MHz )   /* TODO: Verify model */
1490   MCFG_INS8250_ADD( "ins8250_1", ibm5150_com_interface[1], XTAL_1_8432MHz )   /* TODO: Verify model */
1491   MCFG_INS8250_ADD( "ins8250_2", ibm5150_com_interface[2], XTAL_1_8432MHz )   /* TODO: Verify model */
1492   MCFG_INS8250_ADD( "ins8250_3", ibm5150_com_interface[3], XTAL_1_8432MHz )   /* TODO: Verify model */
1493   MCFG_RS232_PORT_ADD( "serport0", ibm5150_serport_config[0], ibm5150_com, NULL, NULL )
1494   MCFG_RS232_PORT_ADD( "serport1", ibm5150_serport_config[1], ibm5150_com, NULL, NULL )
1495   MCFG_RS232_PORT_ADD( "serport2", ibm5150_serport_config[2], ibm5150_com, NULL, NULL )
14831496
14841497   /* video hardware */
14851498   MCFG_FRAGMENT_ADD( pcvideo_cga )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team