glass.cpp: oki memory map instead of memcpy (nw)

This commit is contained in:
Ivan Vangelista 2016-02-18 18:09:31 +01:00
parent a09493eb20
commit 92b1007de7
5 changed files with 62 additions and 56 deletions

View File

@ -825,4 +825,4 @@ GAME( 1987, 1943j, 1943, 1943, 1943, _1943_state, 1943, ROT270, "Capcom"
GAME( 1987, 1943ja, 1943, 1943, 1943, _1943_state, 1943, ROT270, "Capcom", "1943: Midway Kaisen (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1987, 1943b, 1943, 1943, 1943, _1943_state, 1943b,ROT270, "bootleg", "1943: Battle of Midway (bootleg, hack of Japan set)", MACHINE_SUPPORTS_SAVE )
GAME( 1987, 1943bj, 1943, 1943, 1943, _1943_state, 1943b,ROT270, "bootleg", "1943: Midway Kaisen (bootleg)", MACHINE_SUPPORTS_SAVE )
GAME( 1987, 1943kai, 0, 1943, 1943, _1943_state, 1943, ROT270, "Capcom", "1943 Kai: Midway Kaisen (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1987, 1943kai, 0, 1943, 1943, _1943_state, 1943, ROT270, "Capcom", "1943 Kai: Midway Kaisen (Japan)", MACHINE_SUPPORTS_SAVE )

View File

@ -460,7 +460,7 @@ ROM_END
Waterball by ABM (sticker on the pcb 12-3-96)
The pcb has some empty sockets, maybe it was used for other games since it has no markings.
The game has fonts identical to World Rally and obviously Blomby Var ;)
The game has fonts identical to World Rally and obviously Blomby Car ;)
1x 68k
1x oki 6295

View File

@ -6,7 +6,8 @@ Glass (c) 1993 Gaelco (Developed by OMK. Produced by Gaelco)
Driver by Manuel Abadia <emumanu+mame@gmail.com>
The DS5002FP has up to 128KB undumped gameplay code making the game unplayable :_(
The DS5002FP has up to 128KB undumped gameplay code making the game unplayable,
except for the Promat licensed Korean version which is unprotected.
***************************************************************************/
@ -20,7 +21,7 @@ WRITE16_MEMBER(glass_state::clr_int_w)
m_cause_interrupt = 1;
}
INTERRUPT_GEN_MEMBER(glass_state::glass_interrupt)
INTERRUPT_GEN_MEMBER(glass_state::interrupt)
{
if (m_cause_interrupt)
{
@ -54,13 +55,11 @@ GFXDECODE_END
WRITE16_MEMBER(glass_state::OKIM6295_bankswitch_w)
{
UINT8 *RAM = memregion("oki")->base();
if (ACCESSING_BITS_0_7)
memcpy(&RAM[0x30000], &RAM[0x40000 + (data & 0x0f) * 0x10000], 0x10000);
membank("okibank")->set_entry(data & 0x0f);
}
WRITE16_MEMBER(glass_state::glass_coin_w)
WRITE16_MEMBER(glass_state::coin_w)
{
switch (offset >> 3)
{
@ -79,7 +78,7 @@ WRITE16_MEMBER(glass_state::glass_coin_w)
static ADDRESS_MAP_START( glass_map, AS_PROGRAM, 16, glass_state )
AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */
AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(glass_vram_w) AM_SHARE("videoram") /* Video RAM */
AM_RANGE(0x100000, 0x101fff) AM_RAM_WRITE(vram_w) AM_SHARE("videoram") /* Video RAM */
AM_RANGE(0x102000, 0x102fff) AM_RAM /* Extra Video RAM */
AM_RANGE(0x108000, 0x108007) AM_WRITEONLY AM_SHARE("vregs") /* Video Registers */
AM_RANGE(0x108008, 0x108009) AM_WRITE(clr_int_w) /* CLR INT Video */
@ -89,14 +88,20 @@ static ADDRESS_MAP_START( glass_map, AS_PROGRAM, 16, glass_state )
AM_RANGE(0x700002, 0x700003) AM_READ_PORT("DSW1")
AM_RANGE(0x700004, 0x700005) AM_READ_PORT("P1")
AM_RANGE(0x700006, 0x700007) AM_READ_PORT("P2")
AM_RANGE(0x700008, 0x700009) AM_WRITE(glass_blitter_w) /* serial blitter */
AM_RANGE(0x700008, 0x700009) AM_WRITE(blitter_w) /* serial blitter */
AM_RANGE(0x70000c, 0x70000d) AM_WRITE(OKIM6295_bankswitch_w) /* OKI6295 bankswitch */
AM_RANGE(0x70000e, 0x70000f) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) /* OKI6295 status register */
AM_RANGE(0x70000a, 0x70004b) AM_WRITE(glass_coin_w) /* Coin Counters/Lockout */
AM_RANGE(0x70000a, 0x70004b) AM_WRITE(coin_w) /* Coin Counters/Lockout */
AM_RANGE(0xfec000, 0xfeffff) AM_RAM AM_SHARE("mainram") /* Work RAM (partially shared with DS5002FP) */
ADDRESS_MAP_END
static ADDRESS_MAP_START( oki_map, AS_0, 8, glass_state )
AM_RANGE(0x00000, 0x2ffff) AM_ROM
AM_RANGE(0x30000, 0x3ffff) AM_ROMBANK("okibank")
ADDRESS_MAP_END
static INPUT_PORTS_START( glass )
PORT_START("DSW1")
PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:6,7,8")
@ -172,6 +177,8 @@ INPUT_PORTS_END
void glass_state::machine_start()
{
membank("okibank")->configure_entries(0, 16, memregion("oki")->base(), 0x10000);
save_item(NAME(m_cause_interrupt));
save_item(NAME(m_current_bit));
save_item(NAME(m_current_command));
@ -180,13 +187,11 @@ void glass_state::machine_start()
void glass_state::machine_reset()
{
int i;
m_cause_interrupt = 1;
m_current_bit = 0;
m_current_command = 0;
for (i = 0; i < 5; i++)
for (int i = 0; i < 5; i++)
m_blitter_serial_buffer[i] = 0;
}
@ -195,7 +200,7 @@ static MACHINE_CONFIG_START( glass, glass_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, XTAL_24MHz/2) /* 12 MHz verified on PCB */
MCFG_CPU_PROGRAM_MAP(glass_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", glass_state, glass_interrupt)
MCFG_CPU_VBLANK_INT_DRIVER("screen", glass_state, interrupt)
/* video hardware */
@ -204,7 +209,7 @@ static MACHINE_CONFIG_START( glass, glass_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(32*16, 32*16)
MCFG_SCREEN_VISIBLE_AREA(0, 368-1, 16, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(glass_state, screen_update_glass)
MCFG_SCREEN_UPDATE_DRIVER(glass_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", glass)
@ -215,6 +220,7 @@ static MACHINE_CONFIG_START( glass, glass_state )
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_OKIM6295_ADD("oki", XTAL_1MHz, OKIM6295_PIN7_HIGH) /* 1MHz Resonator & pin 7 high verified on PCB */
MCFG_DEVICE_ADDRESS_MAP(AS_0, oki_map)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_CONFIG_END
@ -236,10 +242,9 @@ ROM_START( glass ) /* Version 1.1 */
ROM_REGION( 0x100000, "gfx3", 0 ) /* 16 bitmaps (320x200, indexed colors) */
ROM_LOAD( "h9.bin", 0x000000, 0x100000, CRC(b9492557) SHA1(3f5c0d696d65e1cd492763dfa749c813dd56a9bf) )
ROM_REGION( 0x140000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */
ROM_REGION( 0x100000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */
ROM_LOAD( "c1.bin", 0x000000, 0x100000, CRC(d9f075a2) SHA1(31a7a677861f39d512e9d1f51925c689e481159a) )
/* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */
ROM_RELOAD( 0x040000, 0x100000 )
ROM_END
ROM_START( glass10 ) /* Version 1.0 */
@ -260,10 +265,9 @@ ROM_START( glass10 ) /* Version 1.0 */
ROM_REGION( 0x100000, "gfx3", 0 ) /* 16 bitmaps (320x200, indexed colors) */
ROM_LOAD( "h9.bin", 0x000000, 0x100000, CRC(b9492557) SHA1(3f5c0d696d65e1cd492763dfa749c813dd56a9bf) )
ROM_REGION( 0x140000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */
ROM_REGION( 0x100000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */
ROM_LOAD( "c1.bin", 0x000000, 0x100000, CRC(d9f075a2) SHA1(31a7a677861f39d512e9d1f51925c689e481159a) )
/* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */
ROM_RELOAD( 0x040000, 0x100000 )
ROM_END
ROM_START( glass10a ) /* Title screen shows "GLASS" and under that "Break Edition" on a real PCB */
@ -284,10 +288,9 @@ ROM_START( glass10a ) /* Title screen shows "GLASS" and under that "Break Editio
ROM_REGION( 0x100000, "gfx3", 0 ) /* 16 bitmaps (320x200, indexed colors) */
ROM_LOAD( "h9.bin", 0x000000, 0x100000, CRC(b9492557) SHA1(3f5c0d696d65e1cd492763dfa749c813dd56a9bf) )
ROM_REGION( 0x140000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */
ROM_REGION( 0x100000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */
ROM_LOAD( "c1.bin", 0x000000, 0x100000, CRC(d9f075a2) SHA1(31a7a677861f39d512e9d1f51925c689e481159a) )
/* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */
ROM_RELOAD( 0x040000, 0x100000 )
ROM_END
ROM_START( glasskr )
@ -305,10 +308,9 @@ ROM_START( glasskr )
ROM_REGION( 0x100000, "gfx3", 0 ) /* 16 bitmaps (320x200, indexed colors) */
ROM_LOAD( "glassk.h9", 0x000000, 0x100000, CRC(d499be4c) SHA1(204f754813be687e8dc00bfe7b5dbc4857ac8738) )
ROM_REGION( 0x140000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */
ROM_REGION( 0x100000, "oki", 0 ) /* ADPCM samples - sound chip is OKIM6295 */
ROM_LOAD( "c1.bin", 0x000000, 0x100000, CRC(d9f075a2) SHA1(31a7a677861f39d512e9d1f51925c689e481159a) )
/* 0x00000-0x2ffff is fixed, 0x30000-0x3ffff is bank switched from all the ROMs */
ROM_RELOAD( 0x040000, 0x100000 )
ROM_END
/***************************************************************************
@ -317,7 +319,7 @@ ROM_END
***************************************************************************/
void glass_state::glass_ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 )
void glass_state::ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 )
{
int i;
@ -342,14 +344,14 @@ void glass_state::glass_ROM16_split_gfx( const char *src_reg, const char *dst_re
*/
READ16_MEMBER( glass_state::glass_mainram_r )
READ16_MEMBER( glass_state::mainram_r )
{
UINT16 ret = m_mainram[offset];
int pc = space.device().safe_pc();
if (offset == (0xfede96 - 0xfec000)>>1)
{
// this address seems important, the game will abort with 'power failure' depending on some reads, presumably refering to the power to the battery
// this address seems important, the game will abort with 'power failure' depending on some reads, presumably referring to the power to the battery
// there are also various code segments like the one below
/*
@ -376,7 +378,7 @@ READ16_MEMBER( glass_state::glass_mainram_r )
return ret;
}
WRITE16_MEMBER( glass_state::glass_mainram_w )
WRITE16_MEMBER( glass_state::mainram_w )
{
int pc = space.device().safe_pc();
@ -436,10 +438,10 @@ DRIVER_INIT_MEMBER(glass_state, glass)
*/
/* split ROM H13 */
glass_ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0200000, 0x0000000, 0x0100000);
ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0200000, 0x0000000, 0x0100000);
/* split ROM H11 */
glass_ROM16_split_gfx("gfx2", "gfx1", 0x0200000, 0x0200000, 0x0200000, 0x0300000);
ROM16_split_gfx("gfx2", "gfx1", 0x0200000, 0x0200000, 0x0200000, 0x0300000);
}
@ -449,7 +451,7 @@ DRIVER_INIT_MEMBER(glass_state,glassp)
DRIVER_INIT_CALL(glass);
/* install custom handler over RAM for protection */
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xfec000, 0xfeffff, read16_delegate(FUNC(glass_state::glass_mainram_r), this), write16_delegate(FUNC(glass_state::glass_mainram_w),this));
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xfec000, 0xfeffff, read16_delegate(FUNC(glass_state::mainram_r), this), write16_delegate(FUNC(glass_state::mainram_w),this));
}

View File

@ -11,13 +11,19 @@ class glass_state : public driver_device
public:
glass_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_videoram(*this, "videoram"),
m_vregs(*this, "vregs"),
m_spriteram(*this, "spriteram"),
m_mainram(*this, "mainram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") { }
m_mainram(*this, "mainram") { }
/* devices */
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
/* memory pointers */
required_shared_ptr<UINT16> m_videoram;
@ -34,27 +40,25 @@ public:
int m_current_command;
int m_cause_interrupt;
int m_blitter_serial_buffer[5];
DECLARE_WRITE16_MEMBER(clr_int_w);
DECLARE_WRITE16_MEMBER(OKIM6295_bankswitch_w);
DECLARE_WRITE16_MEMBER(glass_coin_w);
DECLARE_WRITE16_MEMBER(glass_blitter_w);
DECLARE_WRITE16_MEMBER(glass_vram_w);
DECLARE_READ16_MEMBER( glass_mainram_r );
DECLARE_WRITE16_MEMBER( glass_mainram_w );
DECLARE_WRITE16_MEMBER(coin_w);
DECLARE_WRITE16_MEMBER(blitter_w);
DECLARE_WRITE16_MEMBER(vram_w);
DECLARE_READ16_MEMBER(mainram_r);
DECLARE_WRITE16_MEMBER(mainram_w);
DECLARE_DRIVER_INIT(glass);
DECLARE_DRIVER_INIT(glassp);
TILE_GET_INFO_MEMBER(get_tile_info_glass_screen0);
TILE_GET_INFO_MEMBER(get_tile_info_glass_screen1);
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
UINT32 screen_update_glass(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(glass_interrupt);
TILE_GET_INFO_MEMBER(get_tile_info_screen0);
TILE_GET_INFO_MEMBER(get_tile_info_screen1);
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(interrupt);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void glass_ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 );
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
void ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 );
};

View File

@ -33,7 +33,7 @@
1 | xxxxxxxx -------- | not used
*/
TILE_GET_INFO_MEMBER(glass_state::get_tile_info_glass_screen0)
TILE_GET_INFO_MEMBER(glass_state::get_tile_info_screen0)
{
int data = m_videoram[tile_index << 1];
int data2 = m_videoram[(tile_index << 1) + 1];
@ -43,7 +43,7 @@ TILE_GET_INFO_MEMBER(glass_state::get_tile_info_glass_screen0)
}
TILE_GET_INFO_MEMBER(glass_state::get_tile_info_glass_screen1)
TILE_GET_INFO_MEMBER(glass_state::get_tile_info_screen1)
{
int data = m_videoram[(0x1000 / 2) + (tile_index << 1)];
int data2 = m_videoram[(0x1000 / 2) + (tile_index << 1) + 1];
@ -67,7 +67,7 @@ TILE_GET_INFO_MEMBER(glass_state::get_tile_info_glass_screen1)
B2B1B0 selects the picture (there are 8 pictures in each half of the ROM)
*/
WRITE16_MEMBER(glass_state::glass_blitter_w)
WRITE16_MEMBER(glass_state::blitter_w)
{
m_blitter_serial_buffer[m_current_bit] = data & 0x01;
m_current_bit++;
@ -112,7 +112,7 @@ WRITE16_MEMBER(glass_state::glass_blitter_w)
***************************************************************************/
WRITE16_MEMBER(glass_state::glass_vram_w)
WRITE16_MEMBER(glass_state::vram_w)
{
COMBINE_DATA(&m_videoram[offset]);
m_pant[offset >> 11]->mark_tile_dirty(((offset << 1) & 0x0fff) >> 2);
@ -127,8 +127,8 @@ WRITE16_MEMBER(glass_state::glass_vram_w)
void glass_state::video_start()
{
m_pant[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(glass_state::get_tile_info_glass_screen0),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_pant[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(glass_state::get_tile_info_glass_screen1),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_pant[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(glass_state::get_tile_info_screen0),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_pant[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(glass_state::get_tile_info_screen1),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_screen_bitmap = std::make_unique<bitmap_ind16>(320, 200);
save_item(NAME(*m_screen_bitmap));
@ -191,7 +191,7 @@ void glass_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect
****************************************************************************/
UINT32 glass_state::screen_update_glass(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
UINT32 glass_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
/* set scroll registers */
m_pant[0]->set_scrolly(0, m_vregs[0]);