Previous 199869 Revisions Next

r33101 Saturday 1st November, 2014 at 06:40:10 UTC by Fabio Priuli
(MESS) added preliminary emulation of the Bit Corp Gamate [PeT]

out of whatsnew: I have also fixed a couple of compile errors detected by
the old Apple compiler I'm using
- "comparison is always true due to limited range of data type" at lines 70 & 90
- unused variable at line 263
[hash]gamate.xml*
[src/mess]mess.lst mess.mak
[src/mess/drivers]gamate.c*

trunk/hash/gamate.xml
r0r241613
1<?xml version="1.0"?>
2<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
3
4<softwarelist name="gamate" description="Bit Corp Gamate cartridges">
5
6   <software name="cubeup">
7      <description>Cube Up</description>
8      <year>19??</year>
9      <publisher>Bit Corp</publisher>
10      <part name="cart" interface="gamate_cart">
11         <dataarea name="rom" size="16384">
12            <rom name="cube up.bin" size="16384" crc="2a911e57" sha1="9d3b28887b6f375600bff29f8f233087b9152a60" offset="0x00000" />
13         </dataarea>
14      </part>
15   </software>
16
17
18</softwarelist>
trunk/src/mess/drivers/gamate.c
r0r241613
1/******************************************************************************
2 PeT mess@utanet.at 2007, 2014
3******************************************************************************/
4
5#include "emu.h"
6#include "cpu/m6502/m6502.h"
7#include "bus/generic/slot.h"
8#include "bus/generic/carts.h"
9#include "rendlay.h"
10
11class gamate_state : public driver_device
12{
13public:
14   gamate_state(const machine_config &mconfig, device_type type, const char *tag)
15      : driver_device(mconfig, type, tag)
16      , m_maincpu(*this, "maincpu")
17      , m_cart(*this, "cartslot")
18//      , m_gfxdecode(*this, "gfxdecode")
19      , m_io_joy(*this, "JOY")
20      ,   m_palette(*this, "palette")
21   { }
22
23   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);
29   DECLARE_DRIVER_INIT(gamate);
30   UINT32 screen_update_gamate(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
31   INTERRUPT_GEN_MEMBER(gamate_interrupt);
32
33private:
34   virtual void machine_start();
35
36   struct
37   {
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   } video;
49
50//  UINT8 m_ports[5];
51//  UINT8 m_ram[0x4000];
52   required_device<cpu_device> m_maincpu;
53   required_device<generic_slot_device> m_cart;
54//  required_device<gfxdecode_device> m_gfxdecode;
55   required_ioport m_io_joy;
56   required_device<palette_device> m_palette;
57};
58
59WRITE8_MEMBER( gamate_state::video_w )
60{
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;
64   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   }
82   }
83}
84
85READ8_MEMBER( gamate_state::video_r )
86{
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;
103}
104
105WRITE8_MEMBER( gamate_state::audio_w )
106{
107   //  logerror("%.6f audio write %04x %02x\n",timer_get_time(),offset,data);
108}
109
110WRITE8_MEMBER( gamate_state::bios_w )
111{
112   UINT8 *memory = *memregion("main_cpu"); //memory_region (REGION_CPU1);
113
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   }
148}
149
150READ8_MEMBER( gamate_state::pad_r )
151{
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;
155}
156
157static ADDRESS_MAP_START( gamate_mem, AS_PROGRAM, 8, gamate_state )
158//  AM_RANGE(0x4000, 0x7fff) AM_READWRITE(gmaster_io_r, gmaster_io_w)
159
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
169ADDRESS_MAP_END
170
171
172static INPUT_PORTS_START( gamate )
173   PORT_START("JOY")
174   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP)
175   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?
178   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("A")
179   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("B")
180   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START) PORT_NAME("start/pause")
181   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("select")
182INPUT_PORTS_END
183
184static const struct gfx_layout gamate_charlayout =
185{
186      4,      /* width of object */
187      1,      /* height of object */
188      256,/* 256 characters */
189      2,      /* bits per pixel */
190      { 0,1 }, /* no bitplanes */
191      /* x offsets */
192      { 0,2,4,6 },
193      /* y offsets */
194      { 0 },
195      8*1 /* size of 1 object in bits */
196};
197
198static const unsigned short gamate_palette[4] =
199{
200   0,1,2,3
201};
202
203/* palette in red, green, blue tribles */
204static const unsigned char gamate_colors[4][3] =
205{
206   { 255,255,255 },
207   { 0xa0, 0xa0, 0xa0 },
208   { 0x60, 0x60, 0x60 },
209   { 0, 0, 0 }
210};
211
212static GFXDECODE_START( gamate_charlayout )
213      GFXDECODE_ENTRY( "gfx1", 0x0000, gamate_charlayout, 0, 0x100 )
214GFXDECODE_END
215
216PALETTE_INIT_MEMBER(gamate_state, gamate)
217{
218   int i;
219
220   for (i = 0; i < 4; i++)
221   {
222      palette.set_pen_color(i, gamate_colors[i][0], gamate_colors[i][1], gamate_colors[i][2]);
223   }
224#if 0
225   for (int i = 0; i < 8; i++)
226      palette.set_indirect_color(i, arcadia_colors[i]);
227
228   for (int i = 0; i < 128+8; i++)
229      palette.set_pen_indirect(i, arcadia_palette[i]);
230#endif
231}
232
233
234static void BlitPlane(UINT16* line, UINT8 plane1, UINT8 plane2)
235{
236   line[3]=(plane1&1)|((plane2<<1)&2);
237   line[2]=((plane1>>1)&1)|((plane2<<0)&2);
238   line[1]=((plane1>>2)&1)|((plane2>>1)&2);
239   line[0]=((plane1>>3)&1)|((plane2>>2)&2);
240}
241
242UINT32 gamate_state::screen_update_gamate(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
243{
244   int x, y, j;
245   for (y=0;y<160;y++) {
246   for (x=0, j=0;x<160;x+=8, j++) {
247//  for (y=0;y<256;y++) {
248//    for (x=0, j=0;x<256;x+=8, j++) {
249      UINT8 d1=video.bitmap.data[0][y][j];
250      UINT8 d2=video.bitmap.data[1][y][j];
251#if 0
252      UINT16 data=PLANES2_2_PACKED(d1, d2);
253      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), (data>>8)&0xff,0,0,0, x, y);
254      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), data&0xff,0,0,0, x+4, y);
255#else
256         BlitPlane(&bitmap.pix16(y, x+4), d1, d2);
257         BlitPlane(&bitmap.pix16(y, x), d1>>4, d2>>4);
258#endif
259   }
260   }
261   for (y=0; y<32; y++) {
262   for (x=0; x<32; x++) {
263#if 0
264      UINT8 d=video.tilemap.data[y][x];
265      if (d) {
266      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8);
267      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8+1);
268      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8+2);
269      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8+3);
270      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8+4);
271      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8+5);
272      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8+6);
273      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 256+x*8, y*8+7);
274      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8);
275      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8+1);
276      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8+2);
277      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8+3);
278      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8+4);
279      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8+5);
280      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8+6);
281      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0xff,0,0,0, 260+x*8, y*8+7);
282      } else {
283      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8);
284      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8+1);
285      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8+2);
286      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8+3);
287      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8+4);
288      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8+5);
289      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8+6);
290      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 256+x*8, y*8+7);
291      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8);
292      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8+1);
293      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8+2);
294      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8+3);
295      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8+4);
296      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8+5);
297      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8+6);
298      m_gfxdecode->gfx(0)->opaque(bitmap, bitmap.cliprect(), 0,0,0,0, 260+x*8, y*8+7);
299      }
300#endif
301   }
302   }
303   return 0;
304}
305
306DRIVER_INIT_MEMBER(gamate_state,gamate)
307{
308   memset(&video, 0, sizeof(video));/* memset(m_ram, 0, sizeof(m_ram));*/
309   UINT8 *gfx=memregion("gfx1")->base();   for (int i=0; i<256; i++) gfx[i]=i;
310}
311
312
313void gamate_state::machine_start()
314{
315   if (m_cart->exists())
316      m_maincpu->space(AS_PROGRAM).install_read_handler(0x6000, 0xdfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart));
317#if 0
318   save_item(NAME(m_video.data));
319   save_item(NAME(m_video.index));
320   save_item(NAME(m_video.x));
321   save_item(NAME(m_video.y));
322   save_item(NAME(m_video.mode));
323   save_item(NAME(m_video.delayed));
324   save_item(NAME(m_video.pixels));
325   save_item(NAME(m_ports));
326   save_item(NAME(m_ram));
327#endif
328}
329
330
331INTERRUPT_GEN_MEMBER(gamate_state::gamate_interrupt)
332{
333//  m_maincpu->set_input_line(UPD7810_INTFE1, ASSERT_LINE);
334   static bool state=false;
335//  m_maincpu->set_input_line(M6502_IRQ_LINE, state?ASSERT_LINE: CLEAR_LINE);
336   state=!state;
337//  cpu_set_irq_line(0, M6502_INT_IRQ, PULSE_LINE);
338}
339
340static MACHINE_CONFIG_START( gamate, gamate_state )
341   MCFG_CPU_ADD("maincpu", M6502, 4433000)
342   MCFG_CPU_PROGRAM_MAP(gamate_mem)
343   MCFG_CPU_VBLANK_INT_DRIVER("screen", gamate_state,  gamate_interrupt)
344
345   MCFG_SCREEN_ADD("screen", LCD)
346   MCFG_SCREEN_REFRESH_RATE(60)
347#if 0
348   MCFG_SCREEN_SIZE(512, 256)
349   MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
350#else
351   MCFG_SCREEN_SIZE(160, 160)
352   MCFG_SCREEN_VISIBLE_AREA(0, 160-1, 0, 160-1)
353#endif
354   MCFG_SCREEN_UPDATE_DRIVER(gamate_state, screen_update_gamate)
355   MCFG_SCREEN_PALETTE("palette")
356
357//  MCFG_GFXDECODE_ADD("gfxdecode", "palette", gamate )
358   MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gamate_colors))
359//  MCFG_PALETTE_INDIRECT_ENTRIES(4)
360   MCFG_PALETTE_INIT_OWNER(gamate_state, gamate)
361   MCFG_DEFAULT_LAYOUT(layout_lcd)
362
363   MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "gamate_cart")
364   MCFG_GENERIC_MANDATORY
365
366   MCFG_SOFTWARE_LIST_ADD("cart_list", "gamate")
367MACHINE_CONFIG_END
368
369
370ROM_START(gamate)
371   ROM_REGION(0x10000,"maincpu", 0)
372   ROM_LOAD("gamate.bin", 0xf000, 0x1000, BAD_DUMP CRC(b8bf539b) SHA1(d00cb43b8a4cb0cc7fea06bee5f08490a71f5690) )
373//  ROM_LOAD("gamate.bin", 0xf000, 0x1000, CRC(b8bf539b) SHA1(d00cb43b8a4cb0cc7fea06bee5f08490a71f5690) )
374   ROM_REGION(0x100,"gfx1", ROMREGION_ERASEFF)
375ROM_END
376
377
378/*    YEAR  NAME      PARENT  COMPAT    MACHINE   INPUT    CLASS          INIT      COMPANY    FULLNAME */
379CONS( 19??, gamate,  0,      0,        gamate,  gamate, gamate_state, gamate, "Bit Corp", "Gamate", GAME_NOT_WORKING | GAME_NO_SOUND)
trunk/src/mess/mess.lst
r241612r241613
332332// EPOCH
333333gamepock  // Epoch Game Pocket Computer
334334
335// Bit Corp
336gamate   // Bit Corp Gamate
337
335338// KOEI
336339pasogo  // KOEI PasoGo
337340
trunk/src/mess/mess.mak
r241612r241613
18961896   $(MESS_DRIVERS)/fc100.o     \
18971897   $(MESS_DRIVERS)/fk1.o       \
18981898   $(MESS_DRIVERS)/ft68m.o     \
1899   $(MESS_DRIVERS)/gamate.o    \
18991900   $(MESS_DRIVERS)/gameking.o  \
19001901   $(MESS_DRIVERS)/gimix.o     \
19011902   $(MESS_DRIVERS)/grfd2301.o  \


Previous 199869 Revisions Next


© 1997-2024 The MAME Team