Previous 199869 Revisions Next

r32641 Saturday 11th October, 2014 at 04:00:14 UTC by Fabio Priuli
and a last bunch of generic cart slots. nw.
[src/mame/drivers]jaguar.c
[src/mess/drivers]megadriv.c microvsn.c n64.c ngp.c thomson.c
[src/mess/includes]thomson.h

trunk/src/mame/drivers/jaguar.c
r32640r32641
340340#include "sound/dac.h"
341341#include "includes/jaguar.h"
342342#include "emuopts.h"
343#include "imagedev/cartslot.h"
344343#include "imagedev/snapquik.h"
345344#include "sound/dac.h"
346345#include "machine/eepromser.h"
347346#include "sound/cdda.h"
348347#include "cdrom.h"
349348#include "imagedev/chd_cd.h"
349#include "bus/generic/slot.h"
350#include "bus/generic/carts.h"
350351
351352
352353#define COJAG_CLOCK         XTAL_52MHz
r32640r32641
18801881   MCFG_QUICKLOAD_ADD("quickload", jaguar_state, jaguar, "abs,bin,cof,jag,prg", 2)
18811882
18821883   /* cartridge */
1883   MCFG_CARTSLOT_ADD("cart")
1884   MCFG_CARTSLOT_EXTENSION_LIST("j64,rom")
1885   MCFG_CARTSLOT_INTERFACE("jaguar_cart")
1886   MCFG_CARTSLOT_LOAD(jaguar_state,jaguar_cart)
1884   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "jaguar_cart")
1885   MCFG_GENERIC_EXTENSIONS("j64,rom,bin")
1886   MCFG_GENERIC_LOAD(jaguar_state, jaguar_cart)
18871887
18881888   /* software lists */
18891889   MCFG_SOFTWARE_LIST_ADD("cart_list","jaguar")
r32640r32641
20452045{
20462046   /* Initialize for no cartridge present */
20472047   m_using_cart = false;
2048   memset( m_cart_base, 0, memshare("cart")->bytes() );
2048   memset(m_cart_base, 0, memshare("cart")->bytes());
20492049}
20502050
20512051DEVICE_IMAGE_LOAD_MEMBER( jaguar_state, jaguar_cart )
20522052{
2053   return cart_load(image);
2054}
2055
2056int jaguar_state::cart_load(device_image_interface &image)
2057{
20582053   UINT32 size, load_offset = 0;
20592054
20602055   if (image.software_entry() == NULL)
r32640r32641
20642059      /* .rom files load & run at 802000 */
20652060      if (!core_stricmp(image.filetype(), "rom"))
20662061      {
2067         load_offset = 0x2000;       // fix load address
2068         m_cart_base[0x101]=0x802000;    // fix exec address
2062         load_offset = 0x2000;             // fix load address
2063         m_cart_base[0x101] = 0x802000;    // fix exec address
20692064      }
20702065
20712066      /* Load cart into memory */
2072      image.fread( &memregion("maincpu")->base()[0x800000+load_offset], size);
2067      image.fread(&memregion("maincpu")->base()[0x800000 + load_offset], size);
20732068   }
20742069   else
20752070   {
r32640r32641
20842079
20852080   /* Skip the logo */
20862081   m_using_cart = true;
2087//  m_cart_base[0x102] = 1;
2082   //  m_cart_base[0x102] = 1;
20882083
20892084   /* Transfer control to the bios */
20902085   m_maincpu->set_pc(m_rom_base[1]);
r32640r32641
21062101ROM_START( jaguar )
21072102   ROM_REGION( 0x1000000, "maincpu", 0 )  /* 4MB for RAM at 0 */
21082103   ROM_LOAD16_WORD( "jagboot.rom", 0xe00000, 0x020000, CRC(fb731aaa) SHA1(f8991b0c385f4e5002fa2a7e2f5e61e8c5213356) )
2109   ROM_CART_LOAD("cart", 0x800000, 0x600000, ROM_NOMIRROR)
21102104
21112105   ROM_REGION16_BE( 0x1000, "waverom", 0 )
21122106   ROM_LOAD16_WORD("jagwave.rom", 0x0000, 0x1000, CRC(7a25ee5b) SHA1(58117e11fd6478c521fbd3fdbe157f39567552f0) )
r32640r32641
21152109ROM_START( jaguarcd )
21162110   ROM_REGION( 0x1000000, "maincpu", 0 )
21172111   ROM_LOAD16_WORD( "jagboot.rom", 0xe00000, 0x020000, CRC(fb731aaa) SHA1(f8991b0c385f4e5002fa2a7e2f5e61e8c5213356) )
2118   ROM_CART_LOAD("cart", 0x800000, 0x600000, ROM_NOMIRROR) // TODO: needs to be removed (CD BIOS runs in the cart space)
2112   // TODO: cart needs to be removed (CD BIOS runs in the cart space)
21192113
21202114   ROM_REGION(0x40000, "cdbios", 0 )
21212115   ROM_SYSTEM_BIOS( 0, "default", "Jaguar CD" )
trunk/src/mess/drivers/megadriv.c
r32640r32641
44#include "sound/sn76496.h"
55
66#include "imagedev/chd_cd.h"
7#include "imagedev/cartslot.h"
87
8#include "bus/generic/slot.h"
9#include "bus/generic/carts.h"
10
911#include "formats/imageutl.h"
1012
1113
r32640r32641
465467
466468/****************************************** 32X emulation ****************************************/
467469
468// FIXME: non-softlist loading should keep using ROM_CART_LOAD in the ROM definitions,
469// once we better integrate softlist with the old loading procedures
470470DEVICE_IMAGE_LOAD_MEMBER( md_cons_state, _32x_cart )
471471{
472472   UINT32 length;
r32640r32641
555555   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", (0.25)/2)
556556   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", (0.25)/2)
557557
558   MCFG_CARTSLOT_ADD("cart")
559   MCFG_CARTSLOT_EXTENSION_LIST("32x,bin")
560   MCFG_CARTSLOT_MANDATORY
561   MCFG_CARTSLOT_INTERFACE("_32x_cart")
562   MCFG_CARTSLOT_LOAD(md_cons_state, _32x_cart)
558   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "_32x_cart")
559   MCFG_GENERIC_EXTENSIONS("32x,bin")
560   MCFG_GENERIC_MANDATORY
561   MCFG_GENERIC_LOAD(md_cons_state, _32x_cart)
563562
564563   MCFG_SOFTWARE_LIST_ADD("cart_list","32x")
565564   MCFG_SOFTWARE_LIST_FILTER("cart_list","NTSC-U")
r32640r32641
597596   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", (0.25)/2)
598597   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", (0.25)/2)
599598
600   MCFG_CARTSLOT_ADD("cart")
601   MCFG_CARTSLOT_EXTENSION_LIST("32x,bin")
602   MCFG_CARTSLOT_MANDATORY
603   MCFG_CARTSLOT_INTERFACE("_32x_cart")
604   MCFG_CARTSLOT_LOAD(md_cons_state, _32x_cart)
599   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "_32x_cart")
600   MCFG_GENERIC_EXTENSIONS("32x,bin")
601   MCFG_GENERIC_MANDATORY
602   MCFG_GENERIC_LOAD(md_cons_state, _32x_cart)
605603
606604   MCFG_SOFTWARE_LIST_ADD("cart_list","32x")
607605   MCFG_SOFTWARE_LIST_FILTER("cart_list","NTSC-J")
r32640r32641
639637   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", (0.25)/2)
640638   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", (0.25)/2)
641639
642   MCFG_CARTSLOT_ADD("cart")
643   MCFG_CARTSLOT_EXTENSION_LIST("32x,bin")
644   MCFG_CARTSLOT_MANDATORY
645   MCFG_CARTSLOT_INTERFACE("_32x_cart")
646   MCFG_CARTSLOT_LOAD(md_cons_state, _32x_cart)
640   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "_32x_cart")
641   MCFG_GENERIC_EXTENSIONS("32x,bin")
642   MCFG_GENERIC_MANDATORY
643   MCFG_GENERIC_LOAD(md_cons_state, _32x_cart)
647644
648645   MCFG_SOFTWARE_LIST_ADD("cart_list","32x")
649646   MCFG_SOFTWARE_LIST_FILTER("cart_list","PAL")
r32640r32641
748745
749746   MCFG_MACHINE_START_OVERRIDE(md_cons_state, ms_megacd)
750747
751   MCFG_DEVICE_MODIFY("cart")
752   MCFG_CARTSLOT_NOT_MANDATORY
748   MCFG_DEVICE_REMOVE("cartslot")
749   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "_32x_cart")
750   MCFG_GENERIC_EXTENSIONS("32x,bin")
751   MCFG_GENERIC_LOAD(md_cons_state, _32x_cart)
753752
754753   //MCFG_QUANTUM_PERFECT_CPU("32x_master_sh2")
755754MACHINE_CONFIG_END
trunk/src/mess/drivers/microvsn.c
r32640r32641
1717#include "cpu/mcs48/mcs48.h"
1818#include "cpu/tms0980/tms0980.h"
1919#include "sound/dac.h"
20#include "imagedev/cartslot.h"
2120#include "rendlay.h"
2221
22#include "bus/generic/slot.h"
23#include "bus/generic/carts.h"
2324
25
2426#define LOG 0
2527
2628
r32640r32641
3133      : driver_device(mconfig, type, tag),
3234      m_dac( *this, "dac" ),
3335      m_i8021( *this, "maincpu1" ),
34      m_tms1100( *this, "maincpu2" ) { }
36      m_tms1100( *this, "maincpu2" ),
37      m_cart(*this, "cartslot")
38   { }
3539
3640   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3741
r32640r32641
4044   DECLARE_MACHINE_RESET(microvision);
4145
4246   void screen_vblank(screen_device &screen, bool state);
43   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( microvision_cart );
47   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( microvsn_cart );
4448
4549   // i8021 interface
4650   DECLARE_WRITE8_MEMBER(i8021_p0_write);
r32640r32641
8690   required_device<dac_device> m_dac;
8791   required_device<cpu_device> m_i8021;
8892   required_device<cpu_device> m_tms1100;
93   required_device<generic_slot_device> m_cart;
8994
9095   // Timers
9196   static const device_timer_id TIMER_PADDLE = 0;
r32640r32641
507512};
508513
509514
510DEVICE_IMAGE_LOAD_MEMBER(microvision_state,microvision_cart)
515DEVICE_IMAGE_LOAD_MEMBER(microvision_state, microvsn_cart)
511516{
512517   UINT8 *rom1 = memregion("maincpu1")->base();
513518   UINT8 *rom2 = memregion("maincpu2")->base();
514   UINT32 file_size;
519   UINT32 file_size = m_cart->common_get_size("rom");
515520   m_pla = 0;
516521
517   if (image.software_entry() == NULL)
518   {
519      file_size = image.length();
520   }
521   else
522   {
523      file_size = image.get_software_region_length("rom");
524   }
525
526522   if ( file_size != 1024 && file_size != 2048 )
527523   {
528524      image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid rom file size");
r32640r32641
532528   /* Read cartridge */
533529   if (image.software_entry() == NULL)
534530   {
535      if (image.fread( rom1, file_size) != file_size)
531      if (image.fread(rom1, file_size) != file_size)
536532      {
537533         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file");
538534         return IMAGE_INIT_FAIL;
r32640r32641
546542      // Get PLA type
547543      const char *pla = image.get_feature("pla");
548544
549      if ( pla )
550      {
545      if (pla)
551546         m_pla = 1;
552      }
553547
554      tms1xxx_cpu_device::set_output_pla( m_tms1100, m_pla ? microvision_output_pla_1 : microvision_output_pla_0 );
548      tms1xxx_cpu_device::set_output_pla(m_tms1100, m_pla ? microvision_output_pla_1 : microvision_output_pla_0);
555549
556550      // Set default setting for PCB type and RC type
557551      m_pcb_type = microvision_state::PCB_TYPE_UNKNOWN;
r32640r32641
560554      // Detect settings for PCB type
561555      const char *pcb = image.get_feature("pcb");
562556
563      if ( pcb != NULL )
557      if (pcb)
564558      {
565559         static const struct { const char *pcb_name; microvision_state::pcb_type pcbtype; } pcb_types[] =
566560            {
r32640r32641
570564               { "7924952D02", microvision_state::PCB_TYPE_7924952D02 }
571565            };
572566
573         for (int i = 0; i < ARRAY_LENGTH(pcb_types) && m_pcb_type == microvision_state::PCB_TYPE_UNKNOWN; i++ )
567         for (int i = 0; i < ARRAY_LENGTH(pcb_types) && m_pcb_type == microvision_state::PCB_TYPE_UNKNOWN; i++)
574568         {
575569            if (!core_stricmp(pcb, pcb_types[i].pcb_name))
576570            {
r32640r32641
582576      // Detect settings for RC types
583577      const char *rc = image.get_feature("rc");
584578
585      if ( rc != NULL )
579      if (rc)
586580      {
587581         static const struct { const char *rc_name; microvision_state::rc_type rctype; } rc_types[] =
588582            {
r32640r32641
591585               { "100pf/39.4K", microvision_state::RC_TYPE_100PF_39_4K }
592586            };
593587
594         for ( int i = 0; i < ARRAY_LENGTH(rc_types) && m_rc_type == microvision_state::RC_TYPE_UNKNOWN; i++ )
588         for (int i = 0; i < ARRAY_LENGTH(rc_types) && m_rc_type == microvision_state::RC_TYPE_UNKNOWN; i++)
595589         {
596590            if (!core_stricmp(rc, rc_types[i].rc_name))
597591            {
r32640r32641
602596   }
603597
604598   // Mirror rom data to maincpu2 region
605   memcpy( rom2, rom1, file_size );
599   memcpy(rom2, rom1, file_size);
606600
607601   // Based on file size select cpu:
608602   // - 1024 -> I8021
609603   // - 2048 -> TI TMS1100
610604
611   switch ( file_size )
605   switch (file_size)
612606   {
613607      case 1024:
614608         m_cpu_type = microvision_state::CPU_TYPE_I8021;
r32640r32641
689683   MCFG_SOUND_ADD("dac", DAC, 0)
690684   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
691685
692   MCFG_CARTSLOT_ADD("cart")
693   MCFG_CARTSLOT_EXTENSION_LIST("bin")
694   MCFG_CARTSLOT_MANDATORY
695   MCFG_CARTSLOT_INTERFACE("microvision_cart")
696   MCFG_CARTSLOT_LOAD(microvision_state,microvision_cart)
686   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "microvision_cart")
687   MCFG_GENERIC_MANDATORY
688   MCFG_GENERIC_LOAD(microvision_state, microvsn_cart)
697689
698690   /* Software lists */
699691   MCFG_SOFTWARE_LIST_ADD("cart_list","microvision")
trunk/src/mess/drivers/n64.c
r32640r32641
1313#include "cpu/rsp/rsp.h"
1414#include "cpu/mips/mips3.h"
1515#include "sound/dmadac.h"
16#include "imagedev/cartslot.h"
1716#include "includes/n64.h"
17#include "bus/generic/slot.h"
18#include "bus/generic/carts.h"
1819
1920class n64_mess_state : public n64_state
2021{
r32640r32641
185186
186187   if (image.software_entry() == NULL)
187188   {
188      length = image.fread( cart, 0x4000000);
189      length = image.fread(cart, 0x4000000);
189190   }
190191   else
191192   {
r32640r32641
315316   MCFG_N64_PERIPHS_ADD("rcp");
316317
317318   /* cartridge */
318   MCFG_CARTSLOT_ADD("cart")
319   MCFG_CARTSLOT_EXTENSION_LIST("v64,z64,rom,n64,bin")
320   MCFG_CARTSLOT_MANDATORY
321   MCFG_CARTSLOT_INTERFACE("n64_cart")
322   MCFG_CARTSLOT_LOAD(n64_mess_state,n64_cart)
319   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "n64_cart")
320   MCFG_GENERIC_EXTENSIONS("v64,z64,rom,n64,bin")
321   MCFG_GENERIC_MANDATORY
322   MCFG_GENERIC_LOAD(n64_mess_state, n64_cart)
323323
324324   /* software lists */
325325   MCFG_SOFTWARE_LIST_ADD("cart_list","n64")
r32640r32641
331331
332332   MCFG_MACHINE_START_OVERRIDE(n64_mess_state, n64dd)
333333
334   MCFG_CARTSLOT_MODIFY("cart")
335   MCFG_CARTSLOT_NOT_MANDATORY
334   MCFG_DEVICE_REMOVE("cartslot")
335   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "n64_cart")
336   MCFG_GENERIC_EXTENSIONS("v64,z64,rom,n64,bin")
337   MCFG_GENERIC_LOAD(n64_mess_state, n64_cart)
338
336339MACHINE_CONFIG_END
337340
338341ROM_START( n64 )
trunk/src/mess/drivers/thomson.c
r32640r32641
715715
716716
717717/* cartridge */
718   MCFG_CARTSLOT_ADD("cart")
719   MCFG_CARTSLOT_EXTENSION_LIST("m7,rom")
720   MCFG_CARTSLOT_NOT_MANDATORY
721   MCFG_CARTSLOT_LOAD(thomson_state,to7_cartridge)
722   MCFG_CARTSLOT_INTERFACE("to7_cart")
718   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "to7_cart")
719   MCFG_GENERIC_EXTENSIONS("m7,rom")
720   MCFG_GENERIC_LOAD(thomson_state, to7_cartridge)
721
723722   MCFG_SOFTWARE_LIST_ADD("cart_list","to7_cart")
724723
725724/* internal ram */
r32640r32641
906905   MCFG_DEVICE_MODIFY("mc6846")
907906   MCFG_MC6846_OUT_PORT_CB(WRITE8(thomson_state, to770_timer_port_out))
908907
909   MCFG_CARTSLOT_MODIFY("cart")
910   MCFG_CARTSLOT_INTERFACE("to770_cart")
908   MCFG_DEVICE_REMOVE("cartslot")
909   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "to770_cart")
910   MCFG_GENERIC_EXTENSIONS("m7,rom")
911   MCFG_GENERIC_LOAD(thomson_state, to7_cartridge)
912
911913   MCFG_DEVICE_REMOVE("cart_list")
912914   MCFG_SOFTWARE_LIST_ADD("cart_list","to770_cart")
913915
r32640r32641
11031105   MCFG_PIA_CB2_HANDLER(NULL)
11041106   MCFG_PIA_IRQB_HANDLER(WRITELINE(thomson_state, thom_irq_1)) /* WARNING: differs from TO7 ! */
11051107
1106   MCFG_CARTSLOT_MODIFY("cart")
1107   MCFG_CARTSLOT_EXTENSION_LIST("m5,rom")
1108   MCFG_CARTSLOT_LOAD(thomson_state,mo5_cartridge)
1109   MCFG_CARTSLOT_INTERFACE("mo5_cart")
1108   MCFG_DEVICE_REMOVE("cartslot")
1109   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "mo5_cart")
1110   MCFG_GENERIC_EXTENSIONS("m5,rom")
1111   MCFG_GENERIC_LOAD(thomson_state, mo5_cartridge)
11101112
11111113   MCFG_DEVICE_REMOVE("cart_list")
11121114   MCFG_SOFTWARE_LIST_ADD("cart_list","mo5_cart")
r32640r32641
21792181
21802182   MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
21812183
2182   MCFG_CARTSLOT_MODIFY("cart")
2183   MCFG_CARTSLOT_EXTENSION_LIST("m5,rom")
2184   MCFG_CARTSLOT_LOAD(thomson_state, mo5_cartridge)
2184   MCFG_DEVICE_REMOVE("cartslot")
2185   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "mo5_cart")
2186   MCFG_GENERIC_EXTENSIONS("m5,rom")
2187   MCFG_GENERIC_LOAD(thomson_state, mo5_cartridge)
21852188
21862189   /* internal ram */
21872190   MCFG_RAM_MODIFY(RAM_TAG)
r32640r32641
24202423   MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0)
24212424   MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics")
24222425
2423   MCFG_CARTSLOT_MODIFY("cart")
2424   MCFG_CARTSLOT_EXTENSION_LIST("m5,rom")
2425   MCFG_CARTSLOT_LOAD(thomson_state, mo5_cartridge)
2426   MCFG_DEVICE_REMOVE("cartslot")
2427   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "mo5_cart")
2428   MCFG_GENERIC_EXTENSIONS("m5,rom")
2429   MCFG_GENERIC_LOAD(thomson_state, mo5_cartridge)
24262430
24272431   /* internal ram */
24282432   MCFG_RAM_MODIFY(RAM_TAG)
trunk/src/mess/drivers/ngp.c
r32640r32641
9898#include "emu.h"
9999#include "cpu/tlcs900/tlcs900.h"
100100#include "cpu/z80/z80.h"
101#include "imagedev/cartslot.h"
102101#include "sound/t6w28.h"
103102#include "sound/dac.h"
104103#include "video/k1ge.h"
105104#include "rendlay.h"
106105
106#include "bus/generic/slot.h"
107#include "bus/generic/carts.h"
108
107109enum flash_state
108110{
109111   F_READ,                     /* xxxx F0 or 5555 AA 2AAA 55 5555 F0 */
r32640r32641
124126   ngp_state(const machine_config &mconfig, device_type type, const char *tag)
125127      : driver_device(mconfig, type, tag),
126128      device_nvram_interface(mconfig, *this),
127      m_tlcs900( *this, "maincpu" ),
128      m_z80( *this, "soundcpu" ),
129      m_t6w28( *this, "t6w28" ),
130      m_dac_l( *this, "dac_l" ),
131      m_dac_r( *this, "dac_r" ),
132      m_mainram( *this, "mainram" ),
133      m_k1ge( *this, "k1ge" ),
134      m_io_controls( *this, "Controls" ),
135      m_io_power( *this, "Power" ) ,
136      m_maincpu(*this, "maincpu") {
129      m_tlcs900(*this, "maincpu"),
130      m_z80(*this, "soundcpu"),
131      m_t6w28(*this, "t6w28"),
132      m_dac_l(*this, "dac_l"),
133      m_dac_r(*this, "dac_r"),
134      m_cart(*this, "cartslot"),
135      m_mainram(*this, "mainram"),
136      m_k1ge(*this, "k1ge"),
137      m_io_controls(*this, "Controls"),
138      m_io_power(*this, "Power") ,
139      m_maincpu(*this, "maincpu")
140      {
137141         m_flash_chip[0].present = 0;
138142         m_flash_chip[0].state = F_READ;
139143         m_flash_chip[0].data = NULL;
r32640r32641
167171   required_device<t6w28_device> m_t6w28;
168172   required_device<dac_device> m_dac_l;
169173   required_device<dac_device> m_dac_r;
174   required_device<generic_slot_device> m_cart;
170175   required_shared_ptr<UINT8> m_mainram;
171176   required_device<k1ge_device> m_k1ge;
172177
r32640r32641
542547   AM_RANGE( 0x004000, 0x006fff )  AM_RAM AM_SHARE("mainram")                              /* work ram */
543548   AM_RANGE( 0x007000, 0x007fff )  AM_RAM AM_SHARE("share1")                               /* shared with sound cpu */
544549   AM_RANGE( 0x008000, 0x00bfff )  AM_DEVREADWRITE("k1ge", k1ge_device, read, write)       /* video chip */
545   AM_RANGE( 0x200000, 0x3fffff )  AM_ROM AM_WRITE(flash0_w) AM_REGION("cart", 0)          /* cart area #1 */
546   AM_RANGE( 0x800000, 0x9fffff )  AM_ROM AM_WRITE(flash1_w) AM_REGION("cart", 0x200000)   /* cart area #2 */
550   AM_RANGE( 0x200000, 0x3fffff )  AM_WRITE(flash0_w)   /* cart area #1 */
551   AM_RANGE( 0x800000, 0x9fffff )  AM_WRITE(flash1_w)   /* cart area #2 */
547552   AM_RANGE( 0xff0000, 0xffffff )  AM_ROM AM_REGION("maincpu", 0)                          /* system rom */
548553ADDRESS_MAP_END
549554
r32640r32641
637642
638643void ngp_state::machine_start()
639644{
640   UINT8 *cart = memregion("cart")->base();
645   if (m_cart->exists())
646   {
647      astring region_tag;
648      UINT8 *cart = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG))->base();
641649
642   m_flash_chip[0].data = cart;
643   m_flash_chip[0].org_data[0] = m_flash_chip[0].data[0];
644   m_flash_chip[0].org_data[1] = m_flash_chip[0].data[1];
645   m_flash_chip[0].org_data[2] = m_flash_chip[0].data[2];
646   m_flash_chip[0].org_data[3] = m_flash_chip[0].data[3];
647   m_flash_chip[0].org_data[4] = m_flash_chip[0].data[0x7c000];
648   m_flash_chip[0].org_data[5] = m_flash_chip[0].data[0x7c001];
649   m_flash_chip[0].org_data[6] = m_flash_chip[0].data[0x7c002];
650   m_flash_chip[0].org_data[7] = m_flash_chip[0].data[0x7c003];
651   m_flash_chip[0].org_data[8] = m_flash_chip[0].data[0xfc000];
652   m_flash_chip[0].org_data[9] = m_flash_chip[0].data[0xfc001];
653   m_flash_chip[0].org_data[10] = m_flash_chip[0].data[0xfc002];
654   m_flash_chip[0].org_data[11] = m_flash_chip[0].data[0xfc003];
655   m_flash_chip[0].org_data[12] = m_flash_chip[0].data[0x1fc000];
656   m_flash_chip[0].org_data[13] = m_flash_chip[0].data[0x1fc001];
657   m_flash_chip[0].org_data[14] = m_flash_chip[0].data[0x1fc002];
658   m_flash_chip[0].org_data[15] = m_flash_chip[0].data[0x1fc003];
650      m_maincpu->space(AS_PROGRAM).install_read_bank(0x200000, 0x3fffff, "flash0");
651      m_maincpu->space(AS_PROGRAM).install_read_bank(0x800000, 0x9fffff, "flash1");
652      membank("flash0")->set_base(cart);
653      membank("flash1")->set_base(cart + 0x200000);
654     
655      m_flash_chip[0].data = cart;
656      m_flash_chip[0].org_data[0] = m_flash_chip[0].data[0];
657      m_flash_chip[0].org_data[1] = m_flash_chip[0].data[1];
658      m_flash_chip[0].org_data[2] = m_flash_chip[0].data[2];
659      m_flash_chip[0].org_data[3] = m_flash_chip[0].data[3];
660      m_flash_chip[0].org_data[4] = m_flash_chip[0].data[0x7c000];
661      m_flash_chip[0].org_data[5] = m_flash_chip[0].data[0x7c001];
662      m_flash_chip[0].org_data[6] = m_flash_chip[0].data[0x7c002];
663      m_flash_chip[0].org_data[7] = m_flash_chip[0].data[0x7c003];
664      m_flash_chip[0].org_data[8] = m_flash_chip[0].data[0xfc000];
665      m_flash_chip[0].org_data[9] = m_flash_chip[0].data[0xfc001];
666      m_flash_chip[0].org_data[10] = m_flash_chip[0].data[0xfc002];
667      m_flash_chip[0].org_data[11] = m_flash_chip[0].data[0xfc003];
668      m_flash_chip[0].org_data[12] = m_flash_chip[0].data[0x1fc000];
669      m_flash_chip[0].org_data[13] = m_flash_chip[0].data[0x1fc001];
670      m_flash_chip[0].org_data[14] = m_flash_chip[0].data[0x1fc002];
671      m_flash_chip[0].org_data[15] = m_flash_chip[0].data[0x1fc003];
672     
673      m_flash_chip[1].data = cart + 0x200000;
674      m_flash_chip[1].org_data[0] = m_flash_chip[1].data[0];
675      m_flash_chip[1].org_data[1] = m_flash_chip[1].data[1];
676      m_flash_chip[1].org_data[2] = m_flash_chip[1].data[2];
677      m_flash_chip[1].org_data[3] = m_flash_chip[1].data[3];
678      m_flash_chip[1].org_data[4] = m_flash_chip[1].data[0x7c000];
679      m_flash_chip[1].org_data[5] = m_flash_chip[1].data[0x7c001];
680      m_flash_chip[1].org_data[6] = m_flash_chip[1].data[0x7c002];
681      m_flash_chip[1].org_data[7] = m_flash_chip[1].data[0x7c003];
682      m_flash_chip[1].org_data[8] = m_flash_chip[1].data[0xfc000];
683      m_flash_chip[1].org_data[9] = m_flash_chip[1].data[0xfc001];
684      m_flash_chip[1].org_data[10] = m_flash_chip[1].data[0xfc002];
685      m_flash_chip[1].org_data[11] = m_flash_chip[1].data[0xfc003];
686      m_flash_chip[1].org_data[12] = m_flash_chip[1].data[0x1fc000];
687      m_flash_chip[1].org_data[13] = m_flash_chip[1].data[0x1fc001];
688      m_flash_chip[1].org_data[14] = m_flash_chip[1].data[0x1fc002];
689      m_flash_chip[1].org_data[15] = m_flash_chip[1].data[0x1fc003];
690   }
691   else
692   {
693      m_maincpu->space(AS_PROGRAM).unmap_read(0x200000, 0x3fffff);
694      m_maincpu->space(AS_PROGRAM).unmap_read(0x800000, 0x9fffff);
695   }
659696
660   m_flash_chip[1].data = cart + 0x200000;
661   m_flash_chip[1].org_data[0] = m_flash_chip[1].data[0];
662   m_flash_chip[1].org_data[1] = m_flash_chip[1].data[1];
663   m_flash_chip[1].org_data[2] = m_flash_chip[1].data[2];
664   m_flash_chip[1].org_data[3] = m_flash_chip[1].data[3];
665   m_flash_chip[1].org_data[4] = m_flash_chip[1].data[0x7c000];
666   m_flash_chip[1].org_data[5] = m_flash_chip[1].data[0x7c001];
667   m_flash_chip[1].org_data[6] = m_flash_chip[1].data[0x7c002];
668   m_flash_chip[1].org_data[7] = m_flash_chip[1].data[0x7c003];
669   m_flash_chip[1].org_data[8] = m_flash_chip[1].data[0xfc000];
670   m_flash_chip[1].org_data[9] = m_flash_chip[1].data[0xfc001];
671   m_flash_chip[1].org_data[10] = m_flash_chip[1].data[0xfc002];
672   m_flash_chip[1].org_data[11] = m_flash_chip[1].data[0xfc003];
673   m_flash_chip[1].org_data[12] = m_flash_chip[1].data[0x1fc000];
674   m_flash_chip[1].org_data[13] = m_flash_chip[1].data[0x1fc001];
675   m_flash_chip[1].org_data[14] = m_flash_chip[1].data[0x1fc002];
676   m_flash_chip[1].org_data[15] = m_flash_chip[1].data[0x1fc003];
677
678697   m_seconds_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ngp_state::ngp_seconds_callback),this));
679698   m_seconds_timer->adjust( attotime::from_seconds(1), 0, attotime::from_seconds(1) );
680699
r32640r32641
719738
720739DEVICE_IMAGE_LOAD_MEMBER( ngp_state, ngp_cart )
721740{
722   UINT8 *cart = memregion("cart")->base();
723   UINT32 filesize;
724
725   if (image.software_entry() == NULL)
741   UINT32 size = m_cart->common_get_size("rom");
742   
743   if (size != 0x8000 && size != 0x80000 && size != 0x100000 && size != 0x200000 && size != 0x400000)
726744   {
727      filesize = image.length();
728
729      if (filesize != 0x8000 && filesize != 0x80000 && filesize != 0x100000 && filesize != 0x200000 && filesize != 0x400000)
730      {
731         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Incorrect or not support cartridge size");
732         return IMAGE_INIT_FAIL;
733      }
734
735      if (image.fread( cart, filesize) != filesize)
736      {
737         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Error loading file");
738         return IMAGE_INIT_FAIL;
739      }
745      image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
746      return IMAGE_INIT_FAIL;
740747   }
741   else
742   {
743      filesize = image.get_software_region_length("rom");
744      memcpy(cart, image.get_software_region("rom"), filesize);
745   }
746
748   
749   // alloc 0x400000 ROM to simplify mapping in the address map
750   m_cart->rom_alloc(0x400000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
751   m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");         
752   
747753   //printf("%2x%2x - %x - %x\n", (unsigned int) memregion("cart")->u8(0x20), (unsigned int) memregion("cart")->u8(0x21),
748754   //        (unsigned int) memregion("cart")->u8(0x22), (unsigned int) memregion("cart")->u8(0x23));
749755   m_flash_chip[0].manufacturer_id = 0x98;
750   switch( filesize )
756   m_flash_chip[0].present = 1;
757   m_flash_chip[0].state = F_READ;
758
759   switch (size)
751760   {
752761   case 0x8000:
753762   case 0x80000:
r32640r32641
757766      m_flash_chip[0].device_id = 0x2c;
758767      break;
759768   case 0x200000:
769   case 0x400000:
760770      m_flash_chip[0].device_id = 0x2f;
761771      break;
762   case 0x400000:
763      m_flash_chip[0].device_id = 0x2f;
772   }
773
774   if (size == 0x400000)
775   {
764776      m_flash_chip[1].manufacturer_id = 0x98;
765777      m_flash_chip[1].device_id = 0x2f;
766      m_flash_chip[1].present = 0;
778      m_flash_chip[1].present = 1;
767779      m_flash_chip[1].state = F_READ;
768      break;
769780   }
770781
771   m_flash_chip[0].present = 1;
772   m_flash_chip[0].state = F_READ;
773
774782   return IMAGE_INIT_PASS;
775783}
776784
r32640r32641
841849   MCFG_SCREEN_MODIFY("screen")
842850   MCFG_SCREEN_PALETTE("k1ge:palette")
843851
844   MCFG_CARTSLOT_ADD("cart")
845   MCFG_CARTSLOT_EXTENSION_LIST("bin,ngp,npc,ngc")
846   MCFG_CARTSLOT_NOT_MANDATORY
847   MCFG_CARTSLOT_LOAD(ngp_state, ngp_cart)
848   MCFG_CARTSLOT_INTERFACE("ngp_cart")
849   MCFG_CARTSLOT_UNLOAD(ngp_state, ngp_cart)
852   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "ngp_cart")
853   MCFG_GENERIC_EXTENSIONS("bin,ngp,npc,ngc")
854   MCFG_GENERIC_LOAD(ngp_state, ngp_cart)
855   MCFG_GENERIC_UNLOAD(ngp_state, ngp_cart)
850856
851857   /* software lists */
852858   MCFG_SOFTWARE_LIST_ADD("cart_list","ngp")
r32640r32641
860866   MCFG_SCREEN_MODIFY("screen")
861867   MCFG_SCREEN_PALETTE("k1ge:palette")
862868
863   MCFG_CARTSLOT_ADD("cart")
864   MCFG_CARTSLOT_EXTENSION_LIST("bin,ngp,npc,ngc")
865   MCFG_CARTSLOT_NOT_MANDATORY
866   MCFG_CARTSLOT_LOAD(ngp_state,ngp_cart)
867   MCFG_CARTSLOT_INTERFACE("ngp_cart")
868   MCFG_CARTSLOT_UNLOAD(ngp_state,ngp_cart)
869   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "ngp_cart")
870   MCFG_GENERIC_EXTENSIONS("bin,ngp,npc,ngc")
871   MCFG_GENERIC_LOAD(ngp_state, ngp_cart)
872   MCFG_GENERIC_UNLOAD(ngp_state, ngp_cart)
869873
870874   /* software lists */
871875   MCFG_SOFTWARE_LIST_ADD("cart_list","ngpc")
r32640r32641
876880ROM_START( ngp )
877881   ROM_REGION( 0x10000, "maincpu" , 0 )
878882   ROM_LOAD( "ngp_bios.ngp", 0x0000, 0x10000, CRC(6232df8d) SHA1(2f6429b68446536d8b03f35d02f1e98beb6460a0) )
879
880   ROM_REGION( 0x400000, "cart", ROMREGION_ERASEFF )
881883ROM_END
882884
883885
884886ROM_START( ngpc )
885887   ROM_REGION( 0x10000, "maincpu", 0 )
886888   ROM_LOAD( "ngpcbios.rom", 0x0000, 0x10000, CRC(6eeb6f40) SHA1(edc13192054a59be49c6d55f83b70e2510968e86) )
887
888   ROM_REGION( 0x400000, "cart", ROMREGION_ERASEFF )
889889ROM_END
890890
891891
trunk/src/mess/includes/thomson.h
r32640r32641
1919#include "sound/dac.h"
2020#include "audio/mea8000.h"
2121#include "bus/centronics/ctronics.h"
22#include "imagedev/cartslot.h"
2322#include "imagedev/cassette.h"
2423#include "machine/mc6843.h"
2524#include "machine/mc6846.h"
r32640r32641
2928#include "machine/thomflop.h"
3029#include "machine/ram.h"
3130
31#include "bus/generic/slot.h"
32#include "bus/generic/carts.h"
3233
34
3335/* 6821 PIAs */
3436#define THOM_PIA_SYS    "pia_0"  /* system PIA */
3537#define THOM_PIA_GAME   "pia_1"  /* music & game PIA (joypad + sound) */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team