mirror of
https://github.com/holub/mame
synced 2025-07-04 09:28:51 +03:00
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:
parent
01afdeded1
commit
209ad304a0
@ -29,18 +29,42 @@
|
|||||||
#include "sound/ay8910.h"
|
#include "sound/ay8910.h"
|
||||||
#include "cpu/mcs48/mcs48.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 tilemap *bg_tilemap;
|
||||||
|
|
||||||
static UINT8 t0, t1, p0, p1, p2, prog, bus;
|
static UINT8 t0, t1, p0, p1, p2, prog, bus;
|
||||||
|
static UINT8 attract_mode = 0;
|
||||||
static UINT8 active_bank = 0;
|
static UINT8 active_bank = 0;
|
||||||
|
|
||||||
static UINT8 pkr_io_ram[0x100];
|
static UINT8 pkr_io_ram[0x100];
|
||||||
static UINT16 video_ram[0x0400];
|
static UINT16 video_ram[0x0400];
|
||||||
static UINT8 color_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 *
|
* Write Handlers *
|
||||||
@ -108,14 +132,8 @@ static WRITE8_HANDLER( drw80pkr_io_w )
|
|||||||
tilemap_mark_tile_dirty(bg_tilemap, n_offs);
|
tilemap_mark_tile_dirty(bg_tilemap, n_offs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ay8910 control port
|
if (p2 == 0xc7)
|
||||||
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);
|
|
||||||
|
|
||||||
// CRTC Register
|
// CRTC Register
|
||||||
// R0 = 0x1f(31) Horizontal Total
|
// R0 = 0x1f(31) Horizontal Total
|
||||||
// R1 = 0x18(24) Horizontal Displayed
|
// R1 = 0x18(24) Horizontal Displayed
|
||||||
@ -136,14 +154,37 @@ static WRITE8_HANDLER( drw80pkr_io_w )
|
|||||||
// R11 = 0x00 Cursor End
|
// R11 = 0x00 Cursor End
|
||||||
// R12 = 0x00 Display Start Address (High)
|
// R12 = 0x00 Display Start Address (High)
|
||||||
// R13 = 0x00 Display Start Address (Low)
|
// R13 = 0x00 Display Start Address (Low)
|
||||||
//if (p1 == 0xff && p2 == 0xc7)
|
}
|
||||||
|
|
||||||
|
if (p2 == 0xd7)
|
||||||
|
{
|
||||||
// CRTC Address
|
// CRTC Address
|
||||||
//if (p1 == 0xff && p2 == 0xd7)
|
}
|
||||||
|
|
||||||
if (p2 == 0xfb) {
|
if (p2 == 0xfb) {
|
||||||
pkr_io_ram[offset] = data;
|
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 (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
|
// TODO: Get Input Port Values
|
||||||
kbdin = ((input_port_read(space->machine, "IN1") & 0xaf ) << 8) + input_port_read(space->machine, "IN0");
|
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 */
|
case 0x0800: ret = 0x00; break; /* Bet */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -403,6 +466,7 @@ static MACHINE_DRIVER_START( drw80pkr )
|
|||||||
MDRV_PALETTE_INIT(drw80pkr)
|
MDRV_PALETTE_INIT(drw80pkr)
|
||||||
MDRV_VIDEO_START(drw80pkr)
|
MDRV_VIDEO_START(drw80pkr)
|
||||||
MDRV_VIDEO_UPDATE(drw80pkr)
|
MDRV_VIDEO_UPDATE(drw80pkr)
|
||||||
|
MDRV_NVRAM_HANDLER(drw80pkr)
|
||||||
|
|
||||||
// sound hardware
|
// sound hardware
|
||||||
MDRV_SPEAKER_STANDARD_MONO("mono")
|
MDRV_SPEAKER_STANDARD_MONO("mono")
|
||||||
|
Loading…
Reference in New Issue
Block a user