Previous 15994 Revisions Next

r6066 Wednesday 14th October, 2009 at 01:39:29 UTC by Barry Rodewald
[X680x0] Fixed bus error hack for the X68030, added internal SCSI ROM area to trigger a bus error. Added RAM mirror to get Human68k 3.02 to boot on the X68030.
[src/mess/drivers]x68k.c

src/mess/drivers/x68k.c
r6065r6066
15231523static READ32_HANDLER( x68k_sram32_r )
15241524{
15251525   if(offset == 0x08/4)
1526      return mess_ram_size >> 16;  // RAM size
1526      return (mess_ram_size & 0xffff0000);  // RAM size
15271527   /*if(offset == 0x46/2)
15281528        return 0x0024;
15291529    if(offset == 0x6e/2)
r6065r6066
16391639static TIMER_CALLBACK(x68k_fake_bus_error)
16401640{
16411641   int val = param;
1642   int v;
1643   
1644   if(strcmp(machine->gamedrv->name,"x68030") == 0)
1645      v = 0x0b;
1646   else
1647      v = 0x09;
16421648
16431649   // rather hacky, but this generally works for programs that check for MIDI hardware
1644   if(mess_ram[0x09] != 0x02)  // normal vector for bus errors points to 02FF0540
1650   if(mess_ram[v] != 0x02)  // normal vector for bus errors points to 02FF0540
16451651   {
16461652      int addr = (mess_ram[0x09] << 24) | (mess_ram[0x08] << 16) |(mess_ram[0x0b] << 8) | mess_ram[0x0a];
16471653      int sp = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), REG_GENSP);
16481654      int pc = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), REG_GENPC);
16491655      int sr = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), M68K_SR);
16501656      //int pda = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), M68K_PREF_DATA);
1657      if(strcmp(machine->gamedrv->name,"x68030") == 0)
1658      {  // byte order varies on the 68030
1659         addr = (mess_ram[0x0b] << 24) | (mess_ram[0x0a] << 16) |(mess_ram[0x09] << 8) | mess_ram[0x08];
1660      }
16511661      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), REG_GENSP, sp - 14);
16521662      mess_ram[sp-11] = (val & 0xff000000) >> 24;
16531663      mess_ram[sp-12] = (val & 0x00ff0000) >> 16;
r6065r6066
18821892//  AM_RANGE(0xed0000, 0xed3fff) AM_READWRITE(sram_r, sram_w) AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size)
18831893   AM_RANGE(0xed0000, 0xed3fff) AM_RAMBANK(4) AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size)
18841894   AM_RANGE(0xed4000, 0xefffff) AM_NOP
1885   AM_RANGE(0xf00000, 0xffffff) AM_ROM
1895   AM_RANGE(0xf00000, 0xfbffff) AM_ROM
1896   AM_RANGE(0xfc0000, 0xfdffff) AM_READWRITE(x68k_rom0_r, x68k_rom0_w)
1897   AM_RANGE(0xfe0000, 0xffffff) AM_ROM
18861898ADDRESS_MAP_END
18871899
18881900static ADDRESS_MAP_START(x68030_map, ADDRESS_SPACE_PROGRAM, 32)
r6065r6066
19151927//  AM_RANGE(0xed0000, 0xed3fff) AM_READWRITE(sram_r, sram_w) AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size)
19161928   AM_RANGE(0xed0000, 0xed3fff) AM_RAMBANK(4) AM_BASE(&generic_nvram32) AM_SIZE(&generic_nvram_size)
19171929   AM_RANGE(0xed4000, 0xefffff) AM_NOP
1918   AM_RANGE(0xf00000, 0xffffff) AM_ROM
1930   AM_RANGE(0xf00000, 0xfbffff) AM_ROM
1931   AM_RANGE(0xfc0000, 0xfdffff) AM_READWRITE16(x68k_rom0_r, x68k_rom0_w,0xffffffff)
1932   AM_RANGE(0xfe0000, 0xffffff) AM_ROM
19191933ADDRESS_MAP_END
19201934
19211935static WRITE8_DEVICE_HANDLER( mfp_tdo_w )
r6065r6066
24532467   x68k_spriteram = (UINT16*)memory_region(machine, "user1");
24542468   memory_install_read32_handler(space,0x000000,mess_ram_size-1,mess_ram_size-1,0,(read32_space_func)1);
24552469   memory_install_write32_handler(space,0x000000,mess_ram_size-1,mess_ram_size-1,0,(write32_space_func)1);
2470   // mirror? Human68k 3.02 explicitly adds 0x3000000 to some pointers
2471   memory_install_read32_handler(space,0x3000000,0x3000000+mess_ram_size-1,mess_ram_size-1,0,(read32_space_func)1);
2472   memory_install_write32_handler(space,0x3000000,0x3000000+mess_ram_size-1,mess_ram_size-1,0,(write32_space_func)1);
24562473   memory_set_bankptr(machine, 1,mess_ram);
24572474   memory_install_read32_handler(space,0xc00000,0xdfffff,0x3fffff,0,x68k_gvram32_r);
24582475   memory_install_write32_handler(space,0xc00000,0xdfffff,0x3fffff,0,x68k_gvram32_w);
r6065r6066
24622479   memory_set_bankptr(machine, 3,x68k_tvram);  // so that code in VRAM is executable - needed for Terra Cresta
24632480   memory_install_read32_handler(space,0xed0000,0xed3fff,0x003fff,0,x68k_sram32_r);
24642481   memory_install_write32_handler(space,0xed0000,0xed3fff,0x003fff,0,x68k_sram32_w);
2465   memory_set_bankptr(machine, 4,generic_nvram16);  // so that code in SRAM is executable, there is an option for booting from SRAM
2482   memory_set_bankptr(machine, 4,generic_nvram32);  // so that code in SRAM is executable, there is an option for booting from SRAM
24662483
24672484   // start keyboard timer
24682485   timer_adjust_periodic(kb_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(5));  // every 5ms
r6065r6066
26432660   ROM_REGION(0x20000, "user2", 0)
26442661   ROM_FILL(0x000,0x20000,0x00)
26452662   ROM_REGION(0x8000, "scsi", 0)
2646   ROM_LOAD("scsiindat.rom",0x000000, 0x008000, NO_DUMP )
2663   ROM_LOAD("scsiinrom.dat",0x000000, 0x008000, NO_DUMP )
26472664ROM_END
26482665
26492666ROM_START( x68030 )
r6065r6066
26632680   ROM_REGION(0x20000, "user2", 0)
26642681   ROM_FILL(0x000,0x20000,0x00)
26652682   ROM_REGION(0x8000, "scsi", 0)
2666   ROM_LOAD("scsiindat.rom",0x000000, 0x008000, NO_DUMP )
2683   ROM_LOAD("scsiinrom.dat",0x000000, 0x008000, NO_DUMP )
26672684ROM_END
26682685
26692686

Previous 15994 Revisions Next


© 1998-2018 The MESS Team