drw80pkr.c:

- Added Save State Support
- Added Preliminary Dip Switch Settings
- Corrected CPU Clock Value
- Corrected Sound (Now Works)
- Narrowed Down More IO R/W Areas
This commit is contained in:
Jim Stolis 2009-11-20 18:09:08 +00:00
parent 01afdeded1
commit 209ad304a0

View File

@ -29,18 +29,42 @@
#include "sound/ay8910.h"
#include "cpu/mcs48/mcs48.h"
#define CPU_CLOCK XTAL_7_8643MHz
#define CPU_CLOCK XTAL_8MHz
#define DATA_NVRAM_SIZE 0x100
static tilemap *bg_tilemap;
static UINT8 t0, t1, p0, p1, p2, prog, bus;
static UINT8 attract_mode = 0;
static UINT8 active_bank = 0;
static UINT8 pkr_io_ram[0x100];
static UINT16 video_ram[0x0400];
static UINT8 color_ram[0x0400];
/********************
* NVRAM Handler *
********************/
static NVRAM_HANDLER( drw80pkr )
{
if (read_or_write)
{
mame_fwrite(file, pkr_io_ram, DATA_NVRAM_SIZE);
}
else
{
if (file)
{
mame_fread(file, pkr_io_ram, DATA_NVRAM_SIZE);
}
else
{
memset(pkr_io_ram, 0, DATA_NVRAM_SIZE);
}
}
}
/*****************
* Write Handlers *
@ -108,14 +132,8 @@ static WRITE8_HANDLER( drw80pkr_io_w )
tilemap_mark_tile_dirty(bg_tilemap, n_offs);
}
// ay8910 control port
if (p1 == 0xfc && p2 == 0xff && offset == 0x00)
ay8910_address_w(devtag_get_device(space->machine, "aysnd"), 0, data);
// ay8910_write_port_0_w
if (p1 == 0xfe && p2 == 0xff && offset == 0x00)
ay8910_data_w(devtag_get_device(space->machine, "aysnd"), 0, data);
if (p2 == 0xc7)
{
// CRTC Register
// R0 = 0x1f(31) Horizontal Total
// R1 = 0x18(24) Horizontal Displayed
@ -136,14 +154,37 @@ static WRITE8_HANDLER( drw80pkr_io_w )
// R11 = 0x00 Cursor End
// R12 = 0x00 Display Start Address (High)
// R13 = 0x00 Display Start Address (Low)
//if (p1 == 0xff && p2 == 0xc7)
}
if (p2 == 0xd7)
{
// CRTC Address
//if (p1 == 0xff && p2 == 0xd7)
}
if (p2 == 0xfb) {
pkr_io_ram[offset] = data;
}
if (p2 == 0xff)
{
if (p1 == 0xdf)
{
attract_mode = data; // Latch this for use in input reads (0x01 = attract mode, 0x00 = game in progress)
}
if (p1 == 0xdb || p1 == 0xef || p1 == 0xf7 || p1 == 0xfb)
{
// unknown, most likely lamps, meters, hopper etc.
}
// ay8910 control port
if (p1 == 0xfc)
ay8910_address_w(devtag_get_device(space->machine, "aysnd"), 0, data);
// ay8910_write_port_0_w
if (p1 == 0xfe)
ay8910_data_w(devtag_get_device(space->machine, "aysnd"), 0, data);
}
}
/****************
@ -209,6 +250,27 @@ static READ8_HANDLER( drw80pkr_io_r )
if (p2 == 0xff)
{
if (p1 == 0x5f || p1 == 0x9f || p1 == 0xdb)
{
// unknown
}
if (p1 == 0xfe)
{
// Dip switches tied to sound chip
//
// TODO: Unknown switch positions, but found the following flipping bits:
// SW.? = Double Up Option
// SW.? = Coin Denomination
// SW.4 = Payout Type (0=cash, 1=credit)
// SW.? = Use Joker in Deck
//
ret = 0x77; // double-up with credit payout
}
if ((attract_mode == 0x01 && p1 == 0xef) || p1 == 0xf7)
{
// TODO: Get Input Port Values
kbdin = ((input_port_read(space->machine, "IN1") & 0xaf ) << 8) + input_port_read(space->machine, "IN0");
@ -238,6 +300,7 @@ static READ8_HANDLER( drw80pkr_io_r )
case 0x0800: ret = 0x00; break; /* Bet */
}
}
}
return ret;
}
@ -403,6 +466,7 @@ static MACHINE_DRIVER_START( drw80pkr )
MDRV_PALETTE_INIT(drw80pkr)
MDRV_VIDEO_START(drw80pkr)
MDRV_VIDEO_UPDATE(drw80pkr)
MDRV_NVRAM_HANDLER(drw80pkr)
// sound hardware
MDRV_SPEAKER_STANDARD_MONO("mono")