Previous 199869 Revisions Next

r33685 Friday 5th December, 2014 at 07:53:26 UTC by Miodrag Milanović
New System Drivers Supported:
-gamate [PeT]

-gamate bios and cartridges [Peter Wilhelmsen,Morten Shearman Kirkegaard]
[src/mess/drivers]gamate.c

trunk/src/mess/drivers/gamate.c
r242196r242197
11/******************************************************************************
22 PeT mess@utanet.at 2007, 2014
3 Peter Wilhelmsen peter.wilhelmsen@gmail.com
4 Morten Shearman Kirkegaard morten+gamate@afdelingp.dk
35******************************************************************************/
46
57#include "emu.h"
r242196r242197
1517      : driver_device(mconfig, type, tag)
1618      , m_maincpu(*this, "maincpu")
1719      , m_cart(*this, "cartslot")
18//      , m_gfxdecode(*this, "gfxdecode")
20//      , m_gfxdecode(*this, "gfxdecode")
1921      , m_io_joy(*this, "JOY")
20      ,   m_palette(*this, "palette")
22      ,   m_palette(*this, "palette")
23      , m_cart_rom(*this, "cart_rom")
24      , m_bios(*this, "bios")
2125   { }
2226
2327   DECLARE_PALETTE_INIT(gamate);
24   DECLARE_READ8_MEMBER(video_r);
25   DECLARE_READ8_MEMBER(pad_r);
26   DECLARE_WRITE8_MEMBER(video_w);
27   DECLARE_WRITE8_MEMBER(audio_w);
28   DECLARE_WRITE8_MEMBER(bios_w);
28   DECLARE_READ8_MEMBER(protection_r);
29   DECLARE_READ8_MEMBER(gamate_cart_protection_r);
30   DECLARE_WRITE8_MEMBER(gamate_cart_protection_w);
31   DECLARE_READ8_MEMBER(gamate_video_r);
32   DECLARE_READ8_MEMBER(gamate_pad_r);
33   DECLARE_WRITE8_MEMBER(gamate_video_w);
34   DECLARE_READ8_MEMBER(gamate_audio_r);
35   DECLARE_WRITE8_MEMBER(gamate_audio_w);
36   DECLARE_WRITE8_MEMBER(gamate_bios_w);
2937   DECLARE_DRIVER_INIT(gamate);
3038   UINT32 screen_update_gamate(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3139   INTERRUPT_GEN_MEMBER(gamate_interrupt);
40   TIMER_CALLBACK_MEMBER(gamate_timer);
41   TIMER_CALLBACK_MEMBER(gamate_timer2);
3242
3343private:
3444   virtual void machine_start();
3545
3646   struct
3747   {
38   UINT8 reg[8];
39   struct {
40      bool write; // else tilemap
41      bool page2; // else page1
42      UINT8 data[2][0x100][0x20];
43      } bitmap;
44   struct {
45      UINT8 data[32][32];
46   } tilemap;
47   UINT8 x, y;
48     UINT8 reg[8];
49     struct {
50       bool write;
51       bool page2; // else page1
52         UINT8 ypos, xpos/*tennis*/;
53       UINT8 data[2][0x100][0x20];
54     } bitmap;
55     UINT8 x, y;
56      bool y_increment;
4857   } video;
4958
50//  UINT8 m_ports[5];
51//  UINT8 m_ram[0x4000];
59   struct {
60      int bit_shifter;
61      UINT8 cartridge_byte;
62      UINT16 address; // in reality something more like short local cartridge address offset
63      bool unprotected;
64      bool failed;
65   } card_protection;
66
5267   required_device<cpu_device> m_maincpu;
5368   required_device<generic_slot_device> m_cart;
54//  required_device<gfxdecode_device> m_gfxdecode;
69//   required_device<gfxdecode_device> m_gfxdecode;
5570   required_ioport m_io_joy;
5671   required_device<palette_device> m_palette;
72   required_shared_ptr<UINT8> m_cart_rom;
73   required_shared_ptr<UINT8> m_bios;
74   emu_timer *timer1;
75   emu_timer *timer2;
5776};
5877
59WRITE8_MEMBER( gamate_state::video_w )
78WRITE8_MEMBER( gamate_state::gamate_cart_protection_w )
6079{
61   if (m_maincpu->pc()<0xf000)
62   logerror("%.6f %04x video write %04x %02x\n", machine().time().as_double(), m_maincpu->pc(), offset,data);
63   video.reg[offset]=data;
6480   switch (offset) {
65   case 1: video.bitmap.write=data&0x40;break; // probably y increment
66   case 4: video.bitmap.page2=data&0x80;video.x=data&0x7f;break;
67   case 5: video.y=data;break;
68   case 7:
69   if (video.bitmap.write) {
70      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) /*&& video.y<ARRAY_LENGTH(video.bitmap.data[0])*/)
71      video.bitmap.data[video.bitmap.page2][video.y][video.x]=data;
72      else
73      logerror("%.6f %04x video bitmap x %x invalid\n",machine().time().as_double(), m_maincpu->pc(), video.x);
74      video.y++;
75   } else {
76      if (video.x<ARRAY_LENGTH(video.tilemap.data[0]) && (video.y&0x1f)<ARRAY_LENGTH(video.tilemap.data))
77      video.tilemap.data[video.y&0x1f][video.x]=data;
78      else
79      logerror("%.6f %04x video tilemap %x %x invalid\n",machine().time().as_double(), m_maincpu->pc(), video.x, video.y);
80      video.x++;
81   case 0:
82      card_protection.failed= card_protection.failed || ((card_protection.cartridge_byte&0x80)!=0) != ((data&4)!=0);
83      card_protection.bit_shifter++;
84      if (card_protection.bit_shifter>=8) {
85         card_protection.cartridge_byte=m_cart_rom[card_protection.address++];
86         card_protection.bit_shifter=0;
87      }
88      break;
8189   }
90}
91READ8_MEMBER( gamate_state::gamate_cart_protection_r )
92{
93   UINT8 ret=1;
94   switch (offset) {
95   case 0:
96      ret=(card_protection.cartridge_byte&0x80)?2:0;
97      card_protection.cartridge_byte<<=1;
98      card_protection.bit_shifter++;
99      if (card_protection.bit_shifter>=8) {
100         card_protection.bit_shifter=0;
101         card_protection.cartridge_byte=m_cart_rom[card_protection.address++];
102         card_protection.unprotected=true;
103         if (!card_protection.failed) {
104         } // now protection chip on cartridge activates cartridge chip select on cpu accesses
105      }
106      break;
82107   }
108   return ret;
83109}
84110
85READ8_MEMBER( gamate_state::video_r )
111READ8_MEMBER( gamate_state::protection_r ) { return 1; }
112
113WRITE8_MEMBER( gamate_state::gamate_video_w )
86114{
87   if (offset!=6) return 0;
88   UINT8 data=0;
89   if (video.bitmap.write) {
90      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) /*&& video.y<ARRAY_LENGTH(video.bitmap.data[0])*/)
91      data=video.bitmap.data[video.bitmap.page2][video.y][video.x];
92      else
93      logerror("%.6f video bitmap x %x invalid\n",machine().time().as_double(),video.x);
94   } else {
95      if (video.x<ARRAY_LENGTH(video.tilemap.data[0]) && video.y<ARRAY_LENGTH(video.tilemap.data))
96      data=video.tilemap.data[video.y][video.x];
97      else
98      logerror("%.6f video tilemap %x %x invalid\n",machine().time().as_double(),video.x, video.y);
99   }
100   if (m_maincpu->pc()<0xf000)
101   logerror("%.6f video read %04x %02x\n",machine().time().as_double(),offset, data);
102   return data;
115  video.reg[offset]=data;
116  switch (offset) {
117  case 1: video.bitmap.write=data&0xc0; // more addressing mode
118      video.y_increment=data&0x40;
119      break;
120   case 2: video.bitmap.xpos=data;break; // at least 7 bits
121   case 3: video.bitmap.ypos=data;break; // at least 7 bits
122  case 4: video.bitmap.page2=data&0x80;video.x=data&0x7f;break;
123  case 5: video.y=data;break;
124  case 7:
125    if (video.bitmap.write) {
126      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) && video.y<ARRAY_LENGTH(video.bitmap.data[0]))
127        video.bitmap.data[video.bitmap.page2][video.y][video.x]=data;
128      else
129        logerror("%.6f %04x video bitmap x %x invalid\n",machine().time().as_double(), m_maincpu->pc(), video.x);
130    } else {
131        video.bitmap.data[0][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)]=data;
132    }   
133    if (video.y_increment) video.y++;
134      else video.x++;
135  }
103136}
104137
105WRITE8_MEMBER( gamate_state::audio_w )
138READ8_MEMBER( gamate_state::gamate_video_r )
106139{
107   //  logerror("%.6f audio write %04x %02x\n",timer_get_time(),offset,data);
140   if (offset!=6) return 0;
141  UINT8 data=0;
142  if (video.bitmap.write) {
143      if (video.x<ARRAY_LENGTH(video.bitmap.data[0][0]) && video.y<ARRAY_LENGTH(video.bitmap.data[0]))
144        data=video.bitmap.data[video.bitmap.page2][video.y][video.x];   
145      else
146        logerror("%.6f video bitmap x %x invalid\n",machine().time().as_double(),video.x);
147  } else {
148    data=video.bitmap.data[0][video.y][video.x&(ARRAY_LENGTH(video.bitmap.data[0][0])-1)];
149  }
150  if (m_maincpu->pc()<0xf000)
151    logerror("%.6f video read %04x %02x\n",machine().time().as_double(),offset, data);
152  return data;
108153}
109154
110WRITE8_MEMBER( gamate_state::bios_w )
155WRITE8_MEMBER( gamate_state::gamate_audio_w )
111156{
112   UINT8 *memory = memregion("maincpu")->base(); //memory_region (REGION_CPU1);
157  logerror("%.6f %04x audio write %04x %02x\n",machine().time().as_double(),m_maincpu->pc(),offset,data);
158}
113159
114   unsigned short stack=m_maincpu->sp();//cpu_get_reg(M6502_S)|0x100;
115   unsigned short address= memory[stack+1]|(memory[stack+2]<<8);
116   switch (offset) {
117   case 0x12:
118   logerror("%.6f bios api %04x %04x string:%04x x:%02x y:%02x\n",
119            machine().time().as_double(), offset|0xf000, address,
120            memory[0]|(memory[1]<<8), 0, 0);//cpu_get_reg(M6502_X), cpu_get_reg(M6502_Y) );
121   break;
122   case 0x15:
123   logerror("%.6f bios api %04x %04x string:%04x x:%02x y:%02x\n",
124            machine().time().as_double(), offset|0xf000, address,
125            memory[0]|(memory[1]<<8), 0, 0); //cpu_get_reg(M6502_X), cpu_get_reg(M6502_Y) );
126   break;
127   case 0x18:
128   logerror("%.6f bios api %04x %04x string:%04x\n",machine().time().as_double(), offset|0xf000, address,
129            memory[0]|(memory[1]<<8) );
130   break;
131   case 0x1b:
132   logerror("%.6f bios api %04x %04x string:%04x\n",machine().time().as_double(), offset|0xf000, address,
133            memory[0]|(memory[1]<<8) );
134   break;
135   case 0x1e:
136   logerror("%.6f bios api %04x %04x string:%04x\n",machine().time().as_double(), offset|0xf000, address,
137            memory[0]|(memory[1]<<8) );
138   break;
139   case 0x2a: // cube up menu lighting
140   logerror("%.6f bios api %04x %04x 1c1d:%04x a:%02x x:%02x y:%02x\n",
141            machine().time().as_double(), offset|0xf000, address,
142            memory[0x1c]|(memory[0x1d]<<8),
143            0,0,0);//cpu_get_reg(M6502_A), cpu_get_reg(M6502_X), cpu_get_reg(M6502_Y) );
144   break;
145   default:
146   logerror("%.6f bios api %04x %04x\n",machine().time().as_double(), offset|0xf000, address);
147   }
160READ8_MEMBER( gamate_state::gamate_audio_r )
161{
162  logerror("%.6f %04x audio read %04x \n",machine().time().as_double(),m_maincpu->pc(),offset);
163   return 0;
148164}
149165
150READ8_MEMBER( gamate_state::pad_r )
166
167READ8_MEMBER( gamate_state::gamate_pad_r )
151168{
152   UINT8 data=m_io_joy->read();//readinputport(0);
153   //  logerror("%.6f pad read %04x %02x\n",timer_get_time(),offset,data);
154   return data;
169  UINT8 data=m_io_joy->read();
170  return data;
155171}
156172
157173static ADDRESS_MAP_START( gamate_mem, AS_PROGRAM, 8, gamate_state )
158//  AM_RANGE(0x4000, 0x7fff) AM_READWRITE(gmaster_io_r, gmaster_io_w)
174    AM_RANGE(0x0000, 0x03ff) AM_RAM
175  AM_RANGE(0x4000, 0x400d) AM_READWRITE(gamate_audio_r, gamate_audio_w)
176  AM_RANGE(0x4400, 0x4400) AM_READ(gamate_pad_r)
177  AM_RANGE(0x5000, 0x5007) AM_READWRITE(gamate_video_r, gamate_video_w)
178  AM_RANGE(0x5a00, 0x5a00) AM_READ(protection_r)
159179
160   AM_RANGE(0x0000, 0x03ff) AM_RAM
161   AM_RANGE(0x4000, 0x400d) AM_WRITE(audio_w)
162   AM_RANGE(0x4400, 0x4400) AM_READ(pad_r)
163//  AM_RANGE(0x5006, 0x5006) AM_READ(video_r)
164//  AM_RANGE(0x5000, 0x5007) AM_WRITE(video_w)
165   AM_RANGE(0x5000, 0x5007) AM_READWRITE(video_r, video_w)
166
167   AM_RANGE(0x6000, 0xdfff) AM_ROM
168   AM_RANGE(0xf000, 0xffff) AM_ROM
180  AM_RANGE(0x6000, 0xdfff) AM_ROM AM_SHARE("cart_rom")
181   AM_RANGE(0x6000, 0x6002) AM_READWRITE(gamate_cart_protection_r, gamate_cart_protection_w)
182//   AM_RANGE(0x6000, 0xdfff) AM_READWRITE(gamate_cart_r, gamate_cart_w)
183  AM_RANGE(0xf000, 0xffff) AM_ROM AM_SHARE("bios")
169184ADDRESS_MAP_END
170185
171186
r242196r242197
173188   PORT_START("JOY")
174189   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP)
175190   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
176   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) // left?
177   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) // rechts?
191   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
192   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
178193   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A")
179194   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("B")
180195   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START) PORT_NAME("start/pause")
181196   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("select")
182197INPUT_PORTS_END
183198
184#if 0
185199static const struct gfx_layout gamate_charlayout =
186200{
187      4,      /* width of object */
188      1,      /* height of object */
189      256,/* 256 characters */
190      2,      /* bits per pixel */
191      { 0,1 }, /* no bitplanes */
192      /* x offsets */
193      { 0,2,4,6 },
194      /* y offsets */
195      { 0 },
196      8*1 /* size of 1 object in bits */
201        4,      /* width of object */
202        1,      /* height of object */
203        256,/* 256 characters */
204        2,      /* bits per pixel */
205        { 0,1 }, /* no bitplanes */
206        /* x offsets */
207        { 0,2,4,6 },
208        /* y offsets */
209        { 0 },
210        8*1 /* size of 1 object in bits */
197211};
198212
199213static const unsigned short gamate_palette[4] =
200214{
201215   0,1,2,3
202216};
203#endif
204217
205218/* palette in red, green, blue tribles */
206219static const unsigned char gamate_colors[4][3] =
207220{
208   { 255,255,255 },
209   { 0xa0, 0xa0, 0xa0 },
210   { 0x60, 0x60, 0x60 },
211   { 0, 0, 0 }
221  { 255,255,255 },
222  { 0xa0, 0xa0, 0xa0 },
223  { 0x60, 0x60, 0x60 },
224  { 0, 0, 0 }
212225};
213226
214#if 0
215227static GFXDECODE_START( gamate_charlayout )
216      GFXDECODE_ENTRY( "gfx1", 0x0000, gamate_charlayout, 0, 0x100 )
228        GFXDECODE_ENTRY( "gfx1", 0x0000, gamate_charlayout, 0, 0x100 )
217229GFXDECODE_END
218#endif
219230
220231PALETTE_INIT_MEMBER(gamate_state, gamate)
221232{
r242196r242197
245256
246257UINT32 gamate_state::screen_update_gamate(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
247258{
248   int x, y, j;
249   for (y=0;y<160;y++) {
250   for (x=0, j=0;x<160;x+=8, j++) {
251//  for (y=0;y<256;y++) {
252//    for (x=0, j=0;x<256;x+=8, j++) {
253      UINT8 d1=video.bitmap.data[0][y][j];
254      UINT8 d2=video.bitmap.data[1][y][j];
255#if 0
256      UINT16 data=PLANES2_2_PACKED(d1, d2);
257      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), (data>>8)&0xff,0,0,0, x, y);
258      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), data&0xff,0,0,0, x+4, y);
259#else
259  int x, y, j;
260  for (y=0;y<160;y++) {
261    for (x=0, j=0;x<160;x+=8, j++) {
262//      UINT8 d1=video.bitmap.data[0][(y+video.bitmap.ypos)&0xff][j+video.bitmap.xpos/8];
263//      UINT8 d2=video.bitmap.data[1][(y+video.bitmap.ypos)&0xff][j+video.bitmap.xpos/8];
264      UINT8 d1=video.bitmap.data[0][(y+video.bitmap.ypos)%200][j]; // kill shot, tornade
265      UINT8 d2=video.bitmap.data[1][(y+video.bitmap.ypos)%200][j];
260266         BlitPlane(&bitmap.pix16(y, x+4), d1, d2);
261267         BlitPlane(&bitmap.pix16(y, x), d1>>4, d2>>4);
262#endif
263   }
264   }
265   for (y=0; y<32; y++) {
266   for (x=0; x<32; x++) {
267#if 0
268      UINT8 d=video.tilemap.data[y][x];
269      if (d) {
270      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8);
271      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8+1);
272      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8+2);
273      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8+3);
274      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8+4);
275      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8+5);
276      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8+6);
277      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8+7);
278      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8);
279      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8+1);
280      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8+2);
281      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8+3);
282      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8+4);
283      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8+5);
284      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8+6);
285      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8+7);
286      } else {
287      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8);
288      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8+1);
289      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8+2);
290      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8+3);
291      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8+4);
292      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8+5);
293      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8+6);
294      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8+7);
295      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8);
296      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8+1);
297      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8+2);
298      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8+3);
299      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8+4);
300      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8+5);
301      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8+6);
302      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8+7);
303      }
304#endif
305   }
306   }
268    }
269  }
307270   return 0;
308271}
309272
310273DRIVER_INIT_MEMBER(gamate_state,gamate)
311274{
312275   memset(&video, 0, sizeof(video));/* memset(m_ram, 0, sizeof(m_ram));*/
313   UINT8 *gfx=memregion("gfx1")->base();   for (int i=0; i<256; i++) gfx[i]=i;
276   UINT8 *gfx=memregion("gfx1")->base();   for (int i=0; i<256; i++) gfx[i]=i;
277   timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer),this));
278   timer2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamate_state::gamate_timer2),this));
314279}
315280
316281
317282void gamate_state::machine_start()
318283{
319   if (m_cart->exists())
284   if (m_cart->exists()) {
320285      m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0xdfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart));
286//      m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, READ8_DELEGATE(gamate_state, gamate_cart_protection_r));
287   }
288   m_bios[0xdf1]=0xea; m_bios[0xdf2]=0xea; // $47 protection readback
289   card_protection.address=0x6005-0x6001;
290   card_protection.bit_shifter=0;
291   card_protection.cartridge_byte=m_cart_rom[card_protection.address++];
292   card_protection.failed=false;
293   card_protection.unprotected=false;
294   timer2->enable(TRUE);
295   timer2->reset(m_maincpu->cycles_to_attotime(1000));
321296#if 0
322297   save_item(NAME(m_video.data));
323298   save_item(NAME(m_video.index));
r242196r242197
331306#endif
332307}
333308
309TIMER_CALLBACK_MEMBER(gamate_state::gamate_timer)
310{
311   m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE);
312   timer1->enable(FALSE);
313}
334314
315TIMER_CALLBACK_MEMBER(gamate_state::gamate_timer2)
316{
317   m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE);
318   timer1->enable(TRUE);
319   timer1->reset(m_maincpu->cycles_to_attotime(10/* cycles short enought to clear irq line early enough*/));
320   timer2->enable(TRUE);
321   timer2->reset(m_maincpu->cycles_to_attotime(40000));
322}
323
324
335325INTERRUPT_GEN_MEMBER(gamate_state::gamate_interrupt)
336326{
337//  m_maincpu->set_input_line(UPD7810_INTFE1, ASSERT_LINE);
338   static bool state=false;
339//  m_maincpu->set_input_line(M6502_IRQ_LINE, state?ASSERT_LINE: CLEAR_LINE);
340   state=!state;
341//  cpu_set_irq_line(0, M6502_INT_IRQ, PULSE_LINE);
342327}
343328
344329static MACHINE_CONFIG_START( gamate, gamate_state )
r242196r242197
348333
349334   MCFG_SCREEN_ADD("screen", LCD)
350335   MCFG_SCREEN_REFRESH_RATE(60)
351#if 0
352   MCFG_SCREEN_SIZE(512, 256)
353   MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
336#ifdef SHOW_TILEMAP
337   MCFG_SCREEN_SIZE(256, 152+256)
338   MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 152+256-1)
354339#else
355   MCFG_SCREEN_SIZE(160, 160)
356   MCFG_SCREEN_VISIBLE_AREA(0, 160-1, 0, 160-1)
340   MCFG_SCREEN_SIZE(160, 152)
341   MCFG_SCREEN_VISIBLE_AREA(0, 160-1, 0, 152-1)
357342#endif
358343   MCFG_SCREEN_UPDATE_DRIVER(gamate_state, screen_update_gamate)
359344   MCFG_SCREEN_PALETTE("palette")
360345
361//  MCFG_GFXDECODE_ADD("gfxdecode", "palette", gamate )
346//   MCFG_GFXDECODE_ADD("gfxdecode", "palette", gamate )
362347   MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gamate_colors))
363//  MCFG_PALETTE_INDIRECT_ENTRIES(4)
348//   MCFG_PALETTE_INDIRECT_ENTRIES(4)
364349   MCFG_PALETTE_INIT_OWNER(gamate_state, gamate)
365350   MCFG_DEFAULT_LAYOUT(layout_lcd)
366351
367352   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "gamate_cart")
368353   MCFG_GENERIC_MANDATORY
369354
370   MCFG_SOFTWARE_LIST_ADD("cart_list", "gamate")
355   MCFG_SOFTWARE_LIST_ADD("cart_list","gamate")
371356MACHINE_CONFIG_END
372357
373358
374359ROM_START(gamate)
375360   ROM_REGION(0x10000,"maincpu", 0)
376   ROM_LOAD("gamate.bin", 0xf000, 0x1000, BAD_DUMP CRC(b8bf539b) SHA1(d00cb43b8a4cb0cc7fea06bee5f08490a71f5690) )
377//  ROM_LOAD("gamate.bin", 0xf000, 0x1000, CRC(b8bf539b) SHA1(d00cb43b8a4cb0cc7fea06bee5f08490a71f5690) )
378   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
361   ROM_LOAD("gamate_bios_umc.bin", 0xf000, 0x1000, CRC(07090415) SHA1(ea449dc607601f9a68d855ad6ab53800d2e99297) )
362 ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
379363ROM_END
380364
381365
382366/*    YEAR  NAME      PARENT  COMPAT    MACHINE   INPUT    CLASS          INIT      COMPANY    FULLNAME */
383CONS( 19??, gamate,  0,      0,        gamate,  gamate, gamate_state, gamate, "Bit Corp", "Gamate", GAME_NOT_WORKING | GAME_NO_SOUND)
367CONS( 19??, gamate,  0,      0,        gamate,  gamate, gamate_state, gamate, "Bit Corp", "Gamate", GAME_NO_SOUND)
368
369


Previous 199869 Revisions Next


© 1997-2024 The MAME Team