r8617 Sunday 25th July, 2010 at 13:33:39 UTC by Angelo Salese
[RX-78]: Implemented ramsize option, added joypad mappings and did some other minor tweaks
[src/mess/drivers]rx78.c

src/mess/drivers/rx78.c
r8616r8617
1/***************************************************************************
1/************************************************************************************************************
22
33   Gundam RX-78 (c) 1983 Bandai
44
55   preliminary driver by Angelo Salese
66
77   TODO:
8   - caps lock doesn't seem quite right;
9   - implement cmt / printer (hovewer no dumps are available right now)
10   - implement joystick inputs
8   - implement cmt (hovewer no dumps are available right now)
9   - implement printer
10   - caps lock doesn't seem quite right, I need to press it twice to have the desired effect;
1111
12****************************************************************************/
12   Notes:
13   - BS-BASIC v1.0 have a graphic bug with the RX-78 logo, it doesn't set the read bank so all of the color
14     info minus plane 1 is lost when the screen scrolls vertically. Almost certainly a btanb.
15   - To stop a cmt load, press STOP + SHIFT keys
1316
17*************************************************************************************************************/
18
1419#include "emu.h"
1520#include "cpu/z80/z80.h"
1621#include "sound/sn76496.h"
1722#include "devices/cartslot.h"
23#include "devices/messram.h"
1824
25#define MASTER_CLOCK XTAL_28_63636MHz
26
1927static UINT8 vram_read_bank,vram_write_bank,pal_reg[7],pri_mask;
2028
2129static VIDEO_START( rx78 )
r8616r8617
9098      return res;
9199   }
92100
93   if(key_mux >= 1 && key_mux <= 9)
101   if(key_mux >= 1 && key_mux <= 15)
94102      return input_port_read(space->machine, keynames[key_mux - 1]);
95103
96104   return 0;
r8616r8617
105113{
106114   static UINT8 *vram = memory_region(space->machine,"vram");
107115
108   if(vram_read_bank == 0 || vram_read_bank > 6)
116   if(vram_read_bank == 0) //|| vram_read_bank > 6)
109117      return 0xff;
110118
111119   return vram[offset + ((vram_read_bank - 1) * 0x2000)];
r8616r8617
169177   pri_mask = data;
170178}
171179
180
172181static ADDRESS_MAP_START(rx78_mem, ADDRESS_SPACE_PROGRAM, 8)
173182   ADDRESS_MAP_UNMAP_HIGH
174183   AM_RANGE(0x0000, 0x1fff) AM_ROM
r8616r8617
183192   ADDRESS_MAP_GLOBAL_MASK(0xff)
184193//   AM_RANGE(0xe2, 0xe2) AM_READNOP AM_WRITENOP //printer
185194//   AM_RANGE(0xe3, 0xe3) AM_WRITENOP //printer
186//   AM_RANGE(0xf0, 0xf0) AM_NOP //cmt
195//   AM_RANGE(0xf0, 0xf0) AM_READ(cmt_r) //cmt
187196   AM_RANGE(0xf1, 0xf1) AM_WRITE(vram_read_bank_w)
188197   AM_RANGE(0xf2, 0xf2) AM_WRITE(vram_write_bank_w)
189198   AM_RANGE(0xf4, 0xf4) AM_READWRITE(key_r,key_w) //keyboard
r8616r8617
280289   PORT_BIT(0xf8,IP_ACTIVE_HIGH,IPT_UNUSED )
281290
282291   PORT_START("JOY1P_0")
283   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
292   PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
293   PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P1 Up Left") PORT_PLAYER(1)
294   PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
295   PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
296
284297   PORT_START("JOY1P_1")
285   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
298   PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P1 Down Left")  PORT_PLAYER(1)
299   PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P1 Up Right") PORT_PLAYER(1)
300   PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_UNUSED )
301   PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_UNUSED )
302
286303   PORT_START("JOY1P_2")
287   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
304   PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY  PORT_PLAYER(1)
305   PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P1 Down Right") PORT_PLAYER(1)
306   PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY  PORT_PLAYER(1)
307   PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)
308
288309   PORT_START("JOY2P_0")
289   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
310   PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
311   PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P2 Up Left") PORT_PLAYER(2)
312   PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
313   PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
314
290315   PORT_START("JOY2P_1")
291   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
316   PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P2 Down Left")  PORT_PLAYER(2)
317   PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P2 Up Right") PORT_PLAYER(2)
318   PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_UNUSED )
319   PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_UNUSED )
320
292321   PORT_START("JOY2P_2")
293   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
322   PORT_BIT( 0x11, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY  PORT_PLAYER(2)
323   PORT_BIT( 0x22, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("P2 Down Right") PORT_PLAYER(2)
324   PORT_BIT( 0x44, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY  PORT_PLAYER(2)
325   PORT_BIT( 0x88, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
326
294327   PORT_START("UNUSED")
295328   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
296329INPUT_PORTS_END
r8616r8617
320353
321354static MACHINE_DRIVER_START( rx78 )
322355    /* basic machine hardware */
323    MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz)   // 4.1mhz
356    MDRV_CPU_ADD("maincpu",Z80, MASTER_CLOCK/7)   // unknown divider
324357    MDRV_CPU_PROGRAM_MAP(rx78_mem)
325358    MDRV_CPU_IO_MAP(rx78_io)
326359   MDRV_CPU_VBLANK_INT("screen",irq0_line_hold)
r8616r8617
329362
330363    /* video hardware */
331364    MDRV_SCREEN_ADD("screen", RASTER)
332    MDRV_SCREEN_REFRESH_RATE(50)
365    MDRV_SCREEN_REFRESH_RATE(60)
333366    MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
334367    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
335368    MDRV_SCREEN_SIZE(192, 184)
336369    MDRV_SCREEN_VISIBLE_AREA(0, 192-1, 0, 184-1)
337370    MDRV_PALETTE_LENGTH(16+1) //+1 for the background color
338//  MDRV_PALETTE_INIT(black_and_white)
339371   MDRV_GFXDECODE(rx78)
340372
341373    MDRV_VIDEO_START(rx78)
r8616r8617
345377   MDRV_CARTSLOT_EXTENSION_LIST("rom")
346378   MDRV_CARTSLOT_NOT_MANDATORY
347379
380   MDRV_RAM_ADD("messram")
381   MDRV_RAM_DEFAULT_SIZE("32k")
382   MDRV_RAM_EXTRA_OPTIONS("16k")
383
348384   MDRV_SPEAKER_STANDARD_MONO("mono")
349385
350   MDRV_SOUND_ADD("sn1", SN76489A, 3579545) // unknown divider
386   MDRV_SOUND_ADD("sn1", SN76489A, XTAL_28_63636MHz/8) // unknown divider
351387   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
352388MACHINE_DRIVER_END
353389
r8616r8617
362398   ROM_REGION( 6 * 0x2000, "vram", ROMREGION_ERASE00 )
363399ROM_END
364400
401static DRIVER_INIT( rx78 )
402{
403   UINT32 ram_size = messram_get_size(machine->device("messram"));
404   const address_space *prg = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
405
406   if(ram_size == 0x4000)
407      memory_unmap_readwrite(prg, 0x6000, 0xafff, 0, 0);
408}
409
365410/* Driver */
366411
367412/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT     COMPANY   FULLNAME       FLAGS */
368COMP( 1983, rx78,     0,       0,       rx78,    rx78,     0,       "Bandai",   "Gundam RX-78",      GAME_NOT_WORKING)
413COMP( 1983, rx78,     0,       0,       rx78,    rx78,     rx78,       "Bandai",   "Gundam RX-78",      GAME_NOT_WORKING)
369414

Previous 509070 RevisionsNext 50


© 1998-2010 The MESS Team