Previous 15994 Revisions Next

r8247 Monday 7th June, 2010 at 23:11:27 UTC by Michael Zapf
Fixed issues with HSGPL; now fully working.
[src/mess/devices]ti99cart.c
[src/mess/drivers]ti99_4p.c ti99_4x.c
[src/mess/machine]99_hsgpl.c 99_hsgpl.h ti99_4x.c ti99_4x.h

src/mess/devices/ti99cart.c
r8246r8247
3030   /* PCB device associated to this cartridge. If NULL, the slot is empty. */
3131   running_device *pcb;
3232
33        /* GROM buffer size. */
34        int grom_size;
35
36        /* ROM page. */
37        int rom_page;
38        /* RAM page. */
39        int ram_page;
40
41        /* ROM buffer size. All banks have equal sizes. */
42        int rom_size;
43        /* RAM buffer size. All banks have equal sizes. */
44        int ram_size;
45
46        /* pointer to GROM data. */
47        UINT8 *grom_ptr;
48
49        /* GROM buffered data output. */
50        /*        UINT8 grom_buffer; */ /* Now handled by the multicart system. */
51
52        /* ROM buffer. We are using this for both 16 bit (99/4a) and 8 bit
53        (99/8) access. */
54        void *rom_ptr;
55
56        /* ROM buffer for the second bank of paged cartridges. Other cartridges
57        usually store their ROM in one large file. */
58        void *rom2_ptr;
59
60        /* RAM buffer. The persistence service is done by the cartridge system.
61        The RAM space is a consecutive space; all banks are in one buffer. */
62        void *ram_ptr;
33   /* GROM buffer size. */
34   int grom_size;
35   
36   /* ROM page. */
37   int rom_page;
38   /* RAM page. */
39   int ram_page;
40   
41   /* ROM buffer size. All banks have equal sizes. */
42   int rom_size;
43   /* RAM buffer size. All banks have equal sizes. */
44   int ram_size;
45   
46   /* pointer to GROM data. */
47   UINT8 *grom_ptr;
48   
49   /* GROM buffered data output. */
50   /*        UINT8 grom_buffer; */ /* Now handled by the multicart system. */
51   
52   /* ROM buffer. We are using this for both 16 bit (99/4a) and 8 bit
53   (99/8) access. */
54   void *rom_ptr;
55   
56   /* ROM buffer for the second bank of paged cartridges. Other cartridges
57   usually store their ROM in one large file. */
58   void *rom2_ptr;
59   
60   /* RAM buffer. The persistence service is done by the cartridge system.
61   The RAM space is a consecutive space; all banks are in one buffer. */
62   void *ram_ptr;
6363};
6464typedef struct _cartridge_t cartridge_t;
6565
r8246r8247
405405         value = 0;
406406         //printf("Empty socket at address G(%d)>%04x\n", slot, cartslots->grom_address);
407407      }
408      //          printf("GROM address (cart) = %04x, reply = %02x\n", cartslots->grom_address, value);
409      /* The program counter wraps at each GROM chip size (8K),
410        so 0x5fff + 1 = 0x4000. */
411      cartslots->grom_address = ((cartslots->grom_address + 1) & 0x1FFF) | (cartslots->grom_address & 0xE000);
408   }
409   //          printf("GROM address (cart) = %04x, reply = %02x\n", cartslots->grom_address, value);
410   /* The program counter wraps at each GROM chip size (8K), */
411   /* so 0x5fff + 1 = 0x4000. */
412   /* The address must be increased even if there is no cartridge slot */
413   cartslots->grom_address = ((cartslots->grom_address + 1) & 0x1FFF) | (cartslots->grom_address & 0xE000);
414   
415   /* Reset the read and write address flipflops. */
416   cartslots->raddr_LSB = cartslots->waddr_LSB = FALSE;
412417
413      /* Reset the read and write address flipflops. */
414      cartslots->raddr_LSB = cartslots->waddr_LSB = FALSE;
415   }
416418   return value;
417419}
418420
r8246r8247
16211623      if (data != 0)
16221624      {
16231625         cartridge->rom_page = (offset-1)/2;
1624         printf("Setting bit %4x of CRU base >0800\n", offset);
1626         // printf("Setting bit %4x of CRU base >0800\n", offset);
16251627      }
16261628   }
16271629//  printf("setting rompage to %d\n", cartridge->rom_page);
src/mess/machine/99_hsgpl.c
r8246r8247
11/*
22    SNUG HSGPL card emulation.
3
43    Raphael Nabet, 2003.
54*/
65
r8246r8247
8988   UINT16 addr;
9089   char raddr_LSB, waddr_LSB;
9190
91   /* Holds the current GROM base */
9292   int cur_port;
9393
94   /* Holds the current ROM6 bank */
9495   int cur_bank;
9596
97   /* Latches the setting of the 16 CRU bits. Also contains the */
98   /* current DSR bank (PG0...) */
9699   int cru_reg;
97
98   int is_image_writable;
99100} hsgpl;
100101
101102enum
r8246r8247
103104   cr_grmena  = 0x0002,
104105   cr_bnkinh  = 0x0004,
105106   cr_pg      = 0x01f8,
106      cr_pg_mask = 0x3f,
107      cr_pg_shift= 3,
107   cr_pg_mask = 0x3f,
108   cr_pg_shift= 3,
108109   cr_crdena  = 0x0200,
109      cr_crdena_bit = 9,
110   cr_crdena_bit = 9,
110111   cr_wriena  = 0x0400,
111112   cr_scena   = 0x0800,
112113   cr_ledena  = 0x1000,
r8246r8247
140141   UINT8 version;
141142   UINT8 *rgn;
142143
143
144144   /* version flag */
145145   if (mame_fread(file, & version, 1) != 1)
146146      return 1;
r8246r8247
176176{
177177   UINT8 version;
178178
179
180179   /* version flag */
181180   version = 0;
182181   if (mame_fwrite(file, & version, 1) != 1)
r8246r8247
211210
212211
213212
214int ti99_hsgpl_load_memcard(running_machine *machine)
213int ti99_hsgpl_load_flashroms(running_machine *machine, const char *name)
215214{
216215   file_error filerr;
217216   mame_file *file;
218217
219   filerr = mame_fopen(SEARCHPATH_MEMCARD, "hsgpl.nv", OPEN_FLAG_READ, &file);
218   filerr = mame_fopen(SEARCHPATH_NVRAM, name, OPEN_FLAG_READ, &file);
220219   if (filerr != FILERR_NONE)
221      return /*1*/0;
220      return 0;
222221   if (ti99_hsgpl_file_load(machine, file))
223222   {
224223      mame_fclose(file);
r8246r8247
229228   return 0;
230229}
231230
232int ti99_hsgpl_save_memcard(running_machine *machine)
231int ti99_hsgpl_save_flashroms(running_machine *machine, const char *name)
233232{
234233   file_error filerr;
235234   mame_file *file;
236235
237236   if (ti99_hsgpl_get_dirty_flag())
238237   {
239      filerr = mame_fopen(SEARCHPATH_MEMCARD, "hsgpl.nv", OPEN_FLAG_WRITE, &file);
238      filerr = mame_fopen(SEARCHPATH_NVRAM, name,
239         OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file);
240
240241      if (filerr != FILERR_NONE)
241242         return 1;
242243      if (ti99_hsgpl_file_save(file))
r8246r8247
281282   hsgpl.cur_port = 0;
282283   hsgpl.cur_bank = 0;
283284   hsgpl.cru_reg = 0;
284   ti99_set_hsgpl_crdena(/*0*/1);
285285
286   ti99_peb_set_card_handlers(0x1b00, & hsgpl_handlers);
286   /* Card is enabled on startup. */
287   ti99_set_hsgpl_crdena(1);
288
289   ti99_peb_set_card_handlers(0x1b00, &hsgpl_handlers);
287290}
288291
289292
r8246r8247
298301      hsgpl.cru_reg |= 1 << offset;
299302   else
300303      hsgpl.cru_reg &= ~ (1 << offset);
301
304   
302305   if (offset == cr_crdena_bit)
303306      ti99_set_hsgpl_crdena(data);
304307}
305308
306309/*
307    read a byte in hsgpl DSR space
310    read a byte in hsgpl DSR space (4000-5fff)
308311*/
309312static  READ8_HANDLER(hsgpl_dsr_r)
310313{
r8246r8247
398401
399402      case 32:
400403      case 33:
401         /* This has been verified */
404         /* GRAM access */
402405         reply = hsgpl.GRAM_ptr[hsgpl.addr + 0x10000*(port-32)];
403406         break;
404407
405408      case 48:
406      case 49:      /* this mirror is mistakenly used by the hsgpl DSR */
407         /* This has been verified. */
409      case 49:
410         /* RAM6 access */
408411         reply = hsgpl.RAM6_ptr[hsgpl.addr];
409412         break;
410413
r8246r8247
432435{
433436   int port;
434437
435
436438   //activecpu_adjust_icount(-4);
437439
438440   port = hsgpl.cur_port = (offset & 0x1FE) >> 1;
r8246r8247
444446      if (hsgpl.waddr_LSB)
445447      {
446448         hsgpl.addr = (hsgpl.addr & 0xFF00) | ((data >> 8) & 0xFF);
447
448449         hsgpl.waddr_LSB = FALSE;
449450      }
450451      else
r8246r8247
514515
515516         case 32:
516517         case 33:
517            /* This has been verified */
518            /* GRAM access */
518519            hsgpl.GRAM_ptr[hsgpl.addr + 0x10000*(port-32)] = data;
519520            break;
520521
521522         case 48:
522         case 49:      /* this mirror is mistakenly used by the hsgpl DSR */
523            /* This has been verified. */
523         case 49:
524            /* RAM6 access */
524525            hsgpl.RAM6_ptr[hsgpl.addr] = data;
525526            break;
526527
src/mess/machine/99_hsgpl.h
r8246r8247
1#if 0
2DEVICE_IMAGE_LOAD(ti99_hsgpl);
3DEVICE_IMAGE_UNLOAD(ti99_hsgpl);
4#endif
5int ti99_hsgpl_load_memcard(running_machine *machine);
6int ti99_hsgpl_save_memcard(running_machine *machine);
1/*
2    SNUG HSGPL card emulation.
3    Raphael Nabet, 2003.
4*/
75
6int ti99_hsgpl_load_flashroms(running_machine *machine, const char *filename);
7int ti99_hsgpl_save_flashroms(running_machine *machine, const char *filename);
8
89void ti99_hsgpl_init(running_machine *machine);
910void ti99_hsgpl_reset(running_machine *machine);
1011
src/mess/machine/ti99_4x.c
r8246r8247
119119static char has_handset;
120120/* TRUE if hsgpl card present */
121121static char has_hsgpl;
122static char hsgpl_flash_mode;
123
122124/* TRUE if mechatronics mouse present */
123125static char has_mecmouse;
124126/* TRUE if usb-sm card present */
r8246r8247
423425    ti99_common_init(machine, 0);
424426}
425427
428MACHINE_START( ti99_4p )
429{
430   UINT8* mem = memory_region(machine, "maincpu");
431   
432   /* Set up system ROM and scratch pad pointers. Must be set up here */
433   /* so that the system can successfully reset (otherwise the reset  */
434   /* vector would be missing in 0x0000). */
435   memory_set_bankptr(machine, "bank1", mem + offset_rom0_4p);   /* system ROM */
436   memory_set_bankptr(machine, "bank2", mem + offset_sram_4p);   /* scratch pad */
437   memory_set_bankptr(machine, "bank11", mem + offset_dram_4p);   /* extra RAM for debugger */
438
439   ti99_peb_init();
440   ti99_floppy_controllers_init_all(machine);
441   ti99_ide_init(machine);
442   ti99_hsgpl_init(machine);
443   ti99_usbsm_init(machine);
444}
445
426446void ti99_common_init(running_machine *machine, const TMS9928a_interface *gfxparm)
427447{
428448   if (gfxparm != 0)
r8246r8247
474494      memory_set_bankptr(machine, "bank1", memory_region(machine, "maincpu") + offset_sram);
475495   }
476496
477#if 0
478   if (ti99_model != model_99_4p)
479   {
480      if (ti99_model == model_99_8)
481         current_page_ptr_8 = cartridge_pages_8[0];
482      else
483         current_page_ptr = cartridge_pages[0];
484   }
485#endif
486
487497   if (!has_evpc) TMS9928A_reset();
488498   else v9938_reset(0);
489499
r8246r8247
522532   if (ti99_model == model_99_4p)
523533      has_hsgpl = TRUE;
524534   else
525      has_hsgpl = input_port_read(machine, "EXTCARD") & EXT_HSGPL;
535      has_hsgpl = input_port_read(machine, "EXTCARD") & (EXT_HSGPL_ON | EXT_HSGPL_FLASH);
526536
537   hsgpl_flash_mode = input_port_read(machine, "EXTCARD") & EXT_HSGPL_FLASH;
538
527539   has_usb_sm = input_port_read(machine, "HDCTRL") & HD_USB;
528540   has_pcode = input_port_read(machine, "EXTCARD") & EXT_PCODE;
529541
r8246r8247
603615      break;
604616   }
605617
606   if (has_ide) {
618   if (has_ide)
607619      ti99_ide_reset(machine, ti99_model == model_99_8);
608   }
609620
610   if (has_hsgpl)   {
621   if (has_hsgpl)
611622      ti99_hsgpl_reset(machine);
612      ti99_hsgpl_load_memcard(machine);
613   }
614623   else
615624      hsgpl_crdena = 0;
616625
r8246r8247
643652}
644653#endif
645654
655NVRAM_HANDLER( ti99 )
656{
657   const char *filename;
658   
659   /* We may have different HSGPL settings for 80 column and traditional */
660   /* 40 column display. For convenience, we use two different nvram files. */
661   if (has_evpc)
662      filename = "hsgpl80.nv";
663   else
664      filename = "hsgpl40.nv";
665   
666   if ((ti99_model == model_99_4p) || (input_port_read(machine, "EXTCARD") & (EXT_HSGPL_ON | EXT_HSGPL_FLASH)))
667   {
668      if (read_or_write==0)
669      {
670         ti99_hsgpl_load_flashroms(machine, filename);
671      }
672      else
673      {
674         ti99_hsgpl_save_flashroms(machine, filename);
675      }
676   }
677}
646678
679INPUT_CHANGED( hsgpl_changed )
680{
681   hsgpl_flash_mode = newval & EXT_HSGPL_FLASH;
682}
683
647684/*
648685    video initialization.
649686*/
650687VIDEO_START( ti99_4ev )
651688{
652689   VIDEO_START_CALL(generic_bitmapped);
653   v9938_init(machine, 0, machine->primary_screen, machine->generic.tmpbitmap, MODEL_V9938, 0x20000, tms9901_set_int2);   /* v38 with 128 kb of video RAM */
690   v9938_init(machine, 0, machine->primary_screen, machine->generic.tmpbitmap,
691      MODEL_V9938, 0x20000, tms9901_set_int2);   /* v38 with 128 kb of video RAM */
654692}
655693
656694/*
r8246r8247
683721/*
684722    Backdoor function that is called by hsgpl, so that the machine code knows
685723    whether hsgpl or console GROMs are active
724    Called from 99_hsgpl.c
686725*/
687726void ti99_set_hsgpl_crdena(int data)
688727{
r8246r8247
720759}
721760
722761/*
762    Cartridge space (>6000->7FFF). This is usually connected to the cartridge
763    port, but is also used by the HSGPL. So we need to check this here and then
764    delegate to the respective component.
765*/
766READ16_HANDLER ( ti99_cart_r )
767{
768   if (hsgpl_crdena && !hsgpl_flash_mode)
769      /* hsgpl is enabled */
770      return ti99_hsgpl_rom6_r(space, offset, mem_mask);
771   return ti99_multicart_r(cartslots, offset, mem_mask);
772}
773
774/*
775    Cartridge space (>6000->7FFF). This is usually connected to the cartridge
776    port, but is also used by the HSGPL. So we need to check this here and then
777    delegate to the respective component.
778*/
779WRITE16_HANDLER ( ti99_cart_w )
780{
781   ti99_multicart_w(cartslots, offset, data, mem_mask);
782   if (hsgpl_crdena && !hsgpl_flash_mode)
783      /* hsgpl is enabled */
784      ti99_hsgpl_rom6_w(space, offset, data, mem_mask);
785}
786
787/*
723788    99/4p cartridge space: mapped either to internal ROM6 or to HSGPL.
724789*/
725790READ16_HANDLER ( ti99_4p_cart_r )
r8246r8247
730795   cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-4);
731796//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
732797
733   if (hsgpl_crdena)
798   if (hsgpl_crdena && !hsgpl_flash_mode)
734799      /* hsgpl is enabled */
735800      return ti99_hsgpl_rom6_r(space, offset, mem_mask);
736801
r8246r8247
748813   cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-4);
749814//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
750815
751   if (hsgpl_crdena)
816   if (hsgpl_crdena && !hsgpl_flash_mode)
752817      /* hsgpl is enabled */
753818      ti99_hsgpl_rom6_w(space, offset, data, mem_mask);
754819}
r8246r8247
9441009      /* Get next value, put it in buffer. Note that the GROM */
9451010      /* wraps at 8K boundaries. */
9461011      console_GROMs.buf = console_GROMs.data_ptr[console_GROMs.addr];
947//      printf("GROM address (cons) = %04x, offset = %04x, reply = %02x\n", console_GROMs.addr, offset, reply);
9481012   }
9491013
9501014   /* The address pointer in the cartridge system is updated by this */
r8246r8247
9991063   /* it's not clear whether this has unwanted side effects.             */
10001064
10011065   if (offset & 1)
1002   {   /* Read GROM address
1003        We only have one GROM program counter for the console GROMs
1004        and all cartridge GROMs in all banks(!). Hardware
1005        implementations must take this into account as well. Thus,
1006        we use a structure here in the console, rather than separate
1007        counters in each GROM chip. */
1066   {   /* Read GROM address */
1067      /* We only have one GROM program counter for the console */
1068      /* GROMs and all cartridge GROMs in all banks(!). Hardware */
1069      /* implementations must take this into account as well. Thus, */
1070      /* we use a structure here in the console, rather than */
1071      /* separate counters in each GROM chip. */
10081072
1009      /* We call the cartridge system here, but we ignore the
1010           value. This is done to sync the flags. */
1073      /* We call the cartridge system here, but we ignore the */
1074      /* value. This is done to sync the flags. */
10111075      replycart = ti99_cartridge_grom_r(cartslots, (offset<<1))<<8;
10121076
1013      /* When reading, reset the hi/lo flag byte for writing.
1014        TODO: Verify this with a real machine. */
1077      /* When reading, reset the hi/lo flag byte for writing. */
1078      /* TODO: Verify this with a real machine. */
10151079      console_GROMs.waddr_LSB = FALSE;
10161080
1017      /* Address reading is done in two steps; first, the high byte
1018        is transferred, then the low byte. */
1081      /* Address reading is done in two steps; first, the high byte */
1082      /* is transferred, then the low byte. */
10191083      if (console_GROMs.raddr_LSB)
10201084      {
10211085         /* second pass */
r8246r8247
10341098   else
10351099   {
10361100      /* Read GROM data */
1037      /* Note that we shift the GROM port address to accomodate for
1038           8-bit and 16-bit systems. */
1101      /* Note that we shift the GROM port address to accomodate for */
1102      /* 8-bit and 16-bit systems. */
10391103      reply = ((UINT16)GROM_dataread(offset<<1)) << 8;
10401104   }
10411105
10421106   if (hsgpl_crdena)
1043      /* hsgpl buffers are stronger than console GROM buffers */
1044      reply = ti99_hsgpl_gpl_r(space, offset, mem_mask);
1107   {
1108      /* We must prevent the HSGPL to override the console GROMs */
1109      /* when it is not yet set up - or the console will get stuck */
1110      /* in a black screen. The "flash mode" allows to read GROMs */
1111      /* only in higher banks; writing is enabled for all banks. */
1112      int bank = (offset>>1)&0xff;
1113      if (!hsgpl_flash_mode || (bank>=16))
1114      {
1115         /* hsgpl buffers always override console GROM buffers */
1116         reply = ti99_hsgpl_gpl_r(space, offset, mem_mask);
1117      }
1118   }
10451119
10461120   return reply;
10471121}
r8246r8247
10621136      /* see comments above */
10631137      console_GROMs.raddr_LSB = FALSE;
10641138
1065      /* Implements the internal flipflop.
1066        The Editor/Assembler manuals says that the current address
1067        plus one is returned. This effect is properly emulated
1068        as we are using a read-ahead buffer.
1069        */
1139      /* Implements the internal flipflop. */
1140      /* The Editor/Assembler manuals says that the current address */
1141      /* plus one is returned. This effect is properly emulated */
1142      /* by using a read-ahead buffer. */
10701143      if (console_GROMs.waddr_LSB)
10711144      {
10721145         /* Accept low byte (2nd write) */
10731146         console_GROMs.addr = (console_GROMs.addr & 0xFF00) | ((data >> 8) & 0xFF);
1074
1075         /* Setting the address causes a new read, putting the
1076            value into the buffer. We don't need the value here. */
1147         /* Setting the address causes a new read, putting the */
1148         /* value into the buffer. We don't need the value here. */
10771149         GROM_dataread(offset<<1);
10781150         console_GROMs.waddr_LSB = FALSE;
10791151      }
r8246r8247
10881160   {
10891161      /* write GROM data */
10901162      /* the console GROMs are always affected */
1091      /* BTW, console GROMs are never GRAMs, therefore there is no
1092        need to actually write anything, so we just read ahead
1093        TODO: There could be cartridges with GRAM, so this must be
1094        fixed.
1095        */
1163      /* BTW, console GROMs are never GRAMs, therefore there is no */
1164      /* need to actually write anything, so we just read ahead */
1165      /* TODO: There could be cartridges with GRAM, so this must be */
1166      /* fixed.         */
10961167      GROM_dataread(offset<<1);
10971168      console_GROMs.raddr_LSB = console_GROMs.waddr_LSB = FALSE;
10981169   }
10991170
11001171   if (hsgpl_crdena)
1172   {
1173      /* If the HSGPL card is used, we always attempt to write to */
1174      /* its memory, even in flash mode. Writing does no harm to */
1175      /* the internal GROMs. */
11011176      ti99_hsgpl_gpl_w(space, offset, data, mem_mask);
1177   }
11021178}
11031179
11041180/*
r8246r8247
11771253   cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-4);      /* HSGPL is located on 8-bit bus? */
11781254   //  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
11791255
1180   return /*hsgpl_crdena ?*/ ti99_hsgpl_gpl_r(space, offset, mem_mask) /*: 0*/;
1256   return hsgpl_crdena? ti99_hsgpl_gpl_r(space, offset, mem_mask) : 0;
11811257}
11821258
11831259/*
r8246r8247
11881264   cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-4);      /* HSGPL is located on 8-bit bus? */
11891265   //  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
11901266
1191   /*if (hsgpl_crdena)*/
1192   ti99_hsgpl_gpl_w(space, offset, data, mem_mask);
1267   if (hsgpl_crdena)
1268      ti99_hsgpl_gpl_w(space, offset, data, mem_mask);
11931269}
11941270
11951271
r8246r8247
21182194      answer = 4;   /* on systems without handset, the pin is pulled up to avoid spurious interrupts */
21192195
21202196   /* we don't take CS2 into account, as CS2 is a write-only unit */
2121   if ( ti99_model != model_99_8 )
2197   if ( (ti99_model != model_99_8) && (ti99_model != model_99_4p))
21222198   {
21232199      if (cassette_input(devtag_get_device(device->machine, "cassette1")) > 0)
21242200         answer |= 8;
r8246r8247
22652341{
22662342   running_device *img;
22672343
2268   if ( ti99_model != model_99_8 )
2344   if ( (ti99_model != model_99_8) && (ti99_model != model_99_4p))
22692345   {
22702346      img = devtag_get_device(device->machine, (offset-6 ) ? "cassette2" :  "cassette1" );
22712347   }
r8246r8247
22952371*/
22962372static WRITE8_DEVICE_HANDLER( ti99_CS_output )
22972373{
2298   if (ti99_model != model_99_8)   /* 99/8 only has one tape port!!! */
2374   if ((ti99_model != model_99_8) && (ti99_model != model_99_4p))   /* 99/8 only has one tape port!!! */
22992375   {
23002376      cassette_output(devtag_get_device(device->machine, "cassette1"), data ? +1 : -1);
23012377      cassette_output(devtag_get_device(device->machine, "cassette2"), data ? +1 : -1);
r8246r8247
24852561{
24862562   cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-4);
24872563//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
2488
24892564   COMBINE_DATA(xRAM_ptr + offset);
24902565}
24912566
r8246r8247
24942569{
24952570   cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-4);
24962571//  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
2497
24982572   return xRAM_ptr[offset+0x1000];
24992573}
25002574
src/mess/machine/ti99_4x.h
r8246r8247
168168enum
169169{
170170   EXT_NONE = 0,
171   EXT_HSGPL,
172   EXT_PCODE
171   EXT_HSGPL_FLASH = 1,
172   EXT_HSGPL_ON = 2,
173   EXT_PCODE = 4
173174};
174175
175176enum
r8246r8247
213214MACHINE_START( ti99_4a_60hz );
214215MACHINE_START( ti99_4a_50hz );
215216MACHINE_START( ti99_4ev_60hz );
217MACHINE_START( ti99_4p );
218
216219MACHINE_RESET( ti99 );
217220
218// DEVICE_START( ti99_cart );
219// DEVICE_IMAGE_LOAD( ti99_cart );
220// DEVICE_IMAGE_UNLOAD( ti99_cart );
221/* For HSGPL */
222NVRAM_HANDLER( ti99 );
223INPUT_CHANGED( hsgpl_changed );
221224
222225VIDEO_START( ti99_4ev );
223226INTERRUPT_GEN( ti99_vblank_interrupt );
r8246r8247
227230void ti99_common_init(running_machine *machine, const TMS9928a_interface *gfxparm);
228231int ti99_is_99_8(void);
229232
230READ16_HANDLER ( ti99_nop_8_r );
231WRITE16_HANDLER ( ti99_nop_8_w );
233READ16_HANDLER( ti99_nop_8_r );
234WRITE16_HANDLER( ti99_nop_8_w );
232235
233READ16_HANDLER ( ti99_4p_cart_r );
234WRITE16_HANDLER ( ti99_4p_cart_w );
236READ16_HANDLER( ti99_cart_r );
237WRITE16_HANDLER( ti99_cart_w );
238READ16_HANDLER( ti99_4p_cart_r );
239WRITE16_HANDLER( ti99_4p_cart_w );
235240
236241WRITE16_HANDLER( ti99_wsnd_w );
237242
238READ16_HANDLER ( ti99_rvdp_r );
239WRITE16_HANDLER ( ti99_wvdp_w );
240READ16_HANDLER ( ti99_rv38_r );
241WRITE16_HANDLER ( ti99_wv38_w );
243READ16_HANDLER( ti99_rvdp_r );
244WRITE16_HANDLER( ti99_wvdp_w );
245READ16_HANDLER( ti99_rv38_r );
246WRITE16_HANDLER( ti99_wv38_w );
242247
243READ16_HANDLER ( ti99_grom_r );
248READ16_HANDLER( ti99_grom_r );
244249WRITE16_HANDLER( ti99_grom_w );
245READ16_HANDLER ( ti99_4p_grom_r );
246WRITE16_HANDLER ( ti99_4p_grom_w );
250READ16_HANDLER( ti99_4p_grom_r );
251WRITE16_HANDLER( ti99_4p_grom_w );
247252
248253extern void tms9901_set_int2(running_machine *machine, int state);
249254
src/mess/drivers/ti99_4p.c
r8246r8247
3939#include "emu.h"
4040#include "deprecat.h"
4141#include "cpu/tms9900/tms9900.h"
42#include "sound/wave.h"
4243#include "sound/dac.h"
4344#include "sound/sn76496.h"
4445#include "sound/tms5220.h"
r8246r8247
120121   PORT_START( "HDCTRL" )
121122   PORT_CONFNAME( 0x03, 0x00, "HD controller" )
122123      PORT_CONFSETTING(    0x00, DEF_STR( None ) )
123      PORT_CONFSETTING(    0x01, "Nouspikel IDE Controller" )
124//      PORT_CONFSETTING(    0x01, "Nouspikel IDE Controller" )
124125//      PORT_CONFSETTING(    0x02, "WHTech SCSI Controller" )
125126   PORT_CONFNAME( 0x08, 0x00, "USB-SM card" )
126127      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
r8246r8247
289290   MDRV_CPU_IO_MAP(cru_map)
290291   MDRV_CPU_VBLANK_INT_HACK(ti99_4ev_hblank_interrupt, 263)   /* 262.5 in 60Hz, 312.5 in 50Hz */
291292
293   MDRV_MACHINE_START( ti99_4p )
292294   MDRV_MACHINE_RESET( ti99 )
293295
296   /* For HSGPL */
297   MDRV_NVRAM_HANDLER( ti99 )
298
294299   /* video hardware */
295300   MDRV_SCREEN_ADD("screen", RASTER)
296301   MDRV_SCREEN_REFRESH_RATE(60)   /* or 50Hz */
r8246r8247
309314   MDRV_SPEAKER_STANDARD_MONO("mono")
310315   MDRV_SOUND_ADD("dac", DAC, 0)
311316   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
312//  MDRV_SOUND_WAVE_ADD("wave", "cassette")
313//  MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
317   MDRV_SOUND_WAVE_ADD("wave", "cassette")
318   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
314319   MDRV_SOUND_ADD("sn76496", SN76496, 3579545)   /* 3.579545 MHz */
315320   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
316321   MDRV_SOUND_ADD("tmc0285", TMC0285, 680000L)
r8246r8247
318323   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
319324
320325   /* devices */
321   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   /* FIXME */
326/*   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )
327   MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) */
322328
323   MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)
329   MDRV_CASSETTE_ADD( "cassette", default_cassette_config )
324330
325   /* MDRV_CASSETTE_ADD( "cassette", default_cassette_config ) */
326
327331   /* tms9901 */
328332   MDRV_TMS9901_ADD("tms9901", tms9901reset_param_ti99_4x)
329333
src/mess/drivers/ti99_4x.c
r8246r8247
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*/
5757   AM_RANGE(0x4000, 0x5fff) AM_READWRITE(ti99_4x_peb_r, ti99_4x_peb_w)   /*DSR ROM space*/
58//  AM_RANGE(0x6000, 0x7fff) AM_READWRITE(ti99_cart_r, ti99_cart_w)     /*cartridge memory*/
59   AM_RANGE(0x6000, 0x7fff) AM_DEVREADWRITE("ti99_multicart", ti99_multicart_r, ti99_multicart_w)
58   AM_RANGE(0x6000, 0x7fff) AM_READWRITE(ti99_cart_r, ti99_cart_w)     /*cartridge memory*/
59//   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*/
6161   AM_RANGE(0x8400, 0x87ff) AM_READWRITE(ti99_nop_8_r, ti99_wsnd_w)   /*soundchip write*/
6262   AM_RANGE(0x8800, 0x8bff) AM_READWRITE(ti99_rvdp_r, ti99_nop_8_w)   /*vdp read*/
r8246r8247
7070
7171static ADDRESS_MAP_START(memmap_4ev, ADDRESS_SPACE_PROGRAM, 16)
7272   ADDRESS_MAP_GLOBAL_MASK(0xffff)
73   AM_RANGE(0x0000, 0x1fff) AM_ROM                              /*system ROM*/
73   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*/
7575   AM_RANGE(0x4000, 0x5fff) AM_READWRITE(ti99_4x_peb_r, ti99_4x_peb_w)   /*DSR ROM space*/
76   AM_RANGE(0x6000, 0x7fff) AM_DEVREADWRITE("ti99_multicart", ti99_multicart_r, ti99_multicart_w)
76   AM_RANGE(0x6000, 0x7fff) AM_READWRITE(ti99_cart_r, ti99_cart_w)     /*cartridge memory*/
77//   AM_RANGE(0x6000, 0x7fff) AM_DEVREADWRITE("ti99_multicart", ti99_multicart_r, ti99_multicart_w)
7778   AM_RANGE(0x8000, 0x80ff) AM_MIRROR(0x0300) AM_RAMBANK("bank1")         /*RAM PAD, mirrored 4 times*/
7879   AM_RANGE(0x8400, 0x87ff) AM_READWRITE(ti99_nop_8_r, ti99_wsnd_w)   /*soundchip write*/
7980   AM_RANGE(0x8800, 0x8bff) AM_READWRITE(ti99_rv38_r, ti99_nop_8_w)   /*vdp read*/
r8246r8247
132133   PORT_START( "HDCTRL" )
133134   PORT_CONFNAME( 0x03, 0x00, "HD controller" )
134135      PORT_CONFSETTING(    0x00, DEF_STR( None ) )
135      PORT_CONFSETTING(    0x01, "Nouspikel IDE Controller" )
136//      PORT_CONFSETTING(    0x01, "Nouspikel IDE Controller" )
136137//      PORT_CONFSETTING(    0x02, "WHTech SCSI Controller" )
137138   PORT_CONFNAME( 0x04, 0x00, "USB-SM card" )
138139      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
r8246r8247
143144      PORT_CONFSETTING(    0x00, DEF_STR( None ) )
144145      PORT_CONFSETTING(    0x01, "TI RS-232 card" )
145146
147   /* Flash setting is used to flash an empty HSGPL DSR ROM */
146148   PORT_START( "EXTCARD" )
147   PORT_CONFNAME( 0x01, 0x00, "HSGPL extension" )
149   PORT_CONFNAME( 0x03, 0x00, "HSGPL extension" ) PORT_CHANGED( hsgpl_changed, NULL)
148150      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
149      PORT_CONFSETTING(    0x01, DEF_STR( On ) )
150   PORT_CONFNAME( 0x02, 0x00, "P-Code card" )
151      PORT_CONFSETTING(    0x01, "Flash" )
152      PORT_CONFSETTING(    0x02, DEF_STR( On ) )
153   PORT_CONFNAME( 0x04, 0x00, "P-Code card" )
151154      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
152      PORT_CONFSETTING(    0x02, DEF_STR( On ) )
155      PORT_CONFSETTING(    0x04, DEF_STR( On ) )
153156
154157   PORT_START( "HCI" )
155158   PORT_CONFNAME( 0x01, 0x00, "Mouse support" )
r8246r8247
303306   PORT_START( "HDCTRL" )
304307   PORT_CONFNAME( 0x03, 0x00, "HD controller" )
305308      PORT_CONFSETTING(    0x00, DEF_STR( None ) )
306      PORT_CONFSETTING(    0x01, "Nouspikel IDE Controller" )
309//      PORT_CONFSETTING(    0x01, "Nouspikel IDE Controller" )
307310//      PORT_CONFSETTING(    0x02, "WHTech SCSI Controller" )
308311   PORT_CONFNAME( 0x08, 0x00, "USB-SM card" )
309312      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
r8246r8247
682685   MDRV_MACHINE_START( ti99_4_60hz )
683686   MDRV_MACHINE_RESET( ti99 )
684687
688   /* For HSGPL */
689   MDRV_NVRAM_HANDLER( ti99 )
690   
685691   /* video hardware */
686692   MDRV_IMPORT_FROM(tms9928a)
687693   MDRV_SCREEN_MODIFY("screen")
r8246r8247
702708   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
703709
704710   /* devices */
705   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   /* FIXME */
706   MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)
711/*   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )
712   MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)   */
707713
708714   MDRV_CASSETTE_ADD( "cassette1", default_cassette_config )
709715   MDRV_CASSETTE_ADD( "cassette2", default_cassette_config )
r8246r8247
738744   MDRV_MACHINE_START( ti99_4_50hz )
739745   MDRV_MACHINE_RESET( ti99 )
740746
747   /* For HSGPL */
748   MDRV_NVRAM_HANDLER( ti99 )
749   
741750   /* video hardware */
742751   MDRV_IMPORT_FROM(tms9928a)
743752   MDRV_SCREEN_MODIFY("screen")
r8246r8247
756765   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
757766
758767   /* devices */
759   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   /* FIXME */
760   MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)
768/*   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )
769   MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)  */
761770
762771   MDRV_CASSETTE_ADD( "cassette1", default_cassette_config )
763772   MDRV_CASSETTE_ADD( "cassette2", default_cassette_config )
r8246r8247
792801   MDRV_MACHINE_START( ti99_4a_60hz )
793802   MDRV_MACHINE_RESET( ti99 )
794803
804   /* For HSGPL */
805   MDRV_NVRAM_HANDLER( ti99 )
806   
795807   /* video hardware */
796808   MDRV_IMPORT_FROM(tms9928a)
797809   MDRV_SCREEN_MODIFY("screen")
r8246r8247
810822   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
811823
812824   /* devices */
813   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   /* FIXME */
814   MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)
825/*   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )
826   MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) */
815827
816828   MDRV_CASSETTE_ADD( "cassette1", default_cassette_config )
817829   MDRV_CASSETTE_ADD( "cassette2", default_cassette_config )
r8246r8247
848860   MDRV_MACHINE_START( ti99_4a_50hz )
849861   MDRV_MACHINE_RESET( ti99 )
850862
863   /* For HSGPL */
864   MDRV_NVRAM_HANDLER( ti99 )
865   
851866   /* video hardware */
852867   MDRV_IMPORT_FROM(tms9928a)
853868   MDRV_SCREEN_MODIFY("screen")
r8246r8247
866881   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
867882
868883   /* devices */
869   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )
870   MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)
884/*   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )
885   MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback) */
871886
872887   MDRV_CASSETTE_ADD( "cassette1", default_cassette_config )
873888   MDRV_CASSETTE_ADD( "cassette2", default_cassette_config )
r8246r8247
903918   MDRV_MACHINE_START( ti99_4ev_60hz )
904919   MDRV_MACHINE_RESET( ti99 )
905920
921   /* For HSGPL */
922   MDRV_NVRAM_HANDLER( ti99 )
923   
906924   /* video hardware */
907925   MDRV_SCREEN_ADD("screen", RASTER)
908926   MDRV_SCREEN_REFRESH_RATE(60)   /* or 50Hz */
r8246r8247
929947   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
930948
931949   /* devices */
932   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   /* FIXME */
933   MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)
950/*   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   
951   MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)  */
934952
935953   MDRV_CASSETTE_ADD( "cassette1", default_cassette_config )
936954   MDRV_CASSETTE_ADD( "cassette2", default_cassette_config )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team