mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
misc small updates:
* added saves to 6522via.c. this fixes problems of gameplan.c and trvquest.c games with -autosave * added driver data struct and save states to toratora.c and sf.c * enable GAME_SUPPORTS_SAVE flag to dday.c because some of the core changes have fixed the sound problem at loading * added a couple of comments about header inclusions
This commit is contained in:
parent
b991a168d1
commit
66f8650aac
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -2634,6 +2634,7 @@ src/mame/includes/sei_crtc.h svneol=native#text/plain
|
||||
src/mame/includes/seibuspi.h svneol=native#text/plain
|
||||
src/mame/includes/senjyo.h svneol=native#text/plain
|
||||
src/mame/includes/seta.h svneol=native#text/plain
|
||||
src/mame/includes/sf.h svneol=native#text/plain
|
||||
src/mame/includes/shuuz.h svneol=native#text/plain
|
||||
src/mame/includes/simpsons.h svneol=native#text/plain
|
||||
src/mame/includes/skullxbo.h svneol=native#text/plain
|
||||
|
@ -263,6 +263,36 @@ static DEVICE_START( via6522 )
|
||||
/* Default clock is from CPU1 */
|
||||
if (device->clock == 0)
|
||||
device_set_clock(device, device->machine->firstcpu->clock);
|
||||
|
||||
/* save state register */
|
||||
state_save_register_device_item(device, 0, v->in_a);
|
||||
state_save_register_device_item(device, 0, v->in_ca1);
|
||||
state_save_register_device_item(device, 0, v->in_ca2);
|
||||
state_save_register_device_item(device, 0, v->out_a);
|
||||
state_save_register_device_item(device, 0, v->out_ca2);
|
||||
state_save_register_device_item(device, 0, v->ddr_a);
|
||||
state_save_register_device_item(device, 0, v->in_b);
|
||||
state_save_register_device_item(device, 0, v->in_cb1);
|
||||
state_save_register_device_item(device, 0, v->in_cb2);
|
||||
state_save_register_device_item(device, 0, v->out_b);
|
||||
state_save_register_device_item(device, 0, v->out_cb2);
|
||||
state_save_register_device_item(device, 0, v->ddr_b);
|
||||
state_save_register_device_item(device, 0, v->t1cl);
|
||||
state_save_register_device_item(device, 0, v->t1ch);
|
||||
state_save_register_device_item(device, 0, v->t1ll);
|
||||
state_save_register_device_item(device, 0, v->t1lh);
|
||||
state_save_register_device_item(device, 0, v->t2cl);
|
||||
state_save_register_device_item(device, 0, v->t2ch);
|
||||
state_save_register_device_item(device, 0, v->t2ll);
|
||||
state_save_register_device_item(device, 0, v->t2lh);
|
||||
state_save_register_device_item(device, 0, v->sr);
|
||||
state_save_register_device_item(device, 0, v->pcr);
|
||||
state_save_register_device_item(device, 0, v->acr);
|
||||
state_save_register_device_item(device, 0, v->ier);
|
||||
state_save_register_device_item(device, 0, v->ifr);
|
||||
state_save_register_device_item(device, 0, v->t1_active);
|
||||
state_save_register_device_item(device, 0, v->t2_active);
|
||||
state_save_register_device_item(device, 0, v->shift_counter);
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@ TODO:
|
||||
|
||||
#include "driver.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "includes/cps1.h"
|
||||
#include "includes/cps1.h" // needed for decoding functions only
|
||||
#include "machine/eeprom.h"
|
||||
#include "sound/okim6295.h"
|
||||
#include "sound/2413intf.h"
|
||||
|
@ -353,5 +353,5 @@ ROM_START( ddayc )
|
||||
ROM_END
|
||||
|
||||
|
||||
GAME( 1982, dday, 0, dday, dday, 0, ROT0, "Olympia", "D-Day", GAME_IMPERFECT_COLORS )
|
||||
GAME( 1982, ddayc, dday, dday, ddayc, 0, ROT0, "Olympia (Centuri license)", "D-Day (Centuri)", GAME_IMPERFECT_COLORS )
|
||||
GAME( 1982, dday, 0, dday, dday, 0, ROT0, "Olympia", "D-Day", GAME_IMPERFECT_COLORS | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, ddayc, dday, dday, ddayc, 0, ROT0, "Olympia (Centuri license)", "D-Day (Centuri)", GAME_IMPERFECT_COLORS | GAME_SUPPORTS_SAVE )
|
||||
|
@ -80,7 +80,7 @@ mw-9.rom = ST M27C1001 / GFX
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "deprecat.h"
|
||||
#include "machine/eeprom.h"
|
||||
#include "includes/cps1.h"
|
||||
#include "includes/cps1.h" // needed for decoding functions only
|
||||
#include "sound/okim6295.h"
|
||||
#include "sound/3812intf.h"
|
||||
#include "sound/2413intf.h"
|
||||
|
@ -1,11 +1,11 @@
|
||||
/***************************************************************************
|
||||
|
||||
Street Fighter
|
||||
Street Fighter
|
||||
|
||||
driver by Olivier Galibert
|
||||
driver by Olivier Galibert
|
||||
|
||||
TODO:
|
||||
- is there a third coin input?
|
||||
TODO:
|
||||
- is there a third coin input?
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -14,17 +14,7 @@ TODO:
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "sound/2151intf.h"
|
||||
#include "sound/msm5205.h"
|
||||
|
||||
|
||||
extern UINT16 *sf_objectram,*sf_videoram;
|
||||
|
||||
WRITE16_HANDLER( sf_bg_scroll_w );
|
||||
WRITE16_HANDLER( sf_fg_scroll_w );
|
||||
WRITE16_HANDLER( sf_videoram_w );
|
||||
WRITE16_HANDLER( sf_gfxctrl_w );
|
||||
VIDEO_START( sf );
|
||||
VIDEO_UPDATE( sf );
|
||||
|
||||
#include "includes/sf.h"
|
||||
|
||||
static READ16_HANDLER( dummy_r )
|
||||
{
|
||||
@ -36,21 +26,23 @@ static WRITE16_HANDLER( sf_coin_w )
|
||||
{
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
coin_counter_w(space->machine, 0,data & 0x01);
|
||||
coin_counter_w(space->machine, 1,data & 0x02);
|
||||
coin_lockout_w(space->machine, 0,~data & 0x10);
|
||||
coin_lockout_w(space->machine, 1,~data & 0x20);
|
||||
coin_lockout_w(space->machine, 2,~data & 0x40); /* is there a third coin input? */
|
||||
coin_counter_w(space->machine, 0, data & 0x01);
|
||||
coin_counter_w(space->machine, 1, data & 0x02);
|
||||
coin_lockout_w(space->machine, 0, ~data & 0x10);
|
||||
coin_lockout_w(space->machine, 1, ~data & 0x20);
|
||||
coin_lockout_w(space->machine, 2, ~data & 0x40); /* is there a third coin input? */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static WRITE16_HANDLER( soundcmd_w )
|
||||
{
|
||||
sf_state *state = (sf_state *)space->machine->driver_data;
|
||||
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
soundlatch_w(space, offset, data & 0xff);
|
||||
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,10 +50,10 @@ static WRITE16_HANDLER( soundcmd_w )
|
||||
/* The protection of the japanese version */
|
||||
/* I'd love to see someone dump the 68705 rom */
|
||||
|
||||
static void write_dword(const address_space *space,offs_t offset,UINT32 data)
|
||||
static void write_dword( const address_space *space, offs_t offset, UINT32 data )
|
||||
{
|
||||
memory_write_word(space, offset,data >> 16);
|
||||
memory_write_word(space, offset+2,data);
|
||||
memory_write_word(space, offset, data >> 16);
|
||||
memory_write_word(space, offset + 2, data);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( protection_w )
|
||||
@ -76,30 +68,31 @@ static WRITE16_HANDLER( protection_w )
|
||||
|
||||
map = maplist
|
||||
[memory_read_byte(space, 0xffc006)]
|
||||
[(memory_read_byte(space, 0xffc003)<<1) + (memory_read_word(space, 0xffc004)>>8)];
|
||||
[(memory_read_byte(space, 0xffc003) << 1) + (memory_read_word(space, 0xffc004) >> 8)];
|
||||
|
||||
switch(memory_read_byte(space, 0xffc684)) {
|
||||
switch (memory_read_byte(space, 0xffc684))
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
int base;
|
||||
|
||||
base = 0x1b6e8+0x300e*map;
|
||||
base = 0x1b6e8 + 0x300e * map;
|
||||
|
||||
write_dword(space, 0xffc01c, 0x16bfc+0x270*map);
|
||||
write_dword(space, 0xffc020, base+0x80);
|
||||
write_dword(space, 0xffc01c, 0x16bfc + 0x270 * map);
|
||||
write_dword(space, 0xffc020, base + 0x80);
|
||||
write_dword(space, 0xffc024, base);
|
||||
write_dword(space, 0xffc028, base+0x86);
|
||||
write_dword(space, 0xffc02c, base+0x8e);
|
||||
write_dword(space, 0xffc030, base+0x20e);
|
||||
write_dword(space, 0xffc034, base+0x30e);
|
||||
write_dword(space, 0xffc038, base+0x38e);
|
||||
write_dword(space, 0xffc03c, base+0x40e);
|
||||
write_dword(space, 0xffc040, base+0x80e);
|
||||
write_dword(space, 0xffc044, base+0xc0e);
|
||||
write_dword(space, 0xffc048, base+0x180e);
|
||||
write_dword(space, 0xffc04c, base+0x240e);
|
||||
write_dword(space, 0xffc050, 0x19548+0x60*map);
|
||||
write_dword(space, 0xffc054, 0x19578+0x60*map);
|
||||
write_dword(space, 0xffc028, base + 0x86);
|
||||
write_dword(space, 0xffc02c, base + 0x8e);
|
||||
write_dword(space, 0xffc030, base + 0x20e);
|
||||
write_dword(space, 0xffc034, base + 0x30e);
|
||||
write_dword(space, 0xffc038, base + 0x38e);
|
||||
write_dword(space, 0xffc03c, base + 0x40e);
|
||||
write_dword(space, 0xffc040, base + 0x80e);
|
||||
write_dword(space, 0xffc044, base + 0xc0e);
|
||||
write_dword(space, 0xffc048, base + 0x180e);
|
||||
write_dword(space, 0xffc04c, base + 0x240e);
|
||||
write_dword(space, 0xffc050, 0x19548 + 0x60 * map);
|
||||
write_dword(space, 0xffc054, 0x19578 + 0x60 * map);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
@ -126,15 +119,19 @@ static WRITE16_HANDLER( protection_w )
|
||||
case 4:
|
||||
{
|
||||
int pos = memory_read_byte(space, 0xffc010);
|
||||
pos = (pos+1) & 3;
|
||||
pos = (pos + 1) & 3;
|
||||
memory_write_byte(space, 0xffc010, pos);
|
||||
if(!pos) {
|
||||
if(!pos)
|
||||
{
|
||||
int d1 = memory_read_word(space, 0xffc682);
|
||||
int off = memory_read_word(space, 0xffc00e);
|
||||
if(off!=512) {
|
||||
if (off!=512)
|
||||
{
|
||||
off++;
|
||||
d1++;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
off = 0;
|
||||
d1 -= 512;
|
||||
}
|
||||
@ -146,7 +143,7 @@ static WRITE16_HANDLER( protection_w )
|
||||
}
|
||||
default:
|
||||
{
|
||||
logerror("Write protection at %06x (%04x)\n", cpu_get_pc(space->cpu), data&0xffff);
|
||||
logerror("Write protection at %06x (%04x)\n", cpu_get_pc(space->cpu), data & 0xffff);
|
||||
logerror("*** Unknown protection %d\n", memory_read_byte(space, 0xffc684));
|
||||
break;
|
||||
}
|
||||
@ -162,35 +159,35 @@ static const int scale[8] = { 0x00, 0x40, 0xe0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe };
|
||||
|
||||
static READ16_HANDLER( button1_r )
|
||||
{
|
||||
return (scale[input_port_read(space->machine, "IN3")]<<8) | scale[input_port_read(space->machine, "IN1")];
|
||||
return (scale[input_port_read(space->machine, "IN3")] << 8) | scale[input_port_read(space->machine, "IN1")];
|
||||
}
|
||||
|
||||
static READ16_HANDLER( button2_r )
|
||||
{
|
||||
return (scale[input_port_read(space->machine, "IN4")]<<8) | scale[input_port_read(space->machine, "IN2")];
|
||||
return (scale[input_port_read(space->machine, "IN4")] << 8) | scale[input_port_read(space->machine, "IN2")];
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( sound2_bank_w )
|
||||
{
|
||||
memory_set_bankptr(space->machine, "bank1",memory_region(space->machine, "audio2")+0x8000*(data+1));
|
||||
memory_set_bankptr(space->machine, "bank1", memory_region(space->machine, "audio2") + 0x8000 * (data + 1));
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( msm5205_w )
|
||||
{
|
||||
msm5205_reset_w(device,(data>>7)&1);
|
||||
msm5205_reset_w(device, (data >> 7) & 1);
|
||||
/* ?? bit 6?? */
|
||||
msm5205_data_w(device,data);
|
||||
msm5205_vclk_w(device,1);
|
||||
msm5205_vclk_w(device,0);
|
||||
msm5205_data_w(device, data);
|
||||
msm5205_vclk_w(device, 1);
|
||||
msm5205_vclk_w(device, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( sf_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x04ffff) AM_ROM
|
||||
AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(sf_videoram_w) AM_BASE(&sf_videoram) AM_SIZE_GENERIC(videoram)
|
||||
AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(sf_videoram_w) AM_BASE_SIZE_MEMBER(sf_state, videoram, videoram_size)
|
||||
AM_RANGE(0xb00000, 0xb007ff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("COINS")
|
||||
AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("IN0")
|
||||
@ -207,12 +204,12 @@ static ADDRESS_MAP_START( sf_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0xc0001c, 0xc0001d) AM_WRITE(soundcmd_w)
|
||||
AM_RANGE(0xc0001e, 0xc0001f) AM_WRITE(protection_w)
|
||||
AM_RANGE(0xff8000, 0xffdfff) AM_RAM
|
||||
AM_RANGE(0xffe000, 0xffffff) AM_RAM AM_BASE(&sf_objectram)
|
||||
AM_RANGE(0xffe000, 0xffffff) AM_RAM AM_BASE_MEMBER(sf_state, objectram)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( sfus_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x04ffff) AM_ROM
|
||||
AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(sf_videoram_w) AM_BASE(&sf_videoram) AM_SIZE_GENERIC(videoram)
|
||||
AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(sf_videoram_w) AM_BASE_SIZE_MEMBER(sf_state, videoram, videoram_size)
|
||||
AM_RANGE(0xb00000, 0xb007ff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("IN1")
|
||||
@ -229,12 +226,12 @@ static ADDRESS_MAP_START( sfus_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0xc0001c, 0xc0001d) AM_WRITE(soundcmd_w)
|
||||
AM_RANGE(0xc0001e, 0xc0001f) AM_WRITE(protection_w)
|
||||
AM_RANGE(0xff8000, 0xffdfff) AM_RAM
|
||||
AM_RANGE(0xffe000, 0xffffff) AM_RAM AM_BASE(&sf_objectram)
|
||||
AM_RANGE(0xffe000, 0xffffff) AM_RAM AM_BASE_MEMBER(sf_state, objectram)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( sfjp_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x04ffff) AM_ROM
|
||||
AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(sf_videoram_w) AM_BASE(&sf_videoram) AM_SIZE_GENERIC(videoram)
|
||||
AM_RANGE(0x800000, 0x800fff) AM_RAM_WRITE(sf_videoram_w) AM_BASE_SIZE_MEMBER(sf_state, videoram, videoram_size)
|
||||
AM_RANGE(0xb00000, 0xb007ff) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("COINS")
|
||||
AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("P1")
|
||||
@ -251,7 +248,7 @@ static ADDRESS_MAP_START( sfjp_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0xc0001c, 0xc0001d) AM_WRITE(soundcmd_w)
|
||||
AM_RANGE(0xc0001e, 0xc0001f) AM_WRITE(protection_w)
|
||||
AM_RANGE(0xff8000, 0xffdfff) AM_RAM
|
||||
AM_RANGE(0xffe000, 0xffffff) AM_RAM AM_BASE(&sf_objectram)
|
||||
AM_RANGE(0xffe000, 0xffffff) AM_RAM AM_BASE_MEMBER(sf_state, objectram)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
@ -786,9 +783,10 @@ GFXDECODE_END
|
||||
|
||||
|
||||
|
||||
static void irq_handler(const device_config *device, int irq)
|
||||
static void irq_handler( const device_config *device, int irq )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "audiocpu", 0, irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
sf_state *state = (sf_state *)device->machine->driver_data;
|
||||
cpu_set_input_line(state->audiocpu, 0, irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static const ym2151_interface ym2151_config =
|
||||
@ -802,8 +800,33 @@ static const msm5205_interface msm5205_config =
|
||||
MSM5205_SEX_4B /* 8KHz playback ? */
|
||||
};
|
||||
|
||||
static MACHINE_START( sf )
|
||||
{
|
||||
sf_state *state = (sf_state *)machine->driver_data;
|
||||
|
||||
/* devices */
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->audiocpu = devtag_get_device(machine, "audiocpu");
|
||||
|
||||
state_save_register_global(machine, state->sf_active);
|
||||
state_save_register_global(machine, state->bgscroll);
|
||||
state_save_register_global(machine, state->fgscroll);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( sf )
|
||||
{
|
||||
sf_state *state = (sf_state *)machine->driver_data;
|
||||
|
||||
state->sf_active = 0;
|
||||
state->bgscroll = 0;
|
||||
state->fgscroll = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( sf )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(sf_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M68000, 8000000) /* 8 MHz ? (xtal is 16MHz) */
|
||||
MDRV_CPU_PROGRAM_MAP(sf_map)
|
||||
@ -813,6 +836,9 @@ static MACHINE_DRIVER_START( sf )
|
||||
MDRV_CPU_PROGRAM_MAP(sound_map)
|
||||
/* NMIs are caused by the main CPU */
|
||||
|
||||
MDRV_MACHINE_START(sf)
|
||||
MDRV_MACHINE_RESET(sf)
|
||||
|
||||
MDRV_CPU_ADD("audio2", Z80, 3579545) /* ? xtal is 3.579545MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(sound2_map)
|
||||
MDRV_CPU_IO_MAP(sound2_io_map)
|
||||
@ -1133,7 +1159,7 @@ ROM_END
|
||||
|
||||
|
||||
|
||||
GAME( 1987, sf, 0, sf, sf, 0, ROT0, "Capcom", "Street Fighter (World)", 0 )
|
||||
GAME( 1987, sfus, sf, sfus, sfus, 0, ROT0, "Capcom", "Street Fighter (US)", 0 )
|
||||
GAME( 1987, sfj, sf, sfjp, sfjp, 0, ROT0, "Capcom", "Street Fighter (Japan)", 0 )
|
||||
GAME( 1987, sfp, sf, sfp, sf, 0, ROT0, "Capcom", "Street Fighter (prototype)", 0 )
|
||||
GAME( 1987, sf, 0, sf, sf, 0, ROT0, "Capcom", "Street Fighter (World)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1987, sfus, sf, sfus, sfus, 0, ROT0, "Capcom", "Street Fighter (US)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1987, sfj, sf, sfjp, sfjp, 0, ROT0, "Capcom", "Street Fighter (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1987, sfp, sf, sfp, sf, 0, ROT0, "Capcom", "Street Fighter (prototype)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -23,10 +23,24 @@ TODO:
|
||||
#include "sound/sn76477.h"
|
||||
|
||||
|
||||
static UINT8 *toratora_videoram;
|
||||
static size_t toratora_videoram_size;
|
||||
typedef struct _toratora_state toratora_state;
|
||||
struct _toratora_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
size_t videoram_size;
|
||||
|
||||
static UINT8 clear_tv;
|
||||
/* video-related */
|
||||
int timer;
|
||||
UINT8 last;
|
||||
UINT8 clear_tv;
|
||||
|
||||
/* devices */
|
||||
const device_config *maincpu;
|
||||
const device_config *pia_u1;
|
||||
const device_config *pia_u2;
|
||||
const device_config *pia_u3;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -36,20 +50,12 @@ static UINT8 clear_tv;
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static READ8_DEVICE_HANDLER( port_b_u3_r )
|
||||
{
|
||||
logerror("%s: read DIP\n",cpuexec_describe_context(device->machine));
|
||||
return input_port_read(device->machine, "DSW");
|
||||
}
|
||||
|
||||
|
||||
static WRITE_LINE_DEVICE_HANDLER( cb2_u3_w )
|
||||
{
|
||||
logerror("DIP tristate %sactive\n",(state & 1) ? "in" : "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Video hardware
|
||||
@ -58,15 +64,16 @@ static WRITE_LINE_DEVICE_HANDLER( cb2_u3_w )
|
||||
|
||||
static VIDEO_UPDATE( toratora )
|
||||
{
|
||||
toratora_state *state = (toratora_state *)screen->machine->driver_data;
|
||||
offs_t offs;
|
||||
|
||||
for (offs = 0; offs < toratora_videoram_size; offs++)
|
||||
for (offs = 0; offs < state->videoram_size; offs++)
|
||||
{
|
||||
int i;
|
||||
|
||||
UINT8 y = offs >> 5;
|
||||
UINT8 x = offs << 3;
|
||||
UINT8 data = toratora_videoram[offs];
|
||||
UINT8 data = state->videoram[offs];
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
@ -78,11 +85,11 @@ static VIDEO_UPDATE( toratora )
|
||||
}
|
||||
|
||||
/* the video system clears as it writes out the pixels */
|
||||
if (clear_tv)
|
||||
toratora_videoram[offs] = 0;
|
||||
if (state->clear_tv)
|
||||
state->videoram[offs] = 0;
|
||||
}
|
||||
|
||||
clear_tv = 0;
|
||||
state->clear_tv = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -90,11 +97,11 @@ static VIDEO_UPDATE( toratora )
|
||||
|
||||
static WRITE8_HANDLER( clear_tv_w )
|
||||
{
|
||||
clear_tv = 1;
|
||||
toratora_state *state = (toratora_state *)space->machine->driver_data;
|
||||
state->clear_tv = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Coin counter
|
||||
@ -110,7 +117,6 @@ static WRITE8_DEVICE_HANDLER( port_b_u1_w )
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Interrupt generation
|
||||
@ -119,52 +125,46 @@ static WRITE8_DEVICE_HANDLER( port_b_u1_w )
|
||||
|
||||
static WRITE_LINE_DEVICE_HANDLER( main_cpu_irq )
|
||||
{
|
||||
toratora_state *toratora = (toratora_state *)device->machine->driver_data;
|
||||
int combined_state = pia6821_get_irq_a(device) | pia6821_get_irq_b(device);
|
||||
|
||||
logerror("GEN IRQ: %x\n", combined_state);
|
||||
cputag_set_input_line(device->machine, "maincpu", 0, combined_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
logerror("GEN IRQ: %x\n", combined_state);
|
||||
cpu_set_input_line(toratora->maincpu, 0, combined_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static int timer;
|
||||
|
||||
static INTERRUPT_GEN( toratora_timer )
|
||||
{
|
||||
const device_config *pia = devtag_get_device(device->machine, "pia_u1");
|
||||
static UINT8 last = 0;
|
||||
timer++; /* timer counting at 16 Hz */
|
||||
toratora_state *state = (toratora_state *)device->machine->driver_data;
|
||||
state->timer++; /* timer counting at 16 Hz */
|
||||
|
||||
/* also, when the timer overflows (16 seconds) watchdog would kick in */
|
||||
if (timer & 0x100) popmessage("watchdog!");
|
||||
if (state->timer & 0x100)
|
||||
popmessage("watchdog!");
|
||||
|
||||
|
||||
if (last != (input_port_read(device->machine, "INPUT") & 0x0f))
|
||||
if (state->last != (input_port_read(device->machine, "INPUT") & 0x0f))
|
||||
{
|
||||
last = input_port_read(device->machine, "INPUT") & 0x0f;
|
||||
state->last = input_port_read(device->machine, "INPUT") & 0x0f;
|
||||
generic_pulse_irq_line(device, 0);
|
||||
}
|
||||
pia6821_set_input_a(pia, input_port_read(device->machine, "INPUT") & 0x0f, 0);
|
||||
|
||||
pia6821_ca1_w(pia, 0, input_port_read(device->machine, "INPUT") & 0x10);
|
||||
|
||||
pia6821_ca2_w(pia, 0, input_port_read(device->machine, "INPUT") & 0x20);
|
||||
pia6821_set_input_a(state->pia_u1, input_port_read(device->machine, "INPUT") & 0x0f, 0);
|
||||
pia6821_ca1_w(state->pia_u1, 0, input_port_read(device->machine, "INPUT") & 0x10);
|
||||
pia6821_ca2_w(state->pia_u1, 0, input_port_read(device->machine, "INPUT") & 0x20);
|
||||
}
|
||||
|
||||
static READ8_HANDLER( timer_r )
|
||||
{
|
||||
return timer;
|
||||
toratora_state *state = (toratora_state *)space->machine->driver_data;
|
||||
return state->timer;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( clear_timer_w )
|
||||
{
|
||||
timer = 0;
|
||||
toratora_state *state = (toratora_state *)space->machine->driver_data;
|
||||
state->timer = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Audio hardware
|
||||
@ -279,7 +279,7 @@ static const pia6821_interface pia_u2_intf =
|
||||
static const pia6821_interface pia_u3_intf =
|
||||
{
|
||||
DEVCB_NULL, /* port A in */
|
||||
DEVCB_HANDLER(port_b_u3_r), /* port B in */
|
||||
DEVCB_INPUT_PORT("DSW"), /* port B in */
|
||||
DEVCB_NULL, /* line CA1 in */
|
||||
DEVCB_NULL, /* line CB1 in */
|
||||
DEVCB_NULL, /* line CA2 in */
|
||||
@ -307,7 +307,7 @@ static const pia6821_interface pia_u3_intf =
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x0fff) AM_RAM
|
||||
AM_RANGE(0x1000, 0x7fff) AM_ROM /* not fully populated */
|
||||
AM_RANGE(0x8000, 0x9fff) AM_RAM AM_BASE(&toratora_videoram) AM_SIZE(&toratora_videoram_size)
|
||||
AM_RANGE(0x8000, 0x9fff) AM_RAM AM_BASE_SIZE_MEMBER(toratora_state, videoram, videoram_size)
|
||||
AM_RANGE(0xa000, 0xf047) AM_NOP
|
||||
AM_RANGE(0xf048, 0xf049) AM_NOP
|
||||
AM_RANGE(0xf04a, 0xf04a) AM_WRITE(clear_tv_w) /* the read is mark *LEDEN, but not used */
|
||||
@ -368,8 +368,34 @@ INPUT_PORTS_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( toratora )
|
||||
{
|
||||
toratora_state *state = (toratora_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->pia_u1 = devtag_get_device(machine, "pia_u1");
|
||||
state->pia_u2 = devtag_get_device(machine, "pia_u2");
|
||||
state->pia_u3 = devtag_get_device(machine, "pia_u3");
|
||||
|
||||
state_save_register_global(machine, state->timer);
|
||||
state_save_register_global(machine, state->last);
|
||||
state_save_register_global(machine, state->clear_tv);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( toratora )
|
||||
{
|
||||
toratora_state *state = (toratora_state *)machine->driver_data;
|
||||
|
||||
state->timer = 0xff;
|
||||
state->last = 0;
|
||||
state->clear_tv = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( toratora )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(toratora_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M6800,500000) /* ?????? game speed is entirely controlled by this */
|
||||
MDRV_CPU_PROGRAM_MAP(main_map)
|
||||
@ -379,6 +405,9 @@ static MACHINE_DRIVER_START( toratora )
|
||||
MDRV_PIA6821_ADD("pia_u2", pia_u2_intf)
|
||||
MDRV_PIA6821_ADD("pia_u3", pia_u3_intf)
|
||||
|
||||
MDRV_MACHINE_START(toratora)
|
||||
MDRV_MACHINE_RESET(toratora)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_UPDATE(toratora)
|
||||
|
||||
@ -427,4 +456,4 @@ ROM_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1980, toratora, 0, toratora, toratora, 0, ROT90, "GamePlan", "Tora Tora (prototype?)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND )
|
||||
GAME( 1980, toratora, 0, toratora, toratora, 0, ROT90, "GamePlan", "Tora Tora (prototype?)", GAME_NOT_WORKING | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
35
src/mame/includes/sf.h
Normal file
35
src/mame/includes/sf.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*************************************************************************
|
||||
|
||||
Street Fighter
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _sf_state sf_state;
|
||||
struct _sf_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT16 * videoram;
|
||||
UINT16 * objectram;
|
||||
// UINT16 * paletteram; // currently this uses generic palette handling
|
||||
size_t videoram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap, *fg_tilemap, *tx_tilemap;
|
||||
int sf_active;
|
||||
UINT16 bgscroll, fgscroll;
|
||||
|
||||
/* devices */
|
||||
const device_config *maincpu;
|
||||
const device_config *audiocpu;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/sf.c -----------*/
|
||||
|
||||
WRITE16_HANDLER( sf_bg_scroll_w );
|
||||
WRITE16_HANDLER( sf_fg_scroll_w );
|
||||
WRITE16_HANDLER( sf_videoram_w );
|
||||
WRITE16_HANDLER( sf_gfxctrl_w );
|
||||
|
||||
VIDEO_START( sf );
|
||||
VIDEO_UPDATE( sf );
|
@ -1,12 +1,5 @@
|
||||
#include "driver.h"
|
||||
|
||||
|
||||
UINT16 *sf_objectram,*sf_videoram;
|
||||
|
||||
static int sf_active = 0;
|
||||
|
||||
static tilemap *bg_tilemap, *fg_tilemap, *tx_tilemap;
|
||||
|
||||
#include "includes/sf.h"
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -16,10 +9,10 @@ static tilemap *bg_tilemap, *fg_tilemap, *tx_tilemap;
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
UINT8 *base = memory_region(machine, "gfx5") + 2*tile_index;
|
||||
UINT8 *base = memory_region(machine, "gfx5") + 2 * tile_index;
|
||||
int attr = base[0x10000];
|
||||
int color = base[0];
|
||||
int code = (base[0x10000+1]<<8) | base[1];
|
||||
int code = (base[0x10000 + 1] << 8) | base[1];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
code,
|
||||
@ -29,10 +22,10 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
static TILE_GET_INFO( get_fg_tile_info )
|
||||
{
|
||||
UINT8 *base = memory_region(machine, "gfx5") + 0x20000 + 2*tile_index;
|
||||
UINT8 *base = memory_region(machine, "gfx5") + 0x20000 + 2 * tile_index;
|
||||
int attr = base[0x10000];
|
||||
int color = base[0];
|
||||
int code = (base[0x10000+1]<<8) | base[1];
|
||||
int code = (base[0x10000 + 1] << 8) | base[1];
|
||||
SET_TILE_INFO(
|
||||
1,
|
||||
code,
|
||||
@ -42,7 +35,8 @@ static TILE_GET_INFO( get_fg_tile_info )
|
||||
|
||||
static TILE_GET_INFO( get_tx_tile_info )
|
||||
{
|
||||
int code = sf_videoram[tile_index];
|
||||
sf_state *state = (sf_state *)machine->driver_data;
|
||||
int code = state->videoram[tile_index];
|
||||
SET_TILE_INFO(
|
||||
3,
|
||||
code & 0x3ff,
|
||||
@ -60,12 +54,14 @@ static TILE_GET_INFO( get_tx_tile_info )
|
||||
|
||||
VIDEO_START( sf )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_cols, 16,16,2048,16);
|
||||
fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_cols,16,16,2048,16);
|
||||
tx_tilemap = tilemap_create(machine, get_tx_tile_info,tilemap_scan_rows, 8, 8, 64,32);
|
||||
sf_state *state = (sf_state *)machine->driver_data;
|
||||
|
||||
tilemap_set_transparent_pen(fg_tilemap,15);
|
||||
tilemap_set_transparent_pen(tx_tilemap,3);
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols, 16, 16, 2048, 16);
|
||||
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_cols, 16, 16, 2048, 16);
|
||||
state->tx_tilemap = tilemap_create(machine, get_tx_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
|
||||
|
||||
tilemap_set_transparent_pen(state->fg_tilemap, 15);
|
||||
tilemap_set_transparent_pen(state->tx_tilemap, 3);
|
||||
}
|
||||
|
||||
|
||||
@ -78,41 +74,44 @@ VIDEO_START( sf )
|
||||
|
||||
WRITE16_HANDLER( sf_videoram_w )
|
||||
{
|
||||
COMBINE_DATA(&sf_videoram[offset]);
|
||||
tilemap_mark_tile_dirty(tx_tilemap,offset);
|
||||
sf_state *state = (sf_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->videoram[offset]);
|
||||
tilemap_mark_tile_dirty(state->tx_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( sf_bg_scroll_w )
|
||||
{
|
||||
static UINT16 scroll;
|
||||
COMBINE_DATA(&scroll);
|
||||
tilemap_set_scrollx(bg_tilemap,0,scroll);
|
||||
sf_state *state = (sf_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->bgscroll);
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, state->bgscroll);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( sf_fg_scroll_w )
|
||||
{
|
||||
static UINT16 scroll;
|
||||
COMBINE_DATA(&scroll);
|
||||
tilemap_set_scrollx(fg_tilemap,0,scroll);
|
||||
sf_state *state = (sf_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->fgscroll);
|
||||
tilemap_set_scrollx(state->fg_tilemap, 0, state->fgscroll);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( sf_gfxctrl_w )
|
||||
{
|
||||
/* b0 = reset, or maybe "set anyway" */
|
||||
/* b1 = pulsed when control6.b6==0 until it's 1 */
|
||||
/* b2 = active when dip 8 (flip) on */
|
||||
/* b3 = active character plane */
|
||||
/* b4 = unused */
|
||||
/* b5 = active background plane */
|
||||
/* b6 = active middle plane */
|
||||
/* b7 = active sprites */
|
||||
/* b0 = reset, or maybe "set anyway" */
|
||||
/* b1 = pulsed when control6.b6==0 until it's 1 */
|
||||
/* b2 = active when dip 8 (flip) on */
|
||||
/* b3 = active character plane */
|
||||
/* b4 = unused */
|
||||
/* b5 = active background plane */
|
||||
/* b6 = active middle plane */
|
||||
/* b7 = active sprites */
|
||||
|
||||
sf_state *state = (sf_state *)space->machine->driver_data;
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
sf_active = data & 0xff;
|
||||
state->sf_active = data & 0xff;
|
||||
flip_screen_set(space->machine, data & 0x04);
|
||||
tilemap_set_enable(tx_tilemap,data & 0x08);
|
||||
tilemap_set_enable(bg_tilemap,data & 0x20);
|
||||
tilemap_set_enable(fg_tilemap,data & 0x40);
|
||||
tilemap_set_enable(state->tx_tilemap, data & 0x08);
|
||||
tilemap_set_enable(state->bg_tilemap, data & 0x20);
|
||||
tilemap_set_enable(state->fg_tilemap, data & 0x40);
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,29 +123,30 @@ WRITE16_HANDLER( sf_gfxctrl_w )
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
INLINE int sf_invert(int nb)
|
||||
INLINE int sf_invert( int nb )
|
||||
{
|
||||
static const int delta[4] = {0x00, 0x18, 0x18, 0x00};
|
||||
return nb ^ delta[(nb >> 3) & 3];
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
sf_state *state = (sf_state *)machine->driver_data;
|
||||
int offs;
|
||||
|
||||
for (offs = 0x1000-0x20;offs >= 0;offs -= 0x20)
|
||||
for (offs = 0x1000 - 0x20; offs >= 0; offs -= 0x20)
|
||||
{
|
||||
int c = sf_objectram[offs];
|
||||
int attr = sf_objectram[offs+1];
|
||||
int sy = sf_objectram[offs+2];
|
||||
int sx = sf_objectram[offs+3];
|
||||
int c = state->objectram[offs];
|
||||
int attr = state->objectram[offs + 1];
|
||||
int sy = state->objectram[offs + 2];
|
||||
int sx = state->objectram[offs + 3];
|
||||
int color = attr & 0x000f;
|
||||
int flipx = attr & 0x0100;
|
||||
int flipy = attr & 0x0200;
|
||||
|
||||
if (attr & 0x400) /* large sprite */
|
||||
{
|
||||
int c1,c2,c3,c4,t;
|
||||
int c1, c2, c3, c4, t;
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
@ -157,9 +157,9 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
}
|
||||
|
||||
c1 = c;
|
||||
c2 = c+1;
|
||||
c3 = c+16;
|
||||
c4 = c+17;
|
||||
c2 = c + 1;
|
||||
c3 = c + 16;
|
||||
c4 = c + 17;
|
||||
|
||||
if (flipx)
|
||||
{
|
||||
@ -220,16 +220,18 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
|
||||
VIDEO_UPDATE( sf )
|
||||
{
|
||||
if (sf_active & 0x20)
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
sf_state *state = (sf_state *)screen->machine->driver_data;
|
||||
|
||||
if (state->sf_active & 0x20)
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
else
|
||||
bitmap_fill(bitmap,cliprect,0);
|
||||
bitmap_fill(bitmap, cliprect, 0);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
|
||||
|
||||
if (sf_active & 0x80)
|
||||
draw_sprites(screen->machine,bitmap,cliprect);
|
||||
if (state->sf_active & 0x80)
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->tx_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user