Previous 15994 Revisions Next

r3833 Saturday 13th December, 2008 at 16:37:15 UTC by Miodrag Milanović
Removed Machine and moved to regular read/write handlers
[src/mess/drivers]tm990189.c
[src/mess/machine]geneve.c ti99_4x.c tms9901.c tms9901.h

src/mess/machine/tms9901.c
r3832r3833
308308{
309309   int answer;
310310   tms9901_t *tms = get_token(device);
311   const address_space* space = cpu_get_address_space(device->machine->cpu[0],ADDRESS_SPACE_PROGRAM);
311312
312313   offset &= 0x003;
313314
r3832r3833
323324         answer = ((~ tms->int_state) & tms->supported_int_mask) & 0xFF;
324325
325326         if (tms->intf->read_handlers[0])
326            answer |= (* tms->intf->read_handlers[0])(0);
327            answer |= (* tms->intf->read_handlers[0])(space, 0);
327328
328329         answer &= ~ tms->pio_direction_mirror;
329330         answer |= (tms->pio_output_mirror & tms->pio_direction_mirror) & 0xFF;
r3832r3833
341342         answer = ((~ tms->int_state) & tms->supported_int_mask) >> 8;
342343
343344         if (tms->intf->read_handlers[1])
344            answer |= (* tms->intf->read_handlers[1])(1);
345            answer |= (* tms->intf->read_handlers[1])(space, 1);
345346
346347         answer &= ~ (tms->pio_direction_mirror >> 8);
347348         answer |= (tms->pio_output_mirror & tms->pio_direction_mirror) >> 8;
r3832r3833
351352      /* exit timer mode */
352353      tms->mode9901 = 0;
353354
354      answer = (tms->intf->read_handlers[2]) ? (* tms->intf->read_handlers[2])(2) : 0;
355      answer = (tms->intf->read_handlers[2]) ? (* tms->intf->read_handlers[2])(space, 2) : 0;
355356
356357      answer &= ~ tms->pio_direction;
357358      answer |= (tms->pio_output & tms->pio_direction) & 0xFF;
r3832r3833
361362      /* exit timer mode */
362363      tms->mode9901 = 0;
363364
364      answer = (tms->intf->read_handlers[3]) ? (* tms->intf->read_handlers[3])(3) : 0;
365      answer = (tms->intf->read_handlers[3]) ? (* tms->intf->read_handlers[3])(space, 3) : 0;
365366
366367      answer &= ~ (tms->pio_direction >> 8);
367368      answer |= (tms->pio_output & tms->pio_direction) >> 8;
r3832r3833
388389WRITE8_DEVICE_HANDLER ( tms9901_cru_w )
389390{
390391   tms9901_t *tms = get_token(device);
392   const address_space* space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
391393
392394   data &= 1;   /* clear extra bits */
393395   offset &= 0x01F;
r3832r3833
528530         }
529531
530532         if (tms->intf->write_handlers[pin] != NULL)
531            (* tms->intf->write_handlers[pin])(pin, data);
533            (* tms->intf->write_handlers[pin])(space, pin, data);
532534      }
533535
534536      break;
src/mess/machine/tms9901.h
r3832r3833
3434    TYPE DEFINITIONS
3535***************************************************************************/
3636
37typedef void (*tms9910_int_callback_func)(const device_config *device, int intreq, int ic);
38#define TMS9910_INT_CALLBACK(name)   void name(const device_config *device, int intreq, int ic )
39
3740/* TMS5501 timer and interrupt controler */
3841typedef struct _tms9901_interface tms9901_interface;
3942struct _tms9901_interface
4043{
4144   int supported_int_mask;   /* a bit for each input pin whose state is always notified to the TMS9901 core */
42   int (*read_handlers[4])(int offset);   /* 4*8 bits */
43   void (*write_handlers[16])(int offset, int data);   /* 16 Pn outputs */
44   void (*interrupt_callback)(const device_config *device, int intreq, int ic);      /* called when interrupt bus state changes */
45   read8_space_func  read_handlers[4];     /* 4*8 bits */
46   write8_space_func write_handlers[16]; /* 16 Pn outputs */
47   tms9910_int_callback_func interrupt_callback; /* called when interrupt bus state changes */
4548   double clock_rate;
4649};
4750
src/mess/machine/geneve.c
r3832r3833
55
66#include <math.h>
77#include "driver.h"
8#include "deprecat.h"
98#include "tms9901.h"
109#include "mm58274c.h"
1110#include "video/v9938.h"
r3832r3833
3130static void poll_keyboard(running_machine *machine);
3231static void poll_mouse(running_machine *machine);
3332
34static void tms9901_interrupt_callback(const device_config *device,int intreq, int ic);
35static int R9901_0(int offset);
36static int R9901_1(int offset);
37static int R9901_2(int offset);
38static int R9901_3(int offset);
39
40static void W9901_PE_bus_reset(int offset, int data);
41static void W9901_VDP_reset(int offset, int data);
42static void W9901_JoySel(int offset, int data);
43static void W9901_KeyboardReset(int offset, int data);
44static void W9901_ext_mem_wait_states(int offset, int data);
45static void W9901_VDP_wait_states(int offset, int data);
46
4733/*
4834   pointers to memory areas
4935*/
r3832r3833
7561/* TRUE if we are using the alternative boot ROM */
7662static char has_alt_boot;
7763
78/* tms9901 setup */
79const tms9901_interface tms9901reset_param_ti99 =
80{
81   TMS9901_INT1 | TMS9901_INT2 | TMS9901_INT8 | TMS9901_INTB | TMS9901_INTC,   /* only input pins whose state is always known */
82
83   {   /* read handlers */
84      R9901_0,
85      R9901_1,
86      R9901_2,
87      R9901_3
88   },
89
90   {   /* write handlers */
91      W9901_PE_bus_reset,
92      W9901_VDP_reset,
93      W9901_JoySel,
94      NULL,
95      NULL,
96      NULL,
97      W9901_KeyboardReset,
98      W9901_ext_mem_wait_states,
99      NULL,
100      W9901_VDP_wait_states,
101      NULL,
102      NULL,
103      NULL,
104      NULL,
105      NULL,
106      NULL
107   },
108
109   /* interrupt handler */
110   tms9901_interrupt_callback,
111
112   /* clock rate = 3MHz */
113   3000000.
114};
115
11664/* keyboard interface */
11765static int JoySel;
11866enum
r3832r3833
13391287/*
13401288   Called by the 9901 core whenever the state of INTREQ and IC0-3 changes
13411289*/
1342static void tms9901_interrupt_callback(const device_config *device, int intreq, int ic)
1290static TMS9910_INT_CALLBACK( tms9901_interrupt_callback )
13431291{
13441292   /* INTREQ is connected to INT1 (IC0-3 are not connected) */
13451293   cpu_set_input_line(device->machine->cpu[0], 0, intreq ? ASSERT_LINE : CLEAR_LINE);
r3832r3833
13531301    (bit 2: INT2 status)
13541302    bit 3-7: joystick status
13551303*/
1356static int R9901_0(int offset)
1304static READ8_HANDLER( R9901_0 )
13571305{
13581306   int answer;
13591307
1360   answer = input_port_read(Machine, "JOY") >> (JoySel * 8);
1308   answer = input_port_read(space->machine, "JOY") >> (JoySel * 8);
13611309
13621310   return (answer);
13631311}
r3832r3833
13741322    bit 5 & 7: used as output
13751323    bit 6: unused
13761324*/
1377static int R9901_1(int offset)
1325static READ8_HANDLER( R9901_1 )
13781326{
13791327   int answer;
13801328
1381   answer = (input_port_read(Machine, "MOUSE0") & 4) ^ 4;
1329   answer = (input_port_read(space->machine, "MOUSE0") & 4) ^ 4;
13821330
13831331   return answer;
13841332}
r3832r3833
13861334/*
13871335   Read pins P0-P7 of Geneve 9901.
13881336*/
1389static int R9901_2(int offset)
1337static READ8_HANDLER( R9901_2 )
13901338{
13911339   return 0;
13921340}
r3832r3833
13951343   Read pins P8-P15 of Geneve 9901.
13961344   bit 4: mouse right button
13971345*/
1398static int R9901_3(int offset)
1346static READ8_HANDLER( R9901_3 )
13991347{
14001348   int answer = 0;
14011349
1402   if (! (input_port_read(Machine, "MOUSE0") & 4))
1350   if (! (input_port_read(space->machine, "MOUSE0") & 4))
14031351      answer |= 0x10;
14041352
14051353   return answer;
r3832r3833
14091357/*
14101358   Write PE bus reset line
14111359*/
1412static void W9901_PE_bus_reset(int offset, int data)
1360static WRITE8_HANDLER( W9901_PE_bus_reset )
14131361{
14141362}
14151363
14161364/*
14171365   Write VDP reset line
14181366*/
1419static void W9901_VDP_reset(int offset, int data)
1367static WRITE8_HANDLER( W9901_VDP_reset )
14201368{
14211369}
14221370
14231371/*
14241372   Write joystick select line
14251373*/
1426static void W9901_JoySel(int offset, int data)
1374static WRITE8_HANDLER( W9901_JoySel )
14271375{
14281376   JoySel = data;
14291377}
14301378
1431static void W9901_KeyboardReset(int offset, int data)
1379static WRITE8_HANDLER( W9901_KeyboardReset )
14321380{
14331381   KeyReset = ! data;
14341382   if (KeyReset)
r3832r3833
14451393      KeyAutoRepeatKey = 0;
14461394   }
14471395   /*else
1448      poll_keyboard(Machine);*/
1396      poll_keyboard(space->machine);*/
14491397}
14501398
14511399/*
14521400   Write external mem cycles (0=long, 1=short)
14531401*/
1454static void W9901_ext_mem_wait_states(int offset, int data)
1402static WRITE8_HANDLER( W9901_ext_mem_wait_states )
14551403{
14561404}
14571405
14581406/*
14591407   Write vdp wait cycles (1=add 15 cycles, 0=add none)
14601408*/
1461static void W9901_VDP_wait_states(int offset, int data)
1409static WRITE8_HANDLER( W9901_VDP_wait_states )
14621410{
14631411}
14641412
1413/* tms9901 setup */
1414const tms9901_interface tms9901reset_param_ti99 =
1415{
1416   TMS9901_INT1 | TMS9901_INT2 | TMS9901_INT8 | TMS9901_INTB | TMS9901_INTC,   /* only input pins whose state is always known */
14651417
1418   {   /* read handlers */
1419      R9901_0,
1420      R9901_1,
1421      R9901_2,
1422      R9901_3
1423   },
14661424
1425   {   /* write handlers */
1426      W9901_PE_bus_reset,
1427      W9901_VDP_reset,
1428      W9901_JoySel,
1429      NULL,
1430      NULL,
1431      NULL,
1432      W9901_KeyboardReset,
1433      W9901_ext_mem_wait_states,
1434      NULL,
1435      W9901_VDP_wait_states,
1436      NULL,
1437      NULL,
1438      NULL,
1439      NULL,
1440      NULL,
1441      NULL
1442   },
1443
1444   /* interrupt handler */
1445   tms9901_interrupt_callback,
1446
1447   /* clock rate = 3MHz */
1448   3000000.
1449};
1450
1451
src/mess/machine/ti99_4x.c
r3832r3833
7777static WRITE16_HANDLER ( ti99_wspeech_w );
7878
7979static void tms9901_set_int1(running_machine *machine, int state);
80static void tms9901_interrupt_callback(const device_config *device, int intreq, int ic);
81static int ti99_R9901_0(int offset);
82static int ti99_R9901_1(int offset);
83static int ti99_R9901_2(int offset);
84static int ti99_R9901_3(int offset);
8580
86static void ti99_handset_set_ack(int offset, int data);
8781static void ti99_handset_task(running_machine *machine);
8882static void mecmouse_poll(running_machine *machine);
89static void ti99_KeyC(int offset, int data);
90static void ti99_AlphaW(int offset, int data);
9183
92static int ti99_8_R9901_0(int offset);
93static int ti99_8_R9901_1(int offset);
94static void ti99_8_KeyC(int offset, int data);
95static void ti99_8_WCRUS(int offset, int data);
96static void ti99_8_PTGEN(int offset, int data);
97
98static void ti99_CS_motor(int offset, int data);
99static void ti99_audio_gate(int offset, int data);
100static void ti99_CS_output(int offset, int data);
101
10284static void ti99_8_internal_dsr_reset(running_machine *machine);
10385
10486static void ti99_4p_internal_dsr_reset(running_machine *machine);
r3832r3833
145127/* TRUE if usb-sm card present */
146128static char has_usb_sm;
147129
148
149/* tms9901 setup */
150const tms9901_interface tms9901reset_param_ti99_4x =
151{
152   TMS9901_INT1 | TMS9901_INT2 | TMS9901_INTC,   /* only input pins whose state is always known */
153
154   {   /* read handlers */
155      ti99_R9901_0,
156      ti99_R9901_1,
157      ti99_R9901_2,
158      ti99_R9901_3
159   },
160
161   {   /* write handlers */
162      ti99_handset_set_ack,
163      NULL,
164      ti99_KeyC,
165      ti99_KeyC,
166      ti99_KeyC,
167      ti99_AlphaW,
168      ti99_CS_motor,
169      ti99_CS_motor,
170      ti99_audio_gate,
171      ti99_CS_output,
172      NULL,
173      NULL,
174      NULL,
175      NULL,
176      NULL,
177      NULL
178   },
179
180   /* interrupt handler */
181   tms9901_interrupt_callback,
182
183   /* clock rate = 3MHz */
184   3000000.
185};
186
187const tms9901_interface tms9901reset_param_ti99_8 =
188{
189   TMS9901_INT1 | TMS9901_INT2 | TMS9901_INTC,   /* only input pins whose state is always known */
190
191   {   /* read handlers */
192      ti99_8_R9901_0,
193      ti99_8_R9901_1,
194      ti99_R9901_2,
195      ti99_R9901_3
196   },
197
198   {   /* write handlers */
199      ti99_8_KeyC,
200      ti99_8_KeyC,
201      ti99_8_KeyC,
202      ti99_8_KeyC,
203      ti99_8_WCRUS,
204      ti99_8_PTGEN,
205      ti99_CS_motor,
206      NULL,
207      ti99_audio_gate,
208      ti99_CS_output,
209      NULL,
210      NULL,
211      NULL,
212      NULL,
213      NULL,
214      NULL
215   },
216
217   /* interrupt handler */
218   tms9901_interrupt_callback,
219
220   /* clock rate = 3.58MHz??? 2.68MHz??? */
221   /*3579545.*/2684658.75
222};
223
224130/* handset interface */
225131static int handset_buf;
226132static int handset_buflen;
r3832r3833
18031709
18041710   Handler for tms9901 P0 pin (handset data acknowledge)
18051711*/
1806static void ti99_handset_set_ack(int offset, int data)
1712WRITE8_HANDLER( ti99_handset_set_ack )
18071713{
18081714   if (has_handset && handset_buflen && (data != handset_ack))
18091715   {
18101716      handset_ack = data;
18111717      if (data == handset_clock)
18121718         /* I don't know what the real delay is, but 30us apears to be enough */
1813         timer_set(Machine, ATTOTIME_IN_USEC(30), NULL, 0, ti99_handset_ack_callback);
1719         timer_set(space->machine, ATTOTIME_IN_USEC(30), NULL, 0, ti99_handset_ack_callback);
18141720   }
18151721}
18161722
r3832r3833
22262132/*
22272133   Called by the 9901 core whenever the state of INTREQ and IC0-3 changes
22282134*/
2229static void tms9901_interrupt_callback(const device_config *device, int intreq, int ic)
2135static TMS9910_INT_CALLBACK( tms9901_interrupt_callback )
22302136{
22312137   if (intreq)
22322138   {
r3832r3833
22482154    (bit 2: INT2 status)
22492155    bit 3-7: keyboard status bits 0 to 4
22502156*/
2251static int ti99_R9901_0(int offset)
2157static READ8_HANDLER( ti99_R9901_0 )
22522158{
2253   running_machine *machine = Machine;
22542159   int answer;
22552160   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3" };
22562161
r3832r3833
22582163      answer = (ti99_handset_poll_bus() << 3) | 0x80;
22592164   else if (has_mecmouse && (KeyCol == ((ti99_model == model_99_4) ? 6 : 7)))
22602165   {
2261      int buttons = input_port_read(machine, "MOUSE0") & 3;
2166      int buttons = input_port_read(space->machine, "MOUSE0") & 3;
22622167
22632168      answer = (mecmouse_read_y ? mecmouse_y_buf : mecmouse_x_buf) << 4;
22642169
r3832r3833
22712176   }
22722177   else
22732178   {
2274      answer = ((input_port_read(machine, keynames[KeyCol >> 1]) >> ((KeyCol & 1) * 8)) << 3) & 0xF8;
2179      answer = ((input_port_read(space->machine, keynames[KeyCol >> 1]) >> ((KeyCol & 1) * 8)) << 3) & 0xF8;
22752180   }
22762181   
22772182   if ((ti99_model == model_99_4a) || (ti99_model == model_99_4p))
22782183   {
22792184      if (! AlphaLockLine)
2280         answer &= ~ (input_port_read(machine, "ALPHA") << 3);
2185         answer &= ~ (input_port_read(space->machine, "ALPHA") << 3);
22812186   }
22822187
22832188   return answer;
r3832r3833
22922197    (bit 4: IR remote handset interrupt)
22932198    bit 5-7: weird, not emulated
22942199*/
2295static int ti99_R9901_1(int offset)
2200static READ8_HANDLER( ti99_R9901_1 )
22962201{
2297   running_machine *machine = Machine;
22982202   int answer;
22992203   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3" };
23002204
r3832r3833
23022206      answer = 0x07;
23032207   else
23042208   {
2305      answer = ((input_port_read(machine, keynames[KeyCol >> 1]) >> ((KeyCol & 1) * 8)) >> 5) & 0x07;
2209      answer = ((input_port_read(space->machine, keynames[KeyCol >> 1]) >> ((KeyCol & 1) * 8)) >> 5) & 0x07;
23062210   }
23072211   
23082212   /* we don't take CS2 into account, as CS2 is a write-only unit */
r3832r3833
23172221
23182222    bit 1: handset data clock pin
23192223*/
2320static int ti99_R9901_2(int offset)
2224static READ8_HANDLER( ti99_R9901_2 )
23212225{
23222226   return (has_handset && handset_clock) ? 2 : 0;
23232227}
r3832r3833
23282232    bit 26: IR handset interrupt
23292233    bit 27: tape input
23302234*/
2331static int ti99_R9901_3(int offset)
2235static READ8_HANDLER( ti99_R9901_3 )
23322236{
2333   running_machine *machine = Machine;
23342237   int answer;
23352238
23362239   if (has_handset && (handset_buflen == 3))
r3832r3833
23412244   /* we don't take CS2 into account, as CS2 is a write-only unit */
23422245   if ( ti99_model != model_99_8 )
23432246   {
2344      if (cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette1" )) > 0)
2247      if (cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette1" )) > 0)
23452248         answer |= 8;
23462249   }
23472250   else
23482251   {
2349      if (cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" )) > 0)
2252      if (cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) > 0)
23502253         answer |= 8;
23512254   }
23522255
r3832r3833
23572260/*
23582261   WRITE key column select (P2-P4)
23592262*/
2360static void ti99_KeyC(int offset, int data)
2263static WRITE8_HANDLER( ti99_KeyC )
23612264{
23622265   if (data)
23632266      KeyCol |= 1 << (offset-2);
r3832r3833
23722275/*
23732276   WRITE alpha lock line - TI99/4a only (P5)
23742277*/
2375static void ti99_AlphaW(int offset, int data)
2278static WRITE8_HANDLER( ti99_AlphaW )
23762279{
23772280   if ((ti99_model == model_99_4a) || (ti99_model == model_99_4p))
23782281      AlphaLockLine = data;
r3832r3833
23882291    bit 5: ???
23892292    bit 6-7: keyboard status bits 0 through 1
23902293*/
2391static int ti99_8_R9901_0(int offset)
2294static READ8_HANDLER( ti99_8_R9901_0 )
23922295{
2393   running_machine *machine = Machine;
23942296   int answer;
23952297   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7",
23962298                              "KEY8", "KEY9", "KEY10", "KEY11", "KEY12", "KEY13", "KEY14", "KEY15" };
23972299
23982300   if (has_mecmouse && (KeyCol == 15))
23992301   {
2400      int buttons = input_port_read(machine, "MOUSE0") & 3;
2302      int buttons = input_port_read(space->machine, "MOUSE0") & 3;
24012303
24022304      answer = ((mecmouse_read_y ? mecmouse_y_buf : mecmouse_x_buf) << 7) & 0x80;
24032305
r3832r3833
24072309   }
24082310   else
24092311   {
2410      answer = (input_port_read(machine, keynames[KeyCol]) << 6) & 0xC0;
2312      answer = (input_port_read(space->machine, keynames[KeyCol]) << 6) & 0xC0;
24112313   }
24122314   
24132315   return answer;
r3832r3833
24222324    (bit 4: IR remote handset interrupt)
24232325    bit 5-7: weird, not emulated
24242326*/
2425static int ti99_8_R9901_1(int offset)
2327static READ8_HANDLER( ti99_8_R9901_1 )
24262328{
2427   running_machine *machine = Machine;
24282329   int answer;
24292330   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7",
24302331                              "KEY8", "KEY9", "KEY10", "KEY11", "KEY12", "KEY13", "KEY14", "KEY15" };
24312332
24322333   if (has_mecmouse && (KeyCol == 15))
24332334   {
2434      int buttons = input_port_read(machine, "MOUSE0") & 3;
2335      int buttons = input_port_read(space->machine, "MOUSE0") & 3;
24352336
24362337      answer = ((mecmouse_read_y ? mecmouse_y_buf : mecmouse_x_buf) << 1) & 0x03;
24372338
r3832r3833
24412342   }
24422343   else
24432344   {
2444      answer = (input_port_read(machine, keynames[KeyCol]) >> 2) & 0x07;
2345      answer = (input_port_read(space->machine, keynames[KeyCol]) >> 2) & 0x07;
24452346   }
24462347   
24472348   /* we don't take CS2 into account, as CS2 is a write-only unit */
r3832r3833
24542355/*
24552356   WRITE key column select (P0-P3)
24562357*/
2457static void ti99_8_KeyC(int offset, int data)
2358static WRITE8_HANDLER( ti99_8_KeyC )
24582359{
24592360   if (data)
24602361      KeyCol |= 1 << offset;
r3832r3833
24652366      mecmouse_select(KeyCol, 14, 15);
24662367}
24672368
2468static void ti99_8_WCRUS(int offset, int data)
2369static WRITE8_HANDLER( ti99_8_WCRUS )
24692370{
24702371   ti99_8_CRUS = data;
24712372}
24722373
2473static void ti99_8_PTGEN(int offset, int data)
2374static WRITE8_HANDLER( ti99_8_PTGEN )
24742375{
24752376   /* ... */
24762377}
r3832r3833
24782379/*
24792380   command CS1/CS2 tape unit motor (P6-P7)
24802381*/
2481static void ti99_CS_motor(int offset, int data)
2382static WRITE8_HANDLER( ti99_CS_motor )
24822383{
2483   running_machine *machine = Machine;
24842384   const device_config *img;
24852385
24862386   if ( ti99_model != model_99_8 )
24872387   {
2488      img = device_list_find_by_tag( machine->config->devicelist, CASSETTE, ( offset-6 ) ? "cassette2" :  "cassette1" );
2388      img = device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, ( offset-6 ) ? "cassette2" :  "cassette1" );
24892389   }
24902390   else
24912391   {
2492      img = device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
2392      img = device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" );
24932393   }
24942394   cassette_change_state(img, data ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
24952395}
r3832r3833
25032403   We do not really need to emulate this as the tape recorder generates sound
25042404   on its own.
25052405*/
2506static void ti99_audio_gate(int offset, int data)
2406static WRITE8_HANDLER( ti99_audio_gate )
25072407{
25082408}
25092409
r3832r3833
25112411   tape output (P9)
25122412   I think polarity is correct, but don't take my word for it.
25132413*/
2514static void ti99_CS_output(int offset, int data)
2414static WRITE8_HANDLER( ti99_CS_output )
25152415{
2516   running_machine *machine = Machine;
2517
25182416   if (ti99_model != model_99_8)   /* 99/8 only has one tape port!!! */
25192417   {
2520      cassette_output(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette1" ), data ? +1 : -1);
2521      cassette_output(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette2" ), data ? +1 : -1);
2418      cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette1" ), data ? +1 : -1);
2419      cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette2" ), data ? +1 : -1);
25222420   }
25232421   else
25242422   {
2525      cassette_output(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ), data ? +1 : -1);
2423      cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), data ? +1 : -1);
25262424   }
25272425}
25282426
r3832r3833
33753273      }
33763274   }
33773275}
3276
3277/* tms9901 setup */
3278const tms9901_interface tms9901reset_param_ti99_4x =
3279{
3280   TMS9901_INT1 | TMS9901_INT2 | TMS9901_INTC,   /* only input pins whose state is always known */
3281
3282   {   /* read handlers */
3283      ti99_R9901_0,
3284      ti99_R9901_1,
3285      ti99_R9901_2,
3286      ti99_R9901_3
3287   },
3288
3289   {   /* write handlers */
3290      ti99_handset_set_ack,
3291      NULL,
3292      ti99_KeyC,
3293      ti99_KeyC,
3294      ti99_KeyC,
3295      ti99_AlphaW,
3296      ti99_CS_motor,
3297      ti99_CS_motor,
3298      ti99_audio_gate,
3299      ti99_CS_output,
3300      NULL,
3301      NULL,
3302      NULL,
3303      NULL,
3304      NULL,
3305      NULL
3306   },
3307
3308   /* interrupt handler */
3309   tms9901_interrupt_callback,
3310
3311   /* clock rate = 3MHz */
3312   3000000.
3313};
3314
3315const tms9901_interface tms9901reset_param_ti99_8 =
3316{
3317   TMS9901_INT1 | TMS9901_INT2 | TMS9901_INTC,   /* only input pins whose state is always known */
3318
3319   {   /* read handlers */
3320      ti99_8_R9901_0,
3321      ti99_8_R9901_1,
3322      ti99_R9901_2,
3323      ti99_R9901_3
3324   },
3325
3326   {   /* write handlers */
3327      ti99_8_KeyC,
3328      ti99_8_KeyC,
3329      ti99_8_KeyC,
3330      ti99_8_KeyC,
3331      ti99_8_WCRUS,
3332      ti99_8_PTGEN,
3333      ti99_CS_motor,
3334      NULL,
3335      ti99_audio_gate,
3336      ti99_CS_output,
3337      NULL,
3338      NULL,
3339      NULL,
3340      NULL,
3341      NULL,
3342      NULL
3343   },
3344
3345   /* interrupt handler */
3346   tms9901_interrupt_callback,
3347
3348   /* clock rate = 3.58MHz??? 2.68MHz??? */
3349   /*3579545.*/2684658.75
3350};
src/mess/drivers/tm990189.c
r3832r3833
3838*/
3939
4040#include "driver.h"
41#include "deprecat.h"
4241#include "cpu/tms9900/tms9900.h"
4342#include "machine/tms9901.h"
4443#include "machine/tms9902.h"
r3832r3833
8180
8281static void hold_load(running_machine *machine);
8382
84static void usr9901_interrupt_callback(const device_config *device, int intreq, int ic);
85static void sys9901_interrupt_callback(const device_config *device, int intreq, int ic);
86
87static void usr9901_led_w(int offset, int data);
88
89static int sys9901_r0(int offset);
90static void sys9901_digitsel_w(int offset, int data);
91static void sys9901_segment_w(int offset, int data);
92static void sys9901_dsplytrgr_w(int offset, int data);
93static void sys9901_shiftlight_w(int offset, int data);
94static void sys9901_spkrdrive_w(int offset, int data);
95static void sys9901_tapewdata_w(int offset, int data);
96
97
98/* user tms9901 setup */
99static const tms9901_interface usr9901reset_param =
100{
101   TMS9901_INT1 | TMS9901_INT2 | TMS9901_INT3 | TMS9901_INT4 | TMS9901_INT5 | TMS9901_INT6,   /* only input pins whose state is always known */
102
103   {   /* read handlers */
104      NULL
105      /*usr9901_r0,
106        usr9901_r1,
107        usr9901_r2,
108        usr9901_r3*/
109   },
110
111   {   /* write handlers */
112      usr9901_led_w,
113      usr9901_led_w,
114      usr9901_led_w,
115      usr9901_led_w/*,
116        usr9901_w,
117        usr9901_w,
118        usr9901_w,
119        usr9901_w,
120        usr9901_w,
121        usr9901_w,
122        usr9901_w,
123        usr9901_w,
124        usr9901_w,
125        usr9901_w,
126        usr9901_w,
127        usr9901_w*/
128   },
129
130   /* interrupt handler */
131   usr9901_interrupt_callback,
132
133   /* clock rate = 2MHz */
134   2000000.
135};
136
137/* system tms9901 setup */
138static const tms9901_interface sys9901reset_param =
139{
140   0,   /* only input pins whose state is always known */
141
142   {   /* read handlers */
143      sys9901_r0,
144      NULL,
145      NULL,
146      NULL
147   },
148
149   {   /* write handlers */
150      sys9901_digitsel_w,
151      sys9901_digitsel_w,
152      sys9901_digitsel_w,
153      sys9901_digitsel_w,
154      sys9901_segment_w,
155      sys9901_segment_w,
156      sys9901_segment_w,
157      sys9901_segment_w,
158      sys9901_segment_w,
159      sys9901_segment_w,
160      sys9901_segment_w,
161      sys9901_segment_w,
162      sys9901_dsplytrgr_w,
163      sys9901_shiftlight_w,
164      sys9901_spkrdrive_w,
165      sys9901_tapewdata_w
166   },
167
168   /* interrupt handler */
169   sys9901_interrupt_callback,
170
171   /* clock rate = 2MHz */
172   2000000.
173};
174
17583static void rts_callback(int which, int RTS);
17684static void xmit_callback(int which, int data);
17785
r3832r3833
370278    tms9901 code
371279*/
372280
373static void usr9901_interrupt_callback(const device_config *device, int intreq, int ic)
281static TMS9910_INT_CALLBACK ( usr9901_interrupt_callback )
374282{
375283   ic_state = ic & 7;
376284
377285   if (!load_state)
378      field_interrupts(Machine);
286      field_interrupts(device->machine);
379287}
380288
381static void usr9901_led_w(int offset, int data)
289static WRITE8_HANDLER( usr9901_led_w )
382290{
383291   if (data)
384292      LED_state |= (1 << offset);
r3832r3833
386294      LED_state &= ~(1 << offset);
387295}
388296
389static void sys9901_interrupt_callback(const device_config *device,int intreq, int ic)
297static TMS9910_INT_CALLBACK( sys9901_interrupt_callback )
390298{
391299   (void)ic;
392300
393301   tms9901_set_single_int(device_list_find_by_tag(device->machine->config->devicelist, TMS9901, "tms9901_0"), 5, intreq);
394302}
395303
396static int sys9901_r0(int offset)
304static READ8_HANDLER( sys9901_r0 )
397305{
398306   int reply = 0x00;
399307   static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7", "LINE8" };
400308
401309   /* keyboard read */
402310   if (digitsel < 9)
403      reply |= input_port_read(Machine, keynames[digitsel]) << 1;
311      reply |= input_port_read(space->machine, keynames[digitsel]) << 1;
404312
405313   /* tape input */
406   if (cassette_input(device_list_find_by_tag( Machine->config->devicelist, CASSETTE, "cassette" )) > 0.0)
314   if (cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) > 0.0)
407315      reply |= 0x40;
408316
409317   return reply;
410318}
411319
412static void sys9901_digitsel_w(int offset, int data)
320static WRITE8_HANDLER( sys9901_digitsel_w )
413321{
414322   if (data)
415323      digitsel |= 1 << offset;
r3832r3833
417325      digitsel &= ~ (1 << offset);
418326}
419327
420static void sys9901_segment_w(int offset, int data)
328static WRITE8_HANDLER( sys9901_segment_w )
421329{
422330   if (data)
423331      segment |= 1 << (offset-4);
r3832r3833
429337   }
430338}
431339
432static void sys9901_dsplytrgr_w(int offset, int data)
340static WRITE8_HANDLER( sys9901_dsplytrgr_w )
433341{
434342   if ((!data) && (digitsel < 10))
435343   {
r3832r3833
438346   }
439347}
440348
441static void sys9901_shiftlight_w(int offset, int data)
349static WRITE8_HANDLER( sys9901_shiftlight_w )
442350{
443351   if (data)
444352      LED_state |= 0x10;
r3832r3833
446354      LED_state &= ~0x10;
447355}
448356
449static void sys9901_spkrdrive_w(int offset, int data)
357static WRITE8_HANDLER( sys9901_spkrdrive_w )
450358{
451359   speaker_level_w(0, data);
452360}
453361
454static void sys9901_tapewdata_w(int offset, int data)
362static WRITE8_HANDLER( sys9901_tapewdata_w )
455363{
456   cassette_output(device_list_find_by_tag( Machine->config->devicelist, CASSETTE, "cassette" ), data ? +1.0 : -1.0);
364   cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), data ? +1.0 : -1.0);
457365}
458366
459367/*
r3832r3833
645553   timer_reset(joy2y_timer, ATTOTIME_IN_USEC(input_port_read(space->machine, "JOY2_Y")*28+28));
646554}
647555
556/* user tms9901 setup */
557static const tms9901_interface usr9901reset_param =
558{
559   TMS9901_INT1 | TMS9901_INT2 | TMS9901_INT3 | TMS9901_INT4 | TMS9901_INT5 | TMS9901_INT6,   /* only input pins whose state is always known */
648560
561   {   /* read handlers */
562      NULL
563      /*usr9901_r0,
564        usr9901_r1,
565        usr9901_r2,
566        usr9901_r3*/
567   },
568
569   {   /* write handlers */
570      usr9901_led_w,
571      usr9901_led_w,
572      usr9901_led_w,
573      usr9901_led_w/*,
574        usr9901_w,
575        usr9901_w,
576        usr9901_w,
577        usr9901_w,
578        usr9901_w,
579        usr9901_w,
580        usr9901_w,
581        usr9901_w,
582        usr9901_w,
583        usr9901_w,
584        usr9901_w,
585        usr9901_w*/
586   },
587
588   /* interrupt handler */
589   usr9901_interrupt_callback,
590
591   /* clock rate = 2MHz */
592   2000000.
593};
594
595/* system tms9901 setup */
596static const tms9901_interface sys9901reset_param =
597{
598   0,   /* only input pins whose state is always known */
599
600   {   /* read handlers */
601      sys9901_r0,
602      NULL,
603      NULL,
604      NULL
605   },
606
607   {   /* write handlers */
608      sys9901_digitsel_w,
609      sys9901_digitsel_w,
610      sys9901_digitsel_w,
611      sys9901_digitsel_w,
612      sys9901_segment_w,
613      sys9901_segment_w,
614      sys9901_segment_w,
615      sys9901_segment_w,
616      sys9901_segment_w,
617      sys9901_segment_w,
618      sys9901_segment_w,
619      sys9901_segment_w,
620      sys9901_dsplytrgr_w,
621      sys9901_shiftlight_w,
622      sys9901_spkrdrive_w,
623      sys9901_tapewdata_w
624   },
625
626   /* interrupt handler */
627   sys9901_interrupt_callback,
628
629   /* clock rate = 2MHz */
630   2000000.
631};
632
649633/*
650634    Memory map:
651635

Previous 15994 Revisions Next


© 1998-2018 The MESS Team