From 6d3532866331995951bb737f0058d1bec287221c Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Sun, 11 Jan 2009 18:11:29 +0000 Subject: [PATCH] Various improvements to the Jackpool driver [Angelo Salese] * Added a second screen for some extra gfxs that are displayed on it; * Fixed colors; * Preliminary implementation of the transparency pens for the graphics,might not be correct; * Added inputs; * Cleaned-up the driver; Game seems to work fine,but can't accept coins,might be related to the eeprom. --- src/mame/drivers/jackpool.c | 344 ++++++++++++++++++++++-------------- 1 file changed, 215 insertions(+), 129 deletions(-) diff --git a/src/mame/drivers/jackpool.c b/src/mame/drivers/jackpool.c index 93e1f636930..124e4aa1461 100644 --- a/src/mame/drivers/jackpool.c +++ b/src/mame/drivers/jackpool.c @@ -1,129 +1,230 @@ -/* +/******************************************************************************************* -Poker game +Jackpot Cards / Jackpot Pool (c) 1997 Electronic Projects -Copyright (C) 1992 HI-TECH Software..Brisbane, QLD Australia - is present in the ROMs, although the game is in Italian - and has a 1997 copyright, its probably a bootleg +driver by David Haywood & Angelo Salese -*/ +Notes: +-There's a "(c) 1992 HI-TECH Software..Brisbane, QLD Australia" string in the program roms, + this is actually the m68k C compiler used for doing this game. + +TODO: +-Correct NVRAM emulation (and default eeprom too?); +-Doesn't accept coins? (might be related to the eeprom); +-Transparent pen issue on the text layer? (might be a btanb); +-Understand master-slave comms properly; + +*******************************************************************************************/ #include "driver.h" #include "cpu/m68000/m68000.h" -#include "deprecat.h" #include "sound/okim6295.h" +#include "machine/eeprom.h" +#include "rendlay.h" -static tilemap *jackpool_layer0_tilemap; -static UINT16 *jackpool_layer0_videoram; -static tilemap *jackpool_layer1_tilemap; -static UINT16 *jackpool_layer1_videoram; -static tilemap *jackpool_layer2_tilemap; -static UINT16 *jackpool_layer2_videoram; +static UINT16 *sc0_vram; +static UINT16 *sc1_vram; +static UINT16 *sc2_vram; +static UINT16 *sc3_vram; +static UINT16 *jackpool_io; -static TILE_GET_INFO( get_jackpool_layer0_tile_info ) +static VIDEO_START(jackpool) { - int tileno,attr; - - tileno = jackpool_layer0_videoram[tile_index]&0x7fff; - attr = jackpool_layer0_videoram[tile_index+0x800]&0x1f; - - SET_TILE_INFO(0,tileno,attr,0); } -static WRITE16_HANDLER( jackpool_layer0_videoram_w ) +static VIDEO_UPDATE(jackpool) { - COMBINE_DATA(&jackpool_layer0_videoram[offset]); + const device_config *left_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "left"); + const device_config *right_screen = device_list_find_by_tag(screen->machine->config->devicelist, VIDEO_SCREEN, "right"); + const gfx_element *gfx = screen->machine->gfx[0]; + int count;// = 0x00000/2; - tilemap_mark_tile_dirty(jackpool_layer0_tilemap,offset&0x07ff); + int y,x; + + if(screen == left_screen) + { + count = 0x0000/2; + for (y=0;y<32;y++) + { + for (x=0;x<64;x++) + { + int tile = (sc1_vram[count] & 0x7fff); + int attr = (sc1_vram[count+0x800] & 0x1f00)>>8; + //int t_pen = (sc1_vram[count+0x800] & 0x2000); + //int colour = tile>>12; + drawgfx(bitmap,gfx,tile,attr,0,0,x*8,y*8,cliprect,TRANSPARENCY_NONE,0); + + count++; + } + } + + count = 0x0000/2; + for (y=0;y<32;y++) + { + for (x=0;x<64;x++) + { + int tile = (sc0_vram[count] & 0x7fff); + int attr = (sc0_vram[count+0x800] & 0x1f00)>>8; + /*might just be sloppy coding,colors are enabled as 0x20-0x3f*/ + int t_pen = (sc0_vram[count+0x800] & 0x2000); + //int colour = tile>>12; + drawgfx(bitmap,gfx,tile,attr,0,0,x*8,y*8,cliprect,(t_pen) ? TRANSPARENCY_NONE : TRANSPARENCY_PEN,0); + count++; + } + } + } + + if(screen == right_screen) + { + count = 0x0000/2; + for (y=0;y<32;y++) + { + for (x=0;x<64;x++) + { + int tile = (sc2_vram[count] & 0x7fff); + int attr = (sc2_vram[count+0x800] & 0x1f00)>>8; + //int t_pen = (sc1_vram[count+0x800] & 0x2000); + //int colour = tile>>12; + drawgfx(bitmap,gfx,tile,attr,0,0,x*8,y*8,cliprect,TRANSPARENCY_NONE,0); + + count++; + } + } + + count = 0x0000/2; + for (y=0;y<32;y++) + { + for (x=0;x<64;x++) + { + int tile = (sc3_vram[count] & 0x7fff); + int attr = (sc3_vram[count+0x800] & 0x1f00)>>8; + /*might just be sloppy coding,colors are enabled as 0x20-0x3f*/ + int t_pen = (sc3_vram[count+0x800] & 0x2000); + //int colour = tile>>12; + drawgfx(bitmap,gfx,tile,attr,0,0,x*8,y*8,cliprect,(t_pen) ? TRANSPARENCY_NONE : TRANSPARENCY_PEN,0); + count++; + } + } + } + + return 0; } -static TILE_GET_INFO( get_jackpool_layer1_tile_info ) -{ - int tileno,attr; - - tileno = jackpool_layer1_videoram[tile_index]&0x7fff; - attr = jackpool_layer1_videoram[tile_index+0x800]&0x1f; - - SET_TILE_INFO(0,tileno,attr,0); -} - -static WRITE16_HANDLER( jackpool_layer1_videoram_w ) -{ - COMBINE_DATA(&jackpool_layer1_videoram[offset]); - - tilemap_mark_tile_dirty(jackpool_layer1_tilemap,offset&0x07ff); -} - -static TILE_GET_INFO( get_jackpool_layer2_tile_info ) -{ - int tileno,attr; - - tileno = jackpool_layer2_videoram[tile_index]&0x7fff; - attr = jackpool_layer2_videoram[tile_index+0x800]&0x1f; - - SET_TILE_INFO(0,tileno,attr,0); -} - -static WRITE16_HANDLER( jackpool_layer2_videoram_w ) -{ - COMBINE_DATA(&jackpool_layer2_videoram[offset]); - - tilemap_mark_tile_dirty(jackpool_layer2_tilemap,offset&0x07ff); -} - - - -static READ16_HANDLER( jackpool_io_r ) +/*Communication ram*/ +static READ16_HANDLER( jackpool_ff_r ) { return 0xffff; } -static ADDRESS_MAP_START( jackpool_readmem, ADDRESS_SPACE_PROGRAM, 16 ) - AM_RANGE(0x000000, 0x03ffff) AM_READ(SMH_ROM) - AM_RANGE(0x100000, 0x10ffff) AM_READ(SMH_RAM) +static READ16_HANDLER( jackpool_io_r ) +{ + switch(offset*2) + { + case 0x0: return input_port_read(space->machine,"COIN1"); + case 0x8: return input_port_read(space->machine,"SERVICE1"); + case 0xa: return input_port_read(space->machine,"SERVICE2");//probably not a button + case 0xc: return input_port_read(space->machine,"PAYOUT"); + case 0xe: return input_port_read(space->machine,"START2"); + case 0x10: return input_port_read(space->machine,"HOLD3"); + case 0x12: return input_port_read(space->machine,"HOLD4"); + case 0x14: return input_port_read(space->machine,"HOLD2"); + case 0x16: return input_port_read(space->machine,"HOLD1"); + case 0x18: return input_port_read(space->machine,"HOLD5"); + case 0x1a: return input_port_read(space->machine,"START1"); + case 0x1c: return input_port_read(space->machine,"BET"); +// case 0x2c: eeprom 1 r? +// case 0x2e: eeprom 2 r? + } - AM_RANGE(0x120000, 0x1200ff) AM_READ(SMH_RAM) // maybe nvram? +// printf("R %02x\n",offset*2); + return jackpool_io[offset]; +} - AM_RANGE(0x340000, 0x34ffff) AM_READ(SMH_RAM) - AM_RANGE(0x360000, 0x3603ff) AM_READ(SMH_RAM) - AM_RANGE(0x380000, 0x38005f) AM_READ(SMH_RAM) +static WRITE16_HANDLER( jackpool_io_w ) +{ +// printf("W %02x %02x\n",offset*2,data); + COMBINE_DATA(&jackpool_io[offset]); - AM_RANGE(0x800000, 0x80000f) AM_READ(jackpool_io_r) + #if 0 + if(offset*2 == 0x54) + { + printf("Write bit %02x\n",data); + eeprom_write_bit(data & 1); + } + if(offset*2 == 0x52) + { + printf("Clock bit %02x\n",data); + eeprom_set_clock_line((data & 1) ? ASSERT_LINE : CLEAR_LINE ); + } + if(offset*2 == 0x50) + { + printf("chip select bit %02x\n",data); + eeprom_set_cs_line((data & 1) ? CLEAR_LINE : ASSERT_LINE ); + } + #endif +} - -ADDRESS_MAP_END - -static ADDRESS_MAP_START( jackpool_writemem, ADDRESS_SPACE_PROGRAM, 16 ) - AM_RANGE(0x000000, 0x03ffff) AM_WRITE(SMH_ROM) - AM_RANGE(0x100000, 0x10ffff) AM_WRITE(SMH_RAM) - - AM_RANGE(0x120000, 0x1200ff) AM_WRITE(SMH_RAM) - - AM_RANGE(0x340000, 0x341fff) AM_WRITE(jackpool_layer0_videoram_w) AM_BASE(&jackpool_layer0_videoram) - AM_RANGE(0x342000, 0x343fff) AM_WRITE(jackpool_layer1_videoram_w) AM_BASE(&jackpool_layer1_videoram) - AM_RANGE(0x344000, 0x345fff) AM_WRITE(jackpool_layer2_videoram_w) AM_BASE(&jackpool_layer2_videoram) // is this the same screen? - /* are the ones below used? */ - AM_RANGE(0x346000, 0x347fff) AM_WRITE(SMH_RAM) - AM_RANGE(0x348000, 0x349fff) AM_WRITE(SMH_RAM) - AM_RANGE(0x34a000, 0x34bfff) AM_WRITE(SMH_RAM) - AM_RANGE(0x34c000, 0x34dfff) AM_WRITE(SMH_RAM) - AM_RANGE(0x34e000, 0x34ffff) AM_WRITE(SMH_RAM) - - AM_RANGE(0x360000, 0x3603ff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16) - AM_RANGE(0x380000, 0x38005f) AM_WRITE(SMH_RAM) -ADDRESS_MAP_END - -#if 0 -static ADDRESS_MAP_START( roulette_map, ADDRESS_SPACE_PROGRAM, 16 ) +static ADDRESS_MAP_START( jackpool_mem, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x000000, 0x03ffff) AM_ROM -ADDRESS_MAP_END -#endif + AM_RANGE(0x100000, 0x10ffff) AM_RAM + AM_RANGE(0x120000, 0x1200ff) AM_RAM + AM_RANGE(0x340000, 0x341fff) AM_RAM AM_BASE(&sc0_vram) + AM_RANGE(0x342000, 0x343fff) AM_RAM AM_BASE(&sc1_vram) + AM_RANGE(0x344000, 0x345fff) AM_RAM AM_BASE(&sc2_vram) + AM_RANGE(0x346000, 0x347fff) AM_RAM AM_BASE(&sc3_vram) + /* are the ones below used? */ + AM_RANGE(0x348000, 0x349fff) AM_RAM + AM_RANGE(0x34a000, 0x34bfff) AM_RAM + AM_RANGE(0x34c000, 0x34dfff) AM_RAM + AM_RANGE(0x34e000, 0x34ffff) AM_RAM + AM_RANGE(0x360000, 0x3603ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16) + AM_RANGE(0x380000, 0x380061) AM_READWRITE(jackpool_io_r,jackpool_io_w) AM_BASE(&jackpool_io)//AM_READ(jackpool_io_r) + + AM_RANGE(0x800000, 0x80000f) AM_READ(jackpool_ff_r) AM_WRITENOP + AM_RANGE(0xa00000, 0xa00001) AM_READWRITE(okim6295_status_0_lsb_r, okim6295_data_0_lsb_w) +ADDRESS_MAP_END static INPUT_PORTS_START( jackpool ) + PORT_START("COIN1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("SERVICE1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) + PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("SERVICE2") //toggle this to change game to Jackpot Pool,with different gfxs for cards. + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) + PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("PAYOUT") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Payout") PORT_CODE(KEYCODE_W) + PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("START1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("START2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("BET") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Bet / Cancel") PORT_CODE(KEYCODE_A) + PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("HOLD1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z) + PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("HOLD2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X) + PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("HOLD3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C) + PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("HOLD4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V) + PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_START("HOLD5") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B) + PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END @@ -132,62 +233,48 @@ static const gfx_layout tiles8x8_layout = 8,8, RGN_FRAC(1,4), 4, - { RGN_FRAC(3,4),RGN_FRAC(2,4),RGN_FRAC(1,4),RGN_FRAC(0,4) }, + { RGN_FRAC(0,4),RGN_FRAC(1,4),RGN_FRAC(2,4),RGN_FRAC(3,4) }, { 0, 1, 2, 3, 4, 5, 6, 7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, 8*8 }; - - - -static VIDEO_START(jackpool) -{ - jackpool_layer0_tilemap = tilemap_create(machine, get_jackpool_layer0_tile_info,tilemap_scan_rows, 8, 8,64,32); - jackpool_layer1_tilemap = tilemap_create(machine, get_jackpool_layer1_tile_info,tilemap_scan_rows, 8, 8,64,32); - jackpool_layer2_tilemap = tilemap_create(machine, get_jackpool_layer2_tile_info,tilemap_scan_rows, 8, 8,64,32); - - tilemap_set_transparent_pen(jackpool_layer0_tilemap,0); - tilemap_set_transparent_pen(jackpool_layer2_tilemap,0); -} - -static VIDEO_UPDATE(jackpool) -{ - tilemap_draw(bitmap,cliprect,jackpool_layer1_tilemap,0,0); - tilemap_draw(bitmap,cliprect,jackpool_layer0_tilemap,0,0); - -// tilemap_draw(bitmap,cliprect,jackpool_layer2_tilemap,0,0); // is this actually a second display? - - return 0; -} - - static GFXDECODE_START( jackpool ) - GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0x000, 256 ) /* sprites */ + GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0x000, 0x20 ) /* sprites */ GFXDECODE_END -/* verify */ + +/*irq 2 used for communication stuff.3 is just a rte*/ static INTERRUPT_GEN( jackpool_interrupt ) { - cpu_set_input_line(device, cpu_getiloops(device)+1, HOLD_LINE); /* IRQs 3, 2, and 1 */ + cpu_set_input_line(device, 1, HOLD_LINE); } static MACHINE_DRIVER_START( jackpool ) MDRV_CPU_ADD("main", M68000, 12000000) // ? - MDRV_CPU_PROGRAM_MAP(jackpool_readmem,jackpool_writemem) - MDRV_CPU_VBLANK_INT_HACK(jackpool_interrupt,3) // ? + MDRV_CPU_PROGRAM_MAP(jackpool_mem,0) + MDRV_CPU_VBLANK_INT("left",jackpool_interrupt) // ? MDRV_GFXDECODE(jackpool) + MDRV_DEFAULT_LAYOUT(layout_dualhsxs) - - MDRV_SCREEN_ADD("main", RASTER) + MDRV_SCREEN_ADD("left", RASTER) MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MDRV_SCREEN_SIZE(64*8, 64*8) MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1) + MDRV_SCREEN_ADD("right", RASTER) + MDRV_SCREEN_REFRESH_RATE(60) + MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) + MDRV_SCREEN_SIZE(64*8, 64*8) + MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1) + + MDRV_NVRAM_HANDLER(93C46) + MDRV_PALETTE_LENGTH(0x200) MDRV_VIDEO_START(jackpool) @@ -198,7 +285,6 @@ static MACHINE_DRIVER_START( jackpool ) MDRV_SOUND_ADD("oki", OKIM6295, 1056000) MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - MACHINE_DRIVER_END @@ -217,4 +303,4 @@ ROM_START( jackpool ) ROM_LOAD( "jpc7", 0xc0000, 0x40000, CRC(b1d40623) SHA1(fb76ae6b53474bd4bee19dbce9537da0f2b63ff4) ) ROM_END -GAME( 1997, jackpool, 0, jackpool, jackpool, 0, ROT0, "Electronic Projects", "Jackpot Pool (Italy, bootleg)",GAME_NOT_WORKING ) +GAME( 1997, jackpool, 0, jackpool, jackpool, 0, ROT0, "Electronic Projects", "Jackpot Cards / Jackpot Pool (Italy)",GAME_NOT_WORKING )