es5506.c: added save state to both ES5505 and ES5506 [Fabio Priuli]
added driver_data struct and save states to the following drivers: attckufo.c, m79amb.c, macrossp.c, marinedt.c, markham.c, mayumi.c and mcatadv.c
This commit is contained in:
parent
912d6eaf74
commit
9ec77c765d
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -2623,11 +2623,13 @@ src/mame/includes/m107.h svneol=native#text/plain
|
||||
src/mame/includes/m72.h svneol=native#text/plain
|
||||
src/mame/includes/m79amb.h svneol=native#text/plain
|
||||
src/mame/includes/m92.h svneol=native#text/plain
|
||||
src/mame/includes/macrossp.h svneol=native#text/plain
|
||||
src/mame/includes/madalien.h svneol=native#text/plain
|
||||
src/mame/includes/mainevt.h svneol=native#text/plain
|
||||
src/mame/includes/malzak.h svneol=native#text/plain
|
||||
src/mame/includes/mappy.h svneol=native#text/plain
|
||||
src/mame/includes/mario.h svneol=native#text/plain
|
||||
src/mame/includes/markham.h svneol=native#text/plain
|
||||
src/mame/includes/matmania.h svneol=native#text/plain
|
||||
src/mame/includes/mcatadv.h svneol=native#text/plain
|
||||
src/mame/includes/mcr.h svneol=native#text/plain
|
||||
@ -3531,7 +3533,6 @@ src/mame/video/marineb.c svneol=native#text/plain
|
||||
src/mame/video/mario.c svneol=native#text/plain
|
||||
src/mame/video/markham.c svneol=native#text/plain
|
||||
src/mame/video/matmania.c svneol=native#text/plain
|
||||
src/mame/video/mayumi.c svneol=native#text/plain
|
||||
src/mame/video/mcatadv.c svneol=native#text/plain
|
||||
src/mame/video/mcr.c svneol=native#text/plain
|
||||
src/mame/video/mcr3.c svneol=native#text/plain
|
||||
|
@ -210,7 +210,7 @@ static void compute_tables(es5506_state *chip)
|
||||
/* allocate volume lookup table */
|
||||
chip->volume_lookup = auto_alloc_array(chip->device->machine, UINT16, 4096);
|
||||
|
||||
/* generate ulaw lookup table */
|
||||
/* generate volume lookup table */
|
||||
for (i = 0; i < 4096; i++)
|
||||
{
|
||||
UINT8 exponent = i >> 8;
|
||||
@ -870,6 +870,47 @@ static void es5506_start_common(running_device *device, const void *config, soun
|
||||
/* allocate memory */
|
||||
chip->scratch = auto_alloc_array(device->machine, INT32, 2 * MAX_SAMPLE_CHUNK);
|
||||
|
||||
/* register save */
|
||||
state_save_register_device_item(device, 0, chip->sample_rate);
|
||||
state_save_register_device_item(device, 0, chip->write_latch);
|
||||
state_save_register_device_item(device, 0, chip->read_latch);
|
||||
|
||||
state_save_register_device_item(device, 0, chip->current_page);
|
||||
state_save_register_device_item(device, 0, chip->active_voices);
|
||||
state_save_register_device_item(device, 0, chip->mode);
|
||||
state_save_register_device_item(device, 0, chip->wst);
|
||||
state_save_register_device_item(device, 0, chip->wend);
|
||||
state_save_register_device_item(device, 0, chip->lrend);
|
||||
state_save_register_device_item(device, 0, chip->irqv);
|
||||
|
||||
state_save_register_device_item_pointer(device, 0, chip->scratch, 2 * MAX_SAMPLE_CHUNK);
|
||||
|
||||
for (j = 0; j < 32; j++)
|
||||
{
|
||||
state_save_register_device_item(device, j, chip->voice[j].control);
|
||||
state_save_register_device_item(device, j, chip->voice[j].freqcount);
|
||||
state_save_register_device_item(device, j, chip->voice[j].start);
|
||||
state_save_register_device_item(device, j, chip->voice[j].lvol);
|
||||
state_save_register_device_item(device, j, chip->voice[j].end);
|
||||
state_save_register_device_item(device, j, chip->voice[j].lvramp);
|
||||
state_save_register_device_item(device, j, chip->voice[j].accum);
|
||||
state_save_register_device_item(device, j, chip->voice[j].rvol);
|
||||
state_save_register_device_item(device, j, chip->voice[j].rvramp);
|
||||
state_save_register_device_item(device, j, chip->voice[j].ecount);
|
||||
state_save_register_device_item(device, j, chip->voice[j].k2);
|
||||
state_save_register_device_item(device, j, chip->voice[j].k2ramp);
|
||||
state_save_register_device_item(device, j, chip->voice[j].k1);
|
||||
state_save_register_device_item(device, j, chip->voice[j].k1ramp);
|
||||
state_save_register_device_item(device, j, chip->voice[j].o4n1);
|
||||
state_save_register_device_item(device, j, chip->voice[j].o3n1);
|
||||
state_save_register_device_item(device, j, chip->voice[j].o3n2);
|
||||
state_save_register_device_item(device, j, chip->voice[j].o2n1);
|
||||
state_save_register_device_item(device, j, chip->voice[j].o2n2);
|
||||
state_save_register_device_item(device, j, chip->voice[j].o1n1);
|
||||
state_save_register_device_item(device, j, chip->voice[j].exbank);
|
||||
state_save_register_device_item(device, j, chip->voice[j].filtcount);
|
||||
}
|
||||
|
||||
/* success */
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,19 @@ LOIPOIO-B
|
||||
#include "sound/mos6560.h"
|
||||
|
||||
|
||||
static UINT8 *mainram;
|
||||
static UINT8 *tileram;
|
||||
typedef struct _attckufo_state attckufo_state;
|
||||
struct _attckufo_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * mainram;
|
||||
UINT8 * tileram;
|
||||
|
||||
/* devices */
|
||||
running_device *maincpu;
|
||||
running_device *mos6560;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static const rgb_t attckufo_palette[] =
|
||||
{
|
||||
@ -103,10 +114,10 @@ static WRITE8_HANDLER(attckufo_io_w)
|
||||
|
||||
static ADDRESS_MAP_START( cpu_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0x3fff)
|
||||
AM_RANGE(0x0000, 0x0fff) AM_RAM AM_BASE(&mainram)
|
||||
AM_RANGE(0x0000, 0x0fff) AM_RAM AM_BASE_MEMBER(attckufo_state, mainram)
|
||||
AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("mos6560", mos6560_port_r, mos6560_port_w)
|
||||
AM_RANGE(0x1400, 0x1403) AM_READWRITE(attckufo_io_r, attckufo_io_w)
|
||||
AM_RANGE(0x1c00, 0x1fff) AM_RAM AM_BASE(&tileram)
|
||||
AM_RANGE(0x1c00, 0x1fff) AM_RAM AM_BASE_MEMBER(attckufo_state, tileram)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -140,26 +151,28 @@ INPUT_PORTS_END
|
||||
|
||||
INTERRUPT_GEN( attckufo_raster_interrupt )
|
||||
{
|
||||
running_device *mos6560 = devtag_get_device(device->machine, "mos6560");
|
||||
mos6560_raster_interrupt_gen(mos6560);
|
||||
attckufo_state *state = (attckufo_state *)device->machine->driver_data;
|
||||
mos6560_raster_interrupt_gen(state->mos6560);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( attckufo )
|
||||
{
|
||||
running_device *mos6560 = devtag_get_device(screen->machine, "mos6560");
|
||||
mos6560_video_update(mos6560, bitmap, cliprect);
|
||||
attckufo_state *state = (attckufo_state *)screen->machine->driver_data;
|
||||
mos6560_video_update(state->mos6560, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int attckufo_dma_read( running_machine *machine, int offset )
|
||||
{
|
||||
const address_space *program = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
||||
attckufo_state *state = (attckufo_state *)machine->driver_data;
|
||||
const address_space *program = cpu_get_address_space(state->maincpu, ADDRESS_SPACE_PROGRAM);
|
||||
return memory_read_byte(program, offset);
|
||||
}
|
||||
|
||||
static int attckufo_dma_read_color( running_machine *machine, int offset )
|
||||
{
|
||||
const address_space *program = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
||||
attckufo_state *state = (attckufo_state *)machine->driver_data;
|
||||
const address_space *program = cpu_get_address_space(state->maincpu, ADDRESS_SPACE_PROGRAM);
|
||||
return memory_read_byte(program, offset + 0x400);
|
||||
}
|
||||
|
||||
@ -172,11 +185,27 @@ static const mos6560_interface attckufo_6560_intf =
|
||||
attckufo_dma_read, attckufo_dma_read_color /* DMA */
|
||||
};
|
||||
|
||||
|
||||
static MACHINE_START( attckufo )
|
||||
{
|
||||
attckufo_state *state = (attckufo_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->mos6560 = devtag_get_device(machine, "mos6560");
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( attckufo )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(attckufo_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M6502, 14318181/14)
|
||||
MDRV_CPU_PROGRAM_MAP(cpu_map)
|
||||
MDRV_CPU_PERIODIC_INT(attckufo_raster_interrupt, MOS656X_HRETRACERATE)
|
||||
|
||||
MDRV_MACHINE_START(attckufo)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(MOS6560_VRETRACERATE)
|
||||
@ -211,4 +240,4 @@ ROM_START( attckufo )
|
||||
ROM_COPY( "maincpu", 0x02000, 0x00000, 0x400)
|
||||
ROM_END
|
||||
|
||||
GAME( 1980, attckufo, 0, attckufo, attckufo, 0, ROT270, "Ryoto Electric Co.", "Attack Ufo", 0 )
|
||||
GAME( 1980, attckufo, 0, attckufo, attckufo, 0, ROT270, "Ryoto Electric Co.", "Attack Ufo", GAME_SUPPORTS_SAVE )
|
||||
|
@ -58,24 +58,35 @@ and two large (paddles pretending to be) guns.
|
||||
#include "includes/m79amb.h"
|
||||
#include "cpu/i8085/i8085.h"
|
||||
|
||||
static UINT8 *ramtek_videoram;
|
||||
static UINT8 *mask;
|
||||
typedef struct _m79amb_state m79amb_state;
|
||||
struct _m79amb_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * mask;
|
||||
|
||||
/* misc */
|
||||
UINT8 lut_gun1[0x100];
|
||||
UINT8 lut_gun2[0x100];
|
||||
};
|
||||
|
||||
|
||||
static WRITE8_HANDLER( ramtek_videoram_w )
|
||||
{
|
||||
ramtek_videoram[offset] = data & ~*mask;
|
||||
m79amb_state *state = (m79amb_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data & ~*state->mask;
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE( ramtek )
|
||||
{
|
||||
m79amb_state *state = (m79amb_state *)screen->machine->driver_data;
|
||||
offs_t offs;
|
||||
|
||||
for (offs = 0; offs < 0x2000; offs++)
|
||||
{
|
||||
int i;
|
||||
|
||||
UINT8 data = ramtek_videoram[offs];
|
||||
UINT8 data = state->videoram[offs];
|
||||
int y = offs >> 5;
|
||||
int x = (offs & 0x1f) << 3;
|
||||
|
||||
@ -93,51 +104,22 @@ static VIDEO_UPDATE( ramtek )
|
||||
}
|
||||
|
||||
|
||||
/* grenade trajectory per gun position is inconsistent and sloppy in the game:
|
||||
0, 1, 3, 2, 6, 7, 5, 4 - gun position
|
||||
90.00, 90.00, 90.00, 90.00, 86.42, 86.42, 86.42, 86.42 - grenade trajectory (angle, est)
|
||||
18.0, 18.0, 18.0, 18.0, 27.2, 27.2, 27.2, 31.2 - crosses with y=28 (x, est)
|
||||
|
||||
12, 13, 15, 14, 10, 11, 9, 8,
|
||||
84.39, 84.39, 84.39, 80.87, 79.00, 80.87, 79.00, 79.00
|
||||
41.9, 48.9, 56.8, 75.8, 87.2, 88.8, 101.6, 107.6
|
||||
|
||||
24, 25, 27, 26, 30, 31, 29, 28,
|
||||
79.00, 79.00, 75.59, 75.59, 75.59, 73.72, 73.72, 73.72
|
||||
114.1, 121.5, 138.8, 146.0, 152.7, 162.6, 167.6, 172.7
|
||||
|
||||
20, 21, 23, 22, 18, 19, 17, 16
|
||||
73.72, 70.08, 70.08, 70.08, 67.97, 67.97, 64.34, 64.34
|
||||
181.6, 199.9, 205.4, 211.9, 223.5, 232.4, 254.0, 254.0
|
||||
*/
|
||||
static const UINT8 lut_cross[0x20] = {
|
||||
19, 20, 21, 23, 25, 27, 29, 37,
|
||||
45, 53, 66, 82, 88, 95, 105, 111,
|
||||
118, 130, 142, 149, 158, 165, 170, 177,
|
||||
191, 203, 209, 218, 228, 243, 249, 255,
|
||||
};
|
||||
static const UINT8 lut_pos[0x20] = {
|
||||
0x1f, 0x1e, 0x1c, 0x1d, 0x19, 0x18, 0x1a, 0x1b,
|
||||
0x13, 0x12, 0x10, 0x11, 0x15, 0x14, 0x16, 0x17,
|
||||
0x07, 0x06, 0x04, 0x05, 0x01, 0x00, 0x02, 0x03,
|
||||
0x0b, 0x0a, 0x08, 0x09, 0x0d, 0x0c, 0x0e, 0x0f
|
||||
};
|
||||
|
||||
static UINT8 lut_gun1[0x100];
|
||||
static UINT8 lut_gun2[0x100];
|
||||
|
||||
static READ8_HANDLER( gray5bit_controller0_r )
|
||||
{
|
||||
UINT8 port_data = input_port_read(space->machine, "8004");
|
||||
UINT8 gun_pos = input_port_read(space->machine, "GUN1");
|
||||
return (port_data & 0xe0) | lut_gun1[gun_pos];
|
||||
m79amb_state *state = (m79amb_state *)space->machine->driver_data;
|
||||
UINT8 port_data = input_port_read(space->machine, "8004");
|
||||
UINT8 gun_pos = input_port_read(space->machine, "GUN1");
|
||||
|
||||
return (port_data & 0xe0) | state->lut_gun1[gun_pos];
|
||||
}
|
||||
|
||||
static READ8_HANDLER( gray5bit_controller1_r )
|
||||
{
|
||||
UINT8 port_data = input_port_read(space->machine, "8005");
|
||||
UINT8 gun_pos = input_port_read(space->machine, "GUN2");
|
||||
return (port_data & 0xe0) | lut_gun2[gun_pos];
|
||||
m79amb_state *state = (m79amb_state *)space->machine->driver_data;
|
||||
UINT8 port_data = input_port_read(space->machine, "8005");
|
||||
UINT8 gun_pos = input_port_read(space->machine, "GUN2");
|
||||
|
||||
return (port_data & 0xe0) | state->lut_gun2[gun_pos];
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( m79amb_8002_w )
|
||||
@ -149,10 +131,10 @@ static WRITE8_HANDLER( m79amb_8002_w )
|
||||
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_ROM
|
||||
AM_RANGE(0x4000, 0x5fff) AM_RAM_WRITE(ramtek_videoram_w) AM_BASE(&ramtek_videoram)
|
||||
AM_RANGE(0x4000, 0x5fff) AM_RAM_WRITE(ramtek_videoram_w) AM_BASE_MEMBER(m79amb_state, videoram)
|
||||
AM_RANGE(0x6000, 0x63ff) AM_RAM /* ?? */
|
||||
AM_RANGE(0x8000, 0x8000) AM_READ_PORT("8000") AM_DEVWRITE("discrete", m79amb_8000_w)
|
||||
AM_RANGE(0x8001, 0x8001) AM_WRITEONLY AM_BASE(&mask)
|
||||
AM_RANGE(0x8001, 0x8001) AM_WRITEONLY AM_BASE_MEMBER(m79amb_state, mask)
|
||||
AM_RANGE(0x8002, 0x8002) AM_READ_PORT("8002") AM_WRITE(m79amb_8002_w)
|
||||
AM_RANGE(0x8003, 0x8003) AM_DEVWRITE("discrete", m79amb_8003_w)
|
||||
AM_RANGE(0x8004, 0x8004) AM_READ(gray5bit_controller0_r)
|
||||
@ -218,37 +200,11 @@ static INTERRUPT_GEN( m79amb_interrupt )
|
||||
cpu_set_input_line_and_vector(device, 0, HOLD_LINE, 0xcf); /* RST 08h */
|
||||
}
|
||||
|
||||
static DRIVER_INIT( m79amb )
|
||||
{
|
||||
UINT8 *rom = memory_region(machine, "maincpu");
|
||||
int i,j;
|
||||
|
||||
/* PROM data is active low */
|
||||
for (i = 0;i < 0x2000;i++)
|
||||
rom[i] = ~rom[i];
|
||||
|
||||
/* gun positions */
|
||||
for (i=0;i<0x100;i++) {
|
||||
/* gun 1, start at left 18 */
|
||||
for (j=0;j<0x20;j++) {
|
||||
if (i<=lut_cross[j]) {
|
||||
lut_gun1[i]=lut_pos[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* gun 2, start at right 235 */
|
||||
for (j=0;j<0x20;j++) {
|
||||
if (i>=(253-lut_cross[j])) {
|
||||
lut_gun2[i]=lut_pos[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( m79amb )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(m79amb_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", 8080, XTAL_19_6608MHz / 10)
|
||||
MDRV_CPU_PROGRAM_MAP(main_map)
|
||||
@ -297,4 +253,72 @@ ROM_END
|
||||
|
||||
|
||||
|
||||
GAME( 1977, m79amb, 0, m79amb, m79amb, m79amb, ROT0, "Ramtek", "M-79 Ambush", GAME_IMPERFECT_SOUND )
|
||||
/* grenade trajectory per gun position is inconsistent and sloppy in the game:
|
||||
0, 1, 3, 2, 6, 7, 5, 4 - gun position
|
||||
90.00, 90.00, 90.00, 90.00, 86.42, 86.42, 86.42, 86.42 - grenade trajectory (angle, est)
|
||||
18.0, 18.0, 18.0, 18.0, 27.2, 27.2, 27.2, 31.2 - crosses with y=28 (x, est)
|
||||
|
||||
12, 13, 15, 14, 10, 11, 9, 8,
|
||||
84.39, 84.39, 84.39, 80.87, 79.00, 80.87, 79.00, 79.00
|
||||
41.9, 48.9, 56.8, 75.8, 87.2, 88.8, 101.6, 107.6
|
||||
|
||||
24, 25, 27, 26, 30, 31, 29, 28,
|
||||
79.00, 79.00, 75.59, 75.59, 75.59, 73.72, 73.72, 73.72
|
||||
114.1, 121.5, 138.8, 146.0, 152.7, 162.6, 167.6, 172.7
|
||||
|
||||
20, 21, 23, 22, 18, 19, 17, 16
|
||||
73.72, 70.08, 70.08, 70.08, 67.97, 67.97, 64.34, 64.34
|
||||
181.6, 199.9, 205.4, 211.9, 223.5, 232.4, 254.0, 254.0
|
||||
*/
|
||||
|
||||
static const UINT8 lut_cross[0x20] = {
|
||||
19, 20, 21, 23, 25, 27, 29, 37,
|
||||
45, 53, 66, 82, 88, 95, 105, 111,
|
||||
118, 130, 142, 149, 158, 165, 170, 177,
|
||||
191, 203, 209, 218, 228, 243, 249, 255,
|
||||
};
|
||||
|
||||
static const UINT8 lut_pos[0x20] = {
|
||||
0x1f, 0x1e, 0x1c, 0x1d, 0x19, 0x18, 0x1a, 0x1b,
|
||||
0x13, 0x12, 0x10, 0x11, 0x15, 0x14, 0x16, 0x17,
|
||||
0x07, 0x06, 0x04, 0x05, 0x01, 0x00, 0x02, 0x03,
|
||||
0x0b, 0x0a, 0x08, 0x09, 0x0d, 0x0c, 0x0e, 0x0f
|
||||
};
|
||||
|
||||
|
||||
static DRIVER_INIT( m79amb )
|
||||
{
|
||||
m79amb_state *state = (m79amb_state *)machine->driver_data;
|
||||
UINT8 *rom = memory_region(machine, "maincpu");
|
||||
int i, j;
|
||||
|
||||
/* PROM data is active low */
|
||||
for (i = 0; i < 0x2000; i++)
|
||||
rom[i] = ~rom[i];
|
||||
|
||||
/* gun positions */
|
||||
for (i = 0; i < 0x100; i++)
|
||||
{
|
||||
/* gun 1, start at left 18 */
|
||||
for (j = 0; j < 0x20; j++)
|
||||
{
|
||||
if (i <= lut_cross[j])
|
||||
{
|
||||
state->lut_gun1[i] = lut_pos[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* gun 2, start at right 235 */
|
||||
for (j = 0; j < 0x20; j++)
|
||||
{
|
||||
if (i >= (253 - lut_cross[j]))
|
||||
{
|
||||
state->lut_gun2[i] = lut_pos[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GAME( 1977, m79amb, 0, m79amb, m79amb, m79amb, ROT0, "Ramtek", "M-79 Ambush", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
@ -34,13 +34,8 @@ TODO:
|
||||
lev 6 : 0x78 : 001f 002a - x
|
||||
lev 7 : 0x7c : 001f 002a - x
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "sound/es5506.h"
|
||||
|
||||
/*** README INFO **************************************************************
|
||||
**** README INFO **************************************************************
|
||||
|
||||
--- ROMSET: macrossp ---
|
||||
|
||||
@ -301,62 +296,52 @@ Notes:
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
extern UINT32 *macrossp_scra_videoram, *macrossp_scra_videoregs;
|
||||
extern UINT32 *macrossp_scrb_videoram, *macrossp_scrb_videoregs;
|
||||
extern UINT32 *macrossp_scrc_videoram, *macrossp_scrc_videoregs;
|
||||
extern UINT32 *macrossp_text_videoram, *macrossp_text_videoregs;
|
||||
extern UINT32 *macrossp_spriteram;
|
||||
|
||||
static UINT32 *macrossp_mainram;
|
||||
|
||||
/* in video */
|
||||
WRITE32_HANDLER( macrossp_scra_videoram_w );
|
||||
WRITE32_HANDLER( macrossp_scrb_videoram_w );
|
||||
WRITE32_HANDLER( macrossp_scrc_videoram_w );
|
||||
WRITE32_HANDLER( macrossp_text_videoram_w );
|
||||
VIDEO_START(macrossp);
|
||||
VIDEO_UPDATE(macrossp);
|
||||
VIDEO_EOF(macrossp);
|
||||
#include "emu.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "sound/es5506.h"
|
||||
#include "includes/macrossp.h"
|
||||
|
||||
/*** VARIOUS READ / WRITE HANDLERS *******************************************/
|
||||
|
||||
static WRITE32_HANDLER( paletteram32_macrossp_w )
|
||||
{
|
||||
macrossp_state *state = (macrossp_state *)space->machine->driver_data;
|
||||
int r,g,b;
|
||||
COMBINE_DATA(&space->machine->generic.paletteram.u32[offset]);
|
||||
COMBINE_DATA(&state->paletteram[offset]);
|
||||
|
||||
b = ((space->machine->generic.paletteram.u32[offset] & 0x0000ff00) >>8);
|
||||
g = ((space->machine->generic.paletteram.u32[offset] & 0x00ff0000) >>16);
|
||||
r = ((space->machine->generic.paletteram.u32[offset] & 0xff000000) >>24);
|
||||
b = ((state->paletteram[offset] & 0x0000ff00) >>8);
|
||||
g = ((state->paletteram[offset] & 0x00ff0000) >>16);
|
||||
r = ((state->paletteram[offset] & 0xff000000) >>24);
|
||||
|
||||
palette_set_color(space->machine,offset,MAKE_RGB(r,g,b));
|
||||
palette_set_color(space->machine, offset, MAKE_RGB(r,g,b));
|
||||
}
|
||||
|
||||
|
||||
static int sndpending;
|
||||
|
||||
static READ32_HANDLER ( macrossp_soundstatus_r )
|
||||
{
|
||||
static int toggle;
|
||||
macrossp_state *state = (macrossp_state *)space->machine->driver_data;
|
||||
|
||||
// logerror("%08x read soundstatus\n",cpu_get_pc(space->cpu));
|
||||
// logerror("%08x read soundstatus\n", cpu_get_pc(space->cpu));
|
||||
|
||||
/* bit 1 is sound status */
|
||||
/* bit 0 unknown - it is expected to toggle, vblank? */
|
||||
|
||||
toggle ^= 1;
|
||||
state->snd_toggle ^= 1;
|
||||
|
||||
return (sndpending << 1) | toggle;
|
||||
return (state->sndpending << 1) | state->snd_toggle;
|
||||
}
|
||||
|
||||
static WRITE32_HANDLER( macrossp_soundcmd_w )
|
||||
{
|
||||
macrossp_state *state = (macrossp_state *)space->machine->driver_data;
|
||||
|
||||
if (ACCESSING_BITS_16_31)
|
||||
{
|
||||
//logerror("%08x write soundcmd %08x (%08x)\n",cpu_get_pc(space->cpu),data,mem_mask);
|
||||
soundlatch_word_w(space, 0, data >> 16, 0xffff);
|
||||
sndpending = 1;
|
||||
cputag_set_input_line(space->machine, "audiocpu", 2, HOLD_LINE);
|
||||
state->sndpending = 1;
|
||||
cpu_set_input_line(state->audiocpu, 2, HOLD_LINE);
|
||||
/* spin for a while to let the sound CPU read the command */
|
||||
cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(50));
|
||||
}
|
||||
@ -364,40 +349,53 @@ static WRITE32_HANDLER( macrossp_soundcmd_w )
|
||||
|
||||
static READ16_HANDLER( macrossp_soundcmd_r )
|
||||
{
|
||||
// logerror("%06x read soundcmd\n",cpu_get_pc(space->cpu));
|
||||
sndpending = 0;
|
||||
macrossp_state *state = (macrossp_state *)space->machine->driver_data;
|
||||
|
||||
// logerror("%06x read soundcmd\n",cpu_get_pc(space->cpu));
|
||||
state->sndpending = 0;
|
||||
return soundlatch_word_r(space, offset, mem_mask);
|
||||
}
|
||||
|
||||
static INT32 fade_effect,old_fade;
|
||||
|
||||
static void update_colors(running_machine *machine)
|
||||
static void update_colors( running_machine *machine )
|
||||
{
|
||||
static int i,r,g,b;
|
||||
macrossp_state *state = (macrossp_state *)machine->driver_data;
|
||||
int i, r, g, b;
|
||||
|
||||
for(i=0;i<0x1000;i++)
|
||||
for (i = 0; i < 0x1000; i++)
|
||||
{
|
||||
b = ((machine->generic.paletteram.u32[i] & 0x0000ff00) >> 8);
|
||||
if(fade_effect > b) { b = 0; }
|
||||
else { b-=fade_effect; }
|
||||
g = ((machine->generic.paletteram.u32[i] & 0x00ff0000) >>16);
|
||||
if(fade_effect > g) { g = 0; }
|
||||
else { g-=fade_effect; }
|
||||
r = ((machine->generic.paletteram.u32[i] & 0xff000000) >>24);
|
||||
if(fade_effect > r) { r = 0; }
|
||||
else { r-=fade_effect; }
|
||||
b = ((state->paletteram[i] & 0x0000ff00) >> 8);
|
||||
g = ((state->paletteram[i] & 0x00ff0000) >> 16);
|
||||
r = ((state->paletteram[i] & 0xff000000) >> 24);
|
||||
|
||||
palette_set_color(machine,i,MAKE_RGB(r,g,b));
|
||||
if (state->fade_effect > b)
|
||||
b = 0;
|
||||
else
|
||||
b -= state->fade_effect;
|
||||
|
||||
if (state->fade_effect > g)
|
||||
g = 0;
|
||||
else
|
||||
g -= state->fade_effect;
|
||||
|
||||
if (state->fade_effect > r)
|
||||
r = 0;
|
||||
else
|
||||
r -= state->fade_effect;
|
||||
|
||||
palette_set_color(machine, i, MAKE_RGB(r, g, b));
|
||||
}
|
||||
}
|
||||
|
||||
static WRITE32_HANDLER( macrossp_palette_fade_w )
|
||||
{
|
||||
fade_effect = ((data & 0xff00) >> 8) - 0x28;//it writes two times,first with a -0x28 then with the proper data
|
||||
// popmessage("%02x",fade_effect);
|
||||
if(old_fade != fade_effect)
|
||||
macrossp_state *state = (macrossp_state *)space->machine->driver_data;
|
||||
|
||||
state->fade_effect = ((data & 0xff00) >> 8) - 0x28; //it writes two times, first with a -0x28 then with the proper data
|
||||
// popmessage("%02x",fade_effect);
|
||||
|
||||
if (state->old_fade != state->fade_effect)
|
||||
{
|
||||
old_fade = fade_effect;
|
||||
state->old_fade = state->fade_effect;
|
||||
update_colors(space->machine);
|
||||
}
|
||||
}
|
||||
@ -406,25 +404,25 @@ static WRITE32_HANDLER( macrossp_palette_fade_w )
|
||||
|
||||
static ADDRESS_MAP_START( macrossp_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x000000, 0x3fffff) AM_ROM
|
||||
AM_RANGE(0x800000, 0x802fff) AM_RAM AM_BASE(¯ossp_spriteram) AM_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0x800000, 0x802fff) AM_RAM AM_BASE_SIZE_MEMBER(macrossp_state, spriteram, spriteram_size)
|
||||
/* SCR A Layer */
|
||||
AM_RANGE(0x900000, 0x903fff) AM_RAM_WRITE(macrossp_scra_videoram_w) AM_BASE(¯ossp_scra_videoram)
|
||||
AM_RANGE(0x900000, 0x903fff) AM_RAM_WRITE(macrossp_scra_videoram_w) AM_BASE_MEMBER(macrossp_state, scra_videoram)
|
||||
AM_RANGE(0x904200, 0x9043ff) AM_WRITEONLY /* W/O? */
|
||||
AM_RANGE(0x905000, 0x90500b) AM_WRITEONLY AM_BASE(¯ossp_scra_videoregs) /* W/O? */
|
||||
AM_RANGE(0x905000, 0x90500b) AM_WRITEONLY AM_BASE_MEMBER(macrossp_state, scra_videoregs) /* W/O? */
|
||||
/* SCR B Layer */
|
||||
AM_RANGE(0x908000, 0x90bfff) AM_RAM_WRITE(macrossp_scrb_videoram_w) AM_BASE(¯ossp_scrb_videoram)
|
||||
AM_RANGE(0x908000, 0x90bfff) AM_RAM_WRITE(macrossp_scrb_videoram_w) AM_BASE_MEMBER(macrossp_state, scrb_videoram)
|
||||
AM_RANGE(0x90c200, 0x90c3ff) AM_WRITEONLY /* W/O? */
|
||||
AM_RANGE(0x90d000, 0x90d00b) AM_WRITEONLY AM_BASE(¯ossp_scrb_videoregs) /* W/O? */
|
||||
AM_RANGE(0x90d000, 0x90d00b) AM_WRITEONLY AM_BASE_MEMBER(macrossp_state, scrb_videoregs) /* W/O? */
|
||||
/* SCR C Layer */
|
||||
AM_RANGE(0x910000, 0x913fff) AM_RAM_WRITE(macrossp_scrc_videoram_w) AM_BASE(¯ossp_scrc_videoram)
|
||||
AM_RANGE(0x910000, 0x913fff) AM_RAM_WRITE(macrossp_scrc_videoram_w) AM_BASE_MEMBER(macrossp_state, scrc_videoram)
|
||||
AM_RANGE(0x914200, 0x9143ff) AM_WRITEONLY /* W/O? */
|
||||
AM_RANGE(0x915000, 0x91500b) AM_WRITEONLY AM_BASE(¯ossp_scrc_videoregs) /* W/O? */
|
||||
AM_RANGE(0x915000, 0x91500b) AM_WRITEONLY AM_BASE_MEMBER(macrossp_state, scrc_videoregs) /* W/O? */
|
||||
/* Text Layer */
|
||||
AM_RANGE(0x918000, 0x91bfff) AM_RAM_WRITE(macrossp_text_videoram_w) AM_BASE(¯ossp_text_videoram)
|
||||
AM_RANGE(0x918000, 0x91bfff) AM_RAM_WRITE(macrossp_text_videoram_w) AM_BASE_MEMBER(macrossp_state, text_videoram)
|
||||
AM_RANGE(0x91c200, 0x91c3ff) AM_WRITEONLY /* W/O? */
|
||||
AM_RANGE(0x91d000, 0x91d00b) AM_WRITEONLY AM_BASE(¯ossp_text_videoregs) /* W/O? */
|
||||
AM_RANGE(0x91d000, 0x91d00b) AM_WRITEONLY AM_BASE_MEMBER(macrossp_state, text_videoregs) /* W/O? */
|
||||
|
||||
AM_RANGE(0xa00000, 0xa03fff) AM_RAM_WRITE(paletteram32_macrossp_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xa00000, 0xa03fff) AM_RAM_WRITE(paletteram32_macrossp_w) AM_BASE_MEMBER(macrossp_state, paletteram)
|
||||
|
||||
AM_RANGE(0xb00000, 0xb00003) AM_READ_PORT("INPUTS")
|
||||
AM_RANGE(0xb00004, 0xb00007) AM_READ(macrossp_soundstatus_r) AM_WRITENOP // irq related?
|
||||
@ -435,7 +433,7 @@ static ADDRESS_MAP_START( macrossp_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
|
||||
AM_RANGE(0xc00000, 0xc00003) AM_WRITE(macrossp_soundcmd_w)
|
||||
|
||||
AM_RANGE(0xf00000, 0xf1ffff) AM_RAM AM_BASE(¯ossp_mainram) /* Main Ram */
|
||||
AM_RANGE(0xf00000, 0xf1ffff) AM_RAM AM_BASE_MEMBER(macrossp_state, mainram) /* Main Ram */
|
||||
// AM_RANGE(0xfe0000, 0xfe0003) AM_NOP
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -586,11 +584,12 @@ GFXDECODE_END
|
||||
|
||||
static void irqhandler(running_device *device, int irq)
|
||||
{
|
||||
logerror("ES5506 irq %d\n",irq);
|
||||
// macrossp_state *state = (macrossp_state *)space->machine->driver_data;
|
||||
logerror("ES5506 irq %d\n", irq);
|
||||
|
||||
/* IRQ lines 1 & 4 on the sound 68000 are definitely triggered by the ES5506,
|
||||
but I haven't noticed the ES5506 ever assert the line - maybe only used when developing the game? */
|
||||
// cputag_set_input_line(device, "audiocpu", 1, irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
// cpu_set_input_line(state->audiocpu, 1, irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static const es5506_interface es5506_config =
|
||||
@ -603,7 +602,34 @@ static const es5506_interface es5506_config =
|
||||
};
|
||||
|
||||
|
||||
static MACHINE_START( macrossp )
|
||||
{
|
||||
macrossp_state *state = (macrossp_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->audiocpu = devtag_get_device(machine, "audiocpu");
|
||||
|
||||
state_save_register_global(machine, state->sndpending);
|
||||
state_save_register_global(machine, state->snd_toggle);
|
||||
state_save_register_global(machine, state->fade_effect);
|
||||
state_save_register_global(machine, state->old_fade);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( macrossp )
|
||||
{
|
||||
macrossp_state *state = (macrossp_state *)machine->driver_data;
|
||||
|
||||
state->sndpending = 0;
|
||||
state->snd_toggle = 0;
|
||||
state->fade_effect = 0;
|
||||
state->old_fade = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( macrossp )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(macrossp_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M68EC020, 50000000/2) /* 25 MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(macrossp_map)
|
||||
@ -612,6 +638,9 @@ static MACHINE_DRIVER_START( macrossp )
|
||||
MDRV_CPU_ADD("audiocpu", M68000, 32000000/2) /* 16 MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(macrossp_sound_map)
|
||||
|
||||
MDRV_MACHINE_START(macrossp)
|
||||
MDRV_MACHINE_RESET(macrossp)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -749,15 +778,19 @@ PC :00018104 018104: addq.w #1, $f1015a.l
|
||||
PC :0001810A 01810A: cmp.w $f10140.l, D0
|
||||
PC :00018110 018110: beq 18104
|
||||
*/
|
||||
COMBINE_DATA(¯ossp_mainram[0x10158/4]);
|
||||
if (cpu_get_pc(space->cpu)==0x001810A) cpu_spinuntil_int(space->cpu);
|
||||
macrossp_state *state = (macrossp_state *)space->machine->driver_data;
|
||||
|
||||
COMBINE_DATA(&state->mainram[0x10158 / 4]);
|
||||
if (cpu_get_pc(space->cpu) == 0x001810A) cpu_spinuntil_int(space->cpu);
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static WRITE32_HANDLER( quizmoon_speedup_w )
|
||||
{
|
||||
COMBINE_DATA(¯ossp_mainram[0x00020/4]);
|
||||
if (cpu_get_pc(space->cpu)==0x1cc) cpu_spinuntil_int(space->cpu);
|
||||
macrossp_state *state = (macrossp_state *)space->machine->driver_data;
|
||||
|
||||
COMBINE_DATA(&state->mainram[0x00020 / 4]);
|
||||
if (cpu_get_pc(space->cpu) == 0x1cc) cpu_spinuntil_int(space->cpu);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -773,5 +806,5 @@ static DRIVER_INIT( quizmoon )
|
||||
#endif
|
||||
}
|
||||
|
||||
GAME( 1996, macrossp, 0, macrossp, macrossp, macrossp, ROT270, "Banpresto", "Macross Plus", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1997, quizmoon, 0, quizmoon, quizmoon, quizmoon, ROT0, "Banpresto", "Quiz Bisyoujo Senshi Sailor Moon - Chiryoku Tairyoku Toki no Un", GAME_IMPERFECT_GRAPHICS )
|
||||
GAME( 1996, macrossp, 0, macrossp, macrossp, macrossp, ROT270, "Banpresto", "Macross Plus", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1997, quizmoon, 0, quizmoon, quizmoon, quizmoon, ROT0, "Banpresto", "Quiz Bisyoujo Senshi Sailor Moon - Chiryoku Tairyoku Toki no Un", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
|
||||
|
@ -97,30 +97,41 @@ p2 ink doesn't always light up in test mode
|
||||
#include "emu.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
|
||||
static bitmap_t *tile, *obj1, *obj2;
|
||||
static tilemap_t *tx_tilemap;
|
||||
typedef struct _marinedt_state marinedt_state;
|
||||
struct _marinedt_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * tx_tileram;
|
||||
|
||||
static UINT8 *tx_tileram;
|
||||
/* video-related */
|
||||
bitmap_t *tile, *obj1, *obj2;
|
||||
tilemap_t *tx_tilemap;
|
||||
|
||||
UINT8 obj1_a, obj1_x, obj1_y;
|
||||
UINT8 obj2_a, obj2_x, obj2_y;
|
||||
UINT8 pd, pf;
|
||||
UINT8 music, sound;
|
||||
UINT8 coll, cx, cyr, cyq;
|
||||
UINT8 collh, cxh, cyrh, cyqh;
|
||||
};
|
||||
|
||||
static UINT8 marinedt_obj1_a, marinedt_obj1_x, marinedt_obj1_y;
|
||||
static UINT8 marinedt_obj2_a, marinedt_obj2_x, marinedt_obj2_y;
|
||||
static UINT8 marinedt_pd, marinedt_pf;
|
||||
static UINT8 marinedt_music, marinedt_sound;
|
||||
static UINT8 coll, cx, cyr, cyq;
|
||||
static UINT8 collh, cxh, cyrh, cyqh;
|
||||
|
||||
static WRITE8_HANDLER( tx_tileram_w )
|
||||
{
|
||||
tx_tileram[offset] = data;
|
||||
tilemap_mark_tile_dirty(tx_tilemap, offset);
|
||||
marinedt_state *state = (marinedt_state *)space->machine->driver_data;
|
||||
|
||||
state->tx_tileram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->tx_tilemap, offset);
|
||||
}
|
||||
|
||||
static READ8_HANDLER( marinedt_port1_r )
|
||||
{
|
||||
//might need to be reversed for cocktail stuff
|
||||
marinedt_state *state = (marinedt_state *)space->machine->driver_data;
|
||||
|
||||
//might need to be reversed for cocktail stuff
|
||||
|
||||
/* x/y multiplexed */
|
||||
return input_port_read(space->machine, ((marinedt_pf & 0x08)>>3) ? "TRACKY" : "TRACKX");
|
||||
return input_port_read(space->machine, ((state->pf & 0x08) >> 3) ? "TRACKY" : "TRACKX");
|
||||
}
|
||||
|
||||
static READ8_HANDLER( marinedt_coll_r )
|
||||
@ -131,7 +142,8 @@ static READ8_HANDLER( marinedt_coll_r )
|
||||
//----x--- obj1 to playfield collision
|
||||
//-----xxx unused
|
||||
|
||||
return coll | collh;
|
||||
marinedt_state *state = (marinedt_state *)space->machine->driver_data;
|
||||
return state->coll | state->collh;
|
||||
}
|
||||
|
||||
//are these returning only during a collision?
|
||||
@ -144,10 +156,16 @@ static READ8_HANDLER( marinedt_obj1_x_r )
|
||||
//xxxx---- unknown
|
||||
//----xxxx x pos in tile ram
|
||||
|
||||
marinedt_state *state = (marinedt_state *)space->machine->driver_data;
|
||||
UINT8 *RAM = memory_region(space->machine, "maincpu");
|
||||
if(RAM[0x430e]) --cx; else ++cx;
|
||||
//figure out why inc/dec based on 430e?
|
||||
return cx | (cxh<<4);
|
||||
|
||||
if (RAM[0x430e])
|
||||
--state->cx;
|
||||
else
|
||||
++state->cx;
|
||||
|
||||
//figure out why inc/dec based on 430e?
|
||||
return state->cx | (state->cxh << 4);
|
||||
}
|
||||
|
||||
static READ8_HANDLER( marinedt_obj1_yr_r )
|
||||
@ -155,10 +173,14 @@ static READ8_HANDLER( marinedt_obj1_yr_r )
|
||||
//76543210
|
||||
//xxxx---- unknown
|
||||
//----xxxx row in current screen quarter
|
||||
//has to be +1 if cx went over?
|
||||
if (cx==0x10) cyr++;
|
||||
|
||||
return cyr | (cyrh<<4);
|
||||
marinedt_state *state = (marinedt_state *)space->machine->driver_data;
|
||||
|
||||
//has to be +1 if cx went over?
|
||||
if (state->cx == 0x10)
|
||||
state->cyr++;
|
||||
|
||||
return state->cyr | (state->cyrh << 4);
|
||||
}
|
||||
|
||||
static READ8_HANDLER( marinedt_obj1_yq_r )
|
||||
@ -169,17 +191,18 @@ static READ8_HANDLER( marinedt_obj1_yq_r )
|
||||
//----xx-- unknown
|
||||
//------xx screen quarter
|
||||
|
||||
return cyq | (cyqh<<4);
|
||||
marinedt_state *state = (marinedt_state *)space->machine->driver_data;
|
||||
return state->cyq | (state->cyqh << 4);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( marinedt_obj1_a_w ) { marinedt_obj1_a = data; }
|
||||
static WRITE8_HANDLER( marinedt_obj1_x_w ) { marinedt_obj1_x = data; }
|
||||
static WRITE8_HANDLER( marinedt_obj1_y_w ) { marinedt_obj1_y = data; }
|
||||
static WRITE8_HANDLER( marinedt_obj2_a_w ) { marinedt_obj2_a = data; }
|
||||
static WRITE8_HANDLER( marinedt_obj2_x_w ) { marinedt_obj2_x = data; }
|
||||
static WRITE8_HANDLER( marinedt_obj2_y_w ) { marinedt_obj2_y = data; }
|
||||
static WRITE8_HANDLER( marinedt_obj1_a_w ) { marinedt_state *state = (marinedt_state *)space->machine->driver_data; state->obj1_a = data; }
|
||||
static WRITE8_HANDLER( marinedt_obj1_x_w ) { marinedt_state *state = (marinedt_state *)space->machine->driver_data; state->obj1_x = data; }
|
||||
static WRITE8_HANDLER( marinedt_obj1_y_w ) { marinedt_state *state = (marinedt_state *)space->machine->driver_data; state->obj1_y = data; }
|
||||
static WRITE8_HANDLER( marinedt_obj2_a_w ) { marinedt_state *state = (marinedt_state *)space->machine->driver_data; state->obj2_a = data; }
|
||||
static WRITE8_HANDLER( marinedt_obj2_x_w ) { marinedt_state *state = (marinedt_state *)space->machine->driver_data; state->obj2_x = data; }
|
||||
static WRITE8_HANDLER( marinedt_obj2_y_w ) { marinedt_state *state = (marinedt_state *)space->machine->driver_data; state->obj2_y = data; }
|
||||
|
||||
static WRITE8_HANDLER( marinedt_music_w ){ marinedt_music = data; }
|
||||
static WRITE8_HANDLER( marinedt_music_w ){ marinedt_state *state = (marinedt_state *)space->machine->driver_data; state->music = data; }
|
||||
|
||||
static WRITE8_HANDLER( marinedt_sound_w )
|
||||
{
|
||||
@ -192,7 +215,8 @@ static WRITE8_HANDLER( marinedt_sound_w )
|
||||
//------x- dots hit
|
||||
//-------x ??
|
||||
|
||||
marinedt_sound = data;
|
||||
marinedt_state *state = (marinedt_state *)space->machine->driver_data;
|
||||
state->sound = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( marinedt_pd_w )
|
||||
@ -205,7 +229,8 @@ static WRITE8_HANDLER( marinedt_pd_w )
|
||||
//------x- obj2 enable
|
||||
//-------x obj1 enable
|
||||
|
||||
marinedt_pd = data;
|
||||
marinedt_state *state = (marinedt_state *)space->machine->driver_data;
|
||||
state->pd = data;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -232,10 +257,12 @@ static WRITE8_HANDLER( marinedt_pf_w )
|
||||
//------x- ?? upright/cocktail
|
||||
//-------x ?? service mode (coin lockout??)
|
||||
|
||||
//if ((marinedt_pf & 0x07) != (data & 0x07))
|
||||
marinedt_state *state = (marinedt_state *)space->machine->driver_data;
|
||||
|
||||
//if ((state->pf & 0x07) != (data & 0x07))
|
||||
// mame_printf_debug("marinedt_pf_w: %02x\n", data & 0x07);
|
||||
|
||||
if ((marinedt_pf & 0x02) != (data & 0x02))
|
||||
if ((state->pf & 0x02) != (data & 0x02))
|
||||
{
|
||||
if (data & 0x02)
|
||||
mame_printf_debug("tile flip\n");
|
||||
@ -243,16 +270,16 @@ static WRITE8_HANDLER( marinedt_pf_w )
|
||||
mame_printf_debug("tile non-flip\n");
|
||||
|
||||
if (data & 0x02)
|
||||
tilemap_set_flip(tx_tilemap, TILEMAP_FLIPX | TILEMAP_FLIPY);
|
||||
tilemap_set_flip(state->tx_tilemap, TILEMAP_FLIPX | TILEMAP_FLIPY);
|
||||
else
|
||||
tilemap_set_flip(tx_tilemap, 0);
|
||||
tilemap_set_flip(state->tx_tilemap, 0);
|
||||
}
|
||||
|
||||
marinedt_pf = data;
|
||||
state->pf = data;
|
||||
|
||||
//if(data&0xf0)
|
||||
// logerror("pf:%02x %d\n",marinedt_pf);
|
||||
//logerror("pd:%02x %d\n",marinedt_pd, video_screen_get_frame_number(space->machine->primary_screen));
|
||||
//if (data & 0xf0)
|
||||
// logerror("pf:%02x %d\n", state->pf);
|
||||
//logerror("pd:%02x %d\n", state->pd, video_screen_get_frame_number(space->machine->primary_screen));
|
||||
|
||||
}
|
||||
|
||||
@ -260,7 +287,7 @@ static ADDRESS_MAP_START( marinedt_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x37ff) AM_ROM
|
||||
AM_RANGE(0x4000, 0x43ff) AM_RAM
|
||||
AM_RANGE(0x4400, 0x47ff) AM_RAM //unused, vram mirror?
|
||||
AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(tx_tileram_w) AM_BASE(&tx_tileram)
|
||||
AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(tx_tileram_w) AM_BASE_MEMBER(marinedt_state, tx_tileram)
|
||||
AM_RANGE(0x4c00, 0x4c00) AM_WRITENOP //?? maybe off by one error
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -283,7 +310,7 @@ ADDRESS_MAP_END
|
||||
|
||||
|
||||
static INPUT_PORTS_START( marinedt )
|
||||
PORT_START("DSW0") /* IN0 */
|
||||
PORT_START("DSW0")
|
||||
PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) )
|
||||
PORT_DIPSETTING( 0x0f, DEF_STR( 9C_1C ) )
|
||||
PORT_DIPSETTING( 0x0e, DEF_STR( 8C_1C ) )
|
||||
@ -319,7 +346,7 @@ static INPUT_PORTS_START( marinedt )
|
||||
PORT_DIPSETTING( 0x60, DEF_STR( 1C_7C ) )
|
||||
PORT_DIPSETTING( 0x70, DEF_STR( 1C_8C ) )
|
||||
|
||||
PORT_START("IN0") /* IN1 */
|
||||
PORT_START("IN0")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 )
|
||||
@ -329,7 +356,7 @@ static INPUT_PORTS_START( marinedt )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START2 )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START1 )
|
||||
|
||||
PORT_START("DSW1") /* IN2 */
|
||||
PORT_START("DSW1")
|
||||
PORT_DIPNAME( 0x01, 0x00, DEF_STR( Bonus_Life ) )
|
||||
PORT_DIPSETTING( 0x01, "5000" )
|
||||
PORT_DIPSETTING( 0x00, "10000" )
|
||||
@ -355,11 +382,11 @@ static INPUT_PORTS_START( marinedt )
|
||||
PORT_DIPSETTING( 0x80, "5" )
|
||||
PORT_DIPSETTING( 0xc0, "6" )
|
||||
|
||||
PORT_START("TRACKX") /* IN3 - FAKE MUXED */
|
||||
PORT_START("TRACKX") /* FAKE MUXED */
|
||||
//check all bits are used
|
||||
PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_REVERSE
|
||||
|
||||
PORT_START("TRACKY") /* IN4 - FAKE MUXED */
|
||||
PORT_START("TRACKY") /* FAKE MUXED */
|
||||
PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
|
||||
INPUT_PORTS_END
|
||||
|
||||
@ -395,9 +422,9 @@ static PALETTE_INIT( marinedt )
|
||||
{
|
||||
int i,r,b,g;
|
||||
|
||||
for (i = 0;i < machine->config->total_colors; i++)
|
||||
for (i = 0; i < machine->config->total_colors; i++)
|
||||
{
|
||||
int bit0,bit1,bit2;
|
||||
int bit0, bit1, bit2;
|
||||
|
||||
/* red component */
|
||||
bit0 = (~color_prom[i] >> 0) & 0x01;
|
||||
@ -415,7 +442,7 @@ static PALETTE_INIT( marinedt )
|
||||
bit0 = (~color_prom[i] >> 5) & 0x01;
|
||||
bit1 = (~color_prom[i] >> 6) & 0x01;
|
||||
bit2 = (~color_prom[i] >> 7) & 0x01;
|
||||
bit0=0;
|
||||
bit0 = 0;
|
||||
// *(palette++) = 0x92 * bit0 + 0x46 * bit1 + 0x27 * bit2;
|
||||
b = 0x27 * bit0 + 0x46 * bit1 + 0x92 * bit2;
|
||||
|
||||
@ -426,7 +453,8 @@ bit0=0;
|
||||
|
||||
static TILE_GET_INFO( get_tile_info )
|
||||
{
|
||||
int code = tx_tileram[tile_index];
|
||||
marinedt_state *state = (marinedt_state *)machine->driver_data;
|
||||
int code = state->tx_tileram[tile_index];
|
||||
int color = 0;
|
||||
int flags = TILE_FLIPX;
|
||||
|
||||
@ -435,15 +463,16 @@ static TILE_GET_INFO( get_tile_info )
|
||||
|
||||
static VIDEO_START( marinedt )
|
||||
{
|
||||
tx_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 8, 8,32,32);
|
||||
marinedt_state *state = (marinedt_state *)machine->driver_data;
|
||||
state->tx_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
|
||||
tilemap_set_transparent_pen(tx_tilemap, 0);
|
||||
tilemap_set_scrolldx(tx_tilemap, 0, 4*8);
|
||||
tilemap_set_scrolldy(tx_tilemap, 0, -4*8);
|
||||
tilemap_set_transparent_pen(state->tx_tilemap, 0);
|
||||
tilemap_set_scrolldx(state->tx_tilemap, 0, 4*8);
|
||||
tilemap_set_scrolldy(state->tx_tilemap, 0, -4*8);
|
||||
|
||||
tile = auto_bitmap_alloc(machine,32 * 8, 32 * 8, video_screen_get_format(machine->primary_screen));
|
||||
obj1 = auto_bitmap_alloc(machine,32,32,video_screen_get_format(machine->primary_screen));
|
||||
obj2 = auto_bitmap_alloc(machine,32,32,video_screen_get_format(machine->primary_screen));
|
||||
state->tile = auto_bitmap_alloc(machine, 32 * 8, 32 * 8, video_screen_get_format(machine->primary_screen));
|
||||
state->obj1 = auto_bitmap_alloc(machine, 32, 32, video_screen_get_format(machine->primary_screen));
|
||||
state->obj2 = auto_bitmap_alloc(machine, 32, 32, video_screen_get_format(machine->primary_screen));
|
||||
}
|
||||
|
||||
|
||||
@ -457,105 +486,104 @@ static VIDEO_START( marinedt )
|
||||
#define OBJ_COLOR(a) ((a) & 0x03)
|
||||
#define OBJ_X(x) (256 - 32 - (x))
|
||||
#define OBJ_Y(y) (256 - 1 - (y))
|
||||
#define OBJ_FLIPX(a) ((marinedt_pf & 0x02) == 0)
|
||||
#define OBJ_FLIPX(a) ((state->pf & 0x02) == 0)
|
||||
#define OBJ_FLIPY(a) ((a) & 0x80)
|
||||
|
||||
static VIDEO_UPDATE( marinedt )
|
||||
{
|
||||
marinedt_state *state = (marinedt_state *)screen->machine->driver_data;
|
||||
int sx, sy;
|
||||
|
||||
bitmap_fill(tile, NULL, 0);
|
||||
tilemap_draw(tile, cliprect, tx_tilemap, 0, 0);
|
||||
bitmap_fill(state->tile, NULL, 0);
|
||||
tilemap_draw(state->tile, cliprect, state->tx_tilemap, 0, 0);
|
||||
|
||||
bitmap_fill(obj1, NULL, 0);
|
||||
drawgfx_transpen(obj1, NULL, screen->machine->gfx[1],
|
||||
OBJ_CODE(marinedt_obj1_a),
|
||||
OBJ_COLOR(marinedt_obj1_a),
|
||||
OBJ_FLIPX(marinedt_obj1_a), OBJ_FLIPY(marinedt_obj1_a),
|
||||
bitmap_fill(state->obj1, NULL, 0);
|
||||
drawgfx_transpen(state->obj1, NULL, screen->machine->gfx[1],
|
||||
OBJ_CODE(state->obj1_a),
|
||||
OBJ_COLOR(state->obj1_a),
|
||||
OBJ_FLIPX(state->obj1_a), OBJ_FLIPY(state->obj1_a),
|
||||
0, 0, 0);
|
||||
|
||||
bitmap_fill(obj2, NULL, 0);
|
||||
drawgfx_transpen(obj2, NULL, screen->machine->gfx[2],
|
||||
OBJ_CODE(marinedt_obj2_a),
|
||||
OBJ_COLOR(marinedt_obj2_a),
|
||||
OBJ_FLIPX(marinedt_obj2_a), OBJ_FLIPY(marinedt_obj2_a),
|
||||
bitmap_fill(state->obj2, NULL, 0);
|
||||
drawgfx_transpen(state->obj2, NULL, screen->machine->gfx[2],
|
||||
OBJ_CODE(state->obj2_a),
|
||||
OBJ_COLOR(state->obj2_a),
|
||||
OBJ_FLIPX(state->obj2_a), OBJ_FLIPY(state->obj2_a),
|
||||
0, 0, 0);
|
||||
|
||||
bitmap_fill(bitmap, NULL, 0);
|
||||
|
||||
if (marinedt_pd & 0x02)
|
||||
copybitmap_trans(bitmap, obj2, 0, 0, OBJ_X(marinedt_obj2_x), OBJ_Y(marinedt_obj2_y), cliprect, 0);
|
||||
if (state->pd & 0x02)
|
||||
copybitmap_trans(bitmap, state->obj2, 0, 0, OBJ_X(state->obj2_x), OBJ_Y(state->obj2_y), cliprect, 0);
|
||||
|
||||
if (marinedt_pd & 0x01)
|
||||
copybitmap_trans(bitmap, obj1, 0, 0, OBJ_X(marinedt_obj1_x), OBJ_Y(marinedt_obj1_y), cliprect, 0);
|
||||
if (state->pd & 0x01)
|
||||
copybitmap_trans(bitmap, state->obj1, 0, 0, OBJ_X(state->obj1_x), OBJ_Y(state->obj1_y), cliprect, 0);
|
||||
|
||||
copybitmap_trans(bitmap, tile, 0, 0, 0, 0, cliprect, 0);
|
||||
copybitmap_trans(bitmap, state->tile, 0, 0, 0, 0, cliprect, 0);
|
||||
|
||||
coll = cx = cyr = cyq = 0;
|
||||
if (marinedt_pd & 0x01)
|
||||
state->coll = state->cx = state->cyr = state->cyq = 0;
|
||||
if (state->pd & 0x01)
|
||||
{
|
||||
for (sx = 0; sx < 32; sx++)
|
||||
for (sy = 0; sy < 32; sy++)
|
||||
{
|
||||
int x = OBJ_X(marinedt_obj1_x) + sx;
|
||||
int y = OBJ_Y(marinedt_obj1_y) + sy;
|
||||
int x = OBJ_X(state->obj1_x) + sx;
|
||||
int y = OBJ_Y(state->obj1_y) + sy;
|
||||
|
||||
if (x < cliprect->min_x || x > cliprect->max_x
|
||||
|| y < cliprect->min_y || y > cliprect->max_y)
|
||||
if (x < cliprect->min_x || x > cliprect->max_x || y < cliprect->min_y || y > cliprect->max_y)
|
||||
continue;
|
||||
|
||||
if (*BITMAP_ADDR16(obj1, sy, sx) == 0)
|
||||
if (*BITMAP_ADDR16(state->obj1, sy, sx) == 0)
|
||||
continue;
|
||||
|
||||
if (*BITMAP_ADDR16(tile, y, x) != 0)
|
||||
if (*BITMAP_ADDR16(state->tile, y, x) != 0)
|
||||
{
|
||||
coll = 0x08;
|
||||
state->coll = 0x08;
|
||||
|
||||
cx = (x % 128) / 8;
|
||||
cx &= 0x0f;
|
||||
state->cx = (x % 128) / 8;
|
||||
state->cx &= 0x0f;
|
||||
|
||||
cyr = ((y % 64) / 8) * 2 + (x > 127 ? 1 : 0);
|
||||
cyr &= 0x0f;
|
||||
state->cyr = ((y % 64) / 8) * 2 + (x > 127 ? 1 : 0);
|
||||
state->cyr &= 0x0f;
|
||||
|
||||
cyq = y / 64;
|
||||
cyq &= 0x0f;
|
||||
state->cyq = y / 64;
|
||||
state->cyq &= 0x0f;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
collh = cxh = cyrh = cyqh = 0;
|
||||
if ((marinedt_pd & 0x03) == 0x03)
|
||||
state->collh = state->cxh = state->cyrh = state->cyqh = 0;
|
||||
if ((state->pd & 0x03) == 0x03)
|
||||
{
|
||||
for (sx = 0; sx < 32; sx++)
|
||||
for (sy = 0; sy < 32; sy++)
|
||||
{
|
||||
int x = OBJ_X(marinedt_obj1_x + sx);
|
||||
int y = OBJ_Y(marinedt_obj1_y + sy);
|
||||
int x = OBJ_X(state->obj1_x + sx);
|
||||
int y = OBJ_Y(state->obj1_y + sy);
|
||||
|
||||
int xx = OBJ_X(marinedt_obj2_x) - x;
|
||||
int yy = OBJ_Y(marinedt_obj2_y) - y;
|
||||
int xx = OBJ_X(state->obj2_x) - x;
|
||||
int yy = OBJ_Y(state->obj2_y) - y;
|
||||
|
||||
if (xx < 0 || xx >= 32
|
||||
|| yy < 0 || yy >= 32)
|
||||
if (xx < 0 || xx >= 32 || yy < 0 || yy >= 32)
|
||||
continue;
|
||||
|
||||
if (*BITMAP_ADDR16(obj1, sy, sx) == 0)
|
||||
if (*BITMAP_ADDR16(state->obj1, sy, sx) == 0)
|
||||
continue;
|
||||
|
||||
if (*BITMAP_ADDR16(obj2, yy, xx) != 0)
|
||||
if (*BITMAP_ADDR16(state->obj2, yy, xx) != 0)
|
||||
{
|
||||
collh = 0x80;
|
||||
state->collh = 0x80;
|
||||
|
||||
cxh = (x % 128) / 8;
|
||||
cxh &= 0x0f;
|
||||
state->cxh = (x % 128) / 8;
|
||||
state->cxh &= 0x0f;
|
||||
|
||||
cyrh = ((y % 64) / 8) * 2 + (x > 127 ? 1 : 0);
|
||||
cyrh &= 0x0f;
|
||||
state->cyrh = ((y % 64) / 8) * 2 + (x > 127 ? 1 : 0);
|
||||
state->cyrh &= 0x0f;
|
||||
|
||||
cyqh= y / 64;
|
||||
cyqh &= 0x0f;
|
||||
state->cyqh= y / 64;
|
||||
state->cyqh &= 0x0f;
|
||||
|
||||
break;
|
||||
}
|
||||
@ -564,14 +592,68 @@ static VIDEO_UPDATE( marinedt )
|
||||
return 0;
|
||||
}
|
||||
|
||||
static MACHINE_START( marinedt )
|
||||
{
|
||||
marinedt_state *state = (marinedt_state *)machine->driver_data;
|
||||
|
||||
state_save_register_global(machine, state->obj1_a);
|
||||
state_save_register_global(machine, state->obj1_x);
|
||||
state_save_register_global(machine, state->obj1_y);
|
||||
state_save_register_global(machine, state->obj2_a);
|
||||
state_save_register_global(machine, state->obj2_x);
|
||||
state_save_register_global(machine, state->obj2_y);
|
||||
state_save_register_global(machine, state->pd);
|
||||
state_save_register_global(machine, state->pf);
|
||||
state_save_register_global(machine, state->music);
|
||||
state_save_register_global(machine, state->sound);
|
||||
state_save_register_global(machine, state->coll);
|
||||
state_save_register_global(machine, state->cx);
|
||||
state_save_register_global(machine, state->cyr);
|
||||
state_save_register_global(machine, state->cyq);
|
||||
state_save_register_global(machine, state->collh);
|
||||
state_save_register_global(machine, state->cxh);
|
||||
state_save_register_global(machine, state->cyrh);
|
||||
state_save_register_global(machine, state->cyqh);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( marinedt )
|
||||
{
|
||||
marinedt_state *state = (marinedt_state *)machine->driver_data;
|
||||
|
||||
state->obj1_a = 0;
|
||||
state->obj1_x = 0;
|
||||
state->obj1_y = 0;
|
||||
state->obj2_a = 0;
|
||||
state->obj2_x = 0;
|
||||
state->obj2_y = 0;
|
||||
state->pd = 0;
|
||||
state->pf = 0;
|
||||
state->music = 0;
|
||||
state->sound = 0;
|
||||
state->coll = 0;
|
||||
state->cx = 0;
|
||||
state->cyr = 0;
|
||||
state->cyq = 0;
|
||||
state->collh = 0;
|
||||
state->cxh = 0;
|
||||
state->cyrh = 0;
|
||||
state->cyqh = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( marinedt )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(marinedt_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80,10000000/4)
|
||||
MDRV_CPU_PROGRAM_MAP(marinedt_map)
|
||||
MDRV_CPU_IO_MAP(marinedt_io_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
|
||||
|
||||
MDRV_MACHINE_START(marinedt)
|
||||
MDRV_MACHINE_RESET(marinedt)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -626,5 +708,4 @@ ROM_START( marinedt )
|
||||
ROM_LOAD( "mg17.bpr", 0x0060, 0x0020, CRC(13261a02) SHA1(050edd18e4f79d19d5206f55f329340432fd4099) ) //?? table of increasing values
|
||||
ROM_END
|
||||
|
||||
GAME( 1981, marinedt, 0, marinedt, marinedt, 0, ROT270, "Taito", "Marine Date", GAME_NO_SOUND )
|
||||
|
||||
GAME( 1981, marinedt, 0, marinedt, marinedt, 0, ROT270, "Taito", "Marine Date", GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Markham (c) 1983 Sun Electronics
|
||||
Markham (c) 1983 Sun Electronics
|
||||
|
||||
Driver by Uki
|
||||
|
||||
@ -11,15 +11,7 @@ Markham (c) 1983 Sun Electronics
|
||||
#include "emu.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/sn76496.h"
|
||||
|
||||
WRITE8_HANDLER( markham_videoram_w );
|
||||
WRITE8_HANDLER( markham_flipscreen_w );
|
||||
|
||||
PALETTE_INIT( markham );
|
||||
VIDEO_START( markham );
|
||||
VIDEO_UPDATE( markham );
|
||||
|
||||
extern UINT8 *markham_xscroll;
|
||||
#include "includes/markham.h"
|
||||
|
||||
|
||||
static READ8_HANDLER( markham_e004_r )
|
||||
@ -33,8 +25,8 @@ static ADDRESS_MAP_START( markham_master_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x5fff) AM_ROM
|
||||
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_RAM
|
||||
AM_RANGE(0xc800, 0xcfff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(markham_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0xc800, 0xcfff) AM_RAM AM_BASE_SIZE_MEMBER(markham_state, spriteram, spriteram_size)
|
||||
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(markham_videoram_w) AM_BASE_MEMBER(markham_state, videoram)
|
||||
AM_RANGE(0xd800, 0xdfff) AM_RAM AM_SHARE("share1")
|
||||
|
||||
AM_RANGE(0xe000, 0xe000) AM_READ_PORT("DSW2")
|
||||
@ -49,7 +41,7 @@ static ADDRESS_MAP_START( markham_master_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xe008, 0xe008) AM_WRITENOP /* coin counter? */
|
||||
AM_RANGE(0xe009, 0xe009) AM_WRITENOP /* to CPU2 busreq */
|
||||
|
||||
AM_RANGE(0xe00c, 0xe00d) AM_WRITEONLY AM_BASE(&markham_xscroll)
|
||||
AM_RANGE(0xe00c, 0xe00d) AM_WRITEONLY AM_BASE_MEMBER(markham_state, xscroll)
|
||||
AM_RANGE(0xe00e, 0xe00e) AM_WRITE(markham_flipscreen_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -182,6 +174,9 @@ GFXDECODE_END
|
||||
|
||||
static MACHINE_DRIVER_START( markham )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(markham_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80,8000000/2) /* 4.000MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(markham_master_map)
|
||||
@ -249,4 +244,4 @@ ROM_START( markham )
|
||||
ROM_END
|
||||
|
||||
|
||||
GAME( 1983, markham, 0, markham, markham, 0, ROT0, "Sun Electronics", "Markham", 0 )
|
||||
GAME( 1983, markham, 0, markham, markham, 0, ROT0, "Sun Electronics", "Markham", GAME_SUPPORTS_SAVE )
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Kikiippatsu Mayumi-chan (c) 1988 Victory L.L.C.
|
||||
Kikiippatsu Mayumi-chan (c) 1988 Victory L.L.C.
|
||||
|
||||
Driver by Uki
|
||||
|
||||
@ -12,47 +12,100 @@ Kikiippatsu Mayumi-chan (c) 1988 Victory L.L.C.
|
||||
|
||||
#define MCLK 10000000
|
||||
|
||||
extern UINT8 *mayumi_videoram;
|
||||
WRITE8_HANDLER( mayumi_videoram_w );
|
||||
VIDEO_START( mayumi );
|
||||
VIDEO_UPDATE( mayumi );
|
||||
|
||||
static int int_enable;
|
||||
static int input_sel;
|
||||
typedef struct _mayumi_state mayumi_state;
|
||||
struct _mayumi_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
// UINT8 * nvram; // this currently uses generic nvram handlers
|
||||
|
||||
/****************************************************************************/
|
||||
/* video-related */
|
||||
tilemap_t *tilemap;
|
||||
|
||||
/* misc */
|
||||
int int_enable;
|
||||
int input_sel;
|
||||
};
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Video emulation
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static TILE_GET_INFO( get_tile_info )
|
||||
{
|
||||
mayumi_state *state = (mayumi_state *)machine->driver_data;
|
||||
int code = state->videoram[tile_index] + (state->videoram[tile_index + 0x800] & 0x1f) * 0x100;
|
||||
int col = (state->videoram[tile_index + 0x1000] >> 3) & 0x1f;
|
||||
|
||||
SET_TILE_INFO(0, code, col, 0);
|
||||
}
|
||||
|
||||
static VIDEO_START( mayumi )
|
||||
{
|
||||
mayumi_state *state = (mayumi_state *)machine->driver_data;
|
||||
state->tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( mayumi_videoram_w )
|
||||
{
|
||||
mayumi_state *state = (mayumi_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->tilemap, offset & 0x7ff);
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE( mayumi )
|
||||
{
|
||||
mayumi_state *state = (mayumi_state *)screen->machine->driver_data;
|
||||
tilemap_draw(bitmap, cliprect, state->tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Interrupt generator
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static INTERRUPT_GEN( mayumi_interrupt )
|
||||
{
|
||||
if (int_enable)
|
||||
mayumi_state *state = (mayumi_state *)device->machine->driver_data;
|
||||
|
||||
if (state->int_enable)
|
||||
cpu_set_input_line(device, 0, HOLD_LINE);
|
||||
}
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Memory handlers
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static WRITE8_HANDLER( bank_sel_w )
|
||||
{
|
||||
UINT8 *BANKROM = memory_region(space->machine, "maincpu");
|
||||
int bank = ((data & 0x80)) >> 7 | ((data & 0x40) >> 5);
|
||||
memory_set_bankptr(space->machine, "bank1", &BANKROM[0x10000+bank*0x4000]);
|
||||
mayumi_state *state = (mayumi_state *)space->machine->driver_data;
|
||||
int bank = BIT(data, 7) | (BIT(data, 6) << 1);
|
||||
|
||||
int_enable = data & 1;
|
||||
memory_set_bank(space->machine, "bank1", bank);
|
||||
|
||||
state->int_enable = data & 1;
|
||||
|
||||
flip_screen_set(space->machine, data & 2);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( mayumi )
|
||||
{
|
||||
const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
||||
bank_sel_w(space, 0, 0);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( input_sel_w )
|
||||
{
|
||||
input_sel = data;
|
||||
mayumi_state *state = (mayumi_state *)space->machine->driver_data;
|
||||
state->input_sel = data;
|
||||
}
|
||||
|
||||
static READ8_HANDLER( key_matrix_r )
|
||||
{
|
||||
int p,i,ret;
|
||||
mayumi_state *state = (mayumi_state *)space->machine->driver_data;
|
||||
int p, i, ret;
|
||||
static const char *const keynames[2][5] =
|
||||
{
|
||||
{ "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" },
|
||||
@ -61,24 +114,28 @@ static READ8_HANDLER( key_matrix_r )
|
||||
|
||||
ret = 0xff;
|
||||
|
||||
p = ~input_sel & 0x1f;
|
||||
p = ~state->input_sel & 0x1f;
|
||||
|
||||
for (i=0; i<5; i++)
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
if (p & (1 << i))
|
||||
if (BIT(p, i))
|
||||
ret &= input_port_read(space->machine, keynames[offset][i]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/*************************************
|
||||
*
|
||||
* Address maps
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( mayumi_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE_SIZE_GENERIC(nvram)
|
||||
AM_RANGE(0xe000, 0xf7ff) AM_RAM_WRITE(mayumi_videoram_w) AM_BASE(&mayumi_videoram)
|
||||
AM_RANGE(0xe000, 0xf7ff) AM_RAM_WRITE(mayumi_videoram_w) AM_BASE_MEMBER(mayumi_state, videoram)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -91,11 +148,14 @@ static ADDRESS_MAP_START( mayumi_io_map, ADDRESS_SPACE_IO, 8 )
|
||||
AM_RANGE(0xd0, 0xd1) AM_DEVREADWRITE("ymsnd", ym2203_r, ym2203_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
/****************************************************************************/
|
||||
/*************************************
|
||||
*
|
||||
* Input ports
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static INPUT_PORTS_START( mayumi )
|
||||
|
||||
PORT_START("DSW1") /* dsw1 */
|
||||
PORT_START("DSW1")
|
||||
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) )
|
||||
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
@ -120,7 +180,7 @@ static INPUT_PORTS_START( mayumi )
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
|
||||
PORT_START("DSW2") /* dsw2 */
|
||||
PORT_START("DSW2")
|
||||
PORT_DIPNAME( 0x80, 0x80, "Unknown 2-1" )
|
||||
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
@ -146,7 +206,7 @@ static INPUT_PORTS_START( mayumi )
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
|
||||
PORT_START("KEY0") /* P1 IN0 (2) */
|
||||
PORT_START("KEY0")
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_A )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_E )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_I )
|
||||
@ -155,7 +215,7 @@ static INPUT_PORTS_START( mayumi )
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
|
||||
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START("KEY1") /* P1 IN1 (3) */
|
||||
PORT_START("KEY1")
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_B )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_F )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_J )
|
||||
@ -164,7 +224,7 @@ static INPUT_PORTS_START( mayumi )
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START("KEY2") /* P1 IN2 (4) */
|
||||
PORT_START("KEY2")
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_C )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_G )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_K )
|
||||
@ -173,7 +233,7 @@ static INPUT_PORTS_START( mayumi )
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START("KEY3") /* P1 IN3 (5) */
|
||||
PORT_START("KEY3")
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_D )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_H )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_L )
|
||||
@ -182,11 +242,11 @@ static INPUT_PORTS_START( mayumi )
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START("KEY4") /* P1 IN4 (6) */
|
||||
PORT_START("KEY4")
|
||||
PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START("KEY5") /* P2 IN0 (7) */
|
||||
PORT_START("KEY5")
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_PLAYER(2)
|
||||
@ -195,7 +255,7 @@ static INPUT_PORTS_START( mayumi )
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
|
||||
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START("KEY6") /* P2 IN1 (8) */
|
||||
PORT_START("KEY6")
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_J ) PORT_PLAYER(2)
|
||||
@ -204,7 +264,7 @@ static INPUT_PORTS_START( mayumi )
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START("KEY7") /* P2 IN2 (9) */
|
||||
PORT_START("KEY7")
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_K ) PORT_PLAYER(2)
|
||||
@ -213,7 +273,7 @@ static INPUT_PORTS_START( mayumi )
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START("KEY8") /* P2 IN3 (10) */
|
||||
PORT_START("KEY8")
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_PLAYER(2)
|
||||
@ -222,23 +282,26 @@ static INPUT_PORTS_START( mayumi )
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START("KEY9") /* P2 IN4 (11) */
|
||||
PORT_START("KEY9")
|
||||
PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START("IN0")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW , IPT_COIN1 )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW , IPT_COIN1 )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
|
||||
PORT_SERVICE( 0x10, IP_ACTIVE_HIGH )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SERVICE2 ) // analyzer
|
||||
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE4 ) // memory reset
|
||||
|
||||
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SERVICE2 ) // analyzer
|
||||
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE4 ) // memory reset
|
||||
INPUT_PORTS_END
|
||||
|
||||
/****************************************************************************/
|
||||
/*************************************
|
||||
*
|
||||
* Graphics definitions
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const gfx_layout charlayout =
|
||||
{
|
||||
@ -255,6 +318,12 @@ static GFXDECODE_START( mayumi )
|
||||
GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout, 0, 32 )
|
||||
GFXDECODE_END
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Sound interfaces
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const ym2203_interface ym2203_config =
|
||||
{
|
||||
{
|
||||
@ -268,14 +337,44 @@ static const ym2203_interface ym2203_config =
|
||||
NULL
|
||||
};
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Machine driver
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( mayumi )
|
||||
{
|
||||
mayumi_state *state = (mayumi_state *)machine->driver_data;
|
||||
UINT8 *ROM = memory_region(machine, "maincpu");
|
||||
|
||||
memory_configure_bank(machine, "bank1", 0, 4, &ROM[0x10000], 0x4000);
|
||||
memory_set_bank(machine, "bank1", 0);
|
||||
|
||||
state_save_register_global(machine, state->int_enable);
|
||||
state_save_register_global(machine, state->input_sel);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( mayumi )
|
||||
{
|
||||
mayumi_state *state = (mayumi_state *)machine->driver_data;
|
||||
|
||||
state->int_enable = 0;
|
||||
state->input_sel = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( mayumi )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(mayumi_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, MCLK/2) /* 5.000 MHz ? */
|
||||
MDRV_CPU_PROGRAM_MAP(mayumi_map)
|
||||
MDRV_CPU_IO_MAP(mayumi_io_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", mayumi_interrupt)
|
||||
|
||||
MDRV_MACHINE_START( mayumi )
|
||||
MDRV_MACHINE_RESET( mayumi )
|
||||
|
||||
/* video hardware */
|
||||
@ -307,7 +406,11 @@ static MACHINE_DRIVER_START( mayumi )
|
||||
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
/****************************************************************************/
|
||||
/*************************************
|
||||
*
|
||||
* ROM definition(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
ROM_START( mayumi )
|
||||
ROM_REGION( 0x20000, "maincpu", 0 ) /* CPU */
|
||||
@ -326,4 +429,10 @@ ROM_START( mayumi )
|
||||
ROM_LOAD( "my-9k.bin", 0x0200, 0x0100, CRC(3e7a8012) SHA1(24129586a1c39f68dad274b5afbdd6c027ab0901) ) // B
|
||||
ROM_END
|
||||
|
||||
GAME( 1988, mayumi, 0, mayumi, mayumi, 0, ROT0, "[Sanritsu] Victory L.L.C.", "Kikiippatsu Mayumi-chan (Japan)", 0 )
|
||||
/*************************************
|
||||
*
|
||||
* Game driver(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1988, mayumi, 0, mayumi, mayumi, 0, ROT0, "[Sanritsu] Victory L.L.C.", "Kikiippatsu Mayumi-chan (Japan)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -141,17 +141,15 @@ Stephh's notes (based on the games M68000 code and some tests) :
|
||||
#include "sound/2610intf.h"
|
||||
#include "includes/mcatadv.h"
|
||||
|
||||
UINT16* mcatadv_videoram1, *mcatadv_videoram2;
|
||||
UINT16* mcatadv_scroll, *mcatadv_scroll2;
|
||||
UINT16* mcatadv_vidregs;
|
||||
|
||||
|
||||
/*** Main CPU ***/
|
||||
|
||||
static WRITE16_HANDLER( mcat_soundlatch_w )
|
||||
{
|
||||
mcatadv_state *state = (mcatadv_state *)space->machine->driver_data;
|
||||
|
||||
soundlatch_w(space, 0, data);
|
||||
cputag_set_input_line(space->machine, "soundcpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
cpu_set_input_line(state->soundcpu, INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
#if 0 // mcat only.. install read handler?
|
||||
@ -169,7 +167,7 @@ static WRITE16_HANDLER( mcat_coin_w )
|
||||
|
||||
static READ16_HANDLER( mcat_wd_r )
|
||||
{
|
||||
watchdog_reset_r(space,0);
|
||||
watchdog_reset_r(space, 0);
|
||||
return 0xc00;
|
||||
}
|
||||
|
||||
@ -180,16 +178,16 @@ static ADDRESS_MAP_START( mcatadv_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
|
||||
// AM_RANGE(0x180018, 0x18001f) AM_READNOP // ?
|
||||
|
||||
AM_RANGE(0x200000, 0x200005) AM_RAM AM_BASE(&mcatadv_scroll)
|
||||
AM_RANGE(0x300000, 0x300005) AM_RAM AM_BASE(&mcatadv_scroll2)
|
||||
AM_RANGE(0x200000, 0x200005) AM_RAM AM_BASE_MEMBER(mcatadv_state, scroll1)
|
||||
AM_RANGE(0x300000, 0x300005) AM_RAM AM_BASE_MEMBER(mcatadv_state, scroll2)
|
||||
|
||||
AM_RANGE(0x400000, 0x401fff) AM_RAM_WRITE(mcatadv_videoram1_w) AM_BASE(&mcatadv_videoram1) // Tilemap 0
|
||||
AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(mcatadv_videoram2_w) AM_BASE(&mcatadv_videoram2) // Tilemap 1
|
||||
AM_RANGE(0x400000, 0x401fff) AM_RAM_WRITE(mcatadv_videoram1_w) AM_BASE_MEMBER(mcatadv_state, videoram1) // Tilemap 0
|
||||
AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(mcatadv_videoram2_w) AM_BASE_MEMBER(mcatadv_state, videoram2) // Tilemap 1
|
||||
|
||||
AM_RANGE(0x600000, 0x601fff) AM_RAM_WRITE(paletteram16_xGGGGGRRRRRBBBBB_word_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0x602000, 0x602fff) AM_RAM // Bigger than needs to be?
|
||||
|
||||
AM_RANGE(0x700000, 0x707fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) // Sprites, two halves for double buffering
|
||||
AM_RANGE(0x700000, 0x707fff) AM_RAM AM_BASE_SIZE_MEMBER(mcatadv_state, spriteram, spriteram_size) // Sprites, two halves for double buffering
|
||||
AM_RANGE(0x708000, 0x70ffff) AM_RAM // Tests more than is needed?
|
||||
|
||||
AM_RANGE(0x800000, 0x800001) AM_READ_PORT("P1")
|
||||
@ -198,20 +196,18 @@ static ADDRESS_MAP_START( mcatadv_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0xa00000, 0xa00001) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0xa00002, 0xa00003) AM_READ_PORT("DSW2")
|
||||
|
||||
AM_RANGE(0xb00000, 0xb0000f) AM_RAM AM_BASE(&mcatadv_vidregs)
|
||||
AM_RANGE(0xb00000, 0xb0000f) AM_RAM AM_BASE_MEMBER(mcatadv_state, vidregs)
|
||||
|
||||
AM_RANGE(0xb00018, 0xb00019) AM_WRITE(watchdog_reset16_w) // NOST Only
|
||||
AM_RANGE(0xb0001e, 0xb0001f) AM_READ(mcat_wd_r) // MCAT Only
|
||||
AM_RANGE(0xc00000, 0xc00001) AM_READWRITE(soundlatch2_word_r,mcat_soundlatch_w)
|
||||
AM_RANGE(0xc00000, 0xc00001) AM_READWRITE(soundlatch2_word_r, mcat_soundlatch_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
/*** Sound ***/
|
||||
|
||||
static WRITE8_HANDLER ( mcatadv_sound_bw_w )
|
||||
{
|
||||
UINT8 *rom = memory_region(space->machine, "soundcpu") + 0x10000;
|
||||
|
||||
memory_set_bankptr(space->machine, "bank1",rom + data * 0x4000);
|
||||
memory_set_bank(space->machine, "bank1", data);
|
||||
}
|
||||
|
||||
|
||||
@ -420,16 +416,36 @@ GFXDECODE_END
|
||||
/* Stolen from Psikyo.c */
|
||||
static void sound_irq( running_device *device, int irq )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "soundcpu", 0, irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
mcatadv_state *state = (mcatadv_state *)device->machine->driver_data;
|
||||
cpu_set_input_line(state->soundcpu, 0, irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static const ym2610_interface mcatadv_ym2610_interface =
|
||||
{
|
||||
sound_irq /* irq */
|
||||
};
|
||||
|
||||
|
||||
static MACHINE_START( mcatadv )
|
||||
{
|
||||
mcatadv_state *state = (mcatadv_state *)machine->driver_data;
|
||||
UINT8 *ROM = memory_region(machine, "soundcpu");
|
||||
|
||||
memory_configure_bank(machine, "bank1", 0, 8, &ROM[0x10000], 0x4000);
|
||||
memory_set_bank(machine, "bank1", 1);
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->soundcpu = devtag_get_device(machine, "soundcpu");
|
||||
|
||||
state_save_register_global(machine, state->palette_bank1);
|
||||
state_save_register_global(machine, state->palette_bank2);
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( mcatadv )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(mcatadv_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M68000, XTAL_16MHz) /* verified on pcb */
|
||||
MDRV_CPU_PROGRAM_MAP(mcatadv_map)
|
||||
@ -439,6 +455,8 @@ static MACHINE_DRIVER_START( mcatadv )
|
||||
MDRV_CPU_PROGRAM_MAP(mcatadv_sound_map)
|
||||
MDRV_CPU_IO_MAP(mcatadv_sound_io_map)
|
||||
|
||||
MDRV_MACHINE_START(mcatadv)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -476,14 +494,6 @@ static MACHINE_DRIVER_START( nost )
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
|
||||
static DRIVER_INIT( mcatadv )
|
||||
{
|
||||
UINT8 *z80rom = memory_region(machine, "soundcpu") + 0x10000;
|
||||
|
||||
memory_set_bankptr(machine, "bank1", z80rom + 0x4000);
|
||||
}
|
||||
|
||||
|
||||
ROM_START( mcatadv )
|
||||
ROM_REGION( 0x100000, "maincpu", 0 ) /* M68000 */
|
||||
ROM_LOAD16_BYTE( "mca-u30e", 0x00000, 0x80000, CRC(c62fbb65) SHA1(39a30a165d4811141db8687a4849626bef8e778e) )
|
||||
@ -662,9 +672,10 @@ ROM_START( nostk )
|
||||
ROM_LOAD( "nossn-00.u53", 0x00000, 0x100000, CRC(3bd1bcbc) SHA1(1bcad43792e985402db4eca122676c2c555f3313) )
|
||||
ROM_END
|
||||
|
||||
GAME( 1993, mcatadv, 0, mcatadv, mcatadv, mcatadv, ROT0, "Wintechno", "Magical Cat Adventure", GAME_NO_COCKTAIL )
|
||||
GAME( 1993, mcatadvj, mcatadv, mcatadv, mcatadv, mcatadv, ROT0, "Wintechno", "Magical Cat Adventure (Japan)", GAME_NO_COCKTAIL )
|
||||
GAME( 1993, catt, mcatadv, mcatadv, mcatadv, mcatadv, ROT0, "Wintechno", "Catt (Japan)", GAME_NO_COCKTAIL )
|
||||
GAME( 1993, nost, 0, nost, nost, mcatadv, ROT270, "Face", "Nostradamus", GAME_NO_COCKTAIL )
|
||||
GAME( 1993, nostj, nost, nost, nost, mcatadv, ROT270, "Face", "Nostradamus (Japan)", GAME_NO_COCKTAIL )
|
||||
GAME( 1993, nostk, nost, nost, nost, mcatadv, ROT270, "Face", "Nostradamus (Korea)", GAME_NO_COCKTAIL )
|
||||
|
||||
GAME( 1993, mcatadv, 0, mcatadv, mcatadv, 0, ROT0, "Wintechno", "Magical Cat Adventure", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1993, mcatadvj, mcatadv, mcatadv, mcatadv, 0, ROT0, "Wintechno", "Magical Cat Adventure (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1993, catt, mcatadv, mcatadv, mcatadv, 0, ROT0, "Wintechno", "Catt (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1993, nost, 0, nost, nost, 0, ROT270, "Face", "Nostradamus", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1993, nostj, nost, nost, nost, 0, ROT270, "Face", "Nostradamus (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1993, nostk, nost, nost, nost, 0, ROT270, "Face", "Nostradamus (Korea)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
|
48
src/mame/includes/macrossp.h
Normal file
48
src/mame/includes/macrossp.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*************************************************************************
|
||||
|
||||
Macross Plus
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _macrossp_state macrossp_state;
|
||||
struct _macrossp_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT32 * mainram;
|
||||
UINT32 * scra_videoram;
|
||||
UINT32 * scra_videoregs;
|
||||
UINT32 * scrb_videoram;
|
||||
UINT32 * scrb_videoregs;
|
||||
UINT32 * scrc_videoram;
|
||||
UINT32 * scrc_videoregs;
|
||||
UINT32 * text_videoram;
|
||||
UINT32 * text_videoregs;
|
||||
UINT32 * spriteram;
|
||||
UINT32 * spriteram_old;
|
||||
UINT32 * spriteram_old2;
|
||||
UINT32 * paletteram;
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap_t *scra_tilemap, *scrb_tilemap, *scrc_tilemap, *text_tilemap;
|
||||
|
||||
/* misc */
|
||||
int sndpending;
|
||||
int snd_toggle;
|
||||
INT32 fade_effect, old_fade;
|
||||
|
||||
/* devices */
|
||||
running_device *maincpu;
|
||||
running_device *audiocpu;
|
||||
};
|
||||
|
||||
/*----------- defined in video/macrossp.c -----------*/
|
||||
|
||||
WRITE32_HANDLER( macrossp_scra_videoram_w );
|
||||
WRITE32_HANDLER( macrossp_scrb_videoram_w );
|
||||
WRITE32_HANDLER( macrossp_scrc_videoram_w );
|
||||
WRITE32_HANDLER( macrossp_text_videoram_w );
|
||||
|
||||
VIDEO_START(macrossp);
|
||||
VIDEO_UPDATE(macrossp);
|
||||
VIDEO_EOF(macrossp);
|
28
src/mame/includes/markham.h
Normal file
28
src/mame/includes/markham.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*************************************************************************
|
||||
|
||||
Markham
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _markham_state markham_state;
|
||||
struct _markham_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * spriteram;
|
||||
UINT8 * xscroll;
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap_t *bg_tilemap;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/markham.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( markham_videoram_w );
|
||||
WRITE8_HANDLER( markham_flipscreen_w );
|
||||
|
||||
PALETTE_INIT( markham );
|
||||
VIDEO_START( markham );
|
||||
VIDEO_UPDATE( markham );
|
@ -1,9 +1,27 @@
|
||||
/*----------- defined in drivers/mcatadv.c -----------*/
|
||||
|
||||
extern UINT16 *mcatadv_videoram1, *mcatadv_videoram2;
|
||||
extern UINT16 *mcatadv_scroll, *mcatadv_scroll2;
|
||||
extern UINT16 *mcatadv_vidregs;
|
||||
typedef struct _mcatadv_state mcatadv_state;
|
||||
struct _mcatadv_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT16 * videoram1;
|
||||
UINT16 * videoram2;
|
||||
UINT16 * scroll1;
|
||||
UINT16 * scroll2;
|
||||
UINT16 * spriteram;
|
||||
UINT16 * spriteram_old;
|
||||
UINT16 * vidregs;
|
||||
UINT16 * vidregs_old;
|
||||
// UINT16 * paletteram; // this currently uses generic palette handlers
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap_t *tilemap1, *tilemap2;
|
||||
int palette_bank1, palette_bank2;
|
||||
|
||||
/* devices */
|
||||
running_device *maincpu;
|
||||
running_device *soundcpu;
|
||||
};
|
||||
|
||||
/*----------- defined in video/mcatadv.c -----------*/
|
||||
|
||||
|
@ -1095,7 +1095,7 @@ $(MAMEOBJ)/sanritsu.a: \
|
||||
$(DRIVERS)/chinsan.o \
|
||||
$(DRIVERS)/drmicro.o $(VIDEO)/drmicro.o \
|
||||
$(DRIVERS)/jantotsu.o \
|
||||
$(DRIVERS)/mayumi.o $(VIDEO)/mayumi.o \
|
||||
$(DRIVERS)/mayumi.o \
|
||||
$(DRIVERS)/mermaid.o $(VIDEO)/mermaid.o \
|
||||
$(DRIVERS)/mjkjidai.o $(VIDEO)/mjkjidai.o \
|
||||
|
||||
|
@ -1,38 +1,30 @@
|
||||
/* Macross Plus - video
|
||||
see DRIVER file for notes */
|
||||
/* video/macrossp.c */
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
|
||||
UINT32 *macrossp_scra_videoram, *macrossp_scra_videoregs;
|
||||
UINT32 *macrossp_scrb_videoram, *macrossp_scrb_videoregs;
|
||||
UINT32 *macrossp_scrc_videoram, *macrossp_scrc_videoregs;
|
||||
UINT32 *macrossp_text_videoram, *macrossp_text_videoregs;
|
||||
UINT32 *macrossp_spriteram;
|
||||
|
||||
static UINT32 *spriteram_old,*spriteram_old2;
|
||||
|
||||
static tilemap_t *macrossp_scra_tilemap, *macrossp_scrb_tilemap,*macrossp_scrc_tilemap, *macrossp_text_tilemap;
|
||||
#include "includes/macrossp.h"
|
||||
|
||||
|
||||
/*** SCR A LAYER ***/
|
||||
|
||||
WRITE32_HANDLER( macrossp_scra_videoram_w )
|
||||
{
|
||||
COMBINE_DATA(¯ossp_scra_videoram[offset]);
|
||||
macrossp_state *state = (macrossp_state *)space->machine->driver_data;
|
||||
|
||||
tilemap_mark_tile_dirty(macrossp_scra_tilemap,offset);
|
||||
COMBINE_DATA(&state->scra_videoram[offset]);
|
||||
|
||||
tilemap_mark_tile_dirty(state->scra_tilemap, offset);
|
||||
}
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_macrossp_scra_tile_info )
|
||||
{
|
||||
UINT32 attr,tileno,color;
|
||||
macrossp_state *state = (macrossp_state *)machine->driver_data;
|
||||
UINT32 attr, tileno, color;
|
||||
|
||||
attr = macrossp_scra_videoram[tile_index];
|
||||
attr = state->scra_videoram[tile_index];
|
||||
tileno = attr & 0x0000ffff;
|
||||
|
||||
switch (macrossp_scra_videoregs[0] & 0x00000c00)
|
||||
switch (state->scra_videoregs[0] & 0x00000c00)
|
||||
{
|
||||
case 0x00000800:
|
||||
color = (attr & 0x000e0000) >> 15;
|
||||
@ -47,27 +39,30 @@ static TILE_GET_INFO( get_macrossp_scra_tile_info )
|
||||
break;
|
||||
}
|
||||
|
||||
SET_TILE_INFO(1,tileno,color,TILE_FLIPYX((attr & 0xc0000000) >> 30));
|
||||
SET_TILE_INFO(1, tileno, color, TILE_FLIPYX((attr & 0xc0000000) >> 30));
|
||||
}
|
||||
|
||||
/*** SCR B LAYER ***/
|
||||
|
||||
WRITE32_HANDLER( macrossp_scrb_videoram_w )
|
||||
{
|
||||
COMBINE_DATA(¯ossp_scrb_videoram[offset]);
|
||||
macrossp_state *state = (macrossp_state *)space->machine->driver_data;
|
||||
|
||||
tilemap_mark_tile_dirty(macrossp_scrb_tilemap,offset);
|
||||
COMBINE_DATA(&state->scrb_videoram[offset]);
|
||||
|
||||
tilemap_mark_tile_dirty(state->scrb_tilemap, offset);
|
||||
}
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_macrossp_scrb_tile_info )
|
||||
{
|
||||
UINT32 attr,tileno,color;
|
||||
macrossp_state *state = (macrossp_state *)machine->driver_data;
|
||||
UINT32 attr, tileno, color;
|
||||
|
||||
attr = macrossp_scrb_videoram[tile_index];
|
||||
attr = state->scrb_videoram[tile_index];
|
||||
tileno = attr & 0x0000ffff;
|
||||
|
||||
switch (macrossp_scrb_videoregs[0] & 0x00000c00)
|
||||
switch (state->scrb_videoregs[0] & 0x00000c00)
|
||||
{
|
||||
case 0x00000800:
|
||||
color = (attr & 0x000e0000) >> 15;
|
||||
@ -82,27 +77,30 @@ static TILE_GET_INFO( get_macrossp_scrb_tile_info )
|
||||
break;
|
||||
}
|
||||
|
||||
SET_TILE_INFO(2,tileno,color,TILE_FLIPYX((attr & 0xc0000000) >> 30));
|
||||
SET_TILE_INFO(2, tileno, color, TILE_FLIPYX((attr & 0xc0000000) >> 30));
|
||||
}
|
||||
|
||||
/*** SCR C LAYER ***/
|
||||
|
||||
WRITE32_HANDLER( macrossp_scrc_videoram_w )
|
||||
{
|
||||
COMBINE_DATA(¯ossp_scrc_videoram[offset]);
|
||||
macrossp_state *state = (macrossp_state *)space->machine->driver_data;
|
||||
|
||||
tilemap_mark_tile_dirty(macrossp_scrc_tilemap,offset);
|
||||
COMBINE_DATA(&state->scrc_videoram[offset]);
|
||||
|
||||
tilemap_mark_tile_dirty(state->scrc_tilemap, offset);
|
||||
}
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_macrossp_scrc_tile_info )
|
||||
{
|
||||
UINT32 attr,tileno,color;
|
||||
macrossp_state *state = (macrossp_state *)machine->driver_data;
|
||||
UINT32 attr, tileno, color;
|
||||
|
||||
attr = macrossp_scrc_videoram[tile_index];
|
||||
attr = state->scrc_videoram[tile_index];
|
||||
tileno = attr & 0x0000ffff;
|
||||
|
||||
switch (macrossp_scrc_videoregs[0] & 0x00000c00)
|
||||
switch (state->scrc_videoregs[0] & 0x00000c00)
|
||||
{
|
||||
case 0x00000800:
|
||||
color = (attr & 0x000e0000) >> 15;
|
||||
@ -117,65 +115,73 @@ static TILE_GET_INFO( get_macrossp_scrc_tile_info )
|
||||
break;
|
||||
}
|
||||
|
||||
SET_TILE_INFO(3,tileno,color,TILE_FLIPYX((attr & 0xc0000000) >> 30));
|
||||
SET_TILE_INFO(3, tileno, color, TILE_FLIPYX((attr & 0xc0000000) >> 30));
|
||||
}
|
||||
|
||||
/*** TEXT LAYER ***/
|
||||
|
||||
WRITE32_HANDLER( macrossp_text_videoram_w )
|
||||
{
|
||||
COMBINE_DATA(¯ossp_text_videoram[offset]);
|
||||
macrossp_state *state = (macrossp_state *)space->machine->driver_data;
|
||||
|
||||
tilemap_mark_tile_dirty(macrossp_text_tilemap,offset);
|
||||
COMBINE_DATA(&state->text_videoram[offset]);
|
||||
|
||||
tilemap_mark_tile_dirty(state->text_tilemap, offset);
|
||||
}
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_macrossp_text_tile_info )
|
||||
{
|
||||
macrossp_state *state = (macrossp_state *)machine->driver_data;
|
||||
UINT32 tileno, colour;
|
||||
|
||||
tileno = macrossp_text_videoram[tile_index] & 0x0000ffff;
|
||||
colour = (macrossp_text_videoram[tile_index] & 0x00fe0000) >> 17;
|
||||
tileno = state->text_videoram[tile_index] & 0x0000ffff;
|
||||
colour = (state->text_videoram[tile_index] & 0x00fe0000) >> 17;
|
||||
|
||||
SET_TILE_INFO(4,tileno,colour,0);
|
||||
SET_TILE_INFO(4, tileno, colour, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*** VIDEO START / UPDATE ***/
|
||||
|
||||
VIDEO_START(macrossp)
|
||||
VIDEO_START( macrossp )
|
||||
{
|
||||
spriteram_old = auto_alloc_array_clear(machine, UINT32, machine->generic.spriteram_size/4);
|
||||
spriteram_old2 = auto_alloc_array_clear(machine, UINT32, machine->generic.spriteram_size/4);
|
||||
macrossp_state *state = (macrossp_state *)machine->driver_data;
|
||||
|
||||
macrossp_text_tilemap = tilemap_create(machine, get_macrossp_text_tile_info,tilemap_scan_rows,16,16,64,64);
|
||||
macrossp_scra_tilemap = tilemap_create(machine, get_macrossp_scra_tile_info,tilemap_scan_rows,16,16,64,64);
|
||||
macrossp_scrb_tilemap = tilemap_create(machine, get_macrossp_scrb_tile_info,tilemap_scan_rows,16,16,64,64);
|
||||
macrossp_scrc_tilemap = tilemap_create(machine, get_macrossp_scrc_tile_info,tilemap_scan_rows,16,16,64,64);
|
||||
state->spriteram_old = auto_alloc_array_clear(machine, UINT32, state->spriteram_size / 4);
|
||||
state->spriteram_old2 = auto_alloc_array_clear(machine, UINT32, state->spriteram_size / 4);
|
||||
|
||||
tilemap_set_transparent_pen(macrossp_text_tilemap,0);
|
||||
tilemap_set_transparent_pen(macrossp_scra_tilemap,0);
|
||||
tilemap_set_transparent_pen(macrossp_scrb_tilemap,0);
|
||||
tilemap_set_transparent_pen(macrossp_scrc_tilemap,0);
|
||||
state->text_tilemap = tilemap_create(machine, get_macrossp_text_tile_info, tilemap_scan_rows, 16, 16, 64, 64);
|
||||
state->scra_tilemap = tilemap_create(machine, get_macrossp_scra_tile_info, tilemap_scan_rows, 16, 16, 64, 64);
|
||||
state->scrb_tilemap = tilemap_create(machine, get_macrossp_scrb_tile_info, tilemap_scan_rows, 16, 16, 64, 64);
|
||||
state->scrc_tilemap = tilemap_create(machine, get_macrossp_scrc_tile_info, tilemap_scan_rows, 16, 16, 64, 64);
|
||||
|
||||
machine->gfx[0]->color_granularity=64;
|
||||
machine->gfx[1]->color_granularity=64;
|
||||
machine->gfx[2]->color_granularity=64;
|
||||
machine->gfx[3]->color_granularity=64;
|
||||
tilemap_set_transparent_pen(state->text_tilemap, 0);
|
||||
tilemap_set_transparent_pen(state->scra_tilemap, 0);
|
||||
tilemap_set_transparent_pen(state->scrb_tilemap, 0);
|
||||
tilemap_set_transparent_pen(state->scrc_tilemap, 0);
|
||||
|
||||
machine->gfx[0]->color_granularity = 64;
|
||||
machine->gfx[1]->color_granularity = 64;
|
||||
machine->gfx[2]->color_granularity = 64;
|
||||
machine->gfx[3]->color_granularity = 64;
|
||||
|
||||
state_save_register_global_pointer(machine, state->spriteram_old, state->spriteram_size / 4);
|
||||
state_save_register_global_pointer(machine, state->spriteram_old2, state->spriteram_size / 4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority )
|
||||
{
|
||||
macrossp_state *state = (macrossp_state *)machine->driver_data;
|
||||
const gfx_element *gfx = machine->gfx[0];
|
||||
// UINT32 *source = macrossp_spriteram;
|
||||
UINT32 *source = spriteram_old2; /* buffers by two frames */
|
||||
UINT32 *finish = source + machine->generic.spriteram_size/4;
|
||||
// UINT32 *source = state->spriteram;
|
||||
UINT32 *source = state->spriteram_old2; /* buffers by two frames */
|
||||
UINT32 *finish = source + state->spriteram_size / 4;
|
||||
|
||||
|
||||
while( source<finish )
|
||||
while (source < finish)
|
||||
{
|
||||
|
||||
/*
|
||||
@ -208,8 +214,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
int loopno = 0;
|
||||
|
||||
int xcnt,ycnt;
|
||||
int xoffset,yoffset;
|
||||
int xcnt, ycnt;
|
||||
int xoffset, yoffset;
|
||||
|
||||
int pri = (source[2] & 0x0c000000) >> 26;
|
||||
|
||||
@ -234,12 +240,17 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
if (xpos > 0x1ff) xpos -=0x400;
|
||||
if (ypos > 0x1ff) ypos -=0x400;
|
||||
|
||||
if (!flipx) {
|
||||
if (!flipy) { /* noxflip, noyflip */
|
||||
if (!flipx)
|
||||
{
|
||||
if (!flipy)
|
||||
{
|
||||
/* noxflip, noyflip */
|
||||
yoffset = 0; /* I'm doing this so rounding errors are cumulative, still looks a touch crappy when multiple sprites used together */
|
||||
for (ycnt = 0; ycnt <= high; ycnt++) {
|
||||
for (ycnt = 0; ycnt <= high; ycnt++)
|
||||
{
|
||||
xoffset = 0;
|
||||
for (xcnt = 0; xcnt <= wide; xcnt++) {
|
||||
for (xcnt = 0; xcnt <= wide; xcnt++)
|
||||
{
|
||||
drawgfxzoom_alpha(bitmap,cliprect,gfx,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset,xzoom*0x100,yzoom*0x100,0,alpha);
|
||||
|
||||
xoffset += ((xzoom*16 + (1<<7)) >> 8);
|
||||
@ -247,43 +258,59 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
}
|
||||
yoffset += ((yzoom*16 + (1<<7)) >> 8);
|
||||
}
|
||||
}else{ /* noxflip, flipy */
|
||||
yoffset = ((high*yzoom*16) >> 8);
|
||||
for (ycnt = high; ycnt >= 0; ycnt--) {
|
||||
xoffset = 0;
|
||||
for (xcnt = 0; xcnt <= wide; xcnt++) {
|
||||
drawgfxzoom_alpha(bitmap,cliprect,gfx,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset,xzoom*0x100,yzoom*0x100,0,alpha);
|
||||
|
||||
xoffset += ((xzoom*16 + (1<<7)) >> 8);
|
||||
loopno++;
|
||||
}
|
||||
yoffset -= ((yzoom*16 + (1<<7)) >> 8);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if (!flipy) { /* xflip, noyflip */
|
||||
yoffset = 0;
|
||||
for (ycnt = 0; ycnt <= high; ycnt++) {
|
||||
xoffset = ((wide*xzoom*16) >> 8);
|
||||
for (xcnt = wide; xcnt >= 0; xcnt--) {
|
||||
else
|
||||
{
|
||||
/* noxflip, flipy */
|
||||
yoffset = ((high * yzoom * 16) >> 8);
|
||||
for (ycnt = high; ycnt >= 0; ycnt--)
|
||||
{
|
||||
xoffset = 0;
|
||||
for (xcnt = 0; xcnt <= wide; xcnt++)
|
||||
{
|
||||
drawgfxzoom_alpha(bitmap,cliprect,gfx,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset,xzoom*0x100,yzoom*0x100,0,alpha);
|
||||
|
||||
xoffset -= ((xzoom*16 + (1<<7)) >> 8);
|
||||
xoffset += ((xzoom * 16 + (1 << 7)) >> 8);
|
||||
loopno++;
|
||||
}
|
||||
yoffset += ((yzoom*16 + (1<<7)) >> 8);
|
||||
yoffset -= ((yzoom * 16 + (1 << 7)) >> 8);
|
||||
}
|
||||
}else{ /* xflip, yflip */
|
||||
yoffset = ((high*yzoom*16) >> 8);
|
||||
for (ycnt = high; ycnt >= 0; ycnt--) {
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!flipy)
|
||||
{
|
||||
/* xflip, noyflip */
|
||||
yoffset = 0;
|
||||
for (ycnt = 0; ycnt <= high; ycnt++)
|
||||
{
|
||||
xoffset = ((wide*xzoom*16) >> 8);
|
||||
for (xcnt = wide; xcnt >=0 ; xcnt--) {
|
||||
for (xcnt = wide; xcnt >= 0; xcnt--)
|
||||
{
|
||||
drawgfxzoom_alpha(bitmap,cliprect,gfx,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset,xzoom*0x100,yzoom*0x100,0,alpha);
|
||||
|
||||
xoffset -= ((xzoom*16 + (1<<7)) >> 8);
|
||||
xoffset -= ((xzoom * 16 + (1 << 7)) >> 8);
|
||||
loopno++;
|
||||
}
|
||||
yoffset -= ((yzoom*16 + (1<<7)) >> 8);
|
||||
yoffset += ((yzoom * 16 + (1 << 7)) >> 8);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* xflip, yflip */
|
||||
yoffset = ((high * yzoom * 16) >> 8);
|
||||
for (ycnt = high; ycnt >= 0; ycnt--)
|
||||
{
|
||||
xoffset = ((wide * xzoom * 16) >> 8);
|
||||
for (xcnt = wide; xcnt >=0 ; xcnt--)
|
||||
{
|
||||
drawgfxzoom_alpha(bitmap,cliprect,gfx,tileno+loopno,col,flipx,flipy,xpos+xoffset,ypos+yoffset,xzoom*0x100,yzoom*0x100,0,alpha);
|
||||
|
||||
xoffset -= ((xzoom * 16 + (1 << 7)) >> 8);
|
||||
loopno++;
|
||||
}
|
||||
yoffset -= ((yzoom * 16 + (1 << 7)) >> 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -293,8 +320,9 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
}
|
||||
|
||||
|
||||
static void draw_layer(bitmap_t *bitmap, const rectangle *cliprect, int layer)
|
||||
static void draw_layer( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer )
|
||||
{
|
||||
macrossp_state *state = (macrossp_state *)machine->driver_data;
|
||||
tilemap_t *tm;
|
||||
UINT32 *vr;
|
||||
|
||||
@ -302,24 +330,24 @@ static void draw_layer(bitmap_t *bitmap, const rectangle *cliprect, int layer)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
tm = macrossp_scra_tilemap;
|
||||
vr = macrossp_scra_videoregs;
|
||||
tm = state->scra_tilemap;
|
||||
vr = state->scra_videoregs;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
tm = macrossp_scrb_tilemap;
|
||||
vr = macrossp_scrb_videoregs;
|
||||
tm = state->scrb_tilemap;
|
||||
vr = state->scrb_videoregs;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
tm = macrossp_scrc_tilemap;
|
||||
vr = macrossp_scrc_videoregs;
|
||||
tm = state->scrc_tilemap;
|
||||
vr = state->scrc_videoregs;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((vr[2] & 0xf0000000) == 0xe0000000) /* zoom enable (guess, surely wrong) */
|
||||
{
|
||||
int startx,starty,inc;
|
||||
int startx, starty, inc;
|
||||
|
||||
startx = (vr[1] & 0x0000ffff) << 16;
|
||||
starty = (vr[1] & 0xffff0000) >> 0;
|
||||
@ -339,7 +367,7 @@ static void draw_layer(bitmap_t *bitmap, const rectangle *cliprect, int layer)
|
||||
{
|
||||
tilemap_set_scrollx( tm, 0, ((vr[0] & 0x000003ff) >> 0 ) );
|
||||
tilemap_set_scrolly( tm, 0, ((vr[0] & 0x03ff0000) >> 16) );
|
||||
tilemap_draw(bitmap,cliprect,tm,0,0);
|
||||
tilemap_draw(bitmap, cliprect, tm, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -359,51 +387,53 @@ static void sortlayers(int *layer,int *pri)
|
||||
SWAP(1,2)
|
||||
}
|
||||
|
||||
VIDEO_UPDATE(macrossp)
|
||||
VIDEO_UPDATE( macrossp )
|
||||
{
|
||||
macrossp_state *state = (macrossp_state *)screen->machine->driver_data;
|
||||
int layers[3],layerpri[3];
|
||||
|
||||
|
||||
bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));
|
||||
bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
|
||||
|
||||
layers[0] = 0;
|
||||
layerpri[0] = (macrossp_scra_videoregs[0] & 0x0000c000) >> 14;
|
||||
layerpri[0] = (state->scra_videoregs[0] & 0x0000c000) >> 14;
|
||||
layers[1] = 1;
|
||||
layerpri[1] = (macrossp_scrb_videoregs[0] & 0x0000c000) >> 14;
|
||||
layerpri[1] = (state->scrb_videoregs[0] & 0x0000c000) >> 14;
|
||||
layers[2] = 2;
|
||||
layerpri[2] = (macrossp_scrc_videoregs[0] & 0x0000c000) >> 14;
|
||||
layerpri[2] = (state->scrc_videoregs[0] & 0x0000c000) >> 14;
|
||||
|
||||
sortlayers(layers, layerpri);
|
||||
|
||||
draw_layer(bitmap,cliprect,layers[0]);
|
||||
draw_sprites(screen->machine,bitmap,cliprect,0);
|
||||
draw_layer(bitmap,cliprect,layers[1]);
|
||||
draw_sprites(screen->machine,bitmap,cliprect,1);
|
||||
draw_layer(bitmap,cliprect,layers[2]);
|
||||
draw_sprites(screen->machine,bitmap,cliprect,2);
|
||||
draw_sprites(screen->machine,bitmap,cliprect,3);
|
||||
tilemap_draw(bitmap,cliprect,macrossp_text_tilemap,0,0);
|
||||
draw_layer(screen->machine, bitmap, cliprect, layers[0]);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, 0);
|
||||
draw_layer(screen->machine, bitmap, cliprect, layers[1]);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, 1);
|
||||
draw_layer(screen->machine, bitmap, cliprect, layers[2]);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, 2);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, 3);
|
||||
tilemap_draw(bitmap, cliprect, state->text_tilemap, 0, 0);
|
||||
|
||||
#if 0
|
||||
popmessage ("scra - %08x %08x %08x\nscrb - %08x %08x %08x\nscrc - %08x %08x %08x",
|
||||
macrossp_scra_videoregs[0]&0xffff33ff, // yyyyxxxx
|
||||
macrossp_scra_videoregs[1], // ??? more scrolling?
|
||||
macrossp_scra_videoregs[2], // 08 - 0b
|
||||
state->scra_videoregs[0]&0xffff33ff, // yyyyxxxx
|
||||
state->scra_videoregs[1], // ??? more scrolling?
|
||||
state->scra_videoregs[2], // 08 - 0b
|
||||
|
||||
macrossp_scrb_videoregs[0]&0xffff33ff, // 00 - 03
|
||||
macrossp_scrb_videoregs[1], // 04 - 07
|
||||
macrossp_scrb_videoregs[2], // 08 - 0b
|
||||
state->scrb_videoregs[0]&0xffff33ff, // 00 - 03
|
||||
state->scrb_videoregs[1], // 04 - 07
|
||||
state->scrb_videoregs[2], // 08 - 0b
|
||||
|
||||
macrossp_scrc_videoregs[0]&0xffff33ff, // 00 - 03
|
||||
macrossp_scrc_videoregs[1], // 04 - 07
|
||||
macrossp_scrc_videoregs[2]);// 08 - 0b
|
||||
state->scrc_videoregs[0]&0xffff33ff, // 00 - 03
|
||||
state->scrc_videoregs[1], // 04 - 07
|
||||
state->scrc_videoregs[2]);// 08 - 0b
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIDEO_EOF( macrossp )
|
||||
{
|
||||
macrossp_state *state = (macrossp_state *)machine->driver_data;
|
||||
|
||||
/* looks like sprites are *two* frames ahead, like nmk16 */
|
||||
memcpy(spriteram_old2,spriteram_old,machine->generic.spriteram_size);
|
||||
memcpy(spriteram_old,macrossp_spriteram,machine->generic.spriteram_size);
|
||||
memcpy(state->spriteram_old2, state->spriteram_old, state->spriteram_size);
|
||||
memcpy(state->spriteram_old, state->spriteram, state->spriteram_size);
|
||||
}
|
||||
|
@ -1,19 +1,15 @@
|
||||
/******************************************************************************
|
||||
|
||||
Markham (c) 1983 Sun Electronics
|
||||
Markham (c) 1983 Sun Electronics
|
||||
|
||||
Video hardware driver by Uki
|
||||
Video hardware driver by Uki
|
||||
|
||||
17/Jun/2001 -
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
|
||||
UINT8 *markham_xscroll;
|
||||
|
||||
static tilemap_t *bg_tilemap;
|
||||
#include "includes/markham.h"
|
||||
|
||||
PALETTE_INIT( markham )
|
||||
{
|
||||
@ -45,8 +41,9 @@ PALETTE_INIT( markham )
|
||||
|
||||
WRITE8_HANDLER( markham_videoram_w )
|
||||
{
|
||||
space->machine->generic.videoram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset / 2);
|
||||
markham_state *state = (markham_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( markham_flipscreen_w )
|
||||
@ -60,8 +57,9 @@ WRITE8_HANDLER( markham_flipscreen_w )
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
int attr = machine->generic.videoram.u8[tile_index * 2];
|
||||
int code = machine->generic.videoram.u8[(tile_index * 2) + 1] + ((attr & 0x60) << 3);
|
||||
markham_state *state = (markham_state *)machine->driver_data;
|
||||
int attr = state->videoram[tile_index * 2];
|
||||
int code = state->videoram[(tile_index * 2) + 1] + ((attr & 0x60) << 3);
|
||||
int color = (attr & 0x1f) | ((attr & 0x80) >> 2);
|
||||
|
||||
SET_TILE_INFO(0, code, color, 0);
|
||||
@ -69,45 +67,46 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( markham )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols,
|
||||
8, 8, 32, 32);
|
||||
markham_state *state = (markham_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols, 8, 8, 32, 32);
|
||||
|
||||
tilemap_set_scroll_rows(bg_tilemap, 32);
|
||||
tilemap_set_scroll_rows(state->bg_tilemap, 32);
|
||||
}
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
markham_state *state = (markham_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs=0x60; offs<0x100; offs +=4)
|
||||
for (offs = 0x60; offs < 0x100; offs += 4)
|
||||
{
|
||||
int chr = spriteram[offs+1];
|
||||
int col = spriteram[offs+2];
|
||||
int chr = spriteram[offs + 1];
|
||||
int col = spriteram[offs + 2];
|
||||
|
||||
int fx = flip_screen_get(machine);
|
||||
int fy = flip_screen_get(machine);
|
||||
|
||||
int x = spriteram[offs+3];
|
||||
int y = spriteram[offs+0];
|
||||
int px,py;
|
||||
int x = spriteram[offs + 3];
|
||||
int y = spriteram[offs + 0];
|
||||
int px, py;
|
||||
col &= 0x3f ;
|
||||
|
||||
if (flip_screen_get(machine)==0)
|
||||
if (flip_screen_get(machine) == 0)
|
||||
{
|
||||
px = x-2;
|
||||
py = 240-y;
|
||||
px = x - 2;
|
||||
py = 240 - y;
|
||||
}
|
||||
else
|
||||
{
|
||||
px = 240-x;
|
||||
px = 240 - x;
|
||||
py = y;
|
||||
}
|
||||
|
||||
px = px & 0xff;
|
||||
|
||||
if (px>248)
|
||||
px = px-256;
|
||||
if (px > 248)
|
||||
px = px - 256;
|
||||
|
||||
drawgfx_transmask(bitmap,cliprect,machine->gfx[1],
|
||||
chr,
|
||||
@ -120,17 +119,18 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
VIDEO_UPDATE( markham )
|
||||
{
|
||||
markham_state *state = (markham_state *)screen->machine->driver_data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
if ((i > 3) && (i<16))
|
||||
tilemap_set_scrollx(bg_tilemap, i, markham_xscroll[0]);
|
||||
if ((i > 3) && (i < 16))
|
||||
tilemap_set_scrollx(state->bg_tilemap, i, state->xscroll[0]);
|
||||
if (i >= 16)
|
||||
tilemap_set_scrollx(bg_tilemap, i, markham_xscroll[1]);
|
||||
tilemap_set_scrollx(state->bg_tilemap, i, state->xscroll[1]);
|
||||
}
|
||||
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,41 +0,0 @@
|
||||
/******************************************************************************
|
||||
|
||||
Kikiippatsu Mayumi-chan (c) 1988 Victory L.L.C.
|
||||
|
||||
Video hardware
|
||||
driver by Uki
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
UINT8 *mayumi_videoram;
|
||||
static tilemap_t *mayumi_tilemap;
|
||||
|
||||
static TILE_GET_INFO( get_tile_info )
|
||||
{
|
||||
int code = mayumi_videoram[tile_index] + (mayumi_videoram[tile_index+0x800] & 0x1f)*0x100 ;
|
||||
int col = (mayumi_videoram[tile_index+0x1000] >> 3) & 0x1f;
|
||||
|
||||
SET_TILE_INFO(0, code, col, 0);
|
||||
}
|
||||
|
||||
VIDEO_START( mayumi )
|
||||
{
|
||||
mayumi_videoram = auto_alloc_array(machine, UINT8, 0x1800);
|
||||
|
||||
mayumi_tilemap = tilemap_create( machine, get_tile_info,tilemap_scan_rows,8,8,64,32 );
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( mayumi_videoram_w )
|
||||
{
|
||||
mayumi_videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(mayumi_tilemap, offset & 0x7ff );
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( mayumi )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, mayumi_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -14,99 +14,97 @@ ToDo: Fix Sprites & Rowscroll/Select for Cocktail
|
||||
#include "profiler.h"
|
||||
#include "includes/mcatadv.h"
|
||||
|
||||
static tilemap_t *mcatadv_tilemap1, *mcatadv_tilemap2;
|
||||
static UINT16 *spriteram_old, *vidregs_old;
|
||||
static int palette_bank1, palette_bank2;
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_mcatadv_tile_info1 )
|
||||
{
|
||||
int tileno, colour, pri;
|
||||
mcatadv_state *state = (mcatadv_state *)machine->driver_data;
|
||||
int tileno = state->videoram1[tile_index * 2 + 1];
|
||||
int colour = (state->videoram1[tile_index * 2] & 0x3f00) >> 8;
|
||||
int pri = (state->videoram1[tile_index * 2] & 0xc000) >> 14;
|
||||
|
||||
tileno = mcatadv_videoram1[tile_index*2+1];
|
||||
colour = (mcatadv_videoram1[tile_index*2] & 0x3f00)>>8;
|
||||
pri = (mcatadv_videoram1[tile_index*2] & 0xc000)>>14;
|
||||
|
||||
SET_TILE_INFO(0,tileno,colour + palette_bank1*0x40,0);
|
||||
SET_TILE_INFO(0,tileno,colour + state->palette_bank1 * 0x40, 0);
|
||||
tileinfo->category = pri;
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( mcatadv_videoram1_w )
|
||||
{
|
||||
COMBINE_DATA(&mcatadv_videoram1[offset]);
|
||||
tilemap_mark_tile_dirty(mcatadv_tilemap1,offset/2);
|
||||
mcatadv_state *state = (mcatadv_state *)space->machine->driver_data;
|
||||
|
||||
COMBINE_DATA(&state->videoram1[offset]);
|
||||
tilemap_mark_tile_dirty(state->tilemap1, offset / 2);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_mcatadv_tile_info2 )
|
||||
{
|
||||
int tileno, colour, pri;
|
||||
mcatadv_state *state = (mcatadv_state *)machine->driver_data;
|
||||
int tileno = state->videoram2[tile_index * 2 + 1];
|
||||
int colour = (state->videoram2[tile_index * 2] & 0x3f00) >> 8;
|
||||
int pri = (state->videoram2[tile_index * 2] & 0xc000) >> 14;
|
||||
|
||||
tileno = mcatadv_videoram2[tile_index*2+1];
|
||||
colour = (mcatadv_videoram2[tile_index*2] & 0x3f00)>>8;
|
||||
pri = (mcatadv_videoram2[tile_index*2] & 0xc000)>>14;
|
||||
|
||||
SET_TILE_INFO(1,tileno,colour + palette_bank2*0x40,0);
|
||||
SET_TILE_INFO(1, tileno, colour + state->palette_bank2 * 0x40, 0);
|
||||
tileinfo->category = pri;
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( mcatadv_videoram2_w )
|
||||
{
|
||||
COMBINE_DATA(&mcatadv_videoram2[offset]);
|
||||
tilemap_mark_tile_dirty(mcatadv_tilemap2,offset/2);
|
||||
mcatadv_state *state = (mcatadv_state *)space->machine->driver_data;
|
||||
|
||||
COMBINE_DATA(&state->videoram2[offset]);
|
||||
tilemap_mark_tile_dirty(state->tilemap2, offset / 2);
|
||||
}
|
||||
|
||||
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
UINT16 *source = spriteram_old;
|
||||
UINT16 *finish = source + (machine->generic.spriteram_size/2)/2;
|
||||
int global_x = mcatadv_vidregs[0]-0x184;
|
||||
int global_y = mcatadv_vidregs[1]-0x1f1;
|
||||
mcatadv_state *state = (mcatadv_state *)machine->driver_data;
|
||||
UINT16 *source = state->spriteram_old;
|
||||
UINT16 *finish = source + (state->spriteram_size / 2) / 2;
|
||||
int global_x = state->vidregs[0] - 0x184;
|
||||
int global_y = state->vidregs[1] - 0x1f1;
|
||||
|
||||
UINT16 *destline;
|
||||
UINT8 *priline;
|
||||
UINT8 *sprdata = memory_region ( machine, "gfx1" );
|
||||
UINT8 *sprdata = memory_region(machine, "gfx1");
|
||||
|
||||
int xstart, xend, xinc;
|
||||
int ystart, yend, yinc;
|
||||
|
||||
if( vidregs_old[2] == 0x0001 ) /* Double Buffered */
|
||||
if (state->vidregs_old[2] == 0x0001) /* Double Buffered */
|
||||
{
|
||||
source += (machine->generic.spriteram_size/2)/2;
|
||||
finish += (machine->generic.spriteram_size/2)/2;
|
||||
source += (state->spriteram_size / 2) / 2;
|
||||
finish += (state->spriteram_size / 2) / 2;
|
||||
}
|
||||
else if( vidregs_old[2] ) /* I suppose it's possible that there is 4 banks, haven't seen it used though */
|
||||
else if (state->vidregs_old[2]) /* I suppose it's possible that there is 4 banks, haven't seen it used though */
|
||||
{
|
||||
logerror("Spritebank != 0/1\n");
|
||||
}
|
||||
|
||||
while ( source<finish )
|
||||
while (source < finish)
|
||||
{
|
||||
int pen = (source[0]&0x3f00)>>8;
|
||||
int tileno = source[1]&0xffff;
|
||||
int pri = (source[0]&0xc000)>>14;
|
||||
int x = source[2]&0x3ff;
|
||||
int y = source[3]&0x3ff;
|
||||
int pen = (source[0] & 0x3f00) >> 8;
|
||||
int tileno = source[1] & 0xffff;
|
||||
int pri = (source[0] & 0xc000) >> 14;
|
||||
int x = source[2] & 0x3ff;
|
||||
int y = source[3] & 0x3ff;
|
||||
int flipy = source[0] & 0x0040;
|
||||
int flipx = source[0] & 0x0080;
|
||||
|
||||
int height = ((source[3]&0xf000)>>12)*16;
|
||||
int width = ((source[2]&0xf000)>>12)*16;
|
||||
int height = ((source[3] & 0xf000) >> 12) * 16;
|
||||
int width = ((source[2] & 0xf000) >> 12) * 16;
|
||||
int offset = tileno * 256;
|
||||
|
||||
int drawxpos, drawypos;
|
||||
int xcnt,ycnt;
|
||||
int xcnt, ycnt;
|
||||
int pix;
|
||||
|
||||
if (x & 0x200) x-=0x400;
|
||||
if (y & 0x200) y-=0x400;
|
||||
|
||||
#if 0 // For Flipscreen/Cocktail
|
||||
if(mcatadv_vidregs[0]&0x8000)
|
||||
if(state->vidregs[0] & 0x8000)
|
||||
{
|
||||
flipx = !flipx;
|
||||
}
|
||||
if(mcatadv_vidregs[1]&0x8000)
|
||||
if(state->vidregs[1] & 0x8000)
|
||||
{
|
||||
flipy = !flipy;
|
||||
}
|
||||
@ -119,21 +117,27 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect
|
||||
if(!flipy) { ystart = 0; yend = height; yinc = 1; }
|
||||
else { ystart = height-1; yend = -1; yinc = -1; }
|
||||
|
||||
for (ycnt = ystart; ycnt != yend; ycnt += yinc) {
|
||||
drawypos = y+ycnt-global_y;
|
||||
for (ycnt = ystart; ycnt != yend; ycnt += yinc)
|
||||
{
|
||||
drawypos = y + ycnt - global_y;
|
||||
|
||||
if ((drawypos >= cliprect->min_y) && (drawypos <= cliprect->max_y)) {
|
||||
if ((drawypos >= cliprect->min_y) && (drawypos <= cliprect->max_y))
|
||||
{
|
||||
destline = BITMAP_ADDR16(bitmap, drawypos, 0);
|
||||
priline = BITMAP_ADDR8(machine->priority_bitmap, drawypos, 0);
|
||||
|
||||
for (xcnt = xstart; xcnt != xend; xcnt += xinc) {
|
||||
drawxpos = x+xcnt-global_x;
|
||||
for (xcnt = xstart; xcnt != xend; xcnt += xinc)
|
||||
{
|
||||
drawxpos = x + xcnt - global_x;
|
||||
|
||||
if((priline[drawxpos] < pri)) {
|
||||
if (offset >= 0x500000*2) offset = 0;
|
||||
pix = sprdata[offset/2];
|
||||
if((priline[drawxpos] < pri))
|
||||
{
|
||||
if (offset >= 0x500000 * 2)
|
||||
offset = 0;
|
||||
pix = sprdata[offset / 2];
|
||||
|
||||
if (offset & 1) pix = pix >> 4;
|
||||
if (offset & 1)
|
||||
pix = pix >> 4;
|
||||
pix &= 0x0f;
|
||||
|
||||
if ((drawxpos >= cliprect->min_x) && (drawxpos <= cliprect->max_x) && pix)
|
||||
@ -142,16 +146,17 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
offset += width;
|
||||
}
|
||||
}
|
||||
}
|
||||
source+=4;
|
||||
source += 4;
|
||||
}
|
||||
}
|
||||
|
||||
static void mcatadv_draw_tilemap_part(UINT16* current_scroll, UINT16* current_videoram1, int i, tilemap_t* current_tilemap, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void mcatadv_draw_tilemap_part( UINT16* current_scroll, UINT16* current_videoram1, int i, tilemap_t* current_tilemap, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
int flip;
|
||||
UINT32 drawline;
|
||||
@ -160,34 +165,32 @@ static void mcatadv_draw_tilemap_part(UINT16* current_scroll, UINT16* current_vi
|
||||
clip.min_x = cliprect->min_x;
|
||||
clip.max_x = cliprect->max_x;
|
||||
|
||||
for(drawline = cliprect->min_y; drawline <= cliprect->max_y;drawline++)
|
||||
for (drawline = cliprect->min_y; drawline <= cliprect->max_y; drawline++)
|
||||
{
|
||||
int scrollx, scrolly;
|
||||
|
||||
clip.min_y = drawline;
|
||||
clip.max_y = drawline;
|
||||
|
||||
scrollx = (current_scroll[0]&0x1ff)-0x194;
|
||||
scrolly = (current_scroll[1]&0x1ff)-0x1df;
|
||||
scrollx = (current_scroll[0] & 0x1ff) - 0x194;
|
||||
scrolly = (current_scroll[1] & 0x1ff) - 0x1df;
|
||||
|
||||
if ((current_scroll[1]&0x4000)==0x4000)
|
||||
if ((current_scroll[1] & 0x4000) == 0x4000)
|
||||
{
|
||||
int rowselect;
|
||||
rowselect = current_videoram1[0x1000/2 + (((drawline+scrolly)&0x1ff) * 2) + 1];
|
||||
int rowselect = current_videoram1[0x1000 / 2 + (((drawline + scrolly) & 0x1ff) * 2) + 1];
|
||||
scrolly = rowselect - drawline;
|
||||
}
|
||||
|
||||
if ((current_scroll[0]&0x4000)==0x4000)
|
||||
if ((current_scroll[0] & 0x4000) == 0x4000)
|
||||
{
|
||||
int rowscroll;
|
||||
rowscroll = current_videoram1[0x1000/2 + (((drawline+scrolly)&0x1ff) * 2) + 0];
|
||||
int rowscroll = current_videoram1[0x1000 / 2 + (((drawline + scrolly) & 0x1ff) * 2) + 0];
|
||||
scrollx += rowscroll;
|
||||
}
|
||||
|
||||
/* Global Flip */
|
||||
if(!(current_scroll[0]&0x8000)) scrollx -= 0x19;
|
||||
if(!(current_scroll[1]&0x8000)) scrolly -= 0x141;
|
||||
flip = ((current_scroll[0]&0x8000)?0:TILEMAP_FLIPX) | ((current_scroll[1]&0x8000)?0:TILEMAP_FLIPY);
|
||||
if (!(current_scroll[0] & 0x8000)) scrollx -= 0x19;
|
||||
if (!(current_scroll[1] & 0x8000)) scrolly -= 0x141;
|
||||
flip = ((current_scroll[0] & 0x8000) ? 0 : TILEMAP_FLIPX) | ((current_scroll[1] & 0x8000) ? 0 : TILEMAP_FLIPY);
|
||||
|
||||
tilemap_set_scrollx(current_tilemap, 0, scrollx);
|
||||
tilemap_set_scrolly(current_tilemap, 0, scrolly);
|
||||
@ -199,40 +202,43 @@ static void mcatadv_draw_tilemap_part(UINT16* current_scroll, UINT16* current_vi
|
||||
|
||||
VIDEO_UPDATE( mcatadv )
|
||||
{
|
||||
mcatadv_state *state = (mcatadv_state *)screen->machine->driver_data;
|
||||
int i;
|
||||
|
||||
bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
|
||||
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0);
|
||||
|
||||
if(mcatadv_scroll[2] != palette_bank1) {
|
||||
palette_bank1 = mcatadv_scroll[2];
|
||||
tilemap_mark_all_tiles_dirty(mcatadv_tilemap1);
|
||||
if (state->scroll1[2] != state->palette_bank1)
|
||||
{
|
||||
state->palette_bank1 = state->scroll1[2];
|
||||
tilemap_mark_all_tiles_dirty(state->tilemap1);
|
||||
}
|
||||
|
||||
if(mcatadv_scroll2[2] != palette_bank2) {
|
||||
palette_bank2 = mcatadv_scroll2[2];
|
||||
tilemap_mark_all_tiles_dirty(mcatadv_tilemap2);
|
||||
if (state->scroll2[2] != state->palette_bank2)
|
||||
{
|
||||
state->palette_bank2 = state->scroll2[2];
|
||||
tilemap_mark_all_tiles_dirty(state->tilemap2);
|
||||
}
|
||||
|
||||
/*
|
||||
popmessage("%02x %02x %02x %02x",
|
||||
(mcatadv_scroll[0]&0x4000)>>8,
|
||||
(mcatadv_scroll[1]&0x4000)>>8,
|
||||
(mcatadv_scroll2[0]&0x4000)>>8,
|
||||
(mcatadv_scroll2[1]&0x4000)>>8);
|
||||
(mcatadv_scroll1[0] & 0x4000) >> 8,
|
||||
(mcatadv_scroll1[1] & 0x4000) >> 8,
|
||||
(mcatadv_scroll2[0] & 0x4000) >> 8,
|
||||
(mcatadv_scroll2[1] & 0x4000) >> 8);
|
||||
*/
|
||||
|
||||
for (i=0; i<=3; i++)
|
||||
for (i = 0; i <= 3; i++)
|
||||
{
|
||||
#ifdef MAME_DEBUG
|
||||
if (!input_code_pressed(screen->machine, KEYCODE_Q))
|
||||
#endif
|
||||
mcatadv_draw_tilemap_part(mcatadv_scroll, mcatadv_videoram1, i, mcatadv_tilemap1, bitmap, cliprect);
|
||||
mcatadv_draw_tilemap_part(state->scroll1, state->videoram1, i, state->tilemap1, bitmap, cliprect);
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
if (!input_code_pressed(screen->machine, KEYCODE_W))
|
||||
#endif
|
||||
mcatadv_draw_tilemap_part(mcatadv_scroll2, mcatadv_videoram2, i, mcatadv_tilemap2, bitmap, cliprect);
|
||||
mcatadv_draw_tilemap_part(state->scroll2, state->videoram2, i, state->tilemap2, bitmap, cliprect);
|
||||
}
|
||||
|
||||
profiler_mark_start(PROFILER_USER1);
|
||||
@ -246,21 +252,26 @@ VIDEO_UPDATE( mcatadv )
|
||||
|
||||
VIDEO_START( mcatadv )
|
||||
{
|
||||
mcatadv_tilemap1 = tilemap_create(machine, get_mcatadv_tile_info1,tilemap_scan_rows, 16, 16,32,32);
|
||||
tilemap_set_transparent_pen(mcatadv_tilemap1,0);
|
||||
mcatadv_state *state = (mcatadv_state *)machine->driver_data;
|
||||
state->tilemap1 = tilemap_create(machine, get_mcatadv_tile_info1, tilemap_scan_rows, 16, 16, 32, 32);
|
||||
tilemap_set_transparent_pen(state->tilemap1, 0);
|
||||
|
||||
mcatadv_tilemap2 = tilemap_create(machine, get_mcatadv_tile_info2,tilemap_scan_rows, 16, 16,32,32);
|
||||
tilemap_set_transparent_pen(mcatadv_tilemap2,0);
|
||||
state->tilemap2 = tilemap_create(machine, get_mcatadv_tile_info2, tilemap_scan_rows, 16, 16, 32, 32);
|
||||
tilemap_set_transparent_pen(state->tilemap2, 0);
|
||||
|
||||
spriteram_old = auto_alloc_array_clear(machine, UINT16, machine->generic.spriteram_size/2);
|
||||
vidregs_old = auto_alloc_array(machine, UINT16, (0xf+1)/2);
|
||||
state->spriteram_old = auto_alloc_array_clear(machine, UINT16, state->spriteram_size / 2);
|
||||
state->vidregs_old = auto_alloc_array(machine, UINT16, (0x0f + 1) / 2);
|
||||
|
||||
palette_bank1 = 0;
|
||||
palette_bank2 = 0;
|
||||
state->palette_bank1 = 0;
|
||||
state->palette_bank2 = 0;
|
||||
|
||||
state_save_register_global_pointer(machine, state->spriteram_old, state->spriteram_size / 2);
|
||||
state_save_register_global_pointer(machine, state->vidregs_old, (0x0f + 1) / 2);
|
||||
}
|
||||
|
||||
VIDEO_EOF( mcatadv )
|
||||
{
|
||||
memcpy(spriteram_old,machine->generic.spriteram.u16,machine->generic.spriteram_size);
|
||||
memcpy(vidregs_old,mcatadv_vidregs,0xf);
|
||||
mcatadv_state *state = (mcatadv_state *)machine->driver_data;
|
||||
memcpy(state->spriteram_old, state->spriteram, state->spriteram_size);
|
||||
memcpy(state->vidregs_old, state->vidregs, 0xf);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user