Previous 199869 Revisions Next

r32431 Saturday 27th September, 2014 at 08:45:17 UTC by Fabio Priuli
(MESS) misc generic cartslot conversions. while at it, I have added
experimental eprom writing to the beta.c driver (pending more accurate
tests). nw.
[src/mess/drivers]beta.c gamecom.c pc6001.c pc8401a.c socrates.c
[src/mess/includes]beta.h gamecom.h pc8401a.h
[src/mess/machine]gamecom.c

trunk/src/mess/machine/gamecom.c
r32430r32431
1616void gamecom_state::machine_reset()
1717{
1818   UINT8 *rom = m_region_kernel->base();
19   m_bank1->set_base( rom );
20   m_bank2->set_base( rom );
21   m_bank3->set_base( rom );
22   m_bank4->set_base( rom );
19   m_bank1->set_base(rom);
20   m_bank2->set_base(rom);
21   m_bank3->set_base(rom);
22   m_bank4->set_base(rom);
2323
24   m_cartridge = NULL;
24   m_cart_ptr = NULL;
2525   m_lch_reg = 0x07;
2626   m_lcv_reg = 0x27;
2727   m_lcdc_reg = 0xb0;
28
29   astring region_tag;
30   m_cart1_rom = memregion(region_tag.cpy(m_cart1->tag()).cat(GENERIC_ROM_REGION_TAG));
31   m_cart2_rom = memregion(region_tag.cpy(m_cart2->tag()).cat(GENERIC_ROM_REGION_TAG));
2832}
2933
30void gamecom_state::gamecom_set_mmu(UINT8 mmu, UINT8 data )
34void gamecom_state::gamecom_set_mmu(UINT8 mmu, UINT8 data)
3135{
3236   if (data < 0x20)
3337   {
3438      /* select internal ROM bank */
35      switch ( mmu )
39      switch (mmu)
3640      {
37         case 1: m_bank1->set_base( m_region_kernel->base() + (data << 13) ); break;
38         case 2: m_bank2->set_base( m_region_kernel->base() + (data << 13) ); break;
39         case 3: m_bank3->set_base( m_region_kernel->base() + (data << 13) ); break;
40         case 4: m_bank4->set_base( m_region_kernel->base() + (data << 13) ); break;
41         case 1: m_bank1->set_base(m_region_kernel->base() + (data << 13)); break;
42         case 2: m_bank2->set_base(m_region_kernel->base() + (data << 13)); break;
43         case 3: m_bank3->set_base(m_region_kernel->base() + (data << 13)); break;
44         case 4: m_bank4->set_base(m_region_kernel->base() + (data << 13)); break;
4145      }
4246   }
4347   else
4448   {
4549      /* select cartridge bank */
46      if ( m_cartridge )
50      if (m_cart_ptr)
4751      {
48         switch ( mmu )
52         switch (mmu)
4953         {
50            case 1: m_bank1->set_base( m_cartridge + ( data << 13 ) ); break;
51            case 2: m_bank2->set_base( m_cartridge + ( data << 13 ) ); break;
52            case 3: m_bank3->set_base( m_cartridge + ( data << 13 ) ); break;
53            case 4: m_bank4->set_base( m_cartridge + ( data << 13 ) ); break;
54            case 1: m_bank1->set_base(m_cart_ptr + (data << 13)); break;
55            case 2: m_bank2->set_base(m_cart_ptr + (data << 13)); break;
56            case 3: m_bank3->set_base(m_cart_ptr + (data << 13)); break;
57            case 4: m_bank4->set_base(m_cart_ptr + (data << 13)); break;
5458         }
5559      }
5660   }
r32430r32431
175179{
176180   offset += 0x14;
177181   m_p_ram[offset] = data;
178   switch( offset )
182   switch (offset)
179183   {
180184      case SM8521_P1:
181185      case SM8521_P2:
r32430r32431
184188      case SM8521_P3:
185189            /* P3 bit7 clear, bit6 set -> enable cartridge port #0? */
186190            /* P3 bit6 clear, bit7 set -> enable cartridge port #1? */
187            switch( data & 0xc0 )
191            switch (data & 0xc0)
188192            {
189            case 0x40: m_cartridge = m_cartridge1; break;
190            case 0x80: m_cartridge = m_cartridge2; break;
191            default:   m_cartridge = NULL;       break;
193            case 0x40: m_cart_ptr = m_cart1_rom->base(); break;
194            case 0x80: m_cart_ptr = m_cart2_rom->base(); break;
195            default:   m_cart_ptr = NULL;       break;
192196            }
193197            return;
194198   }
r32430r32431
481485//      logerror( "DMA DMBR = %X\n", RAM[SM8521_DMBR] );
482486      m_dma.source_width = 64;
483487      m_dma.source_mask = 0x3FFF;
484      if ( RAM[SM8521_DMBR] < 16 )
485      {
488      if (RAM[SM8521_DMBR] < 16)
486489         m_dma.source_bank = m_region_kernel->base() + (RAM[SM8521_DMBR] << 14);
487      }
488      else
489      {
490         if (m_cartridge)
491         {
492            m_dma.source_bank = m_cartridge + (RAM[SM8521_DMBR] << 14);
493         }
494      }
490      else if (m_cart_ptr)
491         m_dma.source_bank = m_cart_ptr + (RAM[SM8521_DMBR] << 14);
495492
496493      m_dma.dest_bank = &m_p_videoram[(RAM[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000];
497494      break;
r32430r32431
637634   m_p_ram = m_region_maincpu->base(); // required here because pio_w gets called before machine_reset
638635}
639636
640DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart1 )
637int gamecom_state::common_load(device_image_interface &image, generic_slot_device *slot)
641638{
642   UINT32 filesize;
639   UINT32 size = slot->common_get_size("rom");
643640   UINT32 load_offset = 0;
644641
645   m_cartridge1 = memregion("cart1")->base();
646
647   if (image.software_entry() == NULL)
648      filesize = image.length();
649   else
650      filesize = image.get_software_region_length("rom");
651
652   switch(filesize)
642   if (size != 0x008000 && size != 0x040000 && size != 0x080000
643       && size != 0x100000 && size != 0x1c0000 && size != 0x200000)
653644   {
654      case 0x008000: load_offset = 0;        break;  /* 32 KB */
655      case 0x040000: load_offset = 0;        break;  /* 256KB */
656      case 0x080000: load_offset = 0;        break;  /* 512KB */
657      case 0x100000: load_offset = 0;        break;  /* 1  MB */
658      case 0x1c0000: load_offset = 0x040000; break;  /* 1.8MB */
659      case 0x200000: load_offset = 0;        break;  /* 2  MB */
660      default:                                       /* otherwise */
661         logerror("Error loading cartridge: Invalid file size 0x%X\n", filesize);
662         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unhandled cart size");
663         return IMAGE_INIT_FAIL;
645      image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
646      return IMAGE_INIT_FAIL;
664647   }
665
666   if (image.software_entry() == NULL)
667   {
668      if (image.fread( m_cartridge1 + load_offset, filesize) != filesize)
669      {
670         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to load all of the cart");
671         return IMAGE_INIT_FAIL;
672      }
673   }
674   else
675      memcpy(m_cartridge1 + load_offset, image.get_software_region("rom"), filesize);
676
677   if (filesize < 0x010000) { memcpy(m_cartridge1 + 0x008000, m_cartridge1, 0x008000); } /* ->64KB */
678   if (filesize < 0x020000) { memcpy(m_cartridge1 + 0x010000, m_cartridge1, 0x010000); } /* ->128KB */
679   if (filesize < 0x040000) { memcpy(m_cartridge1 + 0x020000, m_cartridge1, 0x020000); } /* ->256KB */
680   if (filesize < 0x080000) { memcpy(m_cartridge1 + 0x040000, m_cartridge1, 0x040000); } /* ->512KB */
681   if (filesize < 0x100000) { memcpy(m_cartridge1 + 0x080000, m_cartridge1, 0x080000); } /* ->1MB */
682   if (filesize < 0x1c0000) { memcpy(m_cartridge1 + 0x100000, m_cartridge1, 0x100000); } /* -> >=1.8MB */
648   
649   if (size == 0x1c0000)
650      load_offset = 0x40000;
651   
652   // in order to simplify banked access from the driver, we always allocate 0x200000,
653   slot->rom_alloc(0x200000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
654   // we load what we have
655   slot->common_load_rom(slot->get_rom_base() + load_offset, size, "rom");
656   // and then we mirror the content, instead of masking out larger accesses
657   UINT8 *crt = slot->get_rom_base();
658   if (size < 0x010000) { memcpy(crt + 0x008000, crt, 0x008000); } /* ->64KB */
659   if (size < 0x020000) { memcpy(crt + 0x010000, crt, 0x010000); } /* ->128KB */
660   if (size < 0x040000) { memcpy(crt + 0x020000, crt, 0x020000); } /* ->256KB */
661   if (size < 0x080000) { memcpy(crt + 0x040000, crt, 0x040000); } /* ->512KB */
662   if (size < 0x100000) { memcpy(crt + 0x080000, crt, 0x080000); } /* ->1MB */
663   if (size < 0x1c0000) { memcpy(crt + 0x100000, crt, 0x100000); } /* -> >=1.8MB */
664   
683665   return IMAGE_INIT_PASS;
684666}
685667
686DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart2 )
668DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart1 )
687669{
688   UINT32 filesize;
689   UINT32 load_offset = 0;
670   return common_load(image, m_cart1);
671}
690672
691   m_cartridge2 = memregion("cart2")->base();
692
693//  if (image.software_entry() == NULL)
694      filesize = image.length();
695//  else
696//      filesize = image.get_software_region_length("rom");
697
698   switch(filesize)
699   {
700      case 0x008000: load_offset = 0;        break;  /* 32 KB */
701      case 0x040000: load_offset = 0;        break;  /* 256KB */
702      case 0x080000: load_offset = 0;        break;  /* 512KB */
703      case 0x100000: load_offset = 0;        break;  /* 1  MB */
704      case 0x1c0000: load_offset = 0x040000; break;  /* 1.8MB */
705      case 0x200000: load_offset = 0;        break;  /* 2  MB */
706      default:                                       /* otherwise */
707         logerror("Error loading cartridge: Invalid file size 0x%X\n", filesize);
708         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unhandled cart size");
709         return IMAGE_INIT_FAIL;
710   }
711
712//  if (image.software_entry() == NULL)
713   {
714      if (image.fread( m_cartridge2 + load_offset, filesize) != filesize)
715      {
716         image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to load all of the cart");
717         return IMAGE_INIT_FAIL;
718      }
719   }
720//  else
721//      memcpy(state->m_cartridge2 + load_offset, image.get_software_region("rom"), filesize);
722
723   if (filesize < 0x010000) { memcpy(m_cartridge2 + 0x008000, m_cartridge2, 0x008000); } /* ->64KB */
724   if (filesize < 0x020000) { memcpy(m_cartridge2 + 0x010000, m_cartridge2, 0x010000); } /* ->128KB */
725   if (filesize < 0x040000) { memcpy(m_cartridge2 + 0x020000, m_cartridge2, 0x020000); } /* ->256KB */
726   if (filesize < 0x080000) { memcpy(m_cartridge2 + 0x040000, m_cartridge2, 0x040000); } /* ->512KB */
727   if (filesize < 0x100000) { memcpy(m_cartridge2 + 0x080000, m_cartridge2, 0x080000); } /* ->1MB */
728   if (filesize < 0x1c0000) { memcpy(m_cartridge2 + 0x100000, m_cartridge2, 0x100000); } /* -> >=1.8MB */
729   return IMAGE_INIT_PASS;
673DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart2 )
674{
675   return common_load(image, m_cart2);
730676}
trunk/src/mess/includes/beta.h
r32430r32431
1// license:BSD-3-Clause
2// copyright-holders:Curt Coder
3#pragma once
4
5#ifndef __BETA__
6#define __BETA__
7
8
9#include "emu.h"
10#include "cpu/m6502/m6502.h"
11#include "imagedev/cartslot.h"
12#include "machine/6532riot.h"
13#include "sound/speaker.h"
14#include "machine/ram.h"
15
16#define SCREEN_TAG      "screen"
17#define M6502_TAG       "m6502"
18#define M6532_TAG       "m6532"
19#define EPROM_TAG       "eprom"
20//#define SPEAKER_TAG       "b237"
21
22class beta_state : public driver_device
23{
24public:
25   beta_state(const machine_config &mconfig, device_type type, const char *tag)
26      : driver_device(mconfig, type, tag),
27         m_maincpu(*this, M6502_TAG),
28         m_speaker(*this, "speaker"),
29         m_eprom(*this, EPROM_TAG),
30         m_q6(*this, "Q6"),
31         m_q7(*this, "Q7"),
32         m_q8(*this, "Q8"),
33         m_q9(*this, "Q9")
34   { }
35
36   required_device<cpu_device> m_maincpu;
37   required_device<speaker_sound_device> m_speaker;
38   required_memory_region m_eprom;
39   required_ioport m_q6;
40   required_ioport m_q7;
41   required_ioport m_q8;
42   required_ioport m_q9;
43
44   virtual void machine_start();
45
46   DECLARE_READ8_MEMBER( riot_pa_r );
47   DECLARE_WRITE8_MEMBER( riot_pa_w );
48   DECLARE_READ8_MEMBER( riot_pb_r );
49   DECLARE_WRITE8_MEMBER( riot_pb_w );
50   DECLARE_INPUT_CHANGED_MEMBER( trigger_reset );
51
52   DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( beta_eprom );
53
54   /* EPROM state */
55   int m_eprom_oe;
56   int m_eprom_ce;
57   UINT16 m_eprom_addr;
58   UINT8 m_eprom_data;
59   UINT8 m_old_data;
60
61   /* display state */
62   UINT8 m_ls145_p;
63   UINT8 m_segment;
64
65   emu_timer *m_led_refresh_timer;
66   TIMER_CALLBACK_MEMBER(led_refresh);
67};
68
69#endif
trunk/src/mess/includes/gamecom.h
r32430r32431
1313
1414#include "emu.h"
1515#include "cpu/sm8500/sm8500.h"
16#include "imagedev/cartslot.h"
17#include "rendlay.h"
1816#include "sound/dac.h"
17#include "bus/generic/slot.h"
18#include "bus/generic/carts.h"
1919
20#include "rendlay.h"
21
2022/* SM8521 register addresses */
2123enum
2224{
r32430r32431
213215      : driver_device(mconfig, type, tag),
214216      m_maincpu(*this, "maincpu"),
215217      m_dac(*this, "dac"),
218      m_cart1(*this, "cartslot1"),
219      m_cart2(*this, "cartslot2"),
216220      m_p_nvram(*this,"p_nvram"),
217221      m_p_videoram(*this,"p_videoram"),
218222      m_bank1(*this, "bank1"),
r32430r32431
230234
231235   required_device<cpu_device> m_maincpu;
232236   required_device<dac_device> m_dac;
237   required_device<generic_slot_device> m_cart1;
238   required_device<generic_slot_device> m_cart2;
233239   DECLARE_READ8_MEMBER( gamecom_internal_r );
234240   DECLARE_READ8_MEMBER( gamecom_pio_r );
235241   DECLARE_WRITE8_MEMBER( gamecom_internal_w );
r32430r32431
237243   required_shared_ptr<UINT8> m_p_nvram;
238244   UINT8 *m_p_ram;
239245   required_shared_ptr<UINT8> m_p_videoram;
240   UINT8 *m_cartridge1;
241   UINT8 *m_cartridge2;
242   UINT8 *m_cartridge;
246   UINT8 *m_cart_ptr;
247   memory_region *m_cart1_rom;
248   memory_region *m_cart2_rom;
243249   emu_timer *m_clock_timer;
244250   emu_timer *m_scanline_timer;
245251   GAMECOM_DMA m_dma;
r32430r32431
268274   TIMER_CALLBACK_MEMBER(gamecom_scanline);
269275   DECLARE_WRITE8_MEMBER( gamecom_handle_dma );
270276   DECLARE_WRITE8_MEMBER( gamecom_update_timers );
277   int common_load(device_image_interface &image, generic_slot_device *slot);
271278   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( gamecom_cart1 );
272279   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( gamecom_cart2 );
273280
trunk/src/mess/includes/pc8401a.h
r32430r32431
88
99#include "emu.h"
1010#include "cpu/z80/z80.h"
11#include "imagedev/cartslot.h"
1211#include "machine/i8255.h"
1312#include "machine/i8251.h"
1413#include "machine/ram.h"
r32430r32431
1615#include "video/mc6845.h"
1716#include "video/sed1330.h"
1817
18#include "bus/generic/slot.h"
19#include "bus/generic/carts.h"
20
1921#define SCREEN_TAG      "screen"
2022#define CRT_SCREEN_TAG  "screen2"
2123
r32430r32431
4042         m_lcdc(*this, SED1330_TAG),
4143         m_crtc(*this, MC6845_TAG),
4244         m_screen_lcd(*this, SCREEN_TAG),
45         m_cart(*this, "cartslot"),
46         m_io_cart(*this, "io_cart"),
4347         m_ram(*this, RAM_TAG),
4448         m_rom(*this, Z80_TAG),
45         m_io_rom(*this, "iorom"),
4649         m_crt_ram(*this, "crt_ram"),
47         m_y0(*this, "Y0"),
48         m_y1(*this, "Y1"),
49         m_y2(*this, "Y2"),
50         m_y3(*this, "Y3"),
51         m_y4(*this, "Y4"),
52         m_y5(*this, "Y5"),
53         m_y6(*this, "Y6"),
54         m_y7(*this, "Y7"),
55         m_y8(*this, "Y8"),
56         m_y9(*this, "Y9")
50         m_io_y(*this, "Y")
5751   { }
5852
5953   required_device<cpu_device> m_maincpu;
r32430r32431
6155   required_device<sed1330_device> m_lcdc;
6256   optional_device<mc6845_device> m_crtc;
6357   required_device<screen_device> m_screen_lcd;
58   required_device<generic_slot_device> m_cart;
59   required_device<generic_slot_device> m_io_cart;
6460   required_device<ram_device> m_ram;
6561   required_memory_region m_rom;
66   required_memory_region m_io_rom;
6762   optional_shared_ptr<UINT8> m_crt_ram;
68   required_ioport m_y0;
69   required_ioport m_y1;
70   required_ioport m_y2;
71   required_ioport m_y3;
72   required_ioport m_y4;
73   required_ioport m_y5;
74   required_ioport m_y6;
75   required_ioport m_y7;
76   required_ioport m_y8;
77   required_ioport m_y9;
63   required_ioport_array<10> m_io_y;
7864
79   virtual void machine_start();
65   memory_region *m_cart_rom;
8066
67   virtual void machine_start();
8168   virtual void video_start();
8269
8370   DECLARE_WRITE8_MEMBER( mmr_w );
trunk/src/mess/drivers/pc6001.c
r32430r32431
134134#include "sound/wave.h"
135135
136136#include "imagedev/cassette.h"
137#include "imagedev/cartslot.h"
137#include "bus/generic/slot.h"
138#include "bus/generic/carts.h"
138139#include "formats/p6001_cas.h"
139140
140141
r32430r32431
147148      m_ram(*this, "ram"),
148149      m_maincpu(*this, "maincpu"),
149150      m_cassette(*this, "cassette"),
151      m_cas_hack(*this, "cas_hack"),
152      m_cart(*this, "cartslot"),
150153      m_region_maincpu(*this, "maincpu"),
151154      m_region_gfx1(*this, "gfx1"),
152      m_region_cas(*this, "cas"),
153      m_region_cart_img(*this, "cart_img"),
154155      m_io_mode4_dsw(*this, "MODE4_DSW"),
155156      m_io_p1(*this, "P1"),
156157      m_io_p2(*this, "P2"),
r32430r32431
266267   DECLARE_WRITE8_MEMBER(pc6001_8255_portb_w);
267268   DECLARE_WRITE8_MEMBER(pc6001_8255_portc_w);
268269   DECLARE_READ8_MEMBER(pc6001_8255_portc_r);
269   DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pc6001_cass);
270270   IRQ_CALLBACK_MEMBER(pc6001_irq_callback);
271271protected:
272272   required_device<cpu_device> m_maincpu;
273   required_device<device_t> m_cassette;
273   optional_device<cassette_image_device> m_cassette;
274   optional_device<generic_slot_device> m_cas_hack;
275   required_device<generic_slot_device> m_cart;
274276   required_memory_region m_region_maincpu;
275277   required_memory_region m_region_gfx1;
276   required_memory_region m_region_cas;
277   required_memory_region m_region_cart_img;
278278   required_ioport m_io_mode4_dsw;
279279   required_ioport m_io_p1;
280280   required_ioport m_io_p2;
r32430r32431
292292   optional_memory_bank m_bank8;
293293   required_device<palette_device> m_palette;
294294
295   memory_region *m_cart_rom;
296
295297   void draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr);
296298   void draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &cliprect, int attr);
297299   void draw_tile_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr);
r32430r32431
906908      m_port_c_8255 |= 0xa8;
907909
908910      {
909         UINT8 *gfx_data = m_region_gfx1->base();
910         UINT8 *ext_rom = m_region_cart_img->base();
911
912911         //printf("%02x\n",data);
913912
914         if((data & 0x0f) == 0x05)
915            m_bank1->set_base(&ext_rom[0x2000]);
916         if((data & 0x0f) == 0x04)
917            m_bank1->set_base(&gfx_data[0]);
913         if ((data & 0x0f) == 0x05 && m_cart_rom)
914            m_bank1->set_base(m_cart_rom->base() + 0x2000);
915         if ((data & 0x0f) == 0x04)
916            m_bank1->set_base(m_region_gfx1->base());
918917      }
919918   }
920919   m_ppi->write(space,offset,data);
r32430r32431
923922static ADDRESS_MAP_START(pc6001_map, AS_PROGRAM, 8, pc6001_state )
924923   ADDRESS_MAP_UNMAP_HIGH
925924   AM_RANGE(0x0000, 0x3fff) AM_ROM AM_WRITENOP
926   AM_RANGE(0x4000, 0x5fff) AM_ROM AM_REGION("cart_img",0)
925   //AM_RANGE(0x4000, 0x5fff)      // mapped by the cartslot
927926   AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank1")
928927   AM_RANGE(0x8000, 0xffff) AM_RAM AM_SHARE("ram")
929928ADDRESS_MAP_END
r32430r32431
16391638
16401639      if(0)
16411640      {
1642         UINT8 *gfx_data = m_region_gfx1->base();
1643         UINT8 *ext_rom = m_region_cart_img->base();
1644
16451641         //printf("%02x\n",data);
1646
1647         if((data & 0x0f) == 0x05)
1648            m_bank1->set_base(&ext_rom[0x2000]);
1649         if((data & 0x0f) == 0x04)
1650            m_bank1->set_base(&gfx_data[0]);
1642         
1643         if ((data & 0x0f) == 0x05 && m_cart_rom)
1644            m_bank1->set_base(m_cart_rom->base() + 0x2000);
1645         if ((data & 0x0f) == 0x04)
1646            m_bank1->set_base(m_region_gfx1->base());
16511647      }
16521648   }
16531649   m_ppi->write(space,offset,data);
r32430r32431
19941990   if(m_cas_switch == 1)
19951991   {
19961992      #if 0
1997      static UINT8 cas_data_i = 0x80,cas_data_poll;
1998      //m_cur_keycode = gfx_data[m_cas_offset++];
1999      if(m_cassette->input() > 0.03)
2000         cas_data_poll|= cas_data_i;
2001      else
2002         cas_data_poll&=~cas_data_i;
2003      if(cas_data_i == 1)
2004      {
2005         m_cur_keycode = cas_data_poll;
2006         cas_data_i = 0x80;
2007         /* data ready, poll irq */
2008         m_irq_vector = 0x08;
2009         m_maincpu->set_input_line(0, ASSERT_LINE);
2010      }
2011      else
2012         cas_data_i>>=1;
1993         static UINT8 cas_data_i = 0x80,cas_data_poll;
1994         //m_cur_keycode = gfx_data[m_cas_offset++];
1995         if(m_cassette->input() > 0.03)
1996            cas_data_poll|= cas_data_i;
1997         else
1998            cas_data_poll&=~cas_data_i;
1999         if(cas_data_i == 1)
2000         {
2001            m_cur_keycode = cas_data_poll;
2002            cas_data_i = 0x80;
2003            /* data ready, poll irq */
2004            m_irq_vector = 0x08;
2005            m_maincpu->set_input_line(0, ASSERT_LINE);
2006         }
2007         else
2008            cas_data_i>>=1;
20132009      #else
2014         UINT8 *cas_data = m_region_cas->base();
2015
2016         m_cur_keycode = cas_data[m_cas_offset++];
2017         popmessage("%04x %04x",m_cas_offset,m_cas_maxsize);
2010         address_space &space = m_maincpu->space(AS_PROGRAM);
2011         m_cur_keycode = m_cas_hack->read_rom(space, m_cas_offset++);
2012         popmessage("%04x %04x", m_cas_offset, m_cas_maxsize);
20182013         if(m_cas_offset > m_cas_maxsize)
20192014         {
20202015            m_cas_offset = 0;
r32430r32431
20782073
20792074void pc6001_state::machine_reset()
20802075{
2081   UINT8 *work_ram = m_region_maincpu->base();
2076   m_video_ram = m_region_maincpu->base() + 0xc000;
2077   
2078   if (m_cart->exists())
2079      m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0x5fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart));
20822080
2083   m_video_ram =  work_ram + 0xc000;
2084
2081   astring region_tag;
2082   m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
2083   
20852084   m_port_c_8255=0;
20862085
20872086   m_cas_switch = 0;
20882087   m_cas_offset = 0;
2088   m_cas_maxsize = (m_cas_hack->exists()) ? m_cas_hack->get_rom_size() : 0;
20892089   m_timer_irq_mask = 1;
20902090   m_timer_irq_mask2 = 1;
20912091   m_timer_irq_vector = 0x06; // actually vector is fixed in plain PC-6001
r32430r32431
20942094
20952095MACHINE_RESET_MEMBER(pc6001_state,pc6001m2)
20962096{
2097   UINT8 *work_ram = m_region_maincpu->base();
2098
2099   m_video_ram = work_ram + 0xc000 + 0x28000;
2100
2097   m_video_ram = m_region_maincpu->base() + 0xc000 + 0x28000;
2098   
2099   astring region_tag;
2100   m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
2101   // hackish way to simplify bankswitch handling
2102   if (m_cart_rom)
2103      memcpy(m_region_maincpu->base() + 0x48000, m_cart_rom->base(), 0x4000);
2104   
21012105   m_port_c_8255=0;
21022106
21032107   m_cas_switch = 0;
21042108   m_cas_offset = 0;
2109   m_cas_maxsize = (m_cas_hack->exists()) ? m_cas_hack->get_rom_size() : 0;
21052110
21062111   /* set default bankswitch */
21072112   {
r32430r32431
21282133
21292134MACHINE_RESET_MEMBER(pc6001_state,pc6001sr)
21302135{
2131   UINT8 *work_ram = m_region_maincpu->base();
2132
2133   m_video_ram = work_ram + 0x70000;
2134
2136   m_video_ram = m_region_maincpu->base() + 0x70000;
2137   
2138   astring region_tag;
2139   m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
2140   // should this be mirrored into the EXROM regions? hard to tell without an actual cart dump...
2141   
21352142   m_port_c_8255=0;
21362143
21372144   m_cas_switch = 0;
21382145   m_cas_offset = 0;
2146   m_cas_maxsize = (m_cas_hack->exists()) ? m_cas_hack->get_rom_size() : 0;
21392147
21402148   /* set default bankswitch */
21412149   {
r32430r32431
22352243};
22362244#endif
22372245
2238DEVICE_IMAGE_LOAD_MEMBER( pc6001_state,pc6001_cass )
2239{
2240   UINT8 *cas = m_region_cas->base();
2241   UINT32 size;
2242
2243   size = image.length();
2244   if (image.fread( cas, size) != size)
2245   {
2246      image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file");
2247      return IMAGE_INIT_FAIL;
2248   }
2249
2250   m_cas_maxsize = size;
2251
2252   return IMAGE_INIT_PASS;
2253}
2254
22552246static const gfx_layout char_layout =
22562247{
22572248   8, 16,
r32430r32431
23182309   /* uart */
23192310   MCFG_DEVICE_ADD("uart", I8251, 0)
23202311
2321   MCFG_CARTSLOT_ADD("cart")
2322   MCFG_CARTSLOT_EXTENSION_LIST("bin")
2323   MCFG_CARTSLOT_NOT_MANDATORY
2312   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "pc6001_cart")
23242313
2325//  MCFG_CASSETTE_ADD("cassette",pc6001_cassette_interface)
2326   MCFG_CARTSLOT_ADD("cassette")
2327   MCFG_CARTSLOT_EXTENSION_LIST("cas,p6")
2328   MCFG_CARTSLOT_NOT_MANDATORY
2329   MCFG_CARTSLOT_INTERFACE("pc6001_cass")
2330   MCFG_CARTSLOT_LOAD(pc6001_state,pc6001_cass)
2314//  MCFG_CASSETTE_ADD("cassette", pc6001_cassette_interface)
2315   MCFG_GENERIC_CARTSLOT_ADD("cas_hack", generic_plain_slot, "pc6001_cass")
2316   MCFG_GENERIC_EXTENSIONS("cas,p6")
23312317
23322318   MCFG_SPEAKER_STANDARD_MONO("mono")
23332319   MCFG_SOUND_ADD("ay8910", AY8910, PC6001_MAIN_CLOCK/4)
r32430r32431
24052391   ROM_RELOAD(             0x1000, 0x1000 )
24062392
24072393   ROM_REGION( 0x8000, "gfx2", ROMREGION_ERASEFF )
2408
2409   ROM_REGION( 0x20000, "cas", ROMREGION_ERASEFF )
2410
2411   ROM_REGION( 0x4000, "cart_img", ROMREGION_ERASE00 )
2412   ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_OPTIONAL | ROM_MIRROR)
24132394ROM_END
24142395
24152396ROM_START( pc6001a )
r32430r32431
24232404   ROM_LOAD( "cgrom60.60a", 0x0000, 0x1000, CRC(49c21d08) SHA1(9454d6e2066abcbd051bad9a29a5ca27b12ec897) )
24242405
24252406   ROM_REGION( 0x8000, "gfx2", ROMREGION_ERASEFF )
2426
2427   ROM_REGION( 0x20000, "cas", ROMREGION_ERASEFF )
2428
2429   ROM_REGION( 0x4000, "cart_img", ROMREGION_ERASE00 )
2430   ROM_CART_LOAD("cart", 0x0000, 0x4000, ROM_OPTIONAL | ROM_MIRROR)
24312407ROM_END
24322408
24332409ROM_START( pc6001mk2 )
r32430r32431
24392415   ROM_LOAD( "kanjirom.62", 0x20000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) )
24402416   // work ram              0x28000,0x10000
24412417   // extended work ram     0x38000,0x10000
2442   ROM_CART_LOAD("cart",    0x48000, 0x4000, ROM_OPTIONAL | ROM_MIRROR)
2418   // exrom                 0x48000, 0x4000
24432419   // <invalid>             0x4c000, 0x4000
24442420
24452421   ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF )
r32430r32431
24502426
24512427   ROM_REGION( 0x8000, "gfx2", 0 )
24522428   ROM_COPY( "maincpu", 0x20000, 0x00000, 0x8000 )
2453
2454   ROM_REGION( 0x20000, "cas", ROMREGION_ERASEFF )
2455
2456   ROM_REGION( 0x4000, "cart_img", ROMREGION_ERASE00 )
2457   ROM_COPY( "maincpu", 0x48000, 0x0000, 0x4000 )
24582429ROM_END
24592430
24602431ROM_START( pc6601 ) /* Variant of pc6001m2 */
r32430r32431
24642435   ROM_LOAD( "cgrom60.66",  0x1c000, 0x2000, CRC(d2434f29) SHA1(a56d76f5cbdbcdb8759abe601eab68f01b0a8fe8) )
24652436   ROM_LOAD( "cgrom66.66",  0x1e000, 0x2000, CRC(3ce48c33) SHA1(f3b6c63e83a17d80dde63c6e4d86adbc26f84f79) )
24662437   ROM_LOAD( "kanjirom.66", 0x20000, 0x8000, CRC(20c8f3eb) SHA1(4c9f30f0a2ebbe70aa8e697f94eac74d8241cadd) )
2467   ROM_CART_LOAD("cart",    0x48000, 0x4000, ROM_OPTIONAL | ROM_MIRROR)
2438   // exrom                 0x48000, 0x4000
24682439
24692440   ROM_REGION( 0x1000, "mcu", ROMREGION_ERASEFF )
24702441   ROM_LOAD( "i8049", 0x0000, 0x1000, NO_DUMP )
r32430r32431
24742445
24752446   ROM_REGION( 0x8000, "gfx2", 0 )
24762447   ROM_COPY( "maincpu", 0x20000, 0x00000, 0x8000 )
2477
2478   ROM_REGION( 0x20000, "cas", ROMREGION_ERASEFF )
2479
2480   ROM_REGION( 0x4000, "cart_img", ROMREGION_ERASE00 )
2481   ROM_COPY( "maincpu", 0x48000, 0x0000, 0x4000 )
24822448ROM_END
24832449
24842450ROM_START( pc6001sr )
r32430r32431
25002466
25012467   ROM_REGION( 0x8000, "gfx2", 0 )
25022468   ROM_COPY( "maincpu", 0x28000, 0x00000, 0x8000 )
2503
2504   ROM_REGION( 0x20000, "cas", ROMREGION_ERASEFF )
2505
2506   ROM_REGION( 0x4000, "cart_img", ROMREGION_ERASE00 )
2507   ROM_COPY( "maincpu", 0x48000, 0x0000, 0x4000 )
25082469ROM_END
25092470
25102471/*    YEAR  NAME      PARENT   COMPAT MACHINE   INPUT     INIT    COMPANY  FULLNAME          FLAGS */
trunk/src/mess/drivers/socrates.c
r32430r32431
106106#include "emu.h"
107107#include "cpu/z80/z80.h"
108108#include "audio/socrates.h"
109#include "imagedev/cartslot.h"
109#include "bus/generic/slot.h"
110#include "bus/generic/carts.h"
110111
111
112112class socrates_state : public driver_device
113113{
114114public:
r32430r32431
122122      : driver_device(mconfig, type, tag),
123123      m_maincpu(*this, "maincpu"),
124124      m_sound(*this, "soc_snd"),
125      m_screen(*this, "screen")
125      m_screen(*this, "screen"),
126      m_cart(*this, "cartslot"),
127      m_bios_reg(*this, "maincpu"),
128      m_vram_reg(*this, "vram")
126129      { }
127130   required_device<cpu_device> m_maincpu;
128131   required_device<socrates_snd_device> m_sound;
129132   required_device<screen_device> m_screen;
133   required_device<generic_slot_device> m_cart;
130134
131135   rgb_t m_palette_val[256];
132136
137   required_memory_region m_bios_reg;
138   required_memory_region m_vram_reg;
139   memory_region *m_cart_reg;
140
133141   UINT8 m_data[8];
134142   UINT8 m_rom_bank;
135143   UINT8 m_ram_bank;
136144   UINT16 m_scroll_offset;
137   UINT8* m_videoram;
138145   UINT8 m_kb_latch_low[2];
139146   UINT8 m_kb_latch_high[2];
140147   UINT8 m_kb_latch_mouse;
r32430r32431
235242
236243/* Devices */
237244
238void socrates_state::socrates_set_rom_bank(  )
245void socrates_state::socrates_set_rom_bank()
239246{
240   membank( "bank1" )->set_base( memregion("maincpu")->base() + ( m_rom_bank * 0x4000 ));
247   if (m_cart_reg && m_rom_bank >= 0x10)
248   {
249      int bank =  m_rom_bank % (m_cart->get_rom_size() / 0x4000);
250      membank("bank1")->set_base(m_cart_reg->base() + (bank * 0x4000));
251   }
252   else
253      membank("bank1")->set_base(m_bios_reg->base() + (m_rom_bank * 0x4000));
241254}
242255
243void socrates_state::socrates_set_ram_bank(  )
256void socrates_state::socrates_set_ram_bank()
244257{
245   membank( "bank2" )->set_base( memregion("vram")->base() + ( (m_ram_bank&0x3) * 0x4000 )); // window 0
246   membank( "bank3" )->set_base( memregion("vram")->base() + ( ((m_ram_bank&0xC)>>2) * 0x4000 )); // window 1
258   membank("bank2")->set_base(m_vram_reg->base() + ( (m_ram_bank & 0x3) * 0x4000)); // window 0
259   membank("bank3")->set_base(m_vram_reg->base() + (((m_ram_bank & 0xc) >> 2) * 0x4000)); // window 1
247260}
248261
249262void socrates_state::socrates_update_kb(  )
r32430r32431
304317
305318void socrates_state::machine_reset()
306319{
320   astring region_tag;
321   m_cart_reg = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
322   
307323   m_rom_bank = 0xF3; // actually set semi-randomly on real console but we need to initialize it somewhere...
308324   socrates_set_rom_bank();
309325   m_ram_bank = 0;  // the actual console sets it semi randomly on power up, and the bios cleans it up.
r32430r32431
343359DRIVER_INIT_MEMBER(socrates_state,socrates)
344360{
345361   UINT8 *gfx = memregion("vram")->base();
346   int i;
362
347363   /* fill vram with its init powerup bit pattern, so startup has the checkerboard screen */
348   for (i = 0; i < 0x10000; i++)
364   for (int i = 0; i < 0x10000; i++)
349365      gfx[i] = (((i&0x1)?0x00:0xFF)^((i&0x100)?0x00:0xff));
350366// init sound channels to both be on lowest pitch and max volume
351367   m_maincpu->set_clock_scale(0.45f); /* RAM access waitstates etc. aren't emulated - slow the CPU to compensate */
r32430r32431
714730
715731void socrates_state::video_start()
716732{
717   m_videoram = memregion("vram")->base();
718733   m_scroll_offset = 0;
719734}
720735
r32430r32431
724739   {
725740   0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0xF7
726741   };
742   UINT8 *videoram = m_vram_reg->base();
727743   int x, y, colidx, color;
728744   int lineoffset = 0; // if display ever tries to display data at 0xfxxx, offset line displayed by 0x1000
729745   for (y = 0; y < 228; y++)
r32430r32431
733749      {
734750         if (x < 256)
735751         {
736            colidx = m_videoram[(((y+m_scroll_offset)*128)+(x>>1)+lineoffset)&0xffff];
752            colidx =videoram[(((y+m_scroll_offset)*128)+(x>>1)+lineoffset)&0xffff];
737753            if (x&1) colidx >>=4;
738754            colidx &= 0xF;
739            if (colidx > 7) color=m_videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)];
755            if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)];
740756            else color=fixedcolors[colidx];
741757            bitmap.pix16(y, x) = color;
742758         }
743759         else
744760         {
745            colidx = m_videoram[(((y+m_scroll_offset)*128)+(127)+lineoffset)&0xffff];
761            colidx = videoram[(((y+m_scroll_offset)*128)+(127)+lineoffset)&0xffff];
746762            colidx >>=4;
747763            colidx &= 0xF;
748            if (colidx > 7) color=m_videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)];
764            if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)];
749765            else color=fixedcolors[colidx];
750766            bitmap.pix16(y, x) = color;
751767         }
r32430r32431
791807   if (index < 8)
792808      return m_colors[index];
793809   else
794      return m_videoram[0xf000 + ((index & 0x0f) << 8) + ((m_scroll_offset + y + 1) & 0xff)];
810      return m_vram_reg->u8(0xf000 + ((index & 0x0f) << 8) + ((m_scroll_offset + y + 1) & 0xff));
795811}
796812
797813UINT32 iqunlim_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
798814{
815   UINT8 *videoram = m_vram_reg->base();
816
799817   // bitmap layer
800818   for (int y=0; y<224; y++)
801819   {
802820      if (y >= m_video_regs[0x03])    break;
803821      for (int x=0; x<128; x++)
804822      {
805         UINT8 data = m_videoram[(m_scroll_offset + y) * 0x80 + x];
823         UINT8 data = videoram[(m_scroll_offset + y) * 0x80 + x];
806824
807825         for(int b=0; b<2; b++)
808826         {
r32430r32431
819837   {
820838      for (int x=0; x<line_len; x++)
821839      {
822         UINT8 c = m_videoram[0x8400 + (y - 1) * (mode_80 ? 0x80 : 0x40) + x];
823         UINT8 *gfx = &m_videoram[0x8000 + (c & 0x7f) * 8];
840         UINT8 c = videoram[0x8400 + (y - 1) * (mode_80 ? 0x80 : 0x40) + x];
841         UINT8 *gfx = &videoram[0x8000 + (c & 0x7f) * 8];
824842
825843         for (int cy=0; cy<8; cy++)
826844         {
r32430r32431
878896
879897void iqunlim_state::machine_start()
880898{
881   UINT8 *bios = memregion("bios")->base();
882   UINT8 *cart = memregion("cart")->base();
883   UINT8 *ram  = memregion("vram")->base();
899   astring region_tag;
900   m_cart_reg = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
901   
902   UINT8 *bios = m_bios_reg->base();
903   UINT8 *cart = m_cart_reg ? m_cart_reg->base() : m_bios_reg->base();
904   UINT8 *ram  = m_vram_reg->base();
905
884906   m_bank1->configure_entries(0x00, 0x10, bios, 0x4000);
885907   m_bank1->configure_entries(0x10, 0x10, cart , 0x4000);
886908   m_bank1->configure_entries(0x20, 0x10, bios + 0x40000, 0x4000);
887   m_bank1->configure_entries(0x30, 0x10, cart + 0x40000 , 0x4000);
909   m_bank1->configure_entries(0x30, 0x10, cart + 0x40000, 0x4000);
888910
889911   m_bank2->configure_entries(0x00, 0x10, bios, 0x4000);
890912   m_bank2->configure_entries(0x10, 0x10, cart , 0x4000);
891913   m_bank2->configure_entries(0x20, 0x10, bios + 0x40000, 0x4000);
892   m_bank2->configure_entries(0x30, 0x10, cart + 0x40000 , 0x4000);
914   m_bank2->configure_entries(0x30, 0x10, cart + 0x40000, 0x4000);
893915
894916   m_bank3->configure_entries(0x00, 0x08, ram, 0x4000);
895917   m_bank4->configure_entries(0x00, 0x08, ram, 0x4000);
r32430r32431
9981020   AM_RANGE(0x00, 0x00) AM_READWRITE(socrates_rom_bank_r, socrates_rom_bank_w) AM_MIRROR(0x7) /* rom bank select - RW - 8 bits */
9991021   AM_RANGE(0x08, 0x08) AM_READWRITE(socrates_ram_bank_r, socrates_ram_bank_w) AM_MIRROR(0x7) /* ram banks select - RW - 4 low bits; Format: 0b****HHLL where LL controls whether window 0 points at ram area: 0b00: 0x0000-0x3fff; 0b01: 0x4000-0x7fff; 0b10: 0x8000-0xbfff; 0b11: 0xc000-0xffff. HH controls the same thing for window 1 */
10001022   AM_RANGE(0x10, 0x17) AM_READWRITE(read_f3, socrates_sound_w) AM_MIRROR (0x8) /* sound section:
1001        0x10 - W - frequency control for channel 1 (louder channel) - 01=high pitch, ff=low; time between 1->0/0->1 transitions = (XTAL_21_4772MHz/(512+256) / (freq_reg+1)) (note that this is double the actual frequency since each full low and high squarewave pulse is two transitions)
1023    0x10 - W - frequency control for channel 1 (louder channel) - 01=high pitch, ff=low; time between 1->0/0->1 transitions = (XTAL_21_4772MHz/(512+256) / (freq_reg+1)) (note that this is double the actual frequency since each full low and high squarewave pulse is two transitions)
10021024    0x11 - W - frequency control for channel 2 (softer channel) - 01=high pitch, ff=low; same equation as above
10031025    0x12 - W - 0b***EVVVV enable, volume control for channel 1
10041026    0x13 - W - 0b***EVVVV enable, volume control for channel 2
r32430r32431
13861408   MCFG_SOUND_ADD("soc_snd", SOCRATES_SOUND, XTAL_21_4772MHz/(512+256)) // this is correct, as strange as it sounds.
13871409   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
13881410
1389   MCFG_CARTSLOT_ADD("cart")
1390   MCFG_CARTSLOT_EXTENSION_LIST("bin")
1391   MCFG_CARTSLOT_NOT_MANDATORY
1392   MCFG_CARTSLOT_INTERFACE("socrates_cart")
1411   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "socrates_cart")
13931412
13941413   /* Software lists */
13951414   MCFG_SOFTWARE_LIST_ADD("cart_list", "socrates")
r32430r32431
14211440   MCFG_SOUND_ADD("soc_snd", SOCRATES_SOUND, XTAL_26_601712MHz/(512+256)) // TODO: verify divider for pal mode
14221441   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
14231442
1424   MCFG_CARTSLOT_ADD("cart")
1425   MCFG_CARTSLOT_EXTENSION_LIST("bin")
1426   MCFG_CARTSLOT_NOT_MANDATORY
1427   MCFG_CARTSLOT_INTERFACE("socrates_cart")
1443   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "socrates_cart")
14281444
14291445   /* Software lists */
14301446   MCFG_SOFTWARE_LIST_ADD("cart_list", "socrates")
r32430r32431
14681484   MCFG_SOUND_ADD("soc_snd", SOCRATES_SOUND, XTAL_21_4772MHz/(512+256))
14691485   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
14701486
1471   MCFG_CARTSLOT_ADD("cart")
1472   MCFG_CARTSLOT_EXTENSION_LIST("bin")
1473   MCFG_CARTSLOT_NOT_MANDATORY
1487   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, NULL)
14741488MACHINE_CONFIG_END
14751489
14761490/******************************************************************************
r32430r32431
15141528   if all tests passed, jump to 0x4000 (0x0000 in cart rom)
15151529   */
15161530   ROM_LOAD("27-00817-000-000.u1", 0x00000, 0x40000, CRC(80f5aa20) SHA1(4fd1ff7f78b5dd2582d5de6f30633e4e4f34ca8f)) // Label: "(Vtech) 27-00817-000-000 // (C)1987 VIDEO TECHNOLOGY // 8811 D"
1517   ROM_CART_LOAD( "cart", 0x40000, 0x20000, 0 )
15181531
15191532   ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) /* fill with ff, driver_init changes this to the 'correct' startup pattern */
15201533
r32430r32431
15361549   ROM_REGION(0x80000, "maincpu", ROMREGION_ERASEVAL(0xF3))
15371550   /* Socrates SAITOUT (French Canadian) NTSC */
15381551   ROM_LOAD("27-00884-001-000.u1", 0x00000, 0x40000, CRC(042d9d21) SHA1(9ffc67b2721683b2536727d0592798fbc4d061cb)) // Label: "(Vtech) 27-00884-001-000 // (C)1988 VIDEO TECHNOLOGY // 8911 D"
1539   ROM_CART_LOAD( "cart", 0x40000, 0x20000, 0 )
15401552
15411553   ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) /* fill with ff, driver_init changes this to the 'correct' startup pattern */
15421554
r32430r32431
15601572   ROMX_LOAD("lh53216d.u1", 0x00000, 0x40000, CRC(6e801762) SHA1(b80574a3abacf18133dacb9d3a8d9e2916730423), ROM_BIOS(1)) // Label: "(Vtech) LH53216D // (C)1989 VIDEO TECHNOLOGY // 9119 D"
15611573   ROM_SYSTEM_BIOS(1, "88", "1988")
15621574   ROMX_LOAD("27-00885-001-000.u1", 0x00000, 0x40000, CRC(fcaf8850) SHA1(a99011ee6a1ef63461c00d062278951252f117db), ROM_BIOS(2)) // Label: "(Vtech) 27-00884-001-000 // (C)1988 VIDEO TECHNOLOGY // 8911 D"
1563   ROM_CART_LOAD( "cart", 0x40000, 0x20000, 0 )
15641575
15651576   ROM_REGION(0x10000, "vram", ROMREGION_ERASEFF) /* fill with ff, driver_init changes this to the 'correct' startup pattern */
15661577
r32430r32431
15761587ROM_END
15771588
15781589ROM_START( iqunlimz )
1579   ROM_REGION( 0x80000, "bios", 0 )
1590   ROM_REGION( 0x80000, "maincpu", 0 )
15801591   ROM_LOAD( "vtech.bin", 0x000000, 0x080000, CRC(f100c8a7) SHA1(6ad2a8accae2dd5c5c46ae953eef33cdd1ea3cf9) )
15811592
1582   ROM_REGION( 0x80000, "cart", ROMREGION_ERASEFF )
1583   ROM_CART_LOAD( "cart", 0, 0x80000, 0 )
1584
15851593   ROM_REGION( 0x20000, "vram", ROMREGION_ERASE )
15861594ROM_END
15871595
trunk/src/mess/drivers/beta.c
r32430r32431
2525
2626    TODO:
2727
28    - write EPROM back to file
28    - verify whether feeding a 0xff-filled 2K binary file as cart allows
29      to write back correctly EPROM or not
2930
3031*/
3132
32#include "includes/beta.h"
33#include "emu.h"
34#include "cpu/m6502/m6502.h"
35#include "machine/6532riot.h"
36#include "machine/ram.h"
37#include "sound/speaker.h"
38
39#include "bus/generic/slot.h"
40#include "bus/generic/carts.h"
41
3342#include "beta.lh"
3443
44#define SCREEN_TAG      "screen"
45#define M6502_TAG       "m6502"
46#define M6532_TAG       "m6532"
47#define EPROM_TAG       "eprom"
48//#define SPEAKER_TAG       "b237"
49
50class beta_state : public driver_device
51{
52public:
53   beta_state(const machine_config &mconfig, device_type type, const char *tag)
54      : driver_device(mconfig, type, tag),
55      m_maincpu(*this, M6502_TAG),
56      m_speaker(*this, "speaker"),
57      m_eprom(*this, EPROM_TAG),
58      m_q6(*this, "Q6"),
59      m_q7(*this, "Q7"),
60      m_q8(*this, "Q8"),
61      m_q9(*this, "Q9")
62   { }
63   
64   required_device<cpu_device> m_maincpu;
65   required_device<speaker_sound_device> m_speaker;
66   required_device<generic_slot_device> m_eprom;
67   required_ioport m_q6;
68   required_ioport m_q7;
69   required_ioport m_q8;
70   required_ioport m_q9;
71   
72   virtual void machine_start();
73   
74   DECLARE_READ8_MEMBER( riot_pa_r );
75   DECLARE_WRITE8_MEMBER( riot_pa_w );
76   DECLARE_READ8_MEMBER( riot_pb_r );
77   DECLARE_WRITE8_MEMBER( riot_pb_w );
78   DECLARE_INPUT_CHANGED_MEMBER( trigger_reset );
79   
80   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( beta_eprom );
81   DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( beta_eprom );
82   
83   /* EPROM state */
84   int m_eprom_oe;
85   int m_eprom_ce;
86   UINT16 m_eprom_addr;
87   UINT8 m_eprom_data;
88   UINT8 m_old_data;
89   dynamic_buffer m_eprom_rom;
90   
91   /* display state */
92   UINT8 m_ls145_p;
93   UINT8 m_segment;
94   
95   emu_timer *m_led_refresh_timer;
96   TIMER_CALLBACK_MEMBER(led_refresh);
97};
98
99
35100/* Memory Maps */
36101
37102static ADDRESS_MAP_START( beta_mem, AS_PROGRAM, 8, beta_state )
r32430r32431
122187   default:
123188      if (!m_eprom_oe && !m_eprom_ce)
124189      {
125         data = m_eprom->base()[m_eprom_addr & 0x7ff];
190         data = m_eprom_rom[m_eprom_addr & 0x7ff];
126191         popmessage("EPROM read %04x = %02x\n", m_eprom_addr & 0x7ff, data);
127192      }
128193   }
r32430r32431
209274   if (BIT(data, 6) && (!BIT(m_old_data, 7) && BIT(data, 7)))
210275   {
211276      popmessage("EPROM write %04x = %02x\n", m_eprom_addr & 0x7ff, m_eprom_data);
212      m_eprom->base()[m_eprom_addr & 0x7ff] &= m_eprom_data;
277      m_eprom_rom[m_eprom_addr & 0x7ff] &= m_eprom_data;
213278   }
214279
215280   m_old_data = data;
216281}
217282
218/* Quickload */
283/* EPROM socket */
219284
285DEVICE_IMAGE_LOAD_MEMBER( beta_state, beta_eprom )
286{
287   UINT32 size = m_eprom->common_get_size("rom");
288   
289   if (size != 0x800)
290   {
291      image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
292      return IMAGE_INIT_FAIL;
293   }
294   
295   m_eprom->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
296   m_eprom->common_load_rom(m_eprom->get_rom_base(), size, "rom");         
297   
298   return IMAGE_INIT_PASS;
299}
300
220301DEVICE_IMAGE_UNLOAD_MEMBER( beta_state, beta_eprom )
221302{
222   UINT8 *ptr = m_eprom->base();
223
224   image.fwrite(ptr, 0x800);
303   if (image.software_entry() == NULL)
304      image.fwrite(m_eprom_rom, 0x800);
225305}
226306
227307/* Machine Initialization */
r32430r32431
230310{
231311   m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(beta_state::led_refresh),this));
232312
313   m_eprom_rom.resize(0x800);
314
315   if (!m_eprom->exists())
316      memset(m_eprom_rom, 0xff, 0x800);
317   else
318   {
319      astring region_tag;
320      memcpy(m_eprom_rom, memregion(region_tag.cpy(m_eprom->tag()).cat(GENERIC_ROM_REGION_TAG))->base(), 0x800);
321   }
322
233323   // state saving
234324   save_item(NAME(m_eprom_oe));
235325   save_item(NAME(m_eprom_ce));
236326   save_item(NAME(m_eprom_addr));
237327   save_item(NAME(m_eprom_data));
238328   save_item(NAME(m_old_data));
329   save_item(NAME(m_eprom_rom));
239330   save_item(NAME(m_ls145_p));
240331   save_item(NAME(m_segment));
241332}
r32430r32431
264355   MCFG_RIOT6532_IRQ_CB(INPUTLINE(M6502_TAG, M6502_IRQ_LINE))
265356
266357   /* EPROM socket */
267   MCFG_CARTSLOT_ADD(EPROM_TAG)
268   MCFG_CARTSLOT_EXTENSION_LIST("bin,rom")
269   MCFG_CARTSLOT_NOT_MANDATORY
270   MCFG_CARTSLOT_UNLOAD(beta_state,beta_eprom)
358   MCFG_GENERIC_CARTSLOT_ADD(EPROM_TAG, generic_plain_slot, NULL)
359   MCFG_GENERIC_EXTENSIONS("bin,rom")
360   MCFG_GENERIC_LOAD(beta_state, beta_eprom)
361   MCFG_GENERIC_UNLOAD(beta_state, beta_eprom)
271362
272363   /* internal ram */
273364   MCFG_RAM_ADD(RAM_TAG)
r32430r32431
279370ROM_START( beta )
280371   ROM_REGION( 0x10000, M6502_TAG, 0 )
281372   ROM_LOAD( "beta.rom", 0x8000, 0x0800, CRC(d42fdb17) SHA1(595225a0cd43dd76c46b2aff6c0f27d5991cc4f0))
282
283   ROM_REGION( 0x800, EPROM_TAG, ROMREGION_ERASEFF )
284   ROM_CART_LOAD( EPROM_TAG, 0x0000, 0x0800, ROM_FULLSIZE )
285373ROM_END
286374
287375/* System Drivers */
trunk/src/mess/drivers/pc8401a.c
r32430r32431
3939
4040void pc8401a_state::scan_keyboard()
4141{
42   int row, strobe = 0;
42   int strobe = 0;
4343
44   UINT8 keydata[10] = { m_y0->read(), m_y1->read(), m_y2->read(), m_y3->read(), m_y4->read(), m_y5->read(), m_y6->read(), m_y7->read(), m_y8->read(), m_y9->read() };
45
4644   /* scan keyboard */
47   for (row = 0; row < 10; row++)
45   for (int row = 0; row < 10; row++)
4846   {
49      UINT8 data = keydata[row];
47      UINT8 data = m_io_y[row]->read();
5048
5149      if (data != 0xff)
5250      {
r32430r32431
9088         program.unmap_write(0x0000, 0x7fff);
9189         membank("bank1")->set_entry(rombank);
9290      }
93      else
91      else if (m_cart_rom)
9492      {
9593         /* ROM cartridge */
96         program.unmap_readwrite(0x0000, 0x7fff);
94         program.install_read_bank(0x0000, 0x7fff, "bank1");
95         program.unmap_write(0x0000, 0x7fff);
96         membank("bank1")->set_entry(6);
9797      }
98      else
99         program.unmap_readwrite(0x0000, 0x7fff);
98100      //logerror("0x0000-0x7fff = ROM %u\n", rombank);
99101      break;
100102
r32430r32431
264266READ8_MEMBER( pc8401a_state::io_rom_data_r )
265267{
266268   //logerror("I/O ROM read from %05x\n", m_io_addr);
267
268   return m_io_rom->base()[m_io_addr];
269   return m_io_cart->read_rom(space, m_io_addr);
269270}
270271
271272WRITE8_MEMBER( pc8401a_state::io_rom_addr_w )
r32430r32431
345346static ADDRESS_MAP_START( pc8500_io, AS_IO, 8, pc8401a_state )
346347   ADDRESS_MAP_UNMAP_HIGH
347348   ADDRESS_MAP_GLOBAL_MASK(0xff)
348   AM_RANGE(0x00, 0x00) AM_READ_PORT("Y0")
349   AM_RANGE(0x01, 0x01) AM_READ_PORT("Y1")
350   AM_RANGE(0x02, 0x02) AM_READ_PORT("Y2")
351   AM_RANGE(0x03, 0x03) AM_READ_PORT("Y3")
352   AM_RANGE(0x04, 0x04) AM_READ_PORT("Y4")
353   AM_RANGE(0x05, 0x05) AM_READ_PORT("Y5")
354   AM_RANGE(0x06, 0x06) AM_READ_PORT("Y6")
355   AM_RANGE(0x07, 0x07) AM_READ_PORT("Y7")
356   AM_RANGE(0x08, 0x08) AM_READ_PORT("Y8")
357   AM_RANGE(0x09, 0x09) AM_READ_PORT("Y9")
349   AM_RANGE(0x00, 0x00) AM_READ_PORT("Y.0")
350   AM_RANGE(0x01, 0x01) AM_READ_PORT("Y.1")
351   AM_RANGE(0x02, 0x02) AM_READ_PORT("Y.2")
352   AM_RANGE(0x03, 0x03) AM_READ_PORT("Y.3")
353   AM_RANGE(0x04, 0x04) AM_READ_PORT("Y.4")
354   AM_RANGE(0x05, 0x05) AM_READ_PORT("Y.5")
355   AM_RANGE(0x06, 0x06) AM_READ_PORT("Y.6")
356   AM_RANGE(0x07, 0x07) AM_READ_PORT("Y.7")
357   AM_RANGE(0x08, 0x08) AM_READ_PORT("Y.8")
358   AM_RANGE(0x09, 0x09) AM_READ_PORT("Y.9")
358359   AM_RANGE(0x10, 0x10) AM_WRITE(rtc_cmd_w)
359360   AM_RANGE(0x20, 0x20) AM_DEVREADWRITE(I8251_TAG, i8251_device, data_r, data_w)
360361   AM_RANGE(0x21, 0x21) AM_DEVREADWRITE(I8251_TAG, i8251_device, status_r, control_w)
r32430r32431
382383/* Input Ports */
383384
384385static INPUT_PORTS_START( pc8401a )
385   PORT_START("Y0")
386   PORT_START("Y.0")
386387   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STOP")// PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
387388   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
388389   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
r32430r32431
392393   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
393394   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
394395
395   PORT_START("Y1")
396   PORT_START("Y.1")
396397   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
397398   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
398399   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
r32430r32431
402403   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
403404   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
404405
405   PORT_START("Y2")
406   PORT_START("Y.2")
406407   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
407408   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
408409   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
r32430r32431
412413   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
413414   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
414415
415   PORT_START("Y3")
416   PORT_START("Y.3")
416417   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
417418   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
418419   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
r32430r32431
422423   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
423424   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
424425
425   PORT_START("Y4")
426   PORT_START("Y.4")
426427   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('*')
427428   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('*')
428429   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('*')
r32430r32431
432433   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
433434   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
434435
435   PORT_START("Y5")
436   PORT_START("Y.5")
436437   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('*')
437438   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('*')
438439   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('*')
r32430r32431
442443   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('*')
443444   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('*')
444445
445   PORT_START("Y6")
446   PORT_START("Y.6")
446447   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('*')
447448   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('*')
448449   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('*')
r32430r32431
452453   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('*')
453454   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
454455
455   PORT_START("Y7")
456   PORT_START("Y.7")
456457   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
457458   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) // ^I
458459   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
r32430r32431
462463   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
463464   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) // ^C
464465
465   PORT_START("Y8")
466   PORT_START("Y.8")
466467   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
467468   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6)
468469   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7)
r32430r32431
472473   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
473474   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
474475
475   PORT_START("Y9")
476   PORT_START("Y.9")
476477   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8)
477478   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9)
478479   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10)
r32430r32431
487488
488489void pc8401a_state::machine_start()
489490{
491   astring region_tag;
492   m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
493
490494   /* initialize RTC */
491495   m_rtc->cs_w(1);
492496
r32430r32431
498502   /* set up A0/A1 memory banking */
499503   membank("bank1")->configure_entries(0, 4, m_rom->base(), 0x8000);
500504   membank("bank1")->configure_entries(4, 2, ram, 0x8000);
505   if (m_cart_rom)
506      membank("bank1")->configure_entries(6, 1, m_cart_rom->base(), 0x8000);
501507   membank("bank1")->set_entry(0);
502508
503509   /* set up A2 memory banking */
r32430r32431
515521
516522   /* bank switch */
517523   bankswitch(0);
518
524   
519525   /* register for state saving */
520526   save_item(NAME(m_mmr));
521527   save_item(NAME(m_io_addr));
r32430r32431
590596   MCFG_FRAGMENT_ADD(pc8401a_video)
591597
592598   /* option ROM cartridge */
593   MCFG_CARTSLOT_ADD("cart")
594   MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
595   MCFG_CARTSLOT_NOT_MANDATORY
599   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, NULL)
600   MCFG_GENERIC_EXTENSIONS("bin,rom")
596601
597602   /* I/O ROM cartridge */
598   MCFG_CARTSLOT_ADD("iocart")
599   MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
600   MCFG_CARTSLOT_NOT_MANDATORY
603   MCFG_GENERIC_CARTSLOT_ADD("io_cart", generic_linear_slot, NULL)
604   MCFG_GENERIC_EXTENSIONS("bin,rom")
601605
602606   /* internal ram */
603607   MCFG_RAM_ADD(RAM_TAG)
r32430r32431
634638   MCFG_FRAGMENT_ADD(pc8500_video)
635639
636640   /* option ROM cartridge */
637   MCFG_CARTSLOT_ADD("cart")
638   MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
639   MCFG_CARTSLOT_NOT_MANDATORY
641   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, NULL)
642   MCFG_GENERIC_EXTENSIONS("bin,rom")
640643
641644   /* I/O ROM cartridge */
642   MCFG_CARTSLOT_ADD("iocart")
643   MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
644   MCFG_CARTSLOT_NOT_MANDATORY
645   MCFG_GENERIC_CARTSLOT_ADD("io_cart", generic_linear_slot, NULL)
646   MCFG_GENERIC_EXTENSIONS("bin,rom")
645647
646648   /* internal ram */
647649   MCFG_RAM_ADD(RAM_TAG)
r32430r32431
654656ROM_START( pc8401a )
655657   ROM_REGION( 0x20000, Z80_TAG, ROMREGION_ERASEFF )
656658   ROM_LOAD( "pc8401a.bin", 0x0000, 0x18000, NO_DUMP )
657   ROM_CART_LOAD("cart", 0x18000, 0x8000, ROM_NOMIRROR | ROM_OPTIONAL)
658659
659660   ROM_REGION( 0x1000, "chargen", 0 )
660661   ROM_LOAD( "pc8441a.bin", 0x0000, 0x1000, NO_DUMP )
661
662   ROM_REGION( 0x40000, "iorom", ROMREGION_ERASEFF )
663   ROM_CART_LOAD("iocart", 0x00000, 0x40000, ROM_NOMIRROR | ROM_OPTIONAL)
664662ROM_END
665663
666664ROM_START( pc8500 )
667665   ROM_REGION( 0x20000, Z80_TAG, ROMREGION_ERASEFF )
668666   ROM_LOAD( "pc8500.bin", 0x0000, 0x10000, CRC(c2749ef0) SHA1(f766afce9fda9ec84ed5b39ebec334806798afb3) )
669   ROM_CART_LOAD("cart", 0x18000, 0x8000, ROM_NOMIRROR | ROM_OPTIONAL)
670667
671668   ROM_REGION( 0x1000, "chargen", 0 )
672669   ROM_LOAD( "pc8441a.bin", 0x0000, 0x1000, NO_DUMP )
673
674   ROM_REGION( 0x40000, "iorom", ROMREGION_ERASEFF )
675   ROM_CART_LOAD("iocart", 0x00000, 0x40000, ROM_NOMIRROR | ROM_OPTIONAL)
676670ROM_END
677671
678672/* System Drivers */
trunk/src/mess/drivers/gamecom.c
r32430r32431
103103
104104   //MCFG_NVRAM_ADD_0FILL("nvram")
105105
106
107106   /* video hardware */
108
109107   MCFG_SCREEN_ADD("screen", LCD)
110108   MCFG_SCREEN_REFRESH_RATE( 59.732155 )
111109   MCFG_SCREEN_VBLANK_TIME(500)
r32430r32431
126124   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.00)
127125
128126   /* cartridge */
129   MCFG_CARTSLOT_ADD("cart1")
130   MCFG_CARTSLOT_EXTENSION_LIST("bin,tgc")
131   MCFG_CARTSLOT_INTERFACE("gamecom_cart")
132   MCFG_CARTSLOT_LOAD(gamecom_state,gamecom_cart1)
127   MCFG_GENERIC_CARTSLOT_ADD("cartslot1", generic_linear_slot, "gamecom_cart")
128   MCFG_GENERIC_EXTENSIONS("bin,tgc")
129   MCFG_GENERIC_LOAD(gamecom_state, gamecom_cart1)
130
131   MCFG_GENERIC_CARTSLOT_ADD("cartslot2", generic_linear_slot, "gamecom_cart")
132   MCFG_GENERIC_EXTENSIONS("bin,tgc")
133   MCFG_GENERIC_LOAD(gamecom_state, gamecom_cart2)
134
133135   MCFG_SOFTWARE_LIST_ADD("cart_list","gamecom")
134   MCFG_CARTSLOT_ADD("cart2")
135   MCFG_CARTSLOT_EXTENSION_LIST("bin,tgc")
136   MCFG_CARTSLOT_INTERFACE("gamecom_cart")
137   MCFG_CARTSLOT_LOAD(gamecom_state,gamecom_cart2)
138136MACHINE_CONFIG_END
139137
140138ROM_START( gamecom )
r32430r32431
143141
144142   ROM_REGION( 0x40000, "kernel", 0 )
145143   ROM_LOAD( "external.bin", 0x00000, 0x40000, CRC(e235a589) SHA1(97f782e72d738f4d7b861363266bf46b438d9b50) )
146
147   ROM_REGION( 0x200000, "cart1", ROMREGION_ERASEFF )
148   ROM_REGION( 0x200000, "cart2", ROMREGION_ERASEFF )
149144ROM_END
150145
151146/*    YEAR  NAME     PARENT COMPAT MACHINE  INPUT    INIT    COMPANY  FULLNAME */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team