From 2e0b4d4c1de62f78e21510fa85a8dceb2d97c416 Mon Sep 17 00:00:00 2001 From: mariuszw1 Date: Tue, 8 Sep 2009 20:12:07 +0000 Subject: [PATCH] New games added or promoted from NOT_WORKING status --------------------------------------------------- Povar / Sobrat' Buran / Agroprom [Mariusz Wojcieszek] Czernyj Korabl [Mariusz Wojcieszek] Brodjaga [Mariusz Wojcieszek] --- .gitattributes | 1 + src/mame/drivers/photon2.c | 358 +++++++++++++++++++++++++++++++++++++ src/mame/mame.mak | 1 + src/mame/mamedriv.c | 5 + 4 files changed, 365 insertions(+) create mode 100644 src/mame/drivers/photon2.c diff --git a/.gitattributes b/.gitattributes index 50cf3186839..68bfe3acaa3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1900,6 +1900,7 @@ src/mame/drivers/peplus.c svneol=native#text/plain src/mame/drivers/pgm.c svneol=native#text/plain src/mame/drivers/phoenix.c svneol=native#text/plain src/mame/drivers/photon.c svneol=native#text/plain +src/mame/drivers/photon2.c svneol=native#text/plain src/mame/drivers/photoply.c svneol=native#text/plain src/mame/drivers/pingpong.c svneol=native#text/plain src/mame/drivers/pipedrm.c svneol=native#text/plain diff --git a/src/mame/drivers/photon2.c b/src/mame/drivers/photon2.c new file mode 100644 index 00000000000..53e18790b5e --- /dev/null +++ b/src/mame/drivers/photon2.c @@ -0,0 +1,358 @@ +/* + Photon IK2 system + + Driver by Mariusz Wojcieszek + + Russian arcade system based on ZX Spectrum home computer. + +*/ + +#include "driver.h" +#include "deprecat.h" +#include "cpu/z80/z80.h" +#include "sound/speaker.h" + +/************************************* + * + * Globals + * + *************************************/ + +static UINT8 *spectrum_video_ram; +static int spectrum_frame_number; /* Used for handling FLASH 1 */ +static int spectrum_flash_invert; +static UINT8 spectrum_port_fe; +static UINT8 nmi_enable = 0; + + +/************************************* + * + * Video (copied from MESS apart from support + * for changing border color mid-frame) + * + *************************************/ + +/* Spectrum screen size in pixels */ +#define SPEC_UNSEEN_LINES 16 /* Non-visible scanlines before first border + line. Some of these may be vertical retrace. */ +#define SPEC_TOP_BORDER 48 /* Number of border lines before actual screen */ +#define SPEC_DISPLAY_YSIZE 192 /* Vertical screen resolution */ +#define SPEC_BOTTOM_BORDER 56 /* Number of border lines at bottom of screen */ +#define SPEC_SCREEN_HEIGHT (SPEC_TOP_BORDER + SPEC_DISPLAY_YSIZE + SPEC_BOTTOM_BORDER) + +#define SPEC_LEFT_BORDER 48 /* Number of left hand border pixels */ +#define SPEC_DISPLAY_XSIZE 256 /* Horizontal screen resolution */ +#define SPEC_RIGHT_BORDER 48 /* Number of right hand border pixels */ +#define SPEC_SCREEN_WIDTH (SPEC_LEFT_BORDER + SPEC_DISPLAY_XSIZE + SPEC_RIGHT_BORDER) + +#define SPEC_LEFT_BORDER_CYCLES 24 /* Cycles to display left hand border */ +#define SPEC_DISPLAY_XSIZE_CYCLES 128 /* Horizontal screen resolution */ +#define SPEC_RIGHT_BORDER_CYCLES 24 /* Cycles to display right hand border */ +#define SPEC_RETRACE_CYCLES 48 /* Cycles taken for horizonal retrace */ +#define SPEC_CYCLES_PER_LINE 224 /* Number of cycles to display a single line */ + +static const rgb_t spectrum_palette[16] = { + MAKE_RGB(0x00, 0x00, 0x00), + MAKE_RGB(0x00, 0x00, 0xbf), + MAKE_RGB(0xbf, 0x00, 0x00), + MAKE_RGB(0xbf, 0x00, 0xbf), + MAKE_RGB(0x00, 0xbf, 0x00), + MAKE_RGB(0x00, 0xbf, 0xbf), + MAKE_RGB(0xbf, 0xbf, 0x00), + MAKE_RGB(0xbf, 0xbf, 0xbf), + MAKE_RGB(0x00, 0x00, 0x00), + MAKE_RGB(0x00, 0x00, 0xff), + MAKE_RGB(0xff, 0x00, 0x00), + MAKE_RGB(0xff, 0x00, 0xff), + MAKE_RGB(0x00, 0xff, 0x00), + MAKE_RGB(0x00, 0xff, 0xff), + MAKE_RGB(0xff, 0xff, 0x00), + MAKE_RGB(0xff, 0xff, 0xff) +}; + +/* Initialise the palette */ +PALETTE_INIT( spectrum ) +{ + palette_set_colors(machine, 0, spectrum_palette, ARRAY_LENGTH(spectrum_palette)); +} + +VIDEO_START( spectrum ) +{ + spectrum_frame_number = 0; + spectrum_flash_invert = 0; +} + +/* return the color to be used inverting FLASHing colors if necessary */ +INLINE unsigned char get_display_color (unsigned char color, int invert) +{ + if (invert && (color & 0x80)) + return (color & 0xc0) + ((color & 0x38) >> 3) + ((color & 0x07) << 3); + else + return color; +} + +/* Code to change the FLASH status every 25 frames. Note this must be + independent of frame skip etc. */ +VIDEO_EOF( spectrum ) +{ + spectrum_frame_number++; + if (spectrum_frame_number >= 25) + { + spectrum_frame_number = 0; + spectrum_flash_invert = !spectrum_flash_invert; + } +} + +INLINE void spectrum_plot_pixel(bitmap_t *bitmap, int x, int y, UINT32 color) +{ + *BITMAP_ADDR16(bitmap, y, x) = (UINT16)color; +} + +VIDEO_UPDATE( spectrum ) +{ + /* for now do a full-refresh */ + int x, y, b, scrx, scry; + unsigned short ink, pap; + unsigned char *attr, *scr; + int full_refresh = 1; + + scr=spectrum_video_ram; + + bitmap_fill(bitmap, cliprect, spectrum_port_fe & 0x07); + + for (y=0; y<192; y++) + { + scrx=SPEC_LEFT_BORDER; + scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); + attr=spectrum_video_ram + ((scry>>3)*32) + 0x1800; + + for (x=0;x<32;x++) + { + /* Get ink and paper colour with bright */ + if (spectrum_flash_invert && (*attr & 0x80)) + { + ink=((*attr)>>3) & 0x0f; + pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); + } + else + { + ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08); + pap=((*attr)>>3) & 0x0f; + } + + for (b=0x80;b!=0;b>>=1) + { + if (*scr&b) + spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,ink); + else + spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,pap); + } + scr++; + attr++; + } + } + + return 0; +} + +/************************************* + * + * I/O - memory banking, sound + * + *************************************/ + +static WRITE8_HANDLER(photon2_membank_w) +{ + int bank = 0; + if (data == 0) + { + bank = 0; + } + else if (data == 1) + { + bank = 1; + } + else if (data == 5) + { + bank = 2; + } + else + { + logerror( "Unknown banking write: %02X\n", data); + } + + memory_set_bankptr(space->machine, 1, memory_region(space->machine, "maincpu") + 0x4000*bank ); +} + +static READ8_HANDLER(photon2_fe_r) +{ + return 0xff; +} + +static WRITE8_HANDLER(photon2_fe_w) +{ + const device_config *speaker = devtag_get_device(space->machine, "speaker"); + spectrum_port_fe = data; + + speaker_level_w(speaker, BIT(data,4)); +} + +static WRITE8_HANDLER(photon2_misc_w) +{ + nmi_enable = !BIT(data,5); +} + +/************************************* + * + * Memory maps + * + *************************************/ + +static ADDRESS_MAP_START (spectrum_mem, ADDRESS_SPACE_PROGRAM, 8) + AM_RANGE(0x0000, 0x3fff) AM_ROMBANK(1) + AM_RANGE(0x4000, 0x5aff) AM_RAM AM_BASE(&spectrum_video_ram ) + AM_RANGE(0x5b00, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START (spectrum_io, ADDRESS_SPACE_IO, 8) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x1f, 0x1f) AM_READ_PORT("JOY") + AM_RANGE(0x5b, 0x5b) AM_READ_PORT("COIN") AM_WRITE(photon2_misc_w) + AM_RANGE(0x7a, 0x7a) AM_WRITE(photon2_membank_w) + AM_RANGE(0x7b, 0x7b) AM_WRITENOP // unknown write + AM_RANGE(0x7e, 0x7e) AM_WRITE(photon2_membank_w) + AM_RANGE(0xfe, 0xfe) AM_READWRITE(photon2_fe_r, photon2_fe_w) +ADDRESS_MAP_END + +/************************************* + * + * Inputs + * + *************************************/ + +static INPUT_PORTS_START( photon2 ) + PORT_START("JOY") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("COIN") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_PLAYER(1) PORT_IMPULSE(1) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) +INPUT_PORTS_END + +static INPUT_PORTS_START( black ) + PORT_INCLUDE( photon2 ) + + PORT_MODIFY("JOY") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) +INPUT_PORTS_END + +/************************************* + * + * Machine + * + *************************************/ + +static INTERRUPT_GEN( spec_interrupt_hack ) +{ + if (cpu_getiloops(device) == 1) + { + cpu_set_input_line(device, 0, HOLD_LINE); + } + else + { + if ( nmi_enable ) + { + cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); + } + } +} + +static MACHINE_RESET( photon2 ) +{ + memory_set_bankptr(machine, 1, memory_region(machine, "maincpu")); +} + +MACHINE_DRIVER_START( photon2 ) + /* basic machine hardware */ + MDRV_CPU_ADD("maincpu", Z80, 3500000) /* 3.5 MHz */ + MDRV_CPU_PROGRAM_MAP(spectrum_mem) + MDRV_CPU_IO_MAP(spectrum_io) + MDRV_CPU_VBLANK_INT_HACK(spec_interrupt_hack, 2) + MDRV_QUANTUM_TIME(HZ(60)) + + MDRV_MACHINE_RESET( photon2 ) + + /* video hardware */ + MDRV_SCREEN_ADD("screen", RASTER) + MDRV_SCREEN_REFRESH_RATE(50.08) + MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ + MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) + MDRV_SCREEN_SIZE(SPEC_SCREEN_WIDTH, SPEC_SCREEN_HEIGHT) + MDRV_SCREEN_VISIBLE_AREA(0, SPEC_SCREEN_WIDTH-1, 0, SPEC_SCREEN_HEIGHT-1) + MDRV_PALETTE_LENGTH(16) + MDRV_PALETTE_INIT( spectrum ) + + MDRV_VIDEO_START( spectrum ) + MDRV_VIDEO_UPDATE( spectrum ) + MDRV_VIDEO_EOF( spectrum ) + + /* sound hardware */ + MDRV_SPEAKER_STANDARD_MONO("mono") + MDRV_SOUND_ADD("speaker", SPEAKER, 0) + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + +MACHINE_DRIVER_END + +/************************************* + * + * Globals + * + *************************************/ + +ROM_START( kok ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "kok00.bin", 0x0000, 0x2000, CRC(ff790d0b) SHA1(26dce26e43c15fd90d99abf25a86ca55ed13de94) ) + ROM_LOAD( "kok01.bin", 0x2000, 0x2000, CRC(bf81811e) SHA1(26f073e49f126a70008256ea74394fbf11649503) ) + ROM_LOAD( "kok10.bin", 0x4000, 0x2000, CRC(73fc7b92) SHA1(226abcb40aa3b8cfa96bc4ac89ba62b79ee79b2a) ) + ROM_LOAD( "kok11.bin", 0x6000, 0x2000, CRC(7de0f54a) SHA1(3ee73f8e133ff3356e0ee8d1918b99d66f5ba53f) ) +ROM_END + +ROM_START( black ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "black1.bin", 0x0000, 0x2000, CRC(8b02b314) SHA1(2e2de2b21634538515d4d6ca0930c4e3e5d1e80f) ) + ROM_LOAD( "black2.bin", 0x2000, 0x2000, CRC(ed93469a) SHA1(5e23da3f649f5e20f7c8450bfa5d7d0b190f892c) ) + ROM_LOAD( "black5.bin", 0x4000, 0x2000, CRC(f7c0baf5) SHA1(0d0a6f8b7f9bf65be61c8c78270a8c6e60fa3fe9) ) + ROM_LOAD( "black6.bin", 0x6000, 0x2000, CRC(1f60bc18) SHA1(fd1a902c51e01dfc6fa42dac94d25566ce5bb3d7) ) + ROM_LOAD( "black3.bin", 0x8000, 0x2000, CRC(784ea7f4) SHA1(f3008ad180ad14e0728bf0ba78fe85302ef2ff85) ) + ROM_LOAD( "black4.bin", 0xa000, 0x2000, CRC(20281f74) SHA1(83df590e21a44fa07d4bc76818a8d0d0c4de42b3) ) +ROM_END + +ROM_START( brod ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "brod00.bin", 0x0000, 0x2000, CRC(cbd6653f) SHA1(18b9134529a1e56c6e90f3bcef5102d5d4b352e3) ) + ROM_FILL( 0x2000, 0x2000, 0x00 ) + ROM_LOAD( "brod10.bin", 0x4000, 0x2000, CRC(9c25d44a) SHA1(f78c7e5b4e6f9fe34f81dc574ca335f70b61e68d) ) + ROM_LOAD( "brod11.bin", 0x6000, 0x2000, CRC(f6505a16) SHA1(3b2ccca78fd83855003cc752766df83b19f89364) ) + ROM_LOAD( "brod12.bin", 0x8000, 0x2000, CRC(94e53d47) SHA1(698415c5e25528e3b1dcab7471cc98c1dc9cb335) ) + ROM_LOAD( "brod13.bin", 0xa000, 0x2000, CRC(1177cd17) SHA1(58c5c09a7b857ce6311339c4d0f4d8c1a7e232a3) ) +ROM_END + +GAME( 19??, kok, 0, photon2, photon2, 0, ROT0, "", "Povar / Sobrat' Buran / Agroprom", 0 ) +GAME( 19??, black, 0, photon2, black, 0, ROT0, "", "Czernyj Korabl", 0 ) +GAME( 19??, brod, 0, photon2, black, 0, ROT0, "", "Brodjaga", 0 ) diff --git a/src/mame/mame.mak b/src/mame/mame.mak index 2bcacab3014..2c8f2bde229 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -1580,6 +1580,7 @@ $(MAMEOBJ)/misc.a: \ $(DRIVERS)/pcxt.o \ $(DRIVERS)/peplus.o \ $(DRIVERS)/photon.o $(VIDEO)/pk8000.o \ + $(DRIVERS)/photon2.o \ $(DRIVERS)/pipeline.o \ $(DRIVERS)/photoply.o \ $(DRIVERS)/pkscram.o \ diff --git a/src/mame/mamedriv.c b/src/mame/mamedriv.c index 4a10fabcdb0..6b77b07c666 100644 --- a/src/mame/mamedriv.c +++ b/src/mame/mamedriv.c @@ -6938,6 +6938,11 @@ BOMULEUL CHAJARA SEGA ST-V 1997/04/11 DRIVER( phtetris ) DRIVER( phpython ) + /* Photon IK2 hardware */ + DRIVER( kok ) + DRIVER( black ) + DRIVER( brod ) + /* Valadon Automation games */ DRIVER( bagman ) /* (c) 1982 */ DRIVER( bagnard ) /* (c) 1982 */