Previous 15994 Revisions Next

r8283 Tuesday 15th June, 2010 at 22:47:56 UTC by Michael Zapf
Fixed problems with GROM address counters and lockups with HSGPL on
Reset
[src/mess/devices]ti99cart.c
[src/mess/machine]ti99_4x.c

src/mess/devices/ti99cart.c
r8282r8283
320320      // Handle the GRAM Kracker
321321      if ((cartslots->gk_slot != -1) && (input_port_read(device->machine, "CARTSLOT")==CART_GK))
322322         cartridge_gram_kracker_writeg(device,data);
323
324      cartslots->grom_address = ((cartslots->grom_address + 1) & 0x1FFF) | (cartslots->grom_address & 0xE000);
325
326      /* Reset the read and write address flipflops. */
327      cartslots->raddr_LSB = cartslots->waddr_LSB = FALSE;
323328   }
324329}
325330
r8282r8283
434439         //printf("Empty socket at address G(%d)>%04x\n", slot, cartslots->grom_address);
435440      }
436441   }
437   //          printf("GROM address (cart) = %04x, reply = %02x\n", cartslots->grom_address, value);
438442   /* The program counter wraps at each GROM chip size (8K), */
439443   /* so 0x5fff + 1 = 0x4000. */
440444   /* The address must be increased even if there is no cartridge slot */
r8282r8283
22172221      value =  (UINT8)cartslots->grom_buffer;
22182222      /* read ahead */
22192223      cartslots->grom_buffer = cartridge->grom_ptr[cartslots->grom_address-0x6000];
2220      //  printf("GROM address = %04x, reply = %02x\n", console_GROMs.addr, reply>>8);
22212224      // The program counter wraps at each GROM chip size (8K),
22222225      // so 0x5fff + 1 = 0x4000.
22232226      cartslots->grom_address = ((cartslots->grom_address + 1) & 0x1FFF) | (cartslots->grom_address & 0xE000);
r8282r8283
25502553            cartslots->cartridge[id].rom_ptr = cartrom;
25512554            cartslots->cartridge[id].rom_size = filesize;
25522555         }
2553         // printf("loaded ROM, size = %d\n", filesize);
25542556         break;
25552557
25562558      case SLOTC_MINIMEM:
r8282r8283
25702572            cartslots->cartridge[id].ram_ptr = (UINT16 *)cartrom +  0x800;
25712573         }
25722574         cartslots->cartridge[id].ram_size = 0x1000;
2573         // printf("loaded NVRAM\n");
25742575         break;
25752576
25762577      case SLOTC_MBX:
r8282r8283
26082609            cartslots->cartridge[id].rom2_ptr = cartrom2;
26092610         }
26102611         cartslots->cartridge[id].rom_size = filesize;
2611         // printf("loaded second ROM, size = %d\n", filesize);
26122612         break;
26132613   }
26142614   return INIT_PASS;
r8282r8283
27252725static DEVICE_START(ti99_multicart)
27262726{
27272727   int i;
2728//  printf("DEVICE_START(ti99_multicart)\n");
27292728   ti99_multicart_state *cartslots = (ti99_multicart_state *)device->token;
27302729
27312730   cartslots->active_slot = 0;
r8282r8283
28822881   {
28832882      if (!slot_is_empty(device, slot))
28842883      {
2885//          printf("writing to cartridge in slot %d\n", slot);
28862884         ti99_pcb_t *pcbdef = (ti99_pcb_t *)cart->pcb->token;
28872885         (*pcbdef->write)(cart->pcb, offset, data, mem_mask);
28882886      }
r8282r8283
30002998
30012999   if (!slot_is_empty(device, slot))
30023000   {
3003//      printf("accessing cartridge in slot %d\n", slot);
30043001      ti99_pcb_t *pcbdef = (ti99_pcb_t *)cart->pcb->token;
30053002      return (*pcbdef->read8)(cart->pcb, offset);
30063003   }
30073004   else
30083005   {
3009//      printf("No cartridge in slot %d\n", slot);
30103006      return 0;
30113007   }
30123008}
r8282r8283
31643160   if (get_gk_switch(4)!=GK_WP)
31653161   {
31663162      // Write protection off
3167      if (((cartslots->grom_address < 0x2000)
3163      if (((write_addr < 0x2000)
31683164            && (get_gk_switch(2)==GK_GRAM0))
3169         || ((cartslots->grom_address >= 0x2000) && (cartslots->grom_address < 0x4000)
3165         || ((write_addr >= 0x2000) && (write_addr < 0x4000)
31703166            && (get_gk_switch(3)==GK_GRAM12)
31713167            && (get_gk_switch(5)==GK_LDOFF))
3172         || ((cartslots->grom_address >= 0x4000) && (cartslots->grom_address < 0x6000)
3168         || ((write_addr >= 0x4000) && (write_addr < 0x6000)
31733169            && (get_gk_switch(3)==GK_GRAM12))
3174         || ((cartslots->grom_address >= 0x6000) && (cartslots->gk_guest_slot==-1)
3170         || ((write_addr >= 0x6000) && (cartslots->gk_guest_slot==-1)
31753171            && (get_gk_switch(1)==GK_NORMAL)))
31763172      {
31773173         ((UINT8 *)gkcartridge->ram_ptr)[write_addr] = data;
31783174      }
31793175      // There is no GRAM in cartridges
3180
31813176   }
3182   cartslots->grom_address = ((cartslots->grom_address + 1) & 0x1FFF) | (cartslots->grom_address & 0xE000);
3183
3184   /* Reset the read and write address flipflops. */
3185   cartslots->raddr_LSB = cartslots->waddr_LSB = FALSE;
31863177}
31873178
31883179/*
src/mess/machine/ti99_4x.c
r8282r8283
454454   /* Initialize all. Actually, at this point, we don't know */
455455   /* how the switches are set. Later we use the configuration switches */
456456   /* to determine which one to use. */
457   ti99_peb_init();
458457   ti99_floppy_controllers_init_all(machine);
459458   ti99_ide_init(machine);
460459   ti99_hsgpl_init(machine);
r8282r8283
475474   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
476475   /*console_GROMs.data_ptr = memory_region(machine, region_grom);*/
477476   console_GROMs.addr = 0;
477   console_GROMs.buf = 0;
478   console_GROMs.raddr_LSB = FALSE;
479   console_GROMs.waddr_LSB = FALSE;
478480
479481   if (ti99_model == model_99_8)
480482   {
r8282r8283
543545   has_pcode = input_port_read(machine, "EXTCARD") & EXT_PCODE;
544546
545547   /* Get the GK settings once */
546   gk_switch[1] = input_port_read(machine, "GKSWITCH1");
547   gk_switch[2] = input_port_read(machine, "GKSWITCH2");
548   gk_switch[3] = input_port_read(machine, "GKSWITCH3");
549   gk_switch[4] = input_port_read(machine, "GKSWITCH4");
550   gk_switch[5] = input_port_read(machine, "GKSWITCH5");
548   if (ti99_model != model_99_4p)
549   {
550      gk_switch[1] = input_port_read(machine, "GKSWITCH1");
551      gk_switch[2] = input_port_read(machine, "GKSWITCH2");
552      gk_switch[3] = input_port_read(machine, "GKSWITCH3");
553      gk_switch[4] = input_port_read(machine, "GKSWITCH4");
554      gk_switch[5] = input_port_read(machine, "GKSWITCH5");
555   }
551556
552   /* set up optional expansion hardware */
557   // Removes all card handlers
558   ti99_peb_init();
559
560   // set up optional expansion hardware
553561   ti99_peb_reset(ti99_model == model_99_4p, tms9901_set_int1, NULL);
554562
555563   if (ti99_model == model_99_8)
r8282r8283
673681   else
674682      filename = "hsgpl40.nv";
675683
676   if ((ti99_model == model_99_4p) || (input_port_read(machine, "EXTCARD") & (EXT_HSGPL_ON | EXT_HSGPL_FLASH)))
684   // We always try to read the HSGPL, even when the config switch is
685   // set to off. Otherwise, when the system is started without HSGPL
686   // and we later switch on the card and do a reset, the console locks
687   // up as it does not find any content. Likewise, we save the contents
688   // even when the card has been turned off during runtime.
689   if (read_or_write==0)
677690   {
678      if (read_or_write==0)
679      {
680         ti99_hsgpl_load_flashroms(machine, filename);
681      }
682      else
683      {
684         ti99_hsgpl_save_flashroms(machine, filename);
685      }
691      ti99_hsgpl_load_flashroms(machine, filename);
686692   }
693   else
694   {
695      ti99_hsgpl_save_flashroms(machine, filename);
696   }
687697}
688698
689699INPUT_CHANGED( hsgpl_changed )
r8282r8283
10441054      console_GROMs.buf = console_GROMs.data_ptr[console_GROMs.addr];
10451055   }
10461056
1047   // The address pointer in the cartridge system is updated by this call.
1057   // The address pointer in the cartridge system is updated by this call
10481058   replycart = ti99_cartridge_grom_r(cartslots, offset);
10491059
10501060   if (console_GROMs.addr >= 0x6000 || override_console)
r8282r8283
11411151         console_GROMs.raddr_LSB = TRUE;
11421152      }
11431153      /* GROM address values must be globally unique. */
1144      // FIXME: Parsec in slot 2 asserts here (bug in Parsec, but
1145      //     should never bring the emulation into trouble)
1146      //     last actions were invalid reads from 99fa
11471154      // FIXME: HSGPL asserts here when switched on during runtime
11481155      //     You should not do that, but again the emulation should
11491156      //     not assert either
r8282r8283
12551262      assert (replycart == reply);
12561263   }
12571264   else
1265   {
12581266      reply = GROM_dataread(space->machine, offset);
1259
1267   }
12601268   return reply;
12611269}
12621270
r8282r8283
12761284      {
12771285         console_GROMs.addr = (console_GROMs.addr & 0xFF00) | (data & 0xFF);
12781286
1279         GROM_dataread(space->machine, offset);
1287         GROM_dataread(space->machine, offset&0xfffc);
12801288         console_GROMs.waddr_LSB = FALSE;
12811289      }
12821290      else

Previous 15994 Revisions Next


© 1998-2018 The MESS Team