Previous 15994 Revisions Next

r8307 Thursday 24th June, 2010 at 21:11:55 UTC by Michael Zapf
Device-ification process: PEB
[src/mess]mess.mak
[src/mess/devices]ti99_peb.c* ti99_peb.h*
[src/mess/drivers]geneve.c ti99_4p.c ti99_4x.c ti99_8.c
[src/mess/includes]geneve.h
[src/mess/machine]994x_ser.c 99_dsk.c 99_hsgpl.c 99_ide.c 99_peb.c 99_peb.h 99_usbsm.c geneve.c ti99_4x.c ti99_4x.h ti99pcod.c

src/mess/devices/ti99_peb.c
r0r8307
1/*
2    Peripheral expansion bus support.
3 
4    The ti-99/4, ti-99/4a, ti computer 99/8, myarc geneve, and snug sgcpu
5    99/4p systems all feature a bus connector that enables the connection of
6    extension cards.  (Although the hexbus is the preferred bus to add
7    additional peripherals to a ti-99/8, ti-99/8 is believed to be compatible
8    with the older PEB system.)  In the case of the TI consoles, this bus
9    connector is located on the right side of the console.
10 
11    While a few extension cards connect to the side bus connector of the
12    ti-99/4(a) console directly, most extension cards were designed to be
13    inserted in a PEB instead.  The PEB (Peripheral Expansion Box) is a big box
14    with an alimentation, a few bus drivers, and several card slots, that
15    connects to the ti-99/4(a) side port.  The reason for using a PEB is that
16    daisy-chaining many modules caused the system to be unreliable due to the
17    noise produced by the successive contacts.  (As a matter of fact, TI
18    initially released most of its extension cards as side bus units, but when
19    the design proved to be unreliable, the PEB was introduced.  The TI speech
20    synthesizer was the only TI extension that remained on the side bus after
21    the introduction of the PEB, probably because TI wanted the speech
22    synthesizer to be a cheap extension, and the PEB was not cheap.)
23 
24    The third-party myarc geneve and snug sgcpu computers are actually cards
25    to be inserted into a PEB: they have a PC keyboard connector, and replace
26    the original ti-99 console completely.
27 
28    Each expansion card is assigned to one of 16 CRU address ranges.
29    I appended the names of known TI peripherals that use each port (I appended
30    '???' when I don't know what the peripheral is :-) ).
31    * 0x1000-0x10FE "For test equipment use on production line"
32    * 0x1100-0x11FE disk controller
33    * 0x1200-0x12FE modem???
34    * 0x1300-0x13FE RS232 1&2, PIO 1
35    * 0x1400-0x14FE unassigned
36    * 0x1500-0x15FE RS232 3&4, PIO 2
37    * 0x1600-0x16FE unassigned
38    * 0x1700-0x17FE hex-bus (prototypes)
39    * 0x1800-0x18FE thermal printer (early peripheral)
40    * 0x1900-0x19FE EPROM programmer??? (Mezzanine board in July 1981's TI99/7
41        prototype)
42    * 0x1A00-0x1AFE unassigned
43    * 0x1B00-0x1BFE TI GPL debugger card
44    * 0x1C00-0x1CFE Video Controller Card (Possibly the weirdest device.  This
45        card is connected to the video output of the computer, to a VCR, and a
46        video monitor.  It can control the VCR, connect the display to either
47        VCR output or computer video output, and it can read or save binary
48        data to video tape.  I think it can act as a genlock interface (i.e.
49        TMS9918 transparent background shows the video signal), too, but I am
50        not sure about this.)
51    * 0x1D00-0x1DFE IEEE 488 Controller Card ('intelligent' parallel bus,
52        schematics on ftp.whtech.com)
53    * 0x1E00-0x1EFE unassigned
54    * 0x1F00-0x1FFE P-code card (part of a complete development system)
55 
56    The ti-99/8 implements 16 extra ports:
57    * 0x2000-0x26ff and 0x2800-0x2fff: reserved for future expansion?
58    * 0x2700-0x27ff: internal DSR
59 
60    The snug sgcpu 99/4p implements 12 extra ports:
61    * 0x0400-0x0eff: free
62    * 0x0f00-0x0fff: internal DSR
63 
64    Known mappings for 3rd party cards:
65    * Horizon RAMdisk: any ports from 0 to 7 (port 0 is most common).
66    * Myarc 128k/512k (RAM and DSR ROM): port 0 (0x1000-0x11FE)
67    * Corcomp 512k (RAM and DSR ROM): port unknown
68    * Super AMS 128k/512k: port 14 (0x1E00-0x1EFE)
69    * Foundation 128k/512k: port 14 (0x1E00-0x1EFE)
70    * Gram Karte: any port (0-15)
71    * EVPC (video card): 0x1400-0x14FE
72    * HSGPL (GROM replacement): 0x1B00-0x1BFE
73 
74    Of course, these devices additionally need some support routines, and
75    possibly memory-mapped I/O registers.  To do so, memory range 0x4000-5FFF
76    is shared by all cards.  The system enables each card as needed by writing
77    a 1 to the first CRU bit: when this happens the card can safely enable its
78    ROM, RAM, memory-mapped registers, etc.  Provided the ROM uses the proper
79    ROM header, the system will recognize and call peripheral I/O functions,
80    interrupt service routines, and startup routines.  (All these routines are
81    generally called DSR = Device Service Routine.)
82 
83    Also, the cards can trigger level-1 ("INTA") interrupts.  A LOAD interrupt
84    is present on the side port of the ti-99/4(a), too, but it was never used
85    by TI, AFAIK.  Also, an interrupt line called "INTB" is found on several
86    cards built by TI, but it is not connected: I am quite unsure whether it
87    was intended to be connected to the LOAD line, to the INT2 line of TMS9985,
88    or it was only to be used with the ti-99/4(a) development system running on
89    a TI990/10.  This is not the only unused feature: cards built by TI support
90    sensing of an interrupt status register and 19-bit addressing, even though
91    ti-99/4(A) does not take advantage of these features.  TI documentation
92    tells that some of these features are "defined by the Personal Computer PCC
93    at Texas Instrument", which is not very explicit (What on earth does "PCC"
94    stand for?).  Maybe it refers to the ti-99/4(a) development system running
95    on a TI990/10, or to the ti-99/7 and ti-99/8 prototypes.
96 
97    Note that I use 8-bit RAM handlers.  Obviously, using 16-bit handlers would
98    be equivalent and faster on a ti-99/4(a), but we need to interface the
99    extension cards not only to the ti-99/4(a), but to the geneve and ti-99/8
100    emulators as well.
101 
102    June 2010: Reimplemented using device structure (MZ) (obsoletes 99_peb.c)
103*/
104 
105#include "emu.h"
106#include "ti99_peb.h"
107 
108enum width_t {
109   width_8bit = 0,
110   width_16bit
111};
112/* expansion card structure for the snug sgcpu 99/4p system, which supports
113dynamical 16-bit accesses (TI did not design this!) */
114typedef struct ti99_4p_peb_card_handlers_t
115{
116   cru_read_handler cru_read;      /* card CRU read handler */
117   cru_write_handler cru_write;   /* card CRU handler */
118 
119   width_t width;
120   union
121   {
122      struct
123      {
124         read8_space_func mem_read;      /* card mem read handler (8 bits) */
125         write8_space_func mem_write;   /* card mem write handler (8 bits) */
126      } width_8bit;
127      struct
128      {
129         read16_space_func mem_read;   /* card mem read handler (16 bits) */
130         write16_space_func mem_write;   /* card mem write handler (16 bits) */
131      } width_16bit;
132   } w;
133} ti99_4p_peb_card_handlers_t;
134 
135typedef struct _ti99_peb_state
136{
137   /* TRUE if we are using the snug sgcpu 99/4p 16-bit extensions */
138   int has_16bit_peb;
139 
140   /* handlers for each of 28 slots */
141   ti99_4p_peb_card_handlers_t ti99_4p_expansion_ports[28];
142 
143   /* handlers for each of 16 slots + 16 extra slots for ti-99/8 */
144   ti99_peb_card_handlers_t expansion_ports[16+16];
145 
146   /* index of the currently active card (-1 if none) */
147   int active_card;
148 
149   /* index of the currently active card, overridden by the mapper */
150   int active_card_tmp;
151 
152   /* Mapper override. */
153   int mapper_override;
154 
155   // ila: inta status register (not actually used on ti-99/4(a), but nevertheless
156   // present)
157   int ila;
158 
159   // ilb: intb status register (completely pointless on ti-99/4(a), as neither
160   // INTB nor SENILB are connected; OTOH, INTB can trigger interrupts on a Geneve,
161   // and snug sgcpu 99/4p can sense ILB)
162   int ilb;
163 
164   /* only used by the snug sgcpu 99/4p */
165   int senila, senilb;
166 
167   /* hack to simulate TMS9900 byte write */
168   int tmp_buffer;
169 
170   /* inta/intb handlers */
171   void (*inta_callback)(running_machine *machine, int state);
172   void (*intb_callback)(running_machine *machine, int state);
173 
174   const address_space *space;
175 
176} ti99_peb_state;
177 
178INLINE ti99_peb_state *get_safe_token(running_device *device)
179{
180   assert(device != NULL);
181   assert(device->token != NULL);
182   return (ti99_peb_state *)device->token;
183}
184 
185INLINE const ti99_peb_config *get_config(running_device *device)
186{
187   assert(device != NULL);
188   assert(device->type == PBOX);
189   return (const ti99_peb_config *) device->baseconfig().inline_config;
190}
191 
192/*
193    Sets the handlers for one expansion port (normal 8-bit card)
194 
195    cru_base: CRU base address (any of 0x1000, 0x1100, 0x1200, ..., 0x1F00)
196        (snug sgcpu 99/4p accepts 0x0400, ..., 0x1F00, ti-99/8 accepts 0x1000,
197        ..., 0x2F00)
198    handler: handler structure for the given card
199*/
200void ti99_peb_set_card_handlers(running_device *box, int cru_base, const ti99_peb_card_handlers_t *handler)
201{
202   int port;
203   ti99_peb_state *peb = get_safe_token(box);
204 
205   if (cru_base & 0xff)
206      return;
207 
208   if (peb->has_16bit_peb)
209   {
210      port = (cru_base - 0x0400) >> 8;
211 
212      if ((port>=0) && (port<28))
213      {
214         peb->ti99_4p_expansion_ports[port].cru_read = handler->cru_read;
215         peb->ti99_4p_expansion_ports[port].cru_write = handler->cru_write;
216         peb->ti99_4p_expansion_ports[port].width = width_8bit;
217         peb->ti99_4p_expansion_ports[port].w.width_8bit.mem_read = handler->mem_read;
218         peb->ti99_4p_expansion_ports[port].w.width_8bit.mem_write = handler->mem_write;
219      }
220   }
221   else
222   {
223      port = (cru_base - 0x1000) >> 8;
224 
225      if ((port>=0) && (port</*16*/32))
226      {
227         peb->expansion_ports[port] = *handler;
228      }
229   }
230}
231 
232/*
233    Sets the handlers for one expansion port (special 16-bit card for snug
234    sgcpu 99/4p)
235 
236    cru_base: CRU base address (any of 0x1000, 0x1100, 0x1200, ..., 0x1F00)
237        (snug sgcpu 99/4p accepts 0x0400, ..., 0x1F00, ti-99/8 accepts 0x1000,
238        ..., 0x2F00)
239    handler: handler structure for the given card
240*/
241void ti99_peb_set_16bit_card_handlers(running_device *box, int cru_base, const ti99_peb_16bit_card_handlers_t *handler)
242{
243   int port;
244   ti99_peb_state *peb = get_safe_token(box);
245 
246   if (cru_base & 0xff)
247      return;
248 
249   if (peb->has_16bit_peb)
250   {
251      port = (cru_base - 0x0400) >> 8;
252 
253      if ((port>=0) && (port<28))
254      {
255         peb->ti99_4p_expansion_ports[port].cru_read = handler->cru_read;
256         peb->ti99_4p_expansion_ports[port].cru_write = handler->cru_write;
257         peb->ti99_4p_expansion_ports[port].width = width_16bit;
258         peb->ti99_4p_expansion_ports[port].w.width_16bit.mem_read = handler->mem_read;
259         peb->ti99_4p_expansion_ports[port].w.width_16bit.mem_write = handler->mem_write;
260      }
261   }
262}
263 
264/*
265    Update ila status register and assert or clear INTA interrupt line
266    accordingly.
267 
268    bit: bit number ([0,7] for original INTA register, [8,15] are extra
269        "virtual" bits for devices that assert the INTA line without setting a
270        bit of the ILA register)
271    state: 1 to assert bit, 0 to clear
272*/
273void ti99_peb_set_ila_bit(running_device *box, int bit, int state)
274{
275   ti99_peb_state *peb = get_safe_token(box);
276   if (state)
277   {
278      peb->ila |= 1 << bit;
279      if (peb->inta_callback)
280         (*peb->inta_callback)(box->machine, 1);
281   }
282   else
283   {
284      peb->ila &= ~(1 << bit);
285      if ((!peb->ila) && peb->inta_callback)
286         (*peb->inta_callback)(box->machine, 0);
287   }
288}
289 
290/*
291    Update ilb status register and assert or clear INTB interrupt line
292    accordingly.
293 
294    bit: bit number ([0,7] for original INTAB register, [8,15] are extra
295        "virtual" bits for devices that assert the INTB line without setting a
296        bit of the ILB register)
297    state: 1 to assert bit, 0 to clear
298*/
299void ti99_peb_set_ilb_bit(running_device *box, int bit, int state)
300{
301   ti99_peb_state *peb = get_safe_token(box);
302 
303   if (state)
304   {
305      peb->ilb |= 1 << bit;
306      if (peb->intb_callback)
307         (*peb->intb_callback)(box->machine, 1);
308   }
309   else
310   {
311      peb->ilb &= ~(1 << bit);
312      if ((!peb->ilb) && peb->intb_callback)
313         (*peb->intb_callback)(box->machine, 0);
314   }
315}
316 
317 
318/*
319    Read CRU in range >1000->1ffe (>800->fff) (ti-99/4(a))
320*/
321READ8_DEVICE_HANDLER( ti99_4x_peb_cru_r )
322{
323   int port;
324   cru_read_handler handler;
325   int reply;
326   ti99_peb_state *peb = get_safe_token(device);
327 
328   port = (offset & 0x00f0) >> 4;
329   handler = peb->expansion_ports[port].cru_read;
330 
331   reply = (handler) ? (*handler)(device->machine, offset & 0xf) : 0;
332 
333   return reply;
334}
335 
336/*
337    Write CRU in range >1000->1ffe (>800->fff) (ti-99/4(a))
338*/
339WRITE8_DEVICE_HANDLER( ti99_4x_peb_cru_w )
340{
341   int port;
342   cru_write_handler handler;
343   ti99_peb_state *peb = get_safe_token(device);
344 
345   port = (offset & 0x0780) >> 7;
346   handler = peb->expansion_ports[port].cru_write;
347 
348   if (handler)
349      (*handler)(device->machine, offset & 0x7f, data);
350 
351   /* expansion card enable? */
352   if ((offset & 0x7f) == 0)
353   {
354      if (data & 1)
355      {
356         /* enable */
357         peb->active_card = port;
358      }
359      else
360      {
361         if (port == peb->active_card)   /* geez... who cares? */
362         {
363            peb->active_card = -1;         /* no port selected */
364         }
365      }
366   }
367}
368 
369/*
370    Read mem in range >4000->5ffe (ti-99/4(a))
371*/
372READ16_DEVICE_HANDLER( ti99_4x_peb_r )
373{
374   int reply = 0;
375   read8_space_func handler;
376   ti99_peb_state *peb = get_safe_token(device);
377 
378   cpu_adjust_icount(device->machine->firstcpu,-4);
379 
380   if (peb->active_card != -1)
381   {
382      handler = peb->expansion_ports[peb->active_card].mem_read;
383      if (handler)
384      {
385         reply = (*handler)(peb->space, (offset << 1) + 1);
386         reply |= ((unsigned) (*handler)(peb->space, offset << 1)) << 8;
387      }
388   }
389//  printf("[%04x:%04x] = %04x\n", (active_card<<8)+0x1000, (offset<<1)+0x4000, reply);
390 
391   return peb->tmp_buffer = reply;
392}
393 
394/*
395    Write mem in range >4000->5ffe (ti-99/4(a))
396*/
397WRITE16_DEVICE_HANDLER( ti99_4x_peb_w )
398{
399   write8_space_func handler;
400   ti99_peb_state *peb = get_safe_token(device);
401 
402   cpu_adjust_icount(device->machine->firstcpu,-4);
403 
404   /* simulate byte write */
405   data = (peb->tmp_buffer & ~mem_mask) | (data & mem_mask);
406 
407   if (peb->active_card != -1)
408   {
409      handler = peb->expansion_ports[peb->active_card].mem_write;
410      if (handler)
411      {
412         (*handler)(peb->space, (offset << 1) + 1, data & 0xff);
413         (*handler)(peb->space, offset << 1, (data >> 8) & 0xff);
414      }
415   }
416}
417 
418 
419/*
420    Read CRU in range >1000->1ffe (>800->fff) (Geneve)
421*/
422READ8_DEVICE_HANDLER( geneve_peb_cru_r )
423{
424   int port;
425   cru_read_handler handler;
426   int reply;
427   ti99_peb_state *peb = get_safe_token(device);
428 
429   port = (offset & 0x00f0) >> 4;
430   handler = peb->expansion_ports[port].cru_read;
431 
432   reply = (handler) ? (*handler)(device->machine, offset & 0xf) : 0;
433 
434   return reply;
435}
436 
437/*
438    Write CRU in range >1000->1ffe (>800->fff) (Geneve)
439*/
440WRITE8_DEVICE_HANDLER( geneve_peb_cru_w )
441{
442   int port;
443   cru_write_handler handler;
444   ti99_peb_state *peb = get_safe_token(device);
445 
446   port = (offset & 0x0780) >> 7;
447   handler = peb->expansion_ports[port].cru_write;
448 
449   if (handler)
450      (*handler)(device->machine, offset & 0x7f, data);
451 
452   /* expansion card enable? */
453   if ((offset & 0x7f) == 0)
454   {
455      if (data & 1)
456      {
457         /* enable */
458         peb->active_card = port;
459      }
460      else
461      {
462         if (port == peb->active_card)   /* geez... who cares? */
463         {
464            peb->active_card = -1;         /* no port selected */
465         }
466      }
467   }
468}
469 
470/*
471    Read mem in range >4000->5fff (Geneve)
472*/
473READ8_DEVICE_HANDLER( geneve_peb_r )
474{
475   int reply = 0;
476   read8_space_func handler;
477   ti99_peb_state *peb = get_safe_token(device);
478 
479   cpu_adjust_icount(device->machine->firstcpu,-8);
480 
481   if (peb->active_card != -1)
482   {
483      handler = peb->expansion_ports[peb->active_card].mem_read;
484      if (handler)
485         reply = (*handler)(peb->space, offset);
486   }
487 
488   return reply;
489}
490 
491/*
492    Write mem in range >4000->5fff (Geneve)
493*/
494WRITE8_DEVICE_HANDLER( geneve_peb_w )
495{
496   write8_space_func handler;
497   ti99_peb_state *peb = get_safe_token(device);
498 
499   cpu_adjust_icount(device->machine->firstcpu,-8);
500 
501   if (peb->active_card != -1)
502   {
503      handler = peb->expansion_ports[peb->active_card].mem_write;
504      if (handler)
505         (*handler)(peb->space, offset, data);
506   }
507}
508 
509/*
510    Read CRU in range >1000->2ffe (>0800->17ff) (ti-99/8)
511*/
512READ8_DEVICE_HANDLER( ti99_8_peb_cru_r )
513{
514   int port;
515   cru_read_handler handler;
516   int reply;
517   ti99_peb_state *peb = get_safe_token(device);
518 
519   port = (offset & 0x01f0) >> 4;
520   handler = peb->expansion_ports[port].cru_read;
521 
522   reply = (handler) ? (*handler)(device->machine, offset & 0xf) : 0;
523 
524   return reply;
525}
526 
527/*
528    Write CRU in range >1000->2ffe (>0800->17ff) (ti-99/8)
529*/
530WRITE8_DEVICE_HANDLER( ti99_8_peb_cru_w )
531{
532   int port;
533   cru_write_handler handler;
534   ti99_peb_state *peb = get_safe_token(device);
535 
536   port = (offset & 0x0f80) >> 7;
537   handler = peb->expansion_ports[port].cru_write;
538 
539   if (handler)
540      (*handler)(device->machine, offset & 0x7f, data);
541 
542   /* expansion card enable? */
543   if ((offset & 0x7f) == 0)
544   {
545      if (data & 1)
546      {
547         /* enable */
548         peb->active_card = port;
549      }
550      else
551      {
552         if (port == peb->active_card)   /* geez... who cares? */
553         {
554            peb->active_card = -1;         /* no port selected */
555         }
556      }
557   }
558}
559 
560/*
561    Read mem in range >4000->5fff (ti-99/8)
562*/
563READ8_DEVICE_HANDLER( ti99_8_peb_r )
564{
565   int reply = 0;
566   read8_space_func handler;
567   ti99_peb_state *peb = get_safe_token(device);
568 
569   cpu_adjust_icount(device->machine->firstcpu,-4);
570 
571   if (peb->active_card != -1)
572   {
573      handler = peb->expansion_ports[peb->active_card].mem_read;
574      if (handler)
575         reply = (*handler)(peb->space, offset);
576   }
577 
578   return reply;
579}
580 
581/*
582    Write mem in range >4000->5fff (ti-99/8)
583*/
584WRITE8_DEVICE_HANDLER( ti99_8_peb_w )
585{
586   write8_space_func handler;
587   ti99_peb_state *peb = get_safe_token(device);
588 
589   cpu_adjust_icount(device->machine->firstcpu,-4);
590 
591   if (peb->active_card != -1)
592   {
593      handler = peb->expansion_ports[peb->active_card].mem_write;
594      if (handler)
595         (*handler)(peb->space, offset, data);
596   }
597}
598 
599/*
600    Read CRU in range >0400->1ffe (>200->fff) (snug sgcpu 99/4p)
601*/
602READ8_DEVICE_HANDLER( ti99_4p_peb_cru_r )
603{
604   int port;
605   cru_read_handler handler;
606   int reply;
607   ti99_peb_state *peb = get_safe_token(device);
608 
609   port = offset >> 4;
610   handler = peb->ti99_4p_expansion_ports[port].cru_read;
611 
612   reply = (handler) ? (*handler)(device->machine, offset & 0xf) : 0;
613 
614   return reply;
615}
616 
617/*
618    Write CRU in range >0400->1ffe (>200->fff) (snug sgcpu 99/4p)
619*/
620WRITE8_DEVICE_HANDLER( ti99_4p_peb_cru_w )
621{
622   int port;
623   cru_write_handler handler;
624   ti99_peb_state *peb = get_safe_token(device);
625 
626   int cru_address = (offset + 0x200)<<1;
627 
628   port = offset >> 7;
629   handler = peb->ti99_4p_expansion_ports[port].cru_write;
630 
631   if (handler)
632      (*handler)(device->machine, offset & 0x7f, data);
633 
634   /* expansion card enable? */
635   if ((cru_address & 0xfe) == 0)
636   {
637      if (data & 1)
638      {
639         /* enable */
640         if (cru_address == 0x1e00)
641         {
642            // The internal mapper has precedence over the external bus.
643            // It may be turned on although there is another device currently turned on
644            peb->active_card_tmp = peb->active_card;
645            peb->mapper_override = TRUE;
646         }
647         peb->active_card = port;
648      }
649      else
650      {
651         if ((cru_address == 0x1e00) && peb->mapper_override)
652         {
653            peb->active_card = peb->active_card_tmp;
654            peb->mapper_override = FALSE;
655         }
656         else
657         {
658            if (port == peb->active_card)   /* geez... who cares? */
659            {
660               peb->active_card = -1;         /* no port selected */
661            }
662         }
663      }
664   }
665}
666 
667/*
668    Read mem in range >4000->5ffe (snug sgcpu 99/4p)
669*/
670READ16_DEVICE_HANDLER( ti99_4p_peb_r )
671{
672   int reply = 0;
673   read8_space_func handler;
674   read16_space_func handler16;
675   ti99_peb_state *peb = get_safe_token(device);
676 
677   if (peb->active_card == -1)
678      cpu_adjust_icount(device->machine->firstcpu,-4);   /* ??? */
679   else
680   {
681      if (peb->ti99_4p_expansion_ports[peb->active_card].width == width_8bit)
682      {
683         cpu_adjust_icount(device->machine->firstcpu,-4);
684 
685         handler = peb->ti99_4p_expansion_ports[peb->active_card].w.width_8bit.mem_read;
686         if (handler)
687         {
688            reply = (*handler)(peb->space, (offset << 1) + 1);
689            reply |= ((unsigned) (*handler)(peb->space, offset << 1)) << 8;
690         }
691      }
692      else
693      {
694         cpu_adjust_icount(device->machine->firstcpu,-1);   /* ??? */
695 
696         handler16 = peb->ti99_4p_expansion_ports[peb->active_card].w.width_16bit.mem_read;
697         if (handler16)
698            reply = (*handler16)(peb->space, offset, /*mem_mask*/0xffff);
699      }
700   }
701 
702   if (peb->senila || peb->senilb)
703   {
704      if ((peb->active_card != -1) || (peb->senila && peb->senilb))
705         /* ah, the smell of burnt silicon... */
706         logerror("<Scrrrrr>: your computer has just burnt (maybe).\n");
707 
708      if (peb->senila)
709         reply = (peb->ila & 0xff) | (peb->ila << 8);
710      else if (peb->senilb)
711         reply = (peb->ilb & 0xff) | (peb->ilb << 8);
712   }
713 
714//  printf("[%04x:%04x] = %04x\n", (active_card<<8)+0x400, (offset<<1)+0x4000, reply);
715   return peb->tmp_buffer = reply;
716}
717 
718/*
719    Write mem in range >4000->5ffe (snug sgcpu 99/4p)
720*/
721WRITE16_DEVICE_HANDLER( ti99_4p_peb_w )
722{
723   write8_space_func handler;
724   write16_space_func handler16;
725   ti99_peb_state *peb = get_safe_token(device);
726 
727   if (peb->active_card == -1)
728      cpu_adjust_icount(device->machine->firstcpu,-4);   /* ??? */
729   else
730   {
731      /* simulate byte write */
732      data = (peb->tmp_buffer & ~mem_mask) | (data & mem_mask);
733 
734      if (peb->ti99_4p_expansion_ports[peb->active_card].width == width_8bit)
735      {
736         cpu_adjust_icount(device->machine->firstcpu,-4);
737 
738         handler = peb->ti99_4p_expansion_ports[peb->active_card].w.width_8bit.mem_write;
739         if (handler)
740         {
741            (*handler)(peb->space, (offset << 1) + 1, data & 0xff);
742            (*handler)(peb->space, offset << 1, (data >> 8) & 0xff);
743         }
744      }
745      else
746      {
747         cpu_adjust_icount(device->machine->firstcpu,-1);   /* ??? */
748 
749         handler16 = peb->ti99_4p_expansion_ports[peb->active_card].w.width_16bit.mem_write;
750         if (handler16)
751            (*handler16)(peb->space, offset, data, /*mem_mask*/0xffff);
752      }
753   }
754}
755 
756/*
757    Set the state of the SENILA line (snug sgcpu 99/4p)
758*/
759void ti99_4p_peb_set_senila(running_device *box, int state)
760{
761   ti99_peb_state *peb = get_safe_token(box);
762   peb->senila = (state != 0);
763}
764 
765/*
766    Set the state of the SENILB line (snug sgcpu 99/4p)
767*/
768void ti99_4p_peb_set_senilb(running_device *box, int state)
769{
770   ti99_peb_state *peb = get_safe_token(box);
771   peb->senilb = (state != 0);
772}
773 
774 
775/***************************************************************************
776    DEVICE FUNCTIONS
777***************************************************************************/
778 
779static DEVICE_START( ti99_peb )
780{
781}
782 
783static DEVICE_STOP( ti99_peb )
784{
785}
786 
787static DEVICE_RESET( ti99_peb )
788{
789   ti99_peb_state *peb = get_safe_token(device);
790 
791   peb->has_16bit_peb = get_config(device)->mode16;
792   peb->inta_callback = get_config(device)->inta_callback;
793   peb->intb_callback = get_config(device)->intb_callback;
794 
795   peb->active_card = -1;
796   peb->active_card_tmp = -1;
797 
798   peb->mapper_override = FALSE; // for ti99_4p
799 
800   peb->ila = 0;
801   peb->ilb = 0;
802 
803   peb->space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
804 
805   // Remove all card handlers; must be reinstalled
806   memset(peb->expansion_ports, 0, sizeof(peb->expansion_ports));
807   memset(peb->ti99_4p_expansion_ports, 0, sizeof(peb->ti99_4p_expansion_ports));
808}
809 
810static const char DEVTEMPLATE_SOURCE[] = __FILE__;
811 
812#define DEVTEMPLATE_ID(p,s)             p##ti99_peb##s
813#define DEVTEMPLATE_FEATURES            DT_HAS_START | DT_HAS_STOP | DT_HAS_RESET | DT_HAS_INLINE_CONFIG
814#define DEVTEMPLATE_NAME                "TI99 Peripheral Expansion System"
815#define DEVTEMPLATE_FAMILY              "External devices"
816#include "devtempl.h"
817 
src/mess/devices/ti99_peb.h
r0r8307
1/*
2    header file for machine/99_peb.c
3*/
4 
5#define PBOX   DEVICE_GET_INFO_NAME( ti99_peb )
6 
7/*
8    mode16: TRUE if we are using the snug sgcpu 99/4p 16-bit extensions
9    inta_callback: callback called when the state of INTA changes (may be NULL)
10    intb_callback: callback called when the state of INTB changes (may be NULL)
11*/
12typedef struct _ti99_peb_config ti99_peb_config;
13struct _ti99_peb_config
14{
15   int      mode16;
16   void   (*inta_callback)(running_machine *machine, int state);
17   void   (*intb_callback)(running_machine *machine, int state);
18 
19};
20 
21/*
22    prototype for CRU handlers in expansion system
23*/
24typedef int (*cru_read_handler)(running_machine *machine, int offset);
25typedef void (*cru_write_handler)(running_machine *machine, int offset, int data);
26 
27/*
28    Descriptor for TI peripheral expansion cards (8-bit bus)
29*/
30typedef struct ti99_peb_card_handlers_t
31{
32   cru_read_handler cru_read;      /* card CRU read handler */
33   cru_write_handler cru_write;   /* card CRU handler */
34 
35   read8_space_func mem_read;      /* card mem read handler (8 bits) */
36   write8_space_func mem_write;   /* card mem write handler (8 bits) */
37} ti99_peb_card_handlers_t;
38 
39/*
40    Descriptor for 16-bit peripheral expansion cards designed for the snug
41    sgcpu 99/4p system.  (These cards were not designed by TI, TI always
42    regarded the ti-99 as an 8-bit system.)
43*/
44typedef struct ti99_peb_16bit_card_handlers_t
45{
46   cru_read_handler cru_read;      /* card CRU read handler */
47   cru_write_handler cru_write;   /* card CRU handler */
48 
49   read16_space_func mem_read;      /* card mem read handler (16 bits) */
50   write16_space_func mem_write;      /* card mem write handler (16 bits) */
51} ti99_peb_16bit_card_handlers_t;
52 
53/* masks for ila and ilb */
54enum
55{
56   /* bits from actual ILA register */
57   inta_rs232_1_bit = 7-0,
58   inta_rs232_2_bit = 7-1,
59   inta_rs232_3_bit = 7-4,
60   inta_rs232_4_bit = 7-5,
61 
62   /* extra "virtual" bits for devices that assert the INTA line without
63    setting a bit of the ILA register */
64   inta_ide_bit     = 8,
65   inta_ide_clk_bit = 9,
66 
67   /* bits from actual ILB register */
68   intb_fdc_bit     = 7-0,
69   intb_ieee488_bit = 7-1
70};
71 
72void ti99_peb_set_card_handlers(running_device *box, int cru_base, const ti99_peb_card_handlers_t *handler);
73void ti99_peb_set_16bit_card_handlers(running_device *box, int cru_base, const ti99_peb_16bit_card_handlers_t *handler);
74void ti99_peb_set_ila_bit(running_device *box, int bit, int state);
75void ti99_peb_set_ilb_bit(running_device *box, int bit, int state);
76 
77READ8_DEVICE_HANDLER( ti99_4x_peb_cru_r );
78WRITE8_DEVICE_HANDLER( ti99_4x_peb_cru_w );
79READ16_DEVICE_HANDLER( ti99_4x_peb_r );
80WRITE16_DEVICE_HANDLER( ti99_4x_peb_w );
81 
82READ8_DEVICE_HANDLER( geneve_peb_cru_r );
83WRITE8_DEVICE_HANDLER( geneve_peb_cru_w );
84READ8_DEVICE_HANDLER( geneve_peb_r );
85WRITE8_DEVICE_HANDLER( geneve_peb_w );
86 
87READ8_DEVICE_HANDLER( ti99_8_peb_cru_r );
88WRITE8_DEVICE_HANDLER( ti99_8_peb_cru_w );
89READ8_DEVICE_HANDLER( ti99_8_peb_r );
90WRITE8_DEVICE_HANDLER( ti99_8_peb_w );
91 
92READ8_DEVICE_HANDLER( ti99_4p_peb_cru_r );
93WRITE8_DEVICE_HANDLER( ti99_4p_peb_cru_w );
94READ16_DEVICE_HANDLER( ti99_4p_peb_r );
95WRITE16_DEVICE_HANDLER( ti99_4p_peb_w );
96 
97void ti99_4p_peb_set_senila(running_device *box, int state);
98void ti99_4p_peb_set_senilb(running_device *box, int state);
99 
100/* device interface */
101DEVICE_GET_INFO( ti99_peb );
102 
103#define MDRV_PBOX_ADD(_tag, _mode16, _inta, _intb)         \
104   MDRV_DEVICE_ADD(_tag, PBOX, 0)                     \
105   MDRV_DEVICE_CONFIG_DATA32(ti99_peb_config, mode16, _mode16)   \
106   MDRV_DEVICE_CONFIG_DATAPTR(ti99_peb_config, inta_callback, _inta)   \
107   MDRV_DEVICE_CONFIG_DATAPTR(ti99_peb_config, intb_callback, _intb)
108 
109 
src/mess/includes/geneve.h
r8306r8307
4545extern const tms9901_interface tms9901reset_param_ti99;
4646void ti99_clk_interrupt_callback(running_device *device, int state);
4747
48/* prototypes */
49void inta_callback(running_machine *machine, int state);
50void intb_callback(running_machine *machine, int state);
51
4852#endif /* GENEVE_H_ */
src/mess/machine/99_dsk.c
r8306r8307
3232#include "wd17xx.h"
3333#include "smc92x4.h"
3434#include "ti99_4x.h"  /* required for memory region offsets */
35#include "99_peb.h"
35#include "devices/ti99_peb.h"
3636#include "99_dsk.h"
3737#include "mm58274c.h"
3838#include "devices/flopdrv.h"
r8306r8307
6868/* count 4.23s from rising edge of motor_on */
6969static emu_timer *motor_on_timer;
7070
71static running_device *expansion_box;
72
7173/*
7274    Resets the drive geometry. This is required because the heuristic of
7375    the default implementation sets the drive geometry to the geometry
r8306r8307
120122   if (state)
121123   {
122124      DRQ_IRQ_status |= fdc_IRQ;
123      ti99_peb_set_ilb_bit(device->machine, intb_fdc_bit, 1);
125      ti99_peb_set_ilb_bit(expansion_box, intb_fdc_bit, 1);
124126   }
125127   else
126128   {
127129      DRQ_IRQ_status &= ~fdc_IRQ;
128      ti99_peb_set_ilb_bit(device->machine, intb_fdc_bit, 0);
130      ti99_peb_set_ilb_bit(expansion_box, intb_fdc_bit, 0);
129131   }
130132
131133   fdc_handle_hold(device->machine);
r8306r8307
159161void ti99_floppy_controllers_init_all(running_machine *machine)
160162{
161163   motor_on_timer = timer_alloc(machine, motor_on_timer_callback, NULL);
164   expansion_box = devtag_get_device(machine, "per_exp_box");
162165}
163166
164167/*===========================================================================*/
r8306r8307
202205
203206   set_all_geometries(machine, FLOPPY_DRIVE_DS_40);
204207
205   ti99_peb_set_card_handlers(0x1100, & fdc_handlers);
208   ti99_peb_set_card_handlers(expansion_box, 0x1100, &fdc_handlers);
206209   if (fdc) {
207210      wd17xx_reset(fdc);      /* resets the fdc */
208211      wd17xx_dden_w(fdc, ASSERT_LINE);
r8306r8307
396399
397400   set_all_geometries(machine, FLOPPY_DRIVE_DS_40);
398401
399   ti99_peb_set_card_handlers(0x1100, & ccfdc_handlers);
402   ti99_peb_set_card_handlers(expansion_box, 0x1100, &ccfdc_handlers);
400403
401404   wd17xx_reset(fdc);      /* initialize the floppy disk controller */
402405   wd17xx_dden(fdc, CLEAR_LINE);
r8306r8307
618621
619622   set_all_geometries(machine, FLOPPY_DRIVE_DS_40);
620623
621   ti99_peb_set_card_handlers(0x1100, & bwg_handlers);
624   ti99_peb_set_card_handlers(expansion_box, 0x1100, & bwg_handlers);
622625
623626   wd17xx_reset(fdc);      /* initialize the floppy disk controller */
624627   wd17xx_dden_w(fdc, CLEAR_LINE);
r8306r8307
985988   /* Set INTA */
986989   if (state)
987990   {
988      ti99_peb_set_ila_bit(device->machine, intb_fdc_bit, 1);
991      ti99_peb_set_ila_bit(expansion_box, intb_fdc_bit, 1);
989992   }
990993   else
991994   {
992      ti99_peb_set_ila_bit(device->machine, intb_fdc_bit, 0);
995      ti99_peb_set_ila_bit(expansion_box, intb_fdc_bit, 0);
993996   }
994997
995998   /* TODO: Check */
r8306r8307
11601163   DVENA = 0;
11611164   motor_on = 0;
11621165
1163   ti99_peb_set_card_handlers(0x1100, & hfdc_handlers);
1166   ti99_peb_set_card_handlers(expansion_box, 0x1100, & hfdc_handlers);
11641167
11651168   if ((input_port_read(machine, "DISKCTRL") & DISK_HFDC)
11661169      && (input_port_read(machine, "HFDCDIP")&0x55))
src/mess/machine/99_usbsm.c
r8306r8307
2626
2727#include "emu.h"
2828#include "ti99_4x.h"
29#include "99_peb.h"
29#include "devices/ti99_peb.h"
3030#include "99_usbsm.h"
3131#include "strata.h"
3232#include "smartmed.h"
r8306r8307
4545static int feeprom_page;
4646static int sram_page;
4747
48static running_device *expansion_box;
49
4850static const ti99_peb_card_handlers_t usbsm_handlers =
4951{
5052   usbsm_cru_r,
r8306r8307
8385*/
8486int ti99_usbsm_reset(running_machine *machine, int in_tms9995_mode)
8587{
86   ti99_peb_set_card_handlers(0x1600, & usbsm_handlers);
88   expansion_box = devtag_get_device(machine, "per_exp_box");
89   ti99_peb_set_card_handlers(expansion_box, 0x1600, & usbsm_handlers);
8790
8891   feeprom_page = 0;
8992   sram_page = 0;
src/mess/machine/99_peb.c
r8306r8307
1/************************************************************************
2
3    Obsoleted by devices/ti99_peb.c
4
5************************************************************************/
6
17/*
28    Peripheral expansion bus support.
39
src/mess/machine/99_peb.h
r8306r8307
1/************************************************************************
2
3    Obsoleted by devices/ti99_peb.h
4
5************************************************************************/
6
17/*
28    header file for machine/99_peb.c
39*/
src/mess/machine/994x_ser.c
r8306r8307
2222
2323#include "emu.h"
2424#include "ti99_4x.h"
25#include "99_peb.h"
25#include "devices/ti99_peb.h"
2626#include "tms9902.h"
2727#include "994x_ser.h"
2828
r8306r8307
174174static DEVICE_RESET( ti99_4_rs232 )
175175{
176176   rs232_DSR = memory_region(device->machine, region_dsr) + offset_rs232_dsr;
177
178   ti99_peb_set_card_handlers(0x1300, & rs232_handlers);
177   running_device *box = devtag_get_device(device->machine, "per_exp_box");
178   ti99_peb_set_card_handlers(box, 0x1300, & rs232_handlers);
179179}
180180
181181static READ8_DEVICE_HANDLER(ti99_4_pio_r)
r8306r8307
402402*/
403403static TMS9902_INT_CALLBACK( int_callback_0 )
404404{
405   ti99_peb_set_ila_bit(device->machine, inta_rs232_1_bit, INT);
405   running_device *box = devtag_get_device(device->machine, "per_exp_box");
406   ti99_peb_set_ila_bit(box, inta_rs232_1_bit, INT);
406407}
407408static TMS9902_INT_CALLBACK( int_callback_1 )
408409{
409   ti99_peb_set_ila_bit(device->machine, inta_rs232_2_bit, INT);
410   running_device *box = devtag_get_device(device->machine, "per_exp_box");
411   ti99_peb_set_ila_bit(box, inta_rs232_2_bit, INT);
410412}
411413
412414static TMS9902_XMIT_CALLBACK( xmit_callback_0 )
src/mess/machine/geneve.c
r8306r8307
1111#include "audio/spchroms.h"
1212#include "ti99_4x.h"
1313#include "includes/geneve.h"
14#include "99_peb.h"
14#include "devices/ti99_peb.h"
1515#include "994x_ser.h"
1616#include "99_dsk.h"
1717#include "99_ide.h"
r8306r8307
2020#include "sound/tms5220.h"   /* for tms5220_set_variant() */
2121#include "sound/sn76496.h"
2222
23
24/* prototypes */
25static void inta_callback(running_machine *machine, int state);
26static void intb_callback(running_machine *machine, int state);
27
2823static void read_key_if_possible(running_machine *machine);
2924static void poll_keyboard(running_machine *machine);
3025static void poll_mouse(running_machine *machine);
r8306r8307
8075static int KeyAutoRepeatKey;
8176static int KeyAutoRepeatTimer;
8277
78static running_device *expansion_box;
79
8380/*
8481    GROM support.
8582
r8306r8307
155152   /* Initialize all. Actually, at this point, we don't know
156153       how the switches are set. Later we use the configuration switches to
157154       determine which one to use. */
158   ti99_peb_init();
159155   ti99_floppy_controllers_init_all(machine);
160156   ti99_ide_init(machine);
161157   ti99_usbsm_init(machine);
r8306r8307
179175   /* reset cartridge mapper */
180176   cartridge_page = 0;
181177
178   expansion_box = devtag_get_device(machine, "per_exp_box");
179
182180   v9938_reset(0);
183181
184182   /* clear keyboard interface state (probably overkill, but can't harm) */
r8306r8307
202200   has_usb_sm = input_port_read(machine, "HDCTRL") & HD_USB;
203201
204202   /* set up optional expansion hardware */
205   ti99_peb_reset(0, inta_callback, intb_callback);
206203
207204   if (has_speech)
208205   {
r8306r8307
269266/*
270267    inta is connected to both tms9901 IRQ1 line and to tms9995 INT4/EC line.
271268*/
272static void inta_callback(running_machine *machine, int state)
269void inta_callback(running_machine *machine, int state)
273270{
274271   tms9901_set_single_int(devtag_get_device(machine, "tms9901"), 1, state);
275272   cputag_set_input_line(machine, "maincpu", 1, state ? ASSERT_LINE : CLEAR_LINE);
r8306r8307
278275/*
279276    intb is connected to tms9901 IRQ12 line.
280277*/
281static void intb_callback(running_machine *machine, int state)
278void intb_callback(running_machine *machine, int state)
282279{
283280   tms9901_set_single_int(devtag_get_device(machine, "tms9901"), 12, state);
284281}
r8306r8307
578575#endif
579576   case 0xba:
580577      /* DSR space */
581      return geneve_peb_r(space, offset);
578      return geneve_peb_r(expansion_box, offset);
582579
583580   case 0xbc:
584581      /* speech space */
r8306r8307
874871#endif
875872   case 0xba:
876873      /* DSR space */
877      geneve_peb_w(space, offset, data);
874      geneve_peb_w(expansion_box, offset, data);
878875      return;
879876
880877   case 0xbc:
r8306r8307
943940      }
944941   }
945942
946   geneve_peb_cru_w(space, offset, data);
943   geneve_peb_cru_w(expansion_box, offset, data);
947944}
948945
949946/*===========================================================================*/
src/mess/machine/ti99pcod.c
r8306r8307
7171    switch position if the Master Title Screen does not appear as expected.
7272*/
7373#include "emu.h"
74#include "99_peb.h"
74#include "devices/ti99_peb.h"
7575#include "ti99_4x.h"
7676#include "ti99pcod.h"
7777
r8306r8307
9191static int pcode_cru_r(running_machine *machine, int offset);
9292static void pcode_cru_w(running_machine *machine, int offset, int data);
9393
94static running_device *expansion_box;
95
9496static const ti99_peb_card_handlers_t pcode_handlers =
9597{
9698   pcode_cru_r,
r8306r8307
209211   pcode_GROMs.addr = 0;
210212   pcode_GROMs.data_ptr = ti99_pcode_grom;
211213
212   ti99_peb_set_card_handlers(0x1f00, &pcode_handlers);
214   expansion_box = devtag_get_device(machine, "per_exp_box");
215
216   ti99_peb_set_card_handlers(expansion_box, 0x1f00, &pcode_handlers);
213217}
214218
215219/*
src/mess/machine/99_ide.c
r8306r8307
2121#include "machine/idectrl.h"
2222#include "machine/rtc65271.h"
2323#include "ti99_4x.h"
24#include "99_peb.h"
24#include "devices/ti99_peb.h"
2525#include "99_ide.h"
2626
2727
r8306r8307
7070only supported ti-99/4(a) (LSByte first) mode. */
7171static int tms9995_mode;
7272
73static running_device *expansion_box;
74
7375/*
7476    ti99_ide_interrupt()
7577
r8306r8307
7981{
8082   ide_irq = state;
8183   if (cru_register & cru_reg_int_en)
82      ti99_peb_set_ila_bit(device->machine, inta_ide_bit, state);
84      ti99_peb_set_ila_bit(expansion_box, inta_ide_bit, state);
8385}
8486
8587/*
r8306r8307
9092void ti99_clk_interrupt_callback(running_device *device, int state)
9193{
9294   clk_irq = state;
93   ti99_peb_set_ila_bit(device->machine, inta_ide_clk_bit, state);
95   ti99_peb_set_ila_bit(expansion_box, inta_ide_clk_bit, state);
9496}
9597
9698/*
r8306r8307
107109*/
108110void ti99_ide_reset(running_machine *machine, int in_tms9995_mode)
109111{
110   ti99_peb_set_card_handlers(0x1000, & ide_handlers);
112   expansion_box = devtag_get_device(machine, "per_exp_box");
113   ti99_peb_set_card_handlers(expansion_box, 0x1000, & ide_handlers);
111114
112115   cur_page = 0;
113116   sram_enable = 0;
r8306r8307
169172         cru_register &= ~ (1 << offset);
170173
171174      if (offset == 6)
172         ti99_peb_set_ila_bit(machine, inta_ide_bit, (cru_register & cru_reg_int_en) && ide_irq);
175         ti99_peb_set_ila_bit(expansion_box, inta_ide_bit, (cru_register & cru_reg_int_en) && ide_irq);
173176
174177      if ((offset == 6) || (offset == 7))
175178         if ((cru_register & cru_reg_int_en) && !(cru_register & cru_reg_reset))
src/mess/machine/99_hsgpl.c
r8306r8307
66#include "emu.h"
77#include "emuopts.h"
88#include "ti99_4x.h"
9#include "99_peb.h"
9#include "devices/ti99_peb.h"
1010#include "99_hsgpl.h"
1111#include "at29040.h"
1212
r8306r8307
119119static void hsgpl_cru_w(running_machine *machine, int offset, int data);
120120static READ8_HANDLER(hsgpl_dsr_r);
121121
122static running_device *expansion_box;
123
122124static const ti99_peb_card_handlers_t hsgpl_handlers =
123125{
124126   NULL,
r8306r8307
283285   hsgpl.cur_bank = 0;
284286   hsgpl.cru_reg = 0;
285287
288   expansion_box = devtag_get_device(machine, "per_exp_box");
289
286290   /* Card is enabled on startup. */
287291   ti99_set_hsgpl_crdena(1);
288292
289   ti99_peb_set_card_handlers(0x1b00, &hsgpl_handlers);
293   ti99_peb_set_card_handlers(expansion_box, 0x1b00, &hsgpl_handlers);
290294}
291295
292296
src/mess/machine/ti99_4x.c
r8306r8307
5757#include "audio/spchroms.h"
5858#include "devices/cassette.h"
5959#include "ti99_4x.h"
60#include "99_peb.h"
60#include "devices/ti99_peb.h"
6161#include "994x_ser.h"
6262#include "99_dsk.h"
6363#include "99_ide.h"
r8306r8307
7575static READ16_HANDLER ( ti99_rspeech_r );
7676static WRITE16_HANDLER ( ti99_wspeech_w );
7777
78static void tms9901_set_int1(running_machine *machine, int state);
79
8078static void ti99_handset_task(running_machine *machine);
8179static void mecmouse_poll(running_machine *machine);
8280
r8306r8307
270268/* Link to the cartridge system. */
271269static running_device *cartslots;
272270
271/* Link to the Peripheral Expansion Box */
272static running_device *expansion_box;
273
273274/*===========================================================================*/
274275/*
275276    General purpose code:
r8306r8307
423424   console_GROMs.raddr_LSB = FALSE;
424425   console_GROMs.waddr_LSB = FALSE;
425426
427   expansion_box = devtag_get_device(machine, "per_exp_box");
428
426429   /* set up scratch pad pointer */
427430   memory_set_bankptr(machine, "bank1", memory_region(machine, "maincpu") + offset_sram);
428431
r8306r8307
461464   gk_switch[4] = input_port_read(machine, "GKSWITCH4");
462465   gk_switch[5] = input_port_read(machine, "GKSWITCH5");
463466
464   // Removes all card handlers
465   ti99_peb_init();
466
467467   // set up optional expansion hardware
468   ti99_peb_reset(FALSE, tms9901_set_int1, NULL);
469
470468   if (has_speech)
471469   {
472470      static const spchroms_interface speech_intf = { region_speech_rom };
r8306r8307
14991497/*
15001498    set the state of int1 (called by the peb core)
15011499*/
1502static void tms9901_set_int1(running_machine *machine, int state)
1500void tms9901_set_int1(running_machine *machine, int state)
15031501{
15041502   tms9901_set_single_int(devtag_get_device(machine, "tms9901"), 1, state);
15051503}
r8306r8307
18911889   memory_install_read16_handler(space, 0xa000, 0xffff, 0, 0, ti99_sAMSxramhigh_r);
18921890   memory_install_write16_handler(space, 0xa000, 0xffff, 0, 0, ti99_sAMSxramhigh_w);
18931891
1894   ti99_peb_set_card_handlers(0x1e00, & sAMS_expansion_handlers);
1892   ti99_peb_set_card_handlers(expansion_box, 0x1e00, & sAMS_expansion_handlers);
18951893
18961894   sAMS_mapper_on = 0;
18971895
r8306r8307
20212019   {
20222020   case RAM_FOUNDATION128:   /* 128kb foundation */
20232021   case RAM_FOUNDATION512:   /* 512kb foundation */
2024      ti99_peb_set_card_handlers(0x1e00, & myarc_expansion_handlers);
2022      ti99_peb_set_card_handlers(expansion_box, 0x1e00, & myarc_expansion_handlers);
20252023      break;
20262024   case RAM_MYARC128:      /* 128kb myarc clone */
20272025   case RAM_MYARC512:      /* 512kb myarc clone */
2028      ti99_peb_set_card_handlers(0x1000, & myarc_expansion_handlers);
2029      ti99_peb_set_card_handlers(0x1900, & myarc_expansion_handlers);
2026      ti99_peb_set_card_handlers(expansion_box, 0x1000, & myarc_expansion_handlers);
2027      ti99_peb_set_card_handlers(expansion_box, 0x1900, & myarc_expansion_handlers);
20302028      break;
20312029   default:
20322030      break;   /* let's just keep GCC's big mouth shut */
r8306r8307
22552253static void ti99_evpc_reset(running_machine *machine)
22562254{
22572255   ti99_evpc_DSR = memory_region(machine, region_dsr) + offset_evpc_dsr;
2256   running_device *box = devtag_get_device(machine, "per_exp_box");
22582257
22592258   RAMEN = 0;
22602259   evpc_dsr_page = 0;
22612260
2262   ti99_peb_set_card_handlers(0x1400, & evpc_handlers);
2261   ti99_peb_set_card_handlers(box, 0x1400, & evpc_handlers);
22632262}
22642263
22652264/*
r8306r8307
25092508   console_GROMs.raddr_LSB = FALSE;
25102509   console_GROMs.waddr_LSB = FALSE;
25112510
2511   expansion_box = devtag_get_device(machine, "per_exp_box");
2512
25122513   ti99_8_enable_rom_and_ports = 1;      /* ??? maybe there is a pull-up */
25132514   /* MZ: already setting this in driver init, otherwise machine locks up */
25142515
r8306r8307
25422543   gk_switch[5] = input_port_read(machine, "GKSWITCH5");
25432544
25442545   // Removes all card handlers
2545   ti99_peb_init();
2546//  ti99_peb_init();
25462547
25472548   // set up optional expansion hardware
2548   ti99_peb_reset(FALSE, tms9901_set_int1, NULL);
25492549
25502550   ti99_8_internal_dsr_reset(machine);
25512551
r8306r8307
27672767
27682768      case 2:
27692769         /* ff4000 - ff5fff: DSR space */
2770         reply = ti99_8_peb_r(space, offset & 0x1fff);
2770         reply = ti99_8_peb_r(expansion_box, offset & 0x1fff);
27712771         break;
27722772
27732773      case 3:
r8306r8307
29422942
29432943      case 2:
29442944         /* DSR space */
2945         ti99_8_peb_w(space, offset & 0x1fff, data);
2945         ti99_8_peb_w(expansion_box, offset & 0x1fff, data);
29462946         break;
29472947
29482948      case 3:
r8306r8307
30163016static void ti99_8_internal_dsr_reset(running_machine *machine)
30173017{
30183018   ti99_8_internal_DSR = memory_region(machine, "maincpu") + offset_rom0_8 + 0x4000;
3019
3020   ti99_peb_set_card_handlers(0x2700, & ti99_8_internal_dsr_handlers);
3019   ti99_peb_set_card_handlers(expansion_box, 0x2700, & ti99_8_internal_dsr_handlers);
30213020}
30223021
30233022/* write CRU bit:
r8306r8307
31883187
31893188   UINT8* mem = memory_region(machine, "maincpu");
31903189
3190   expansion_box = devtag_get_device(machine, "per_exp_box");
3191
31913192   /* set up system ROM and scratch pad pointers */
31923193   memory_set_bankptr(machine, "bank1", mem + offset_rom0_4p);   /* system ROM */
31933194   memory_set_bankptr(machine, "bank2", mem + offset_sram_4p);   /* scratch pad */
r8306r8307
32123213   has_usb_sm = input_port_read(machine, "HDCTRL") & HD_USB;
32133214   has_pcode = input_port_read(machine, "EXTCARD") & EXT_PCODE;
32143215
3215   // Removes all card handlers
3216   ti99_peb_init();
3217
32183216   // set up optional expansion hardware
3219   ti99_peb_reset(TRUE, tms9901_set_int1, NULL);
3220
32213217   ti99_4p_internal_dsr_reset(machine);
32223218   ti99_4p_mapper_init(machine);
32233219   ti99_hsgpl_reset(machine);
r8306r8307
32813277   int i;
32823278   char bank_name[10];
32833279   /* Not required at run-time */
3284   ti99_peb_set_16bit_card_handlers(0x1e00, & ti99_4p_mapper_handlers);
3280   ti99_peb_set_16bit_card_handlers(expansion_box, 0x1e00, & ti99_4p_mapper_handlers);
32853281
32863282   ti99_4p_mapper_on = 0;
32873283
r8306r8307
34033399   rom6_bank_offset = offset_rom6_4p;
34043400   ti99_4p_mem = (UINT16 *)mem;
34053401
3406   ti99_peb_set_16bit_card_handlers(0x0f00, & ti99_4p_internal_dsr_handlers);
3402   ti99_peb_set_16bit_card_handlers(expansion_box, 0x0f00, &ti99_4p_internal_dsr_handlers);
34073403
34083404   ti99_4p_internal_rom6_enable = 0;
3409   ti99_4p_peb_set_senila(0);
3410   ti99_4p_peb_set_senilb(0);
3405   ti99_4p_peb_set_senila(expansion_box, 0);
3406   ti99_4p_peb_set_senilb(expansion_box, 0);
34113407}
34123408
34133409/*
r8306r8307
34253421      ti99_4p_internal_rom6_enable = data;
34263422      break;
34273423   case 2:
3428      ti99_4p_peb_set_senila(data);
3424      ti99_4p_peb_set_senila(expansion_box, data);
34293425      break;
34303426   case 3:
3431      ti99_4p_peb_set_senilb(data);
3427      ti99_4p_peb_set_senilb(expansion_box, data);
34323428      break;
34333429   case 4:
34343430      /* 0: 16-bit (fast) memory timings */
src/mess/machine/ti99_4x.h
r8306r8307
243243READ16_HANDLER( ti99_4p_grom_r );
244244WRITE16_HANDLER( ti99_4p_grom_w );
245245
246extern void tms9901_set_int2(running_machine *machine, int state);
246void tms9901_set_int2(running_machine *machine, int state);
247void tms9901_set_int1(running_machine *machine, int state);
247248
248249READ8_HANDLER ( ti99_8_r );
249250WRITE8_HANDLER ( ti99_8_w );
src/mess/mess.mak
r8306r8307
429429   $(MESS_DEVICES)/multcart.o   \
430430   $(MESS_DEVICES)/printer.o   \
431431   $(MESS_DEVICES)/snapquik.o   \
432   $(MESS_DEVICES)/ti99_hd.o    \
433432   $(MESS_DEVICES)/z80bin.o   \
434433   $(MESS_FORMATS)/basicdsk.o   \
435434   $(MESS_FORMATS)/cassimg.o   \
r8306r8307
875874$(MESSOBJ)/elektor.a:         \
876875   $(MESS_DRIVERS)/ec65.o      \
877876   $(MESS_DRIVERS)/elekscmp.o   \
878   $(MESS_DRIVERS)/elektor.o    \
877   $(MESS_DRIVERS)/elektor.o   \
879878   $(MESS_DRIVERS)/junior.o   \
880879
881880$(MESSOBJ)/ensoniq.a:         \
r8306r8307
15091508   $(MESS_MACHINE)/994x_ser.o   \
15101509   $(MESS_MACHINE)/99_dsk.o   \
15111510   $(MESS_MACHINE)/99_ide.o   \
1512   $(MESS_MACHINE)/99_peb.o   \
15131511   $(MESS_MACHINE)/99_hsgpl.o   \
15141512   $(MESS_MACHINE)/99_usbsm.o   \
15151513   $(MESS_MACHINE)/ti99pcod.o   \
r8306r8307
15221520   $(MESS_DRIVERS)/geneve.o   \
15231521   $(MESS_DRIVERS)/tm990189.o   \
15241522   $(MESS_DRIVERS)/ti99_8.o   \
1523   $(MESS_DEVICES)/ti99_hd.o   \
1524   $(MESS_DEVICES)/ti99_peb.o   \
15251525   $(MESS_VIDEO)/911_vdt.o      \
15261526   $(MESS_VIDEO)/733_asr.o      \
15271527   $(MESS_DRIVERS)/ti990_10.o   \
r8306r8307
16081608   $(MESS_VIDEO)/pp01.o      \
16091609
16101610$(MESSOBJ)/skeleton.a:         \
1611   $(MESS_DRIVERS)/alesis.o    \
1611   $(MESS_DRIVERS)/alesis.o   \
16121612   $(MESS_DRIVERS)/amico2k.o   \
16131613   $(MESS_DRIVERS)/beehive.o   \
16141614   $(MESS_DRIVERS)/bob85.o      \
16151615   $(MESS_DRIVERS)/busicom.o   \
16161616   $(MESS_VIDEO)/busicom.o      \
16171617   $(MESS_DRIVERS)/chaos.o    \
1618   $(MESS_DRIVERS)/cd2650.o    \
1618   $(MESS_DRIVERS)/cd2650.o   \
16191619   $(MESS_DRIVERS)/codata.o   \
16201620   $(MESS_DRIVERS)/cosmicos.o   \
16211621   $(MESS_DRIVERS)/d6809.o      \
1622   $(MESS_DRIVERS)/dm7000.o    \
1623   $(MESS_DRIVERS)/dolphin.o    \
1622   $(MESS_DRIVERS)/dm7000.o   \
1623   $(MESS_DRIVERS)/dolphin.o   \
16241624   $(MESS_DRIVERS)/dual68.o   \
1625   $(MESS_DRIVERS)/e01.o       \
1625   $(MESS_DRIVERS)/e01.o      \
16261626   $(MESS_DRIVERS)/elwro800.o   \
16271627   $(MESS_DRIVERS)/eti660.o   \
16281628   $(MESS_DRIVERS)/fk1.o      \
r8306r8307
16311631   $(MESS_DRIVERS)/ht68k.o      \
16321632   $(MESS_DRIVERS)/iq151.o      \
16331633   $(MESS_DRIVERS)/indiana.o   \
1634   $(MESS_DRIVERS)/instruct.o    \
1634   $(MESS_DRIVERS)/instruct.o   \
16351635   $(MESS_DRIVERS)/microdec.o   \
16361636   $(MESS_DRIVERS)/micronic.o   \
16371637   $(MESS_DRIVERS)/mk14.o      \
r8306r8307
16411641   $(MESS_DRIVERS)/nanos.o      \
16421642   $(MESS_DRIVERS)/next.o      \
16431643   $(MESS_DRIVERS)/p8k.o      \
1644   $(MESS_DRIVERS)/pegasus.o    \
1644   $(MESS_DRIVERS)/pegasus.o   \
16451645   $(MESS_VIDEO)/pegasus.o    \
16461646   $(MESS_DRIVERS)/pimps.o      \
1647   $(MESS_DRIVERS)/pipbug.o    \
1647   $(MESS_DRIVERS)/pipbug.o   \
16481648   $(MESS_DRIVERS)/plan80.o   \
16491649   $(MESS_DRIVERS)/pro80.o      \
16501650   $(MESS_DRIVERS)/ptcsol.o   \
1651   $(MESS_DRIVERS)/pv9234.o    \
1651   $(MESS_DRIVERS)/pv9234.o   \
16521652   $(MESS_DRIVERS)/pyl601.o   \
16531653   $(MESS_DRIVERS)/qtsbc.o      \
16541654   $(MESS_DRIVERS)/rvoice.o   \
r8306r8307
16611661   $(MESS_DRIVERS)/unior.o      \
16621662   $(MESS_DRIVERS)/unistar.o   \
16631663   $(MESS_DRIVERS)/vector4.o   \
1664   $(MESS_DRIVERS)/vidbrain.o    \
1664   $(MESS_DRIVERS)/vidbrain.o   \
16651665   $(MESS_DRIVERS)/vii.o      \
16661666   $(MESS_DRIVERS)/xor100.o   \
1667   $(MESS_DRIVERS)/z80dev.o    \
1667   $(MESS_DRIVERS)/z80dev.o   \
16681668   $(MESS_DRIVERS)/zexall.o   \
1669   
16701669
16711670
16721671
1672
16731673#-------------------------------------------------
16741674# miscellaneous dependencies
16751675#-------------------------------------------------
src/mess/drivers/ti99_8.c
r8306r8307
164164#include "machine/ti99_4x.h"
165165#include "machine/tms9901.h"
166166#include "audio/spchroms.h"
167#include "machine/99_peb.h"
167#include "devices/ti99_peb.h"
168168#include "machine/994x_ser.h"
169169#include "machine/99_dsk.h"
170170#include "machine/99_ide.h"
r8306r8307
203203//  AM_RANGE(0x0000, 0x00ff) AM_DEVREAD("tms9901", tms9901_cru_r)
204204   AM_RANGE(0x0000, 0x007f) AM_DEVREAD("tms9901", tms9901_cru_r)
205205   AM_RANGE(0x0080, 0x00ff) AM_DEVREAD("ti99_multicart", ti99_multicart_cru_r)     /* SuperSpace cartridge */
206   AM_RANGE(0x0100, 0x02ff) AM_READ(ti99_8_peb_cru_r)
206   AM_RANGE(0x0100, 0x02ff) AM_DEVREAD("per_exp_box", ti99_8_peb_cru_r)
207207
208208//      AM_RANGE(0x0000, 0x07ff) AM_DEVWRITE("tms9901", tms9901_cru_w)
209209   AM_RANGE(0x0000, 0x03ff) AM_DEVWRITE("tms9901", tms9901_cru_w)
210210   AM_RANGE(0x0400, 0x07ff) AM_DEVWRITE("ti99_multicart", ti99_multicart_cru_w)    /* SuperSpace cartridge */
211   AM_RANGE(0x0800, 0x17ff) AM_WRITE(ti99_8_peb_cru_w)
211   AM_RANGE(0x0800, 0x17ff) AM_DEVWRITE("per_exp_box", ti99_8_peb_cru_w)
212212
213213ADDRESS_MAP_END
214214
r8306r8307
591591   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
592592
593593   /* devices */
594   MDRV_PBOX_ADD( "per_exp_box", FALSE, tms9901_set_int1, NULL )
595
594596   // MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt
595597   // MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)
596598
r8306r8307
644646   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
645647
646648   /* devices */
649   MDRV_PBOX_ADD( "per_exp_box", FALSE, tms9901_set_int1, NULL )
647650   // MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )
648651   // MDRV_IDE_HARDDISK_ADD( "ide_harddisk" )
649652   // MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)
src/mess/drivers/geneve.c
r8306r8307
208208#include "machine/tms9901.h"
209209#include "machine/tms9902.h"
210210#include "audio/spchroms.h"
211#include "machine/99_peb.h"
211#include "devices/ti99_peb.h"
212212#include "machine/994x_ser.h"
213213#include "machine/99_dsk.h"
214214#include "machine/99_ide.h"
r8306r8307
237237
238238static ADDRESS_MAP_START(cru_map, ADDRESS_SPACE_IO, 8)
239239   AM_RANGE(0x0000, 0x00ff) AM_DEVREAD("tms9901", tms9901_cru_r)
240   AM_RANGE(0x0100, 0x01ff) AM_READ(geneve_peb_cru_r)
240   AM_RANGE(0x0100, 0x01ff) AM_DEVREAD("per_exp_box", geneve_peb_cru_r)
241241
242242   AM_RANGE(0x0000, 0x07ff) AM_DEVWRITE("tms9901", tms9901_cru_w)
243   AM_RANGE(0x0800, 0x0fff) AM_WRITE(geneve_peb_mode_cru_w)
243   AM_RANGE(0x0800, 0x0fff) AM_DEVWRITE("per_exp_box", geneve_peb_mode_cru_w)
244244ADDRESS_MAP_END
245245
246246
r8306r8307
271271   PORT_START( "HDCTRL" )
272272   PORT_CONFNAME( 0x03, 0x00, "HD controller" )
273273      PORT_CONFSETTING(    0x00, DEF_STR( None ) )
274//      PORT_CONFSETTING(    0x01, "Nouspikel IDE Controller" )
274//      PORT_CONFSETTING(    0x01, "Nouspikel IDE Controller" )
275275//      PORT_CONFSETTING(    0x02, "WHTech SCSI Controller" )
276276   PORT_CONFNAME( 0x08, 0x00, "USB-SM card" )
277277      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
r8306r8307
526526   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
527527
528528   /* devices */
529/*   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )
529   MDRV_PBOX_ADD( "per_exp_box", FALSE, inta_callback, intb_callback )
530530
531   MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) */
531/*  MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )
532532
533    MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) */
534
533535   /* rtc */
534536   MDRV_MM58274C_ADD("mm58274c", geneve_mm58274c_interface)
535537   MDRV_MM58274C_ADD("mm58274c_floppy", floppy_mm58274c_interface)
src/mess/drivers/ti99_4p.c
r8306r8307
5757#include "machine/tms9901.h"
5858#include "machine/tms9902.h"
5959#include "audio/spchroms.h"
60#include "machine/99_peb.h"
60#include "devices/ti99_peb.h"
6161#include "machine/994x_ser.h"
6262#include "machine/99_dsk.h"
6363#include "machine/99_ide.h"
r8306r8307
7777   AM_RANGE(0x0000, 0x1fff) AM_ROMBANK("bank1")                         // system ROM
7878   AM_RANGE(0x2000, 0x2fff) AM_RAMBANK("bank3")                         // lower 8kb of RAM extension: AMS bank 2
7979   AM_RANGE(0x3000, 0x3fff) AM_RAMBANK("bank4")                         // lower 8kb of RAM extension: AMS bank 3
80   AM_RANGE(0x4000, 0x5fff) AM_READWRITE(ti99_4p_peb_r, ti99_4p_peb_w)    // DSR ROM space
80   AM_RANGE(0x4000, 0x5fff) AM_DEVREADWRITE("per_exp_box", ti99_4p_peb_r, ti99_4p_peb_w)    // DSR ROM space
8181   AM_RANGE(0x6000, 0x7fff) AM_READWRITE(ti99_4p_cart_r,ti99_4p_cart_w) // cartridge space (internal or hsgpl)
8282   AM_RANGE(0x8000, 0x83ff) AM_RAMBANK("bank2")                         // RAM PAD
8383   AM_RANGE(0x8400, 0x87ff) AM_READWRITE(ti99_nop_8_r, ti99_wsnd_w)     // soundchip write
r8306r8307
9898
9999static ADDRESS_MAP_START(cru_map, ADDRESS_SPACE_IO, 8)
100100   AM_RANGE(0x0000, 0x003f) AM_DEVREAD("tms9901", tms9901_cru_r)
101   AM_RANGE(0x0040, 0x01ff) AM_READ(ti99_4p_peb_cru_r)
101   AM_RANGE(0x0040, 0x01ff) AM_DEVREAD("per_exp_box", ti99_4p_peb_cru_r)
102102
103103   AM_RANGE(0x0000, 0x01ff) AM_DEVWRITE("tms9901", tms9901_cru_w)
104   AM_RANGE(0x0200, 0x0fff) AM_WRITE(ti99_4p_peb_cru_w)
104   AM_RANGE(0x0200, 0x0fff) AM_DEVWRITE("per_exp_box", ti99_4p_peb_cru_w)
105105ADDRESS_MAP_END
106106
107107
r8306r8307
434434   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
435435
436436   /* devices */
437   MDRV_PBOX_ADD( "per_exp_box", TRUE, tms9901_set_int1, NULL )
438
437439/*  MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )
438440    MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) */
439441
src/mess/drivers/ti99_4x.c
r8306r8307
2929#include "machine/tms9901.h"
3030#include "machine/tms9902.h"
3131#include "audio/spchroms.h"
32#include "machine/99_peb.h"
32#include "devices/ti99_peb.h"
3333#include "machine/994x_ser.h"
3434#include "machine/99_dsk.h"
3535#include "machine/99_ide.h"
r8306r8307
5454   ADDRESS_MAP_GLOBAL_MASK(0xffff)
5555   AM_RANGE(0x0000, 0x1fff) AM_ROM                              /*system ROM*/
5656   AM_RANGE(0x2000, 0x3fff) AM_READWRITE(ti99_nop_8_r, ti99_nop_8_w)   /*lower 8kb of RAM extension - installed dynamically*/
57   AM_RANGE(0x4000, 0x5fff) AM_READWRITE(ti99_4x_peb_r, ti99_4x_peb_w)   /*DSR ROM space*/
57   AM_RANGE(0x4000, 0x5fff) AM_DEVREADWRITE("per_exp_box", ti99_4x_peb_r, ti99_4x_peb_w)   /*DSR ROM space*/
5858   AM_RANGE(0x6000, 0x7fff) AM_READWRITE(ti99_cart_r, ti99_cart_w)     /*cartridge memory*/
5959//  AM_RANGE(0x6000, 0x7fff) AM_DEVREADWRITE("ti99_multicart", ti99_multicart_r, ti99_multicart_w)
6060   AM_RANGE(0x8000, 0x80ff) AM_MIRROR(0x0300) AM_RAMBANK("bank1")         /*RAM PAD, mirrored 4 times*/
r8306r8307
7272   ADDRESS_MAP_GLOBAL_MASK(0xffff)
7373   AM_RANGE(0x0000, 0x1fff) AM_ROM                  /*system ROM*/
7474   AM_RANGE(0x2000, 0x3fff) AM_READWRITE(ti99_nop_8_r, ti99_nop_8_w)   /*lower 8kb of RAM extension - installed dynamically*/
75   AM_RANGE(0x4000, 0x5fff) AM_READWRITE(ti99_4x_peb_r, ti99_4x_peb_w)   /*DSR ROM space*/
75   AM_RANGE(0x4000, 0x5fff) AM_DEVREADWRITE("per_exp_box", ti99_4x_peb_r, ti99_4x_peb_w)   /*DSR ROM space*/
7676   AM_RANGE(0x6000, 0x7fff) AM_READWRITE(ti99_cart_r, ti99_cart_w)     /*cartridge memory*/
7777//  AM_RANGE(0x6000, 0x7fff) AM_DEVREADWRITE("ti99_multicart", ti99_multicart_r, ti99_multicart_w)
7878   AM_RANGE(0x8000, 0x80ff) AM_MIRROR(0x0300) AM_RAMBANK("bank1")         /*RAM PAD, mirrored 4 times*/
r8306r8307
9393static ADDRESS_MAP_START(cru_map, ADDRESS_SPACE_IO, 8)
9494   AM_RANGE(0x0000, 0x007f) AM_DEVREAD("tms9901", tms9901_cru_r)
9595   AM_RANGE(0x0080, 0x00ff) AM_DEVREAD("ti99_multicart", ti99_multicart_cru_r)   /* SuperSpace */
96   AM_RANGE(0x0100, 0x01ff) AM_READ(ti99_4x_peb_cru_r)
96   AM_RANGE(0x0100, 0x01ff) AM_DEVREAD("per_exp_box", ti99_4x_peb_cru_r)
9797
9898   AM_RANGE(0x0000, 0x03ff) AM_DEVWRITE("tms9901", tms9901_cru_w)
9999   AM_RANGE(0x0400, 0x07ff) AM_DEVWRITE("ti99_multicart", ti99_multicart_cru_w)   /* SuperSpace */
100   AM_RANGE(0x0800, 0x0fff) AM_WRITE(ti99_4x_peb_cru_w)
100   AM_RANGE(0x0800, 0x0fff) AM_DEVWRITE("per_exp_box", ti99_4x_peb_cru_w)
101101ADDRESS_MAP_END
102102
103103/*
r8306r8307
790790   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
791791
792792   /* devices */
793   MDRV_PBOX_ADD( "per_exp_box", FALSE, tms9901_set_int1, NULL )
794
793795   // MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )
794796   // MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)
795797
r8306r8307
847849   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
848850
849851   /* devices */
852   MDRV_PBOX_ADD( "per_exp_box", FALSE, tms9901_set_int1, NULL )
853
850854   // MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt
851855   // MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)
852856
r8306r8307
904908   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
905909
906910   /* devices */
911   MDRV_PBOX_ADD( "per_exp_box", FALSE, tms9901_set_int1, NULL )
912
907913   // MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )
908914   // MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)
909915
r8306r8307
963969   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
964970
965971   /* devices */
972   MDRV_PBOX_ADD( "per_exp_box", FALSE, tms9901_set_int1, NULL )
973
966974   // MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )
967975   // MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) */
968976
r8306r8307
10311039   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
10321040
10331041   /* devices */
1042   MDRV_PBOX_ADD( "per_exp_box", FALSE, tms9901_set_int1, NULL )
1043
10341044   // MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )
10351045   // MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)  */
10361046

Previous 15994 Revisions Next


© 1998-2018 The MESS Team