mirror of
https://github.com/holub/mame
synced 2025-10-04 16:34:53 +03:00
further st0016 reorganization (nw)
This commit is contained in:
parent
54047d6b53
commit
afaa880c42
@ -112,9 +112,11 @@ public:
|
||||
m_tmapscroll2(*this, "tmapscroll2"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_gdfs_st0020(*this, "st0020_spr"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_gamecpu(*this, "gamecpu"),
|
||||
m_eeprom(*this, "eeprom"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_palette(*this, "palette"),
|
||||
m_gfxdecode(*this, "gfxdecode")
|
||||
{ }
|
||||
|
||||
tilemap_t *m_tmap;
|
||||
tilemap_t *m_tmap2;
|
||||
@ -128,7 +130,7 @@ public:
|
||||
int m_jclub2_gfx_index;
|
||||
optional_shared_ptr<UINT32> m_spriteram;
|
||||
optional_device<st0020_device> m_gdfs_st0020;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_gamecpu;
|
||||
required_device<eeprom_serial_93cxx_device> m_eeprom;
|
||||
required_device<palette_device> m_palette;
|
||||
DECLARE_WRITE32_MEMBER(darkhors_tmapram_w);
|
||||
@ -155,6 +157,7 @@ public:
|
||||
UINT32 screen_update_jclub2o(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(darkhors_irq);
|
||||
void draw_sprites_darkhors(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
};
|
||||
|
||||
|
||||
@ -948,17 +951,17 @@ TIMER_DEVICE_CALLBACK_MEMBER(darkhors_state::darkhors_irq)
|
||||
int scanline = param;
|
||||
|
||||
if(scanline == 248)
|
||||
m_maincpu->set_input_line(5, HOLD_LINE);
|
||||
m_gamecpu->set_input_line(5, HOLD_LINE);
|
||||
|
||||
if(scanline == 0)
|
||||
m_maincpu->set_input_line(3, HOLD_LINE);
|
||||
m_gamecpu->set_input_line(3, HOLD_LINE);
|
||||
|
||||
if(scanline == 128)
|
||||
m_maincpu->set_input_line(4, HOLD_LINE);
|
||||
m_gamecpu->set_input_line(4, HOLD_LINE);
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( darkhors, darkhors_state )
|
||||
MCFG_CPU_ADD("maincpu", M68EC020, 12000000) // 36MHz/3 ??
|
||||
MCFG_CPU_ADD("gamecpu", M68EC020, 12000000) // 36MHz/3 ??
|
||||
MCFG_CPU_PROGRAM_MAP(darkhors_map)
|
||||
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", darkhors_state, darkhors_irq, "screen", 0, 1)
|
||||
|
||||
@ -1001,7 +1004,7 @@ UINT32 darkhors_state::screen_update_jclub2(screen_device &screen, bitmap_ind16
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( jclub2, darkhors_state )
|
||||
MCFG_CPU_ADD("maincpu", M68EC020, 12000000)
|
||||
MCFG_CPU_ADD("gamecpu", M68EC020, 12000000)
|
||||
MCFG_CPU_PROGRAM_MAP(jclub2_map)
|
||||
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", darkhors_state, darkhors_irq, "screen", 0, 1)
|
||||
|
||||
@ -1038,14 +1041,14 @@ static ADDRESS_MAP_START( st0016_mem, AS_PROGRAM, 8, darkhors_state )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
|
||||
//AM_RANGE(0xe900, 0xe9ff) // sound - internal
|
||||
AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
|
||||
//AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
|
||||
AM_RANGE(0xe82f, 0xe830) AM_READNOP
|
||||
AM_RANGE(0xf000, 0xffff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( st0016_io, AS_IO, 8, darkhors_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w)
|
||||
//AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w)
|
||||
//AM_RANGE(0xc0, 0xc0) AM_READ(cmd1_r)
|
||||
//AM_RANGE(0xc1, 0xc1) AM_READ(cmd2_r)
|
||||
//AM_RANGE(0xc2, 0xc2) AM_READ(cmd_stat8_r)
|
||||
@ -1066,11 +1069,11 @@ UINT32 darkhors_state::screen_update_jclub2o(screen_device &screen, bitmap_ind16
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( jclub2o, darkhors_state )
|
||||
MCFG_CPU_ADD("maincpu", M68EC020, 12000000)
|
||||
MCFG_CPU_ADD("gamecpu", M68EC020, 12000000)
|
||||
MCFG_CPU_PROGRAM_MAP(jclub2o_map)
|
||||
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", darkhors_state, darkhors_irq, "screen", 0, 1)
|
||||
|
||||
MCFG_CPU_ADD("st0016",ST0016_CPU,8000000)
|
||||
MCFG_CPU_ADD("maincpu",ST0016_CPU,8000000)
|
||||
MCFG_CPU_PROGRAM_MAP(st0016_mem)
|
||||
MCFG_CPU_IO_MAP(st0016_io)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", darkhors_state, irq0_line_hold)
|
||||
@ -1111,7 +1114,7 @@ MACHINE_CONFIG_END
|
||||
***************************************************************************/
|
||||
|
||||
ROM_START( darkhors )
|
||||
ROM_REGION( 0x100000, "maincpu", 0 ) // 68EC020 code
|
||||
ROM_REGION( 0x100000, "gamecpu", 0 ) // 68EC020 code
|
||||
ROM_LOAD32_WORD_SWAP( "prg2", 0x00000, 0x80000, CRC(f2ec5818) SHA1(326937a331496880f517f41b0b8ab54e55fd7af7) )
|
||||
ROM_LOAD32_WORD_SWAP( "prg1", 0x00002, 0x80000, CRC(b80f8f59) SHA1(abc26dd8b36da0d510978364febe385f69fb317f) )
|
||||
|
||||
@ -1186,7 +1189,7 @@ Provided to you by Belgium Dump Team Gerald (COY) on 18/01/2007.
|
||||
|
||||
// this contains mutliple sets, although splitting them as listed above makes no sense.. especially not the 'subcpu' roms
|
||||
ROM_START( jclub2 )
|
||||
ROM_REGION( 0x200000, "maincpu", 0 ) // 68EC020 code + compressed GFX
|
||||
ROM_REGION( 0x200000, "gamecpu", 0 ) // 68EC020 code + compressed GFX
|
||||
// main program (similar to main program of bootleg
|
||||
ROM_LOAD16_WORD_SWAP( "m88-01b.u38",0x00000, 0x200000, CRC(f1054c69) SHA1(be6d92653f0d3cc0a36a2ff0798043f4a95439bc) )
|
||||
ROM_LOAD16_WORD_SWAP( "m88-01a.u38",0x00000, 0x200000, CRC(c1243e1c) SHA1(2a5857738b8950daf77ddaa8304b765f809f8241) ) // alt revision?
|
||||
@ -1244,7 +1247,7 @@ Provided to you by Belgium Dump Team Gerald (COY) on 18/01/2007.
|
||||
|
||||
// this contains mutliple sets
|
||||
ROM_START( jclub2o )
|
||||
ROM_REGION( 0x200000, "maincpu", 0 ) // 68EC020 code + compressed gfx
|
||||
ROM_REGION( 0x200000, "gamecpu", 0 ) // 68EC020 code + compressed gfx
|
||||
ROM_LOAD16_WORD_SWAP( "sx006a-01.106",0x00000, 0x200000, CRC(55e249bc) SHA1(ed0f066ed17f047760b712cbbfba1a62d4b452ba) )
|
||||
ROM_LOAD16_WORD_SWAP( "sx006b-01.u26",0x00000, 0x200000, CRC(f730dded) SHA1(efb966dcb98440a072d4825ef2788c85acdfd103) ) // alt revision?
|
||||
|
||||
@ -1254,7 +1257,7 @@ ROM_START( jclub2o )
|
||||
ROM_LOAD16_WORD_SWAP( "jc2-110x.u27",0x00000, 0x080000, CRC(03aa6882) SHA1(e0343bc77a19994ddafa614891663b40e1476332) )
|
||||
ROM_LOAD16_WORD_SWAP( "jc2-112x.u27",0x00000, 0x080000, CRC(e1ab93bd) SHA1(78b618b3f7819bd5351ebf949f328fec7795cec9) ) // alt revision?
|
||||
|
||||
ROM_REGION( 0x80000, "st0016", 0 ) // z80 core (used for sound?)
|
||||
ROM_REGION( 0x80000, "maincpu", 0 ) // z80 core (used for sound?)
|
||||
ROM_LOAD( "sx006-04.u87", 0x00000, 0x80000, CRC(a87adedd) SHA1(1cd5af2d03738fff2230b46241659179467c828c) )
|
||||
|
||||
ROM_REGION( 0x100, "eeprom", 0 ) // eeprom 16 bit one!!!
|
||||
@ -1267,7 +1270,7 @@ ROM_END
|
||||
Maybe upgraded to a release candidate software revision.
|
||||
*/
|
||||
ROM_START( jclub2ob )
|
||||
ROM_REGION( 0x200000, "maincpu", 0 ) // 68EC020 code + compressed gfx
|
||||
ROM_REGION( 0x200000, "gamecpu", 0 ) // 68EC020 code + compressed gfx
|
||||
ROM_LOAD16_WORD_SWAP( "sx006a-01.u26",0x00000, 0x200000, CRC(55e249bc) SHA1(ed0f066ed17f047760b712cbbfba1a62d4b452ba) )
|
||||
|
||||
ROM_REGION( 0x200000, "patch", 0 ) // 68EC020 code
|
||||
@ -1275,7 +1278,7 @@ ROM_START( jclub2ob )
|
||||
// overriding the initial 0x80000 bytes of the program rom.
|
||||
ROM_LOAD16_WORD_SWAP( "203x-rom1.u27",0x00000, 0x080000, CRC(7446ed3e) SHA1(b0936e42549280e2965159270429c4fdacba114a) )
|
||||
|
||||
ROM_REGION( 0x80000, "st0016", 0 ) // z80 core (used for sound?)
|
||||
ROM_REGION( 0x80000, "maincpu", 0 ) // z80 core (used for sound?)
|
||||
ROM_LOAD( "sx006-04.u87", 0x00000, 0x80000, CRC(a87adedd) SHA1(1cd5af2d03738fff2230b46241659179467c828c) )
|
||||
|
||||
ROM_REGION( 0x100, "eeprom", 0 ) // eeprom 16 bit one!!!
|
||||
|
@ -89,13 +89,13 @@ public:
|
||||
static ADDRESS_MAP_START( macs_mem, AS_PROGRAM, 8, macs_state )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROMBANK("bank4")
|
||||
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0xc000, 0xcfff) AM_READ(st0016_sprite_ram_r) AM_WRITE(st0016_sprite_ram_w)
|
||||
AM_RANGE(0xd000, 0xdfff) AM_READ(st0016_sprite2_ram_r) AM_WRITE(st0016_sprite2_ram_w)
|
||||
//AM_RANGE(0xc000, 0xcfff) AM_READ(st0016_sprite_ram_r) AM_WRITE(st0016_sprite_ram_w)
|
||||
//AM_RANGE(0xd000, 0xdfff) AM_READ(st0016_sprite2_ram_r) AM_WRITE(st0016_sprite2_ram_w)
|
||||
AM_RANGE(0xe000, 0xe7ff) AM_RAM /* work ram ? */
|
||||
AM_RANGE(0xe800, 0xe87f) AM_RAM AM_SHARE("ram2")
|
||||
//AM_RANGE(0xe900, 0xe9ff) // sound - internal
|
||||
AM_RANGE(0xea00, 0xebff) AM_READ(st0016_palette_ram_r) AM_WRITE(st0016_palette_ram_w)
|
||||
AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
|
||||
//AM_RANGE(0xea00, 0xebff) AM_READ(st0016_palette_ram_r) AM_WRITE(st0016_palette_ram_w)
|
||||
//AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
|
||||
AM_RANGE(0xf000, 0xf7ff) AM_RAMBANK("bank3") /* common /backup ram ?*/
|
||||
AM_RANGE(0xf800, 0xffff) AM_RAMBANK("bank2") /* common /backup ram ?*/
|
||||
ADDRESS_MAP_END
|
||||
@ -178,16 +178,16 @@ WRITE8_MEMBER(macs_state::macs_output_w)
|
||||
|
||||
static ADDRESS_MAP_START( macs_io, AS_IO, 8, macs_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w) /* video/crt regs ? */
|
||||
//AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w) /* video/crt regs ? */
|
||||
AM_RANGE(0xc0, 0xc7) AM_READWRITE(macs_input_r,macs_output_w)
|
||||
AM_RANGE(0xe0, 0xe0) AM_WRITENOP /* renju = $40, neratte = 0 */
|
||||
AM_RANGE(0xe1, 0xe1) AM_WRITE(macs_rom_bank_w)
|
||||
AM_RANGE(0xe2, 0xe2) AM_WRITE(st0016_sprite_bank_w)
|
||||
AM_RANGE(0xe3, 0xe4) AM_WRITE(st0016_character_bank_w)
|
||||
AM_RANGE(0xe5, 0xe5) AM_WRITE(st0016_palette_bank_w)
|
||||
//AM_RANGE(0xe2, 0xe2) AM_WRITE(st0016_sprite_bank_w)
|
||||
//AM_RANGE(0xe3, 0xe4) AM_WRITE(st0016_character_bank_w)
|
||||
//AM_RANGE(0xe5, 0xe5) AM_WRITE(st0016_palette_bank_w)
|
||||
AM_RANGE(0xe6, 0xe6) AM_WRITE(rambank_w) /* banking ? ram bank ? shared rambank ? */
|
||||
AM_RANGE(0xe7, 0xe7) AM_WRITENOP /* watchdog */
|
||||
AM_RANGE(0xf0, 0xf0) AM_READ(st0016_dma_r)
|
||||
//AM_RANGE(0xf0, 0xf0) AM_READ(st0016_dma_r)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static GFXDECODE_START( macs )
|
||||
@ -488,10 +488,7 @@ static MACHINE_CONFIG_START( macs, macs_state )
|
||||
MCFG_SCREEN_SIZE(128*8, 128*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 128*8-1, 0*8, 128*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(st0016_state, screen_update_st0016)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", macs)
|
||||
MCFG_PALETTE_ADD("palette", 16*16*4+1)
|
||||
MCFG_SCREEN_PALETTE("maincpu:palette")
|
||||
|
||||
MCFG_VIDEO_START_OVERRIDE(st0016_state,st0016)
|
||||
MACHINE_CONFIG_END
|
||||
@ -711,28 +708,28 @@ MACHINE_RESET_MEMBER(macs_state,macs)
|
||||
DRIVER_INIT_MEMBER(macs_state,macs)
|
||||
{
|
||||
m_ram1=auto_alloc_array(machine(), UINT8, 0x20000);
|
||||
st0016_game=10|0x80;
|
||||
m_maincpu->st0016_game=10|0x80;
|
||||
m_rev = 1;
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(macs_state,macs2)
|
||||
{
|
||||
m_ram1=auto_alloc_array(machine(), UINT8, 0x20000);
|
||||
st0016_game=10|0x80;
|
||||
m_maincpu->st0016_game=10|0x80;
|
||||
m_rev = 2;
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(macs_state,kisekaeh)
|
||||
{
|
||||
m_ram1=auto_alloc_array(machine(), UINT8, 0x20000);
|
||||
st0016_game=11|0x180;
|
||||
m_maincpu->st0016_game=11|0x180;
|
||||
m_rev = 1;
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(macs_state,kisekaem)
|
||||
{
|
||||
m_ram1=auto_alloc_array(machine(), UINT8, 0x20000);
|
||||
st0016_game=10|0x180;
|
||||
m_maincpu->st0016_game=10|0x180;
|
||||
m_rev = 1;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,9 @@ public:
|
||||
: st0016_state(mconfig, type, tag),
|
||||
m_shared(*this, "shared"),
|
||||
m_framebuffer(*this, "framebuffer"),
|
||||
m_cop_ram(*this, "cop_ram") { }
|
||||
m_cop_ram(*this, "cop_ram"),
|
||||
m_palette(*this, "palette")
|
||||
{ }
|
||||
|
||||
required_shared_ptr<UINT8> m_shared;
|
||||
required_shared_ptr<UINT32> m_framebuffer;
|
||||
@ -133,32 +135,34 @@ public:
|
||||
DECLARE_MACHINE_RESET(speglsht);
|
||||
DECLARE_VIDEO_START(speglsht);
|
||||
UINT32 screen_update_speglsht(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
};
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( st0016_mem, AS_PROGRAM, 8, speglsht_state )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0xc000, 0xcfff) AM_READ(st0016_sprite_ram_r) AM_WRITE(st0016_sprite_ram_w)
|
||||
AM_RANGE(0xd000, 0xdfff) AM_READ(st0016_sprite2_ram_r) AM_WRITE(st0016_sprite2_ram_w)
|
||||
//AM_RANGE(0xc000, 0xcfff) AM_READ(st0016_sprite_ram_r) AM_WRITE(st0016_sprite_ram_w)
|
||||
//AM_RANGE(0xd000, 0xdfff) AM_READ(st0016_sprite2_ram_r) AM_WRITE(st0016_sprite2_ram_w)
|
||||
AM_RANGE(0xe000, 0xe7ff) AM_RAM
|
||||
AM_RANGE(0xe800, 0xe87f) AM_RAM
|
||||
//AM_RANGE(0xe900, 0xe9ff) // sound - internal
|
||||
AM_RANGE(0xea00, 0xebff) AM_READ(st0016_palette_ram_r) AM_WRITE(st0016_palette_ram_w)
|
||||
AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
|
||||
//AM_RANGE(0xea00, 0xebff) AM_READ(st0016_palette_ram_r) AM_WRITE(st0016_palette_ram_w)
|
||||
//AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
|
||||
AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("shared")
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( st0016_io, AS_IO, 8, speglsht_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w)
|
||||
//AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w)
|
||||
AM_RANGE(0xe1, 0xe1) AM_WRITE(st0016_rom_bank_w)
|
||||
AM_RANGE(0xe2, 0xe2) AM_WRITE(st0016_sprite_bank_w)
|
||||
AM_RANGE(0xe3, 0xe4) AM_WRITE(st0016_character_bank_w)
|
||||
AM_RANGE(0xe5, 0xe5) AM_WRITE(st0016_palette_bank_w)
|
||||
//AM_RANGE(0xe2, 0xe2) AM_WRITE(st0016_sprite_bank_w)
|
||||
//AM_RANGE(0xe3, 0xe4) AM_WRITE(st0016_character_bank_w)
|
||||
//AM_RANGE(0xe5, 0xe5) AM_WRITE(st0016_palette_bank_w)
|
||||
AM_RANGE(0xe6, 0xe6) AM_WRITENOP
|
||||
AM_RANGE(0xe7, 0xe7) AM_WRITENOP
|
||||
AM_RANGE(0xf0, 0xf0) AM_READ(st0016_dma_r)
|
||||
//AM_RANGE(0xf0, 0xf0) AM_READ(st0016_dma_r)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
READ32_MEMBER(speglsht_state::shared_r)
|
||||
@ -354,7 +358,7 @@ UINT32 speglsht_state::screen_update_speglsht(screen_device &screen, bitmap_rgb3
|
||||
|
||||
//draw st0016 gfx to temporary bitmap (indexed 16)
|
||||
m_bitmap->fill(0);
|
||||
st0016_draw_screen(screen, *m_bitmap, cliprect);
|
||||
m_maincpu->st0016_draw_screen(screen, *m_bitmap, cliprect);
|
||||
|
||||
//copy temporary bitmap to rgb 32 bit bitmap
|
||||
for(y=cliprect.min_y; y<cliprect.max_y;y++)
|
||||
@ -364,7 +368,7 @@ UINT32 speglsht_state::screen_update_speglsht(screen_device &screen, bitmap_rgb3
|
||||
{
|
||||
if(srcline[x])
|
||||
{
|
||||
rgb_t color=m_palette->pen_color(srcline[x]);
|
||||
rgb_t color=m_maincpu->m_palette->pen_color(srcline[x]);
|
||||
PLOT_PIXEL_RGB(x,y,color.r(),color.g(),color.b());
|
||||
}
|
||||
}
|
||||
@ -425,7 +429,7 @@ ROM_END
|
||||
|
||||
DRIVER_INIT_MEMBER(speglsht_state,speglsht)
|
||||
{
|
||||
st0016_game=3;
|
||||
m_maincpu->st0016_game=3;
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,6 +34,8 @@ This is not a bug (real machine behaves the same).
|
||||
*/
|
||||
|
||||
|
||||
// this uploads a charset for the st0016, but never a palette, seems to be for sound only?
|
||||
|
||||
#include "emu.h"
|
||||
#include "machine/st0016.h"
|
||||
#include "cpu/mips/r3000.h"
|
||||
@ -64,7 +66,11 @@ class srmp5_state : public st0016_state
|
||||
{
|
||||
public:
|
||||
srmp5_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: st0016_state(mconfig, type, tag) { }
|
||||
: st0016_state(mconfig, type, tag),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette")
|
||||
|
||||
{ }
|
||||
|
||||
UINT32 m_databank;
|
||||
UINT16 *m_tileram;
|
||||
@ -102,6 +108,8 @@ public:
|
||||
DECLARE_READ8_MEMBER(cmd_stat8_r);
|
||||
DECLARE_DRIVER_INIT(srmp5);
|
||||
UINT32 screen_update_srmp5(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
};
|
||||
|
||||
|
||||
@ -370,7 +378,7 @@ static ADDRESS_MAP_START( st0016_mem, AS_PROGRAM, 8, srmp5_state )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
|
||||
//AM_RANGE(0xe900, 0xe9ff) // sound - internal
|
||||
AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
|
||||
//AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
|
||||
AM_RANGE(0xf000, 0xffff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -392,13 +400,13 @@ READ8_MEMBER(srmp5_state::cmd_stat8_r)
|
||||
|
||||
static ADDRESS_MAP_START( st0016_io, AS_IO, 8, srmp5_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w)
|
||||
//AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w)
|
||||
AM_RANGE(0xc0, 0xc0) AM_READ(cmd1_r)
|
||||
AM_RANGE(0xc1, 0xc1) AM_READ(cmd2_r)
|
||||
AM_RANGE(0xc2, 0xc2) AM_READ(cmd_stat8_r)
|
||||
AM_RANGE(0xe1, 0xe1) AM_WRITE(st0016_rom_bank_w)
|
||||
AM_RANGE(0xe7, 0xe7) AM_WRITE(st0016_rom_bank_w)
|
||||
AM_RANGE(0xf0, 0xf0) AM_READ(st0016_dma_r)
|
||||
//AM_RANGE(0xf0, 0xf0) AM_READ(st0016_dma_r)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -583,7 +591,7 @@ ROM_END
|
||||
|
||||
DRIVER_INIT_MEMBER(srmp5_state,srmp5)
|
||||
{
|
||||
st0016_game = 9;
|
||||
m_maincpu->st0016_game = 9;
|
||||
|
||||
m_tileram = auto_alloc_array(machine(), UINT16, 0x100000/2);
|
||||
m_sprram = auto_alloc_array(machine(), UINT16, 0x080000/2);
|
||||
|
@ -28,13 +28,8 @@ UINT32 st0016_rom_bank;
|
||||
static ADDRESS_MAP_START( st0016_mem, AS_PROGRAM, 8, st0016_state )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0xc000, 0xcfff) AM_READ(st0016_sprite_ram_r) AM_WRITE(st0016_sprite_ram_w)
|
||||
AM_RANGE(0xd000, 0xdfff) AM_READ(st0016_sprite2_ram_r) AM_WRITE(st0016_sprite2_ram_w)
|
||||
AM_RANGE(0xe000, 0xe7ff) AM_RAM
|
||||
AM_RANGE(0xe800, 0xe87f) AM_RAM /* common ram */
|
||||
//AM_RANGE(0xe900, 0xe9ff) // sound - internal
|
||||
AM_RANGE(0xea00, 0xebff) AM_READ(st0016_palette_ram_r) AM_WRITE(st0016_palette_ram_w)
|
||||
AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
|
||||
AM_RANGE(0xf000, 0xffff) AM_RAM /* work ram */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -81,19 +76,14 @@ WRITE8_MEMBER(st0016_state::st0016_rom_bank_w)
|
||||
|
||||
static ADDRESS_MAP_START( st0016_io, AS_IO, 8, st0016_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w) /* video/crt regs ? */
|
||||
AM_RANGE(0xc0, 0xc0) AM_READ_PORT("P1") AM_WRITE(mux_select_w)
|
||||
AM_RANGE(0xc1, 0xc1) AM_READ_PORT("P2") AM_WRITENOP
|
||||
AM_RANGE(0xc2, 0xc2) AM_READ(mux_r) AM_WRITENOP
|
||||
AM_RANGE(0xc3, 0xc3) AM_READ_PORT("P2") AM_WRITENOP
|
||||
AM_RANGE(0xe0, 0xe0) AM_WRITENOP /* renju = $40, neratte = 0 */
|
||||
AM_RANGE(0xe1, 0xe1) AM_WRITE(st0016_rom_bank_w)
|
||||
AM_RANGE(0xe2, 0xe2) AM_WRITE(st0016_sprite_bank_w)
|
||||
AM_RANGE(0xe3, 0xe4) AM_WRITE(st0016_character_bank_w)
|
||||
AM_RANGE(0xe5, 0xe5) AM_WRITE(st0016_palette_bank_w)
|
||||
AM_RANGE(0xe6, 0xe6) AM_WRITENOP /* banking ? ram bank ? shared rambank ? */
|
||||
AM_RANGE(0xe7, 0xe7) AM_WRITENOP /* watchdog */
|
||||
AM_RANGE(0xf0, 0xf0) AM_READ(st0016_dma_r)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -145,7 +135,6 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( st0016_m2_io, AS_IO, 8, st0016_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w)
|
||||
AM_RANGE(0xc0, 0xc3) AM_READ(latch8_r) AM_WRITE(latch8_w)
|
||||
AM_RANGE(0xd0, 0xd0) AM_READ_PORT("P1") AM_WRITE(mux_select_w)
|
||||
AM_RANGE(0xd1, 0xd1) AM_READ_PORT("P2") AM_WRITENOP
|
||||
@ -153,12 +142,8 @@ static ADDRESS_MAP_START( st0016_m2_io, AS_IO, 8, st0016_state )
|
||||
AM_RANGE(0xd3, 0xd3) AM_READ_PORT("P2") AM_WRITENOP
|
||||
AM_RANGE(0xe0, 0xe0) AM_WRITENOP
|
||||
AM_RANGE(0xe1, 0xe1) AM_WRITE(st0016_rom_bank_w)
|
||||
AM_RANGE(0xe2, 0xe2) AM_WRITE(st0016_sprite_bank_w)
|
||||
AM_RANGE(0xe3, 0xe4) AM_WRITE(st0016_character_bank_w)
|
||||
AM_RANGE(0xe5, 0xe5) AM_WRITE(st0016_palette_bank_w)
|
||||
AM_RANGE(0xe6, 0xe6) AM_WRITENOP /* banking ? ram bank ? shared rambank ? */
|
||||
AM_RANGE(0xe7, 0xe7) AM_WRITENOP /* watchdog */
|
||||
AM_RANGE(0xf0, 0xf0) AM_READ(st0016_dma_r)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
/*************************************
|
||||
@ -418,10 +403,8 @@ static MACHINE_CONFIG_START( st0016, st0016_state )
|
||||
MCFG_SCREEN_SIZE(48*8, 48*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 0*8, 48*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(st0016_state, screen_update_st0016)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
MCFG_SCREEN_PALETTE("maincpu:palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", st0016)
|
||||
MCFG_PALETTE_ADD("palette", 16*16*4+1)
|
||||
|
||||
MCFG_VIDEO_START_OVERRIDE(st0016_state,st0016)
|
||||
|
||||
@ -637,23 +620,23 @@ ROM_END
|
||||
|
||||
DRIVER_INIT_MEMBER(st0016_state,renju)
|
||||
{
|
||||
st0016_game=0;
|
||||
m_maincpu->st0016_game=0;
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(st0016_state,nratechu)
|
||||
{
|
||||
st0016_game=1;
|
||||
m_maincpu->st0016_game=1;
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(st0016_state,mayjinsn)
|
||||
{
|
||||
st0016_game=4;//|0x80;
|
||||
m_maincpu->st0016_game=4;//|0x80;
|
||||
membank("bank2")->set_base(memregion("user1")->base());
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(st0016_state,mayjisn2)
|
||||
{
|
||||
st0016_game=4;
|
||||
m_maincpu->st0016_game=4;
|
||||
membank("bank2")->set_base(memregion("user1")->base());
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
|
||||
#include "machine/st0016.h"
|
||||
|
||||
class st0016_state : public driver_device
|
||||
{
|
||||
public:
|
||||
@ -6,34 +8,20 @@ public:
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this,"maincpu"),
|
||||
m_subcpu(*this, "sub"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_screen(*this, "screen")
|
||||
{ }
|
||||
|
||||
int mux_port;
|
||||
UINT32 m_st0016_rom_bank;
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
optional_device<st0016_cpu_device> m_maincpu;
|
||||
DECLARE_READ8_MEMBER(mux_r);
|
||||
DECLARE_WRITE8_MEMBER(mux_select_w);
|
||||
DECLARE_READ32_MEMBER(latch32_r);
|
||||
DECLARE_WRITE32_MEMBER(latch32_w);
|
||||
DECLARE_READ8_MEMBER(latch8_r);
|
||||
DECLARE_WRITE8_MEMBER(latch8_w);
|
||||
DECLARE_WRITE8_MEMBER(st0016_sprite_bank_w);
|
||||
DECLARE_WRITE8_MEMBER(st0016_palette_bank_w);
|
||||
DECLARE_WRITE8_MEMBER(st0016_character_bank_w);
|
||||
DECLARE_READ8_MEMBER(st0016_sprite_ram_r);
|
||||
DECLARE_WRITE8_MEMBER(st0016_sprite_ram_w);
|
||||
DECLARE_READ8_MEMBER(st0016_sprite2_ram_r);
|
||||
DECLARE_WRITE8_MEMBER(st0016_sprite2_ram_w);
|
||||
DECLARE_READ8_MEMBER(st0016_palette_ram_r);
|
||||
DECLARE_WRITE8_MEMBER(st0016_palette_ram_w);
|
||||
DECLARE_READ8_MEMBER(st0016_character_ram_r);
|
||||
DECLARE_WRITE8_MEMBER(st0016_character_ram_w);
|
||||
DECLARE_READ8_MEMBER(st0016_vregs_r);
|
||||
DECLARE_READ8_MEMBER(st0016_dma_r);
|
||||
DECLARE_WRITE8_MEMBER(st0016_vregs_w);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(st0016_rom_bank_w);
|
||||
DECLARE_DRIVER_INIT(nratechu);
|
||||
DECLARE_DRIVER_INIT(mayjinsn);
|
||||
@ -43,36 +31,11 @@ public:
|
||||
void st0016_draw_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_st0016(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(st0016_int);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void st0016_save_init();
|
||||
void draw_bgmap(bitmap_ind16 &bitmap,const rectangle &cliprect, int priority);
|
||||
optional_device<cpu_device> m_subcpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
};
|
||||
|
||||
#define ISMACS (st0016_game&0x80)
|
||||
#define ISMACS1 (((st0016_game&0x180)==0x180))
|
||||
#define ISMACS2 (((st0016_game&0x180)==0x080))
|
||||
|
||||
|
||||
#define ST0016_MAX_SPR_BANK 0x10
|
||||
#define ST0016_MAX_CHAR_BANK 0x10000
|
||||
#define ST0016_MAX_PAL_BANK 4
|
||||
|
||||
#define ST0016_SPR_BANK_SIZE 0x1000
|
||||
#define ST0016_CHAR_BANK_SIZE 0x20
|
||||
#define ST0016_PAL_BANK_SIZE 0x200
|
||||
|
||||
#define UNUSED_PEN 1024
|
||||
|
||||
#define ST0016_SPR_BANK_MASK (ST0016_MAX_SPR_BANK-1)
|
||||
#define ST0016_CHAR_BANK_MASK (ST0016_MAX_CHAR_BANK-1)
|
||||
#define ST0016_PAL_BANK_MASK (ST0016_MAX_PAL_BANK-1)
|
||||
|
||||
/*----------- defined in video/st0016.c -----------*/
|
||||
|
||||
extern UINT8 macs_cart_slot;
|
||||
extern UINT32 st0016_game;
|
||||
extern UINT8 *st0016_charram;
|
||||
|
@ -4,25 +4,57 @@
|
||||
|
||||
const device_type ST0016_CPU = &device_creator<st0016_cpu_device>;
|
||||
|
||||
UINT8 *st0016_charram; // todo, get it in the device
|
||||
UINT8 macs_cart_slot;
|
||||
|
||||
|
||||
static ADDRESS_MAP_START(st0016_cpu_internal_map, AS_PROGRAM, 8, st0016_cpu_device)
|
||||
AM_RANGE(0xc000, 0xcfff) AM_READ(st0016_sprite_ram_r) AM_WRITE(st0016_sprite_ram_w)
|
||||
AM_RANGE(0xd000, 0xdfff) AM_READ(st0016_sprite2_ram_r) AM_WRITE(st0016_sprite2_ram_w)
|
||||
AM_RANGE(0xea00, 0xebff) AM_READ(st0016_palette_ram_r) AM_WRITE(st0016_palette_ram_w)
|
||||
AM_RANGE(0xec00, 0xec1f) AM_READ(st0016_character_ram_r) AM_WRITE(st0016_character_ram_w)
|
||||
AM_RANGE(0xe900, 0xe9ff) AM_DEVREADWRITE("stsnd", st0016_device, st0016_snd_r, st0016_snd_w) /* sound regs 8 x $20 bytes, see notes */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
static ADDRESS_MAP_START(st0016_cpu_internal_io_map, AS_IO, 8, st0016_cpu_device)
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w) /* video/crt regs ? */
|
||||
AM_RANGE(0xe2, 0xe2) AM_WRITE(st0016_sprite_bank_w)
|
||||
AM_RANGE(0xe3, 0xe4) AM_WRITE(st0016_character_bank_w)
|
||||
AM_RANGE(0xe5, 0xe5) AM_WRITE(st0016_palette_bank_w)
|
||||
AM_RANGE(0xf0, 0xf0) AM_READ(st0016_dma_r)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
// note: a lot of bits are left uninitialized by the games, the default values are uncertain
|
||||
|
||||
st0016_cpu_device::st0016_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: z80_device(mconfig, ST0016_CPU, "ST0016", tag, owner, clock, "st0016_cpu", __FILE__),
|
||||
m_io_space_config("io", ENDIANNESS_LITTLE, 8, 16, 0, ADDRESS_MAP_NAME(st0016_cpu_internal_io_map)),
|
||||
m_space_config("regs", ENDIANNESS_LITTLE, 8, 16, 0, ADDRESS_MAP_NAME(st0016_cpu_internal_map))
|
||||
st0016_game(-1),
|
||||
st0016_spr_bank(0),
|
||||
st0016_spr2_bank(0),
|
||||
st0016_pal_bank(0),
|
||||
st0016_char_bank(0),
|
||||
spr_dx(0),
|
||||
spr_dy(0),
|
||||
st0016_ramgfx(0),
|
||||
|
||||
m_io_space_config("io", ENDIANNESS_LITTLE, 8, 16, 0, ADDRESS_MAP_NAME(st0016_cpu_internal_io_map)),
|
||||
m_space_config("regs", ENDIANNESS_LITTLE, 8, 16, 0, ADDRESS_MAP_NAME(st0016_cpu_internal_map)),
|
||||
|
||||
|
||||
m_screen(*this, ":screen"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette")
|
||||
|
||||
{
|
||||
for (int i = 0; i < 0xc0; i++)
|
||||
st0016_vregs[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
@ -30,6 +62,7 @@ st0016_cpu_device::st0016_cpu_device(const machine_config &mconfig, const char *
|
||||
void st0016_cpu_device::device_start()
|
||||
{
|
||||
z80_device::device_start();
|
||||
startup();
|
||||
}
|
||||
|
||||
|
||||
@ -40,6 +73,34 @@ void st0016_cpu_device::device_start()
|
||||
void st0016_cpu_device::device_reset()
|
||||
{
|
||||
z80_device::device_reset();
|
||||
|
||||
switch(st0016_game&0x3f)
|
||||
{
|
||||
case 0: //renju kizoku
|
||||
m_screen->set_visible_area(0, 40*8-1, 0, 30*8-1);
|
||||
spr_dx=0;
|
||||
spr_dy=0;
|
||||
break;
|
||||
|
||||
case 1: //neratte chu!
|
||||
m_screen->set_visible_area(8,41*8-1,0,30*8-1);
|
||||
spr_dx=0;
|
||||
spr_dy=8;
|
||||
break;
|
||||
|
||||
case 4: //mayjinsen 1&2
|
||||
m_screen->set_visible_area(0,32*8-1,0,28*8-1);
|
||||
break;
|
||||
|
||||
case 10:
|
||||
m_screen->set_visible_area(0,383,0,255);
|
||||
break;
|
||||
|
||||
case 11:
|
||||
m_screen->set_visible_area(0,383,0,383);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static const st0016_interface st0016_config =
|
||||
@ -47,10 +108,16 @@ static const st0016_interface st0016_config =
|
||||
&st0016_charram
|
||||
};
|
||||
|
||||
static GFXDECODE_START( st0016 )
|
||||
GFXDECODE_END
|
||||
|
||||
/* CPU interface */
|
||||
static MACHINE_CONFIG_FRAGMENT( st0016_cpu )
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", st0016)
|
||||
MCFG_PALETTE_ADD("palette", 16*16*4+1)
|
||||
|
||||
MCFG_ST0016_ADD("stsnd", 0)
|
||||
MCFG_SOUND_CONFIG(st0016_config)
|
||||
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
|
||||
@ -64,3 +131,584 @@ machine_config_constructor st0016_cpu_device::device_mconfig_additions() const
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static const gfx_layout charlayout =
|
||||
{
|
||||
8,8,
|
||||
0x10000,
|
||||
4,
|
||||
{ 0, 1, 2, 3 },
|
||||
{ 1*4, 0*4, 3*4, 2*4, 5*4, 4*4, 7*4, 6*4 },
|
||||
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
|
||||
8*8*4
|
||||
};
|
||||
|
||||
WRITE8_MEMBER(st0016_cpu_device::st0016_sprite_bank_w)
|
||||
{
|
||||
/*
|
||||
76543210
|
||||
xxxx - spriteram bank1
|
||||
xxxx - spriteram bank2
|
||||
*/
|
||||
st0016_spr_bank=data&ST0016_SPR_BANK_MASK;
|
||||
st0016_spr2_bank=(data>>4)&ST0016_SPR_BANK_MASK;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(st0016_cpu_device::st0016_palette_bank_w)
|
||||
{
|
||||
/*
|
||||
76543210
|
||||
xx - palram bank
|
||||
xxxxxx - unknown/unused
|
||||
*/
|
||||
st0016_pal_bank=data&ST0016_PAL_BANK_MASK;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(st0016_cpu_device::st0016_character_bank_w)
|
||||
{
|
||||
/*
|
||||
fedcba9876543210
|
||||
xxxxxxxxxxxxxxxx - character (bank )
|
||||
*/
|
||||
|
||||
if(offset&1)
|
||||
st0016_char_bank=(st0016_char_bank&0xff)|(data<<8);
|
||||
else
|
||||
st0016_char_bank=(st0016_char_bank&0xff00)|data;
|
||||
|
||||
st0016_char_bank&=ST0016_CHAR_BANK_MASK;
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER(st0016_cpu_device::st0016_sprite_ram_r)
|
||||
{
|
||||
return st0016_spriteram[ST0016_SPR_BANK_SIZE*st0016_spr_bank+offset];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(st0016_cpu_device::st0016_sprite_ram_w)
|
||||
{
|
||||
st0016_spriteram[ST0016_SPR_BANK_SIZE*st0016_spr_bank+offset]=data;
|
||||
}
|
||||
|
||||
READ8_MEMBER(st0016_cpu_device::st0016_sprite2_ram_r)
|
||||
{
|
||||
return st0016_spriteram[ST0016_SPR_BANK_SIZE*st0016_spr2_bank+offset];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(st0016_cpu_device::st0016_sprite2_ram_w)
|
||||
{
|
||||
st0016_spriteram[ST0016_SPR_BANK_SIZE*st0016_spr2_bank+offset]=data;
|
||||
}
|
||||
|
||||
READ8_MEMBER(st0016_cpu_device::st0016_palette_ram_r)
|
||||
{
|
||||
return st0016_paletteram[ST0016_PAL_BANK_SIZE*st0016_pal_bank+offset];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(st0016_cpu_device::st0016_palette_ram_w)
|
||||
{
|
||||
int color=(ST0016_PAL_BANK_SIZE*st0016_pal_bank+offset)/2;
|
||||
int val;
|
||||
st0016_paletteram[ST0016_PAL_BANK_SIZE*st0016_pal_bank+offset]=data;
|
||||
val=st0016_paletteram[color*2]+(st0016_paletteram[color*2+1]<<8);
|
||||
if(!color)
|
||||
m_palette->set_pen_color(UNUSED_PEN,pal5bit(val >> 0),pal5bit(val >> 5),pal5bit(val >> 10)); /* same as color 0 - bg ? */
|
||||
m_palette->set_pen_color(color,pal5bit(val >> 0),pal5bit(val >> 5),pal5bit(val >> 10));
|
||||
}
|
||||
|
||||
READ8_MEMBER(st0016_cpu_device::st0016_character_ram_r)
|
||||
{
|
||||
return st0016_charram[ST0016_CHAR_BANK_SIZE*st0016_char_bank+offset];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(st0016_cpu_device::st0016_character_ram_w)
|
||||
{
|
||||
st0016_charram[ST0016_CHAR_BANK_SIZE*st0016_char_bank+offset]=data;
|
||||
m_gfxdecode->gfx(st0016_ramgfx)->mark_dirty(st0016_char_bank);
|
||||
}
|
||||
|
||||
READ8_MEMBER(st0016_cpu_device::st0016_vregs_r)
|
||||
{
|
||||
/*
|
||||
$0, $1 = max scanline(including vblank)/timer? ($3e7)
|
||||
|
||||
$8-$40 = bg tilemaps (8 bytes each) :
|
||||
0 - ? = usually 0/20/ba*
|
||||
1 - 0 = disabled , !zero = address of tilemap in spriteram /$1000 (for example: 3 -> tilemap at $3000 )
|
||||
2 - ? = usually ff/1f/af*
|
||||
3 - priority ? = 0 - under sprites , $ff - over sprites \
|
||||
4 - ? = $7f/$ff
|
||||
5 - ? = $29/$20 (29 when tilemap must be drawn over sprites . maybe this is real priority ?)
|
||||
6 - ? = 0
|
||||
7 - ? =$20/$10/$12*
|
||||
|
||||
|
||||
$40-$60 = scroll registers , X.w, Y.w
|
||||
|
||||
*/
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
return machine().rand();
|
||||
}
|
||||
|
||||
return st0016_vregs[offset];
|
||||
}
|
||||
|
||||
READ8_MEMBER(st0016_cpu_device::st0016_dma_r)
|
||||
{
|
||||
/* bits 0 and 1 = 0 -> DMA transfer complete */
|
||||
if(ISMACS)
|
||||
return 0;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(st0016_cpu_device::st0016_vregs_w)
|
||||
{
|
||||
/*
|
||||
|
||||
I/O ports:
|
||||
|
||||
$a0 \
|
||||
$a1 - source address >> 1
|
||||
$a2 /
|
||||
|
||||
$a3 \
|
||||
$a4 - destination address >> 1 (inside character ram)
|
||||
$a5 /
|
||||
|
||||
$a6 \
|
||||
&a7 - (length inbytes - 1 ) >> 1
|
||||
|
||||
$a8 - 76543210
|
||||
??faaaaa
|
||||
|
||||
a - most sign. bits of length
|
||||
f - DMA start latch
|
||||
|
||||
*/
|
||||
|
||||
st0016_vregs[offset]=data;
|
||||
if(offset==0xa8 && (data&0x20))
|
||||
{
|
||||
UINT32 srcadr=(st0016_vregs[0xa0]|(st0016_vregs[0xa1]<<8)|(st0016_vregs[0xa2]<<16))<<1;
|
||||
UINT32 dstadr=(st0016_vregs[0xa3]|(st0016_vregs[0xa4]<<8)|(st0016_vregs[0xa5]<<16))<<1;
|
||||
UINT32 length=((st0016_vregs[0xa6]|(st0016_vregs[0xa7]<<8)|((st0016_vregs[0xa8]&0x1f)<<16))+1)<<1;
|
||||
|
||||
// todo : dma callback so macs_cart_slot can be local to MACs driver?
|
||||
|
||||
UINT32 srclen = (memregion(":maincpu")->bytes());
|
||||
UINT8 *mem = memregion(":maincpu")->base();
|
||||
|
||||
srcadr += macs_cart_slot*0x400000;
|
||||
|
||||
while(length>0)
|
||||
{
|
||||
if( srcadr < srclen && (dstadr < ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE))
|
||||
{
|
||||
st0016_char_bank=dstadr>>5;
|
||||
st0016_character_ram_w(space,dstadr&0x1f,mem[srcadr]);
|
||||
srcadr++;
|
||||
dstadr++;
|
||||
length--;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* samples ? sound dma ? */
|
||||
// speaglsht: unknown DMA copy : src - 2B6740, dst - 4400, len - 1E400
|
||||
logerror("unknown DMA copy : src - %X, dst - %X, len - %X, PC - %X\n",srcadr,dstadr,length,space.device().safe_pcbase());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void st0016_cpu_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
/*
|
||||
object ram :
|
||||
|
||||
each entry is 8 bytes:
|
||||
|
||||
76543210 (bit)
|
||||
0 llllllll
|
||||
1 ---1SSSl
|
||||
2 oooooooo
|
||||
3 fooooooo
|
||||
4 xxxxxxxx
|
||||
5 ------xx
|
||||
6 yyyyyyyy
|
||||
7 ------yy
|
||||
|
||||
1 - always(?) set
|
||||
S - scroll index ? (ports $40-$60, X(word),Y(word) )
|
||||
l - sublist length (8 byte entries -1)
|
||||
o - sublist offset (*8 to get real offset)
|
||||
f - end of list flag
|
||||
x,y - sprite coords
|
||||
|
||||
sublist format (8 bytes/entry):
|
||||
|
||||
76543210
|
||||
0 cccccccc
|
||||
1 cccccccc
|
||||
2 --kkkkkk
|
||||
3 QW------
|
||||
4 xxxxxxxx
|
||||
5 -B---XXx
|
||||
6 yyyyyyyy
|
||||
7 -----YYy
|
||||
|
||||
c - character code
|
||||
k - palette
|
||||
QW - flips
|
||||
x,y - coords
|
||||
XX,YY - size (1<<size)
|
||||
B - merge pixel data with prevoius one (8bpp mode - neratte: seta logo and title screen)
|
||||
|
||||
*/
|
||||
|
||||
gfx_element *gfx = m_gfxdecode->gfx(st0016_ramgfx);
|
||||
int i,j,lx,ly,x,y,code,offset,length,sx,sy,color,flipx,flipy,scrollx,scrolly/*,plx,ply*/;
|
||||
|
||||
|
||||
for(i=0;i<ST0016_SPR_BANK_SIZE*ST0016_MAX_SPR_BANK;i+=8)
|
||||
{
|
||||
x=st0016_spriteram[i+4]+((st0016_spriteram[i+5]&3)<<8);
|
||||
y=st0016_spriteram[i+6]+((st0016_spriteram[i+7]&3)<<8);
|
||||
|
||||
scrollx=(st0016_vregs[(((st0016_spriteram[i+1]&0x0f)>>1)<<2)+0x40]+256*st0016_vregs[(((st0016_spriteram[i+1]&0x0f)>>1)<<2)+1+0x40])&0x3ff;
|
||||
scrolly=(st0016_vregs[(((st0016_spriteram[i+1]&0x0f)>>1)<<2)+2+0x40]+256*st0016_vregs[(((st0016_spriteram[i+1]&0x0f)>>1)<<2)+3+0x40])&0x3ff;
|
||||
|
||||
if(!ISMACS)
|
||||
{
|
||||
if (x & 0x200) x-= 0x400; //sign
|
||||
if (y & 0x200) y-= 0x400;
|
||||
|
||||
if (scrollx & 0x200) scrollx-= 0x400; //sign
|
||||
if (scrolly & 0x200) scrolly-= 0x400;
|
||||
}
|
||||
|
||||
if(ISMACS1)
|
||||
{
|
||||
if (x & 0x200) x-= 0x400; //sign
|
||||
if (y & 0x200) y-= 0x2b0;//0x400;
|
||||
|
||||
if (scrollx & 0x200) scrollx-= 0x400; //sign
|
||||
if (scrolly & 0x200) scrolly-= 0x400;
|
||||
}
|
||||
|
||||
x+=scrollx;
|
||||
y+=scrolly;
|
||||
|
||||
if(ISMACS)
|
||||
{
|
||||
y+=0x20;
|
||||
}
|
||||
|
||||
if( st0016_spriteram[i+3]&0x80) /* end of list */
|
||||
break;
|
||||
|
||||
offset=st0016_spriteram[i+2]+256*(st0016_spriteram[i+3]);
|
||||
offset<<=3;
|
||||
|
||||
length=st0016_spriteram[i+0]+1+256*(st0016_spriteram[i+1]&1);
|
||||
|
||||
//plx=(st0016_spriteram[i+5]>>2)&0x3;
|
||||
//ply=(st0016_spriteram[i+7]>>2)&0x3;
|
||||
|
||||
if(offset<ST0016_SPR_BANK_SIZE*ST0016_MAX_SPR_BANK)
|
||||
{
|
||||
for(j=0;j<length;j++)
|
||||
{
|
||||
code=st0016_spriteram[offset]+256*st0016_spriteram[offset+1];
|
||||
sx=st0016_spriteram[offset+4]+((st0016_spriteram[offset+5]&1)<<8);
|
||||
sy=st0016_spriteram[offset+6]+((st0016_spriteram[offset+7]&1)<<8);
|
||||
|
||||
if(ISMACS && !(ISMACS1))
|
||||
{
|
||||
if (sy & 0x100) sy-= 0x200; //yuka & yujan
|
||||
}
|
||||
|
||||
if(ISMACS)
|
||||
{
|
||||
sy=0xe0-sy;
|
||||
}
|
||||
|
||||
sx+=x;
|
||||
sy+=y;
|
||||
color=st0016_spriteram[offset+2]&0x3f;
|
||||
lx=(st0016_spriteram[offset+5]>>2)&3;
|
||||
ly=(st0016_spriteram[offset+7]>>2)&3;
|
||||
/*
|
||||
if(plx |ply) //parent
|
||||
{
|
||||
lx=plx;
|
||||
ly=ply;
|
||||
}
|
||||
*/
|
||||
|
||||
flipx=st0016_spriteram[offset+3]&0x80;
|
||||
flipy=st0016_spriteram[offset+3]&0x40;
|
||||
|
||||
if(ISMACS)
|
||||
sy-=(1<<ly)*8;
|
||||
|
||||
{
|
||||
int x0,y0,i0=0;
|
||||
for(x0=(flipx?((1<<lx)-1):0);x0!=(flipx?-1:(1<<lx));x0+=(flipx?-1:1))
|
||||
for(y0=(flipy?((1<<ly)-1):0);y0!=(flipy?-1:(1<<ly));y0+=(flipy?-1:1))
|
||||
{
|
||||
/* custom draw */
|
||||
UINT16 *destline;
|
||||
int yloop,xloop;
|
||||
int ypos, xpos;
|
||||
int tileno;
|
||||
const UINT8 *srcgfx;
|
||||
int gfxoffs;
|
||||
ypos = sy+y0*8+spr_dy;
|
||||
xpos = sx+x0*8+spr_dx;
|
||||
tileno = (code+i0++)&ST0016_CHAR_BANK_MASK ;
|
||||
|
||||
gfxoffs = 0;
|
||||
srcgfx= gfx->get_data(tileno);
|
||||
|
||||
for (yloop=0; yloop<8; yloop++)
|
||||
{
|
||||
UINT16 drawypos;
|
||||
|
||||
if (!flipy) {drawypos = ypos+yloop;} else {drawypos = (ypos+8-1)-yloop;}
|
||||
destline = &bitmap.pix16(drawypos);
|
||||
|
||||
for (xloop=0; xloop<8; xloop++)
|
||||
{
|
||||
UINT16 drawxpos;
|
||||
int pixdata;
|
||||
pixdata = srcgfx[gfxoffs];
|
||||
|
||||
if (!flipx) { drawxpos = xpos+xloop; } else { drawxpos = (xpos+8-1)-xloop; }
|
||||
|
||||
if (drawxpos > cliprect.max_x)
|
||||
drawxpos -= 512; // wrap around
|
||||
|
||||
if (cliprect.contains(drawxpos, drawypos))
|
||||
{
|
||||
if(st0016_spriteram[offset+5]&0x40)
|
||||
{
|
||||
destline[drawxpos] =(destline[drawxpos] | pixdata<<4)&0x3ff;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ISMACS2)
|
||||
{
|
||||
if(pixdata )//|| destline[drawxpos]==UNUSED_PEN)
|
||||
{
|
||||
destline[drawxpos] = pixdata + (color*16);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pixdata || destline[drawxpos]==UNUSED_PEN)
|
||||
{
|
||||
destline[drawxpos] = pixdata + (color*16);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gfxoffs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
offset+=8;
|
||||
if(offset>=ST0016_SPR_BANK_SIZE*ST0016_MAX_SPR_BANK)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void st0016_cpu_device::st0016_save_init()
|
||||
{
|
||||
save_item(NAME(st0016_spr_bank));
|
||||
save_item(NAME(st0016_spr2_bank));
|
||||
save_item(NAME(st0016_pal_bank));
|
||||
save_item(NAME(st0016_char_bank));
|
||||
//save_item(NAME(st0016_rom_bank));
|
||||
save_item(NAME(st0016_vregs));
|
||||
save_pointer(NAME(st0016_charram), ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE);
|
||||
save_pointer(NAME(st0016_paletteram), ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE);
|
||||
save_pointer(NAME(st0016_spriteram), ST0016_MAX_SPR_BANK*ST0016_SPR_BANK_SIZE);
|
||||
}
|
||||
|
||||
|
||||
void st0016_cpu_device::startup()
|
||||
{
|
||||
int gfx_index=0;
|
||||
|
||||
macs_cart_slot = 0;
|
||||
st0016_charram=auto_alloc_array_clear(machine(), UINT8, ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE);
|
||||
st0016_spriteram=auto_alloc_array_clear(machine(), UINT8, ST0016_MAX_SPR_BANK*ST0016_SPR_BANK_SIZE);
|
||||
st0016_paletteram=auto_alloc_array_clear(machine(), UINT8, ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE);
|
||||
|
||||
/* find first empty slot to decode gfx */
|
||||
for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++)
|
||||
if (m_gfxdecode->gfx(gfx_index) == 0)
|
||||
break;
|
||||
|
||||
assert(gfx_index != MAX_GFX_ELEMENTS);
|
||||
|
||||
/* create the char set (gfx will then be updated dynamically from RAM) */
|
||||
m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, charlayout, (UINT8 *) st0016_charram, 0, 0x40, 0)));
|
||||
st0016_ramgfx = gfx_index;
|
||||
|
||||
spr_dx=0;
|
||||
spr_dy=0;
|
||||
|
||||
|
||||
|
||||
st0016_save_init();
|
||||
}
|
||||
|
||||
|
||||
void st0016_cpu_device::draw_bgmap(bitmap_ind16 &bitmap,const rectangle &cliprect, int priority)
|
||||
{
|
||||
gfx_element *gfx = m_gfxdecode->gfx(st0016_ramgfx);
|
||||
int j;
|
||||
//for(j=0x40-8;j>=0;j-=8)
|
||||
for(j=0;j<0x40;j+=8)
|
||||
{
|
||||
if(st0016_vregs[j+1] && ((priority && (st0016_vregs[j+3]==0xff))||((!priority)&&(st0016_vregs[j+3]!=0xff))))
|
||||
{
|
||||
int x,y,code,color,flipx,flipy;
|
||||
int i=st0016_vregs[j+1]*0x1000;
|
||||
for(x=0;x<32*2;x++)
|
||||
for(y=0;y<8*4;y++)
|
||||
{
|
||||
code=st0016_spriteram[i]+256*st0016_spriteram[i+1];
|
||||
color=st0016_spriteram[i+2]&0x3f;
|
||||
|
||||
flipx=st0016_spriteram[i+3]&0x80;
|
||||
flipy=st0016_spriteram[i+3]&0x40;
|
||||
|
||||
if(priority)
|
||||
{
|
||||
gfx->transpen(bitmap,cliprect,
|
||||
code,
|
||||
color,
|
||||
flipx,flipy,
|
||||
x*8+spr_dx,y*8+spr_dy,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT16 *destline;
|
||||
int yloop,xloop;
|
||||
int ypos, xpos;
|
||||
const UINT8 *srcgfx;
|
||||
int gfxoffs;
|
||||
ypos = y*8+spr_dy;//+((st0016_vregs[j+2]==0xaf)?0x50:0);//hack for mayjinsen title screen
|
||||
xpos = x*8+spr_dx;
|
||||
gfxoffs = 0;
|
||||
srcgfx= gfx->get_data(code);
|
||||
|
||||
for (yloop=0; yloop<8; yloop++)
|
||||
{
|
||||
UINT16 drawypos;
|
||||
|
||||
if (!flipy) {drawypos = ypos+yloop;} else {drawypos = (ypos+8-1)-yloop;}
|
||||
destline = &bitmap.pix16(drawypos);
|
||||
|
||||
for (xloop=0; xloop<8; xloop++)
|
||||
{
|
||||
UINT16 drawxpos;
|
||||
int pixdata;
|
||||
pixdata = srcgfx[gfxoffs];
|
||||
|
||||
if (!flipx) { drawxpos = xpos+xloop; } else { drawxpos = (xpos+8-1)-xloop; }
|
||||
|
||||
if (drawxpos > cliprect.max_x)
|
||||
drawxpos -= 512; // wrap around
|
||||
|
||||
if (cliprect.contains(drawxpos, drawypos))
|
||||
{
|
||||
if(st0016_vregs[j+7]==0x12)
|
||||
destline[drawxpos] = (destline[drawxpos] | (pixdata<<4))&0x3ff;
|
||||
else
|
||||
{
|
||||
if(ISMACS2)
|
||||
{
|
||||
if(pixdata)// || destline[drawxpos]==UNUSED_PEN)
|
||||
{
|
||||
destline[drawxpos] = pixdata + (color*16);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pixdata || destline[drawxpos]==UNUSED_PEN)
|
||||
{
|
||||
destline[drawxpos] = pixdata + (color*16);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
gfxoffs++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
i+=4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void st0016_cpu_device::st0016_draw_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
draw_bgmap(bitmap,cliprect,0);
|
||||
draw_sprites(bitmap,cliprect);
|
||||
draw_bgmap(bitmap,cliprect,1);
|
||||
}
|
||||
|
||||
UINT32 st0016_cpu_device::update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
#ifdef MAME_DEBUG
|
||||
if(machine().input().code_pressed_once(KEYCODE_Z))
|
||||
{
|
||||
int h,j;
|
||||
FILE *p=fopen("vram.bin","wb");
|
||||
fwrite(st0016_spriteram,1,0x1000*ST0016_MAX_SPR_BANK,p);
|
||||
fclose(p);
|
||||
|
||||
p=fopen("vram.txt","wt");
|
||||
for(h=0;h<0xc0;h++)
|
||||
fprintf(p,"VREG %.4x - %.4x\n",h,st0016_vregs[h]);
|
||||
for(h=0;h<0x1000*ST0016_MAX_SPR_BANK;h+=8)
|
||||
{
|
||||
fprintf(p,"%.4x - %.4x - ",h,h>>3);
|
||||
for(j=0;j<8;j++)
|
||||
fprintf(p,"%.2x ",st0016_spriteram[h+j]);
|
||||
fprintf(p,"\n");
|
||||
}
|
||||
fclose(p);
|
||||
}
|
||||
#endif
|
||||
|
||||
bitmap.fill(UNUSED_PEN, cliprect);
|
||||
st0016_draw_screen(screen, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,27 @@
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/st0016.h"
|
||||
|
||||
extern UINT8 *st0016_charram;
|
||||
extern UINT8 macs_cart_slot;
|
||||
|
||||
#define ISMACS (st0016_game&0x80)
|
||||
#define ISMACS1 (((st0016_game&0x180)==0x180))
|
||||
#define ISMACS2 (((st0016_game&0x180)==0x080))
|
||||
|
||||
|
||||
#define ST0016_MAX_SPR_BANK 0x10
|
||||
#define ST0016_MAX_CHAR_BANK 0x10000
|
||||
#define ST0016_MAX_PAL_BANK 4
|
||||
|
||||
#define ST0016_SPR_BANK_SIZE 0x1000
|
||||
#define ST0016_CHAR_BANK_SIZE 0x20
|
||||
#define ST0016_PAL_BANK_SIZE 0x200
|
||||
|
||||
#define UNUSED_PEN 1024
|
||||
|
||||
#define ST0016_SPR_BANK_MASK (ST0016_MAX_SPR_BANK-1)
|
||||
#define ST0016_CHAR_BANK_MASK (ST0016_MAX_CHAR_BANK-1)
|
||||
#define ST0016_PAL_BANK_MASK (ST0016_MAX_PAL_BANK-1)
|
||||
|
||||
|
||||
|
||||
class st0016_cpu_device : public z80_device
|
||||
@ -17,6 +37,41 @@ class st0016_cpu_device : public z80_device
|
||||
public:
|
||||
st0016_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(st0016_sprite_bank_w);
|
||||
DECLARE_WRITE8_MEMBER(st0016_palette_bank_w);
|
||||
DECLARE_WRITE8_MEMBER(st0016_character_bank_w);
|
||||
DECLARE_READ8_MEMBER(st0016_sprite_ram_r);
|
||||
DECLARE_WRITE8_MEMBER(st0016_sprite_ram_w);
|
||||
DECLARE_READ8_MEMBER(st0016_sprite2_ram_r);
|
||||
DECLARE_WRITE8_MEMBER(st0016_sprite2_ram_w);
|
||||
DECLARE_READ8_MEMBER(st0016_palette_ram_r);
|
||||
DECLARE_WRITE8_MEMBER(st0016_palette_ram_w);
|
||||
DECLARE_READ8_MEMBER(st0016_character_ram_r);
|
||||
DECLARE_WRITE8_MEMBER(st0016_character_ram_w);
|
||||
DECLARE_READ8_MEMBER(st0016_vregs_r);
|
||||
DECLARE_READ8_MEMBER(st0016_dma_r);
|
||||
DECLARE_WRITE8_MEMBER(st0016_vregs_w);
|
||||
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void st0016_save_init();
|
||||
void draw_bgmap(bitmap_ind16 &bitmap,const rectangle &cliprect, int priority);
|
||||
|
||||
void startup();
|
||||
UINT32 update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void st0016_draw_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
UINT8 *st0016_spriteram,*st0016_paletteram;
|
||||
|
||||
UINT32 st0016_game;
|
||||
|
||||
|
||||
INT32 st0016_spr_bank,st0016_spr2_bank,st0016_pal_bank,st0016_char_bank;
|
||||
int spr_dx,spr_dy;
|
||||
|
||||
UINT8 st0016_vregs[0xc0];
|
||||
int st0016_ramgfx;
|
||||
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
@ -35,8 +90,12 @@ protected:
|
||||
case AS_PROGRAM: return &m_space_config;
|
||||
default: return z80_device::memory_space_config(spacenum);
|
||||
}
|
||||
}
|
||||
};
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
|
||||
public: // speglsht needs to access this for mixing
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -6,613 +6,12 @@
|
||||
#include "emu.h"
|
||||
#include "includes/st0016.h"
|
||||
|
||||
UINT8 *st0016_charram;
|
||||
static UINT8 *st0016_spriteram,*st0016_paletteram;
|
||||
|
||||
UINT32 st0016_game;
|
||||
|
||||
UINT8 macs_cart_slot;
|
||||
|
||||
static INT32 st0016_spr_bank,st0016_spr2_bank,st0016_pal_bank,st0016_char_bank;
|
||||
static int spr_dx,spr_dy;
|
||||
|
||||
static UINT8 st0016_vregs[0xc0];
|
||||
static int st0016_ramgfx;
|
||||
|
||||
static const gfx_layout charlayout =
|
||||
{
|
||||
8,8,
|
||||
0x10000,
|
||||
4,
|
||||
{ 0, 1, 2, 3 },
|
||||
{ 1*4, 0*4, 3*4, 2*4, 5*4, 4*4, 7*4, 6*4 },
|
||||
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
|
||||
8*8*4
|
||||
};
|
||||
|
||||
WRITE8_MEMBER(st0016_state::st0016_sprite_bank_w)
|
||||
{
|
||||
/*
|
||||
76543210
|
||||
xxxx - spriteram bank1
|
||||
xxxx - spriteram bank2
|
||||
*/
|
||||
st0016_spr_bank=data&ST0016_SPR_BANK_MASK;
|
||||
st0016_spr2_bank=(data>>4)&ST0016_SPR_BANK_MASK;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(st0016_state::st0016_palette_bank_w)
|
||||
{
|
||||
/*
|
||||
76543210
|
||||
xx - palram bank
|
||||
xxxxxx - unknown/unused
|
||||
*/
|
||||
st0016_pal_bank=data&ST0016_PAL_BANK_MASK;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(st0016_state::st0016_character_bank_w)
|
||||
{
|
||||
/*
|
||||
fedcba9876543210
|
||||
xxxxxxxxxxxxxxxx - character (bank )
|
||||
*/
|
||||
|
||||
if(offset&1)
|
||||
st0016_char_bank=(st0016_char_bank&0xff)|(data<<8);
|
||||
else
|
||||
st0016_char_bank=(st0016_char_bank&0xff00)|data;
|
||||
|
||||
st0016_char_bank&=ST0016_CHAR_BANK_MASK;
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER(st0016_state::st0016_sprite_ram_r)
|
||||
{
|
||||
return st0016_spriteram[ST0016_SPR_BANK_SIZE*st0016_spr_bank+offset];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(st0016_state::st0016_sprite_ram_w)
|
||||
{
|
||||
st0016_spriteram[ST0016_SPR_BANK_SIZE*st0016_spr_bank+offset]=data;
|
||||
}
|
||||
|
||||
READ8_MEMBER(st0016_state::st0016_sprite2_ram_r)
|
||||
{
|
||||
return st0016_spriteram[ST0016_SPR_BANK_SIZE*st0016_spr2_bank+offset];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(st0016_state::st0016_sprite2_ram_w)
|
||||
{
|
||||
st0016_spriteram[ST0016_SPR_BANK_SIZE*st0016_spr2_bank+offset]=data;
|
||||
}
|
||||
|
||||
READ8_MEMBER(st0016_state::st0016_palette_ram_r)
|
||||
{
|
||||
return st0016_paletteram[ST0016_PAL_BANK_SIZE*st0016_pal_bank+offset];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(st0016_state::st0016_palette_ram_w)
|
||||
{
|
||||
int color=(ST0016_PAL_BANK_SIZE*st0016_pal_bank+offset)/2;
|
||||
int val;
|
||||
st0016_paletteram[ST0016_PAL_BANK_SIZE*st0016_pal_bank+offset]=data;
|
||||
val=st0016_paletteram[color*2]+(st0016_paletteram[color*2+1]<<8);
|
||||
if(!color)
|
||||
m_palette->set_pen_color(UNUSED_PEN,pal5bit(val >> 0),pal5bit(val >> 5),pal5bit(val >> 10)); /* same as color 0 - bg ? */
|
||||
m_palette->set_pen_color(color,pal5bit(val >> 0),pal5bit(val >> 5),pal5bit(val >> 10));
|
||||
}
|
||||
|
||||
READ8_MEMBER(st0016_state::st0016_character_ram_r)
|
||||
{
|
||||
return st0016_charram[ST0016_CHAR_BANK_SIZE*st0016_char_bank+offset];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(st0016_state::st0016_character_ram_w)
|
||||
{
|
||||
st0016_charram[ST0016_CHAR_BANK_SIZE*st0016_char_bank+offset]=data;
|
||||
m_gfxdecode->gfx(st0016_ramgfx)->mark_dirty(st0016_char_bank);
|
||||
}
|
||||
|
||||
READ8_MEMBER(st0016_state::st0016_vregs_r)
|
||||
{
|
||||
/*
|
||||
$0, $1 = max scanline(including vblank)/timer? ($3e7)
|
||||
|
||||
$8-$40 = bg tilemaps (8 bytes each) :
|
||||
0 - ? = usually 0/20/ba*
|
||||
1 - 0 = disabled , !zero = address of tilemap in spriteram /$1000 (for example: 3 -> tilemap at $3000 )
|
||||
2 - ? = usually ff/1f/af*
|
||||
3 - priority ? = 0 - under sprites , $ff - over sprites \
|
||||
4 - ? = $7f/$ff
|
||||
5 - ? = $29/$20 (29 when tilemap must be drawn over sprites . maybe this is real priority ?)
|
||||
6 - ? = 0
|
||||
7 - ? =$20/$10/$12*
|
||||
|
||||
|
||||
$40-$60 = scroll registers , X.w, Y.w
|
||||
|
||||
*/
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
return machine().rand();
|
||||
}
|
||||
|
||||
return st0016_vregs[offset];
|
||||
}
|
||||
|
||||
READ8_MEMBER(st0016_state::st0016_dma_r)
|
||||
{
|
||||
/* bits 0 and 1 = 0 -> DMA transfer complete */
|
||||
if(ISMACS)
|
||||
return 0;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER(st0016_state::st0016_vregs_w)
|
||||
{
|
||||
/*
|
||||
|
||||
I/O ports:
|
||||
|
||||
$a0 \
|
||||
$a1 - source address >> 1
|
||||
$a2 /
|
||||
|
||||
$a3 \
|
||||
$a4 - destination address >> 1 (inside character ram)
|
||||
$a5 /
|
||||
|
||||
$a6 \
|
||||
&a7 - (length inbytes - 1 ) >> 1
|
||||
|
||||
$a8 - 76543210
|
||||
??faaaaa
|
||||
|
||||
a - most sign. bits of length
|
||||
f - DMA start latch
|
||||
|
||||
*/
|
||||
|
||||
st0016_vregs[offset]=data;
|
||||
if(offset==0xa8 && (data&0x20))
|
||||
{
|
||||
UINT32 srcadr=(st0016_vregs[0xa0]|(st0016_vregs[0xa1]<<8)|(st0016_vregs[0xa2]<<16))<<1;
|
||||
UINT32 dstadr=(st0016_vregs[0xa3]|(st0016_vregs[0xa4]<<8)|(st0016_vregs[0xa5]<<16))<<1;
|
||||
UINT32 length=((st0016_vregs[0xa6]|(st0016_vregs[0xa7]<<8)|((st0016_vregs[0xa8]&0x1f)<<16))+1)<<1;
|
||||
UINT32 srclen = (memregion("maincpu")->bytes());
|
||||
UINT8 *mem = memregion("maincpu")->base();
|
||||
|
||||
srcadr += macs_cart_slot*0x400000;
|
||||
|
||||
while(length>0)
|
||||
{
|
||||
if( srcadr < srclen && (dstadr < ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE))
|
||||
{
|
||||
st0016_char_bank=dstadr>>5;
|
||||
st0016_character_ram_w(space,dstadr&0x1f,mem[srcadr]);
|
||||
srcadr++;
|
||||
dstadr++;
|
||||
length--;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* samples ? sound dma ? */
|
||||
// speaglsht: unknown DMA copy : src - 2B6740, dst - 4400, len - 1E400
|
||||
logerror("unknown DMA copy : src - %X, dst - %X, len - %X, PC - %X\n",srcadr,dstadr,length,space.device().safe_pcbase());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void st0016_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
/*
|
||||
object ram :
|
||||
|
||||
each entry is 8 bytes:
|
||||
|
||||
76543210 (bit)
|
||||
0 llllllll
|
||||
1 ---1SSSl
|
||||
2 oooooooo
|
||||
3 fooooooo
|
||||
4 xxxxxxxx
|
||||
5 ------xx
|
||||
6 yyyyyyyy
|
||||
7 ------yy
|
||||
|
||||
1 - always(?) set
|
||||
S - scroll index ? (ports $40-$60, X(word),Y(word) )
|
||||
l - sublist length (8 byte entries -1)
|
||||
o - sublist offset (*8 to get real offset)
|
||||
f - end of list flag
|
||||
x,y - sprite coords
|
||||
|
||||
sublist format (8 bytes/entry):
|
||||
|
||||
76543210
|
||||
0 cccccccc
|
||||
1 cccccccc
|
||||
2 --kkkkkk
|
||||
3 QW------
|
||||
4 xxxxxxxx
|
||||
5 -B---XXx
|
||||
6 yyyyyyyy
|
||||
7 -----YYy
|
||||
|
||||
c - character code
|
||||
k - palette
|
||||
QW - flips
|
||||
x,y - coords
|
||||
XX,YY - size (1<<size)
|
||||
B - merge pixel data with prevoius one (8bpp mode - neratte: seta logo and title screen)
|
||||
|
||||
*/
|
||||
|
||||
gfx_element *gfx = m_gfxdecode->gfx(st0016_ramgfx);
|
||||
int i,j,lx,ly,x,y,code,offset,length,sx,sy,color,flipx,flipy,scrollx,scrolly/*,plx,ply*/;
|
||||
|
||||
|
||||
for(i=0;i<ST0016_SPR_BANK_SIZE*ST0016_MAX_SPR_BANK;i+=8)
|
||||
{
|
||||
x=st0016_spriteram[i+4]+((st0016_spriteram[i+5]&3)<<8);
|
||||
y=st0016_spriteram[i+6]+((st0016_spriteram[i+7]&3)<<8);
|
||||
|
||||
scrollx=(st0016_vregs[(((st0016_spriteram[i+1]&0x0f)>>1)<<2)+0x40]+256*st0016_vregs[(((st0016_spriteram[i+1]&0x0f)>>1)<<2)+1+0x40])&0x3ff;
|
||||
scrolly=(st0016_vregs[(((st0016_spriteram[i+1]&0x0f)>>1)<<2)+2+0x40]+256*st0016_vregs[(((st0016_spriteram[i+1]&0x0f)>>1)<<2)+3+0x40])&0x3ff;
|
||||
|
||||
if(!ISMACS)
|
||||
{
|
||||
if (x & 0x200) x-= 0x400; //sign
|
||||
if (y & 0x200) y-= 0x400;
|
||||
|
||||
if (scrollx & 0x200) scrollx-= 0x400; //sign
|
||||
if (scrolly & 0x200) scrolly-= 0x400;
|
||||
}
|
||||
|
||||
if(ISMACS1)
|
||||
{
|
||||
if (x & 0x200) x-= 0x400; //sign
|
||||
if (y & 0x200) y-= 0x2b0;//0x400;
|
||||
|
||||
if (scrollx & 0x200) scrollx-= 0x400; //sign
|
||||
if (scrolly & 0x200) scrolly-= 0x400;
|
||||
}
|
||||
|
||||
x+=scrollx;
|
||||
y+=scrolly;
|
||||
|
||||
if(ISMACS)
|
||||
{
|
||||
y+=0x20;
|
||||
}
|
||||
|
||||
if( st0016_spriteram[i+3]&0x80) /* end of list */
|
||||
break;
|
||||
|
||||
offset=st0016_spriteram[i+2]+256*(st0016_spriteram[i+3]);
|
||||
offset<<=3;
|
||||
|
||||
length=st0016_spriteram[i+0]+1+256*(st0016_spriteram[i+1]&1);
|
||||
|
||||
//plx=(st0016_spriteram[i+5]>>2)&0x3;
|
||||
//ply=(st0016_spriteram[i+7]>>2)&0x3;
|
||||
|
||||
if(offset<ST0016_SPR_BANK_SIZE*ST0016_MAX_SPR_BANK)
|
||||
{
|
||||
for(j=0;j<length;j++)
|
||||
{
|
||||
code=st0016_spriteram[offset]+256*st0016_spriteram[offset+1];
|
||||
sx=st0016_spriteram[offset+4]+((st0016_spriteram[offset+5]&1)<<8);
|
||||
sy=st0016_spriteram[offset+6]+((st0016_spriteram[offset+7]&1)<<8);
|
||||
|
||||
if(ISMACS && !(ISMACS1))
|
||||
{
|
||||
if (sy & 0x100) sy-= 0x200; //yuka & yujan
|
||||
}
|
||||
|
||||
if(ISMACS)
|
||||
{
|
||||
sy=0xe0-sy;
|
||||
}
|
||||
|
||||
sx+=x;
|
||||
sy+=y;
|
||||
color=st0016_spriteram[offset+2]&0x3f;
|
||||
lx=(st0016_spriteram[offset+5]>>2)&3;
|
||||
ly=(st0016_spriteram[offset+7]>>2)&3;
|
||||
/*
|
||||
if(plx |ply) //parent
|
||||
{
|
||||
lx=plx;
|
||||
ly=ply;
|
||||
}
|
||||
*/
|
||||
|
||||
flipx=st0016_spriteram[offset+3]&0x80;
|
||||
flipy=st0016_spriteram[offset+3]&0x40;
|
||||
|
||||
if(ISMACS)
|
||||
sy-=(1<<ly)*8;
|
||||
|
||||
{
|
||||
int x0,y0,i0=0;
|
||||
for(x0=(flipx?((1<<lx)-1):0);x0!=(flipx?-1:(1<<lx));x0+=(flipx?-1:1))
|
||||
for(y0=(flipy?((1<<ly)-1):0);y0!=(flipy?-1:(1<<ly));y0+=(flipy?-1:1))
|
||||
{
|
||||
/* custom draw */
|
||||
UINT16 *destline;
|
||||
int yloop,xloop;
|
||||
int ypos, xpos;
|
||||
int tileno;
|
||||
const UINT8 *srcgfx;
|
||||
int gfxoffs;
|
||||
ypos = sy+y0*8+spr_dy;
|
||||
xpos = sx+x0*8+spr_dx;
|
||||
tileno = (code+i0++)&ST0016_CHAR_BANK_MASK ;
|
||||
|
||||
gfxoffs = 0;
|
||||
srcgfx= gfx->get_data(tileno);
|
||||
|
||||
for (yloop=0; yloop<8; yloop++)
|
||||
{
|
||||
UINT16 drawypos;
|
||||
|
||||
if (!flipy) {drawypos = ypos+yloop;} else {drawypos = (ypos+8-1)-yloop;}
|
||||
destline = &bitmap.pix16(drawypos);
|
||||
|
||||
for (xloop=0; xloop<8; xloop++)
|
||||
{
|
||||
UINT16 drawxpos;
|
||||
int pixdata;
|
||||
pixdata = srcgfx[gfxoffs];
|
||||
|
||||
if (!flipx) { drawxpos = xpos+xloop; } else { drawxpos = (xpos+8-1)-xloop; }
|
||||
|
||||
if (drawxpos > cliprect.max_x)
|
||||
drawxpos -= 512; // wrap around
|
||||
|
||||
if (cliprect.contains(drawxpos, drawypos))
|
||||
{
|
||||
if(st0016_spriteram[offset+5]&0x40)
|
||||
{
|
||||
destline[drawxpos] =(destline[drawxpos] | pixdata<<4)&0x3ff;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ISMACS2)
|
||||
{
|
||||
if(pixdata )//|| destline[drawxpos]==UNUSED_PEN)
|
||||
{
|
||||
destline[drawxpos] = pixdata + (color*16);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pixdata || destline[drawxpos]==UNUSED_PEN)
|
||||
{
|
||||
destline[drawxpos] = pixdata + (color*16);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gfxoffs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
offset+=8;
|
||||
if(offset>=ST0016_SPR_BANK_SIZE*ST0016_MAX_SPR_BANK)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void st0016_state::st0016_save_init()
|
||||
{
|
||||
save_item(NAME(st0016_spr_bank));
|
||||
save_item(NAME(st0016_spr2_bank));
|
||||
save_item(NAME(st0016_pal_bank));
|
||||
save_item(NAME(st0016_char_bank));
|
||||
//save_item(NAME(st0016_rom_bank));
|
||||
save_item(NAME(st0016_vregs));
|
||||
save_pointer(NAME(st0016_charram), ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE);
|
||||
save_pointer(NAME(st0016_paletteram), ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE);
|
||||
save_pointer(NAME(st0016_spriteram), ST0016_MAX_SPR_BANK*ST0016_SPR_BANK_SIZE);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START_MEMBER(st0016_state,st0016)
|
||||
{
|
||||
int gfx_index=0;
|
||||
|
||||
macs_cart_slot = 0;
|
||||
st0016_charram=auto_alloc_array(machine(), UINT8, ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE);
|
||||
st0016_spriteram=auto_alloc_array(machine(), UINT8, ST0016_MAX_SPR_BANK*ST0016_SPR_BANK_SIZE);
|
||||
st0016_paletteram=auto_alloc_array(machine(), UINT8, ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE);
|
||||
|
||||
/* find first empty slot to decode gfx */
|
||||
for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++)
|
||||
if (m_gfxdecode->gfx(gfx_index) == 0)
|
||||
break;
|
||||
|
||||
assert(gfx_index != MAX_GFX_ELEMENTS);
|
||||
|
||||
/* create the char set (gfx will then be updated dynamically from RAM) */
|
||||
m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, charlayout, (UINT8 *) st0016_charram, 0, 0x40, 0)));
|
||||
st0016_ramgfx = gfx_index;
|
||||
|
||||
spr_dx=0;
|
||||
spr_dy=0;
|
||||
|
||||
switch(st0016_game&0x3f)
|
||||
{
|
||||
case 0: //renju kizoku
|
||||
m_screen->set_visible_area(0, 40*8-1, 0, 30*8-1);
|
||||
spr_dx=0;
|
||||
spr_dy=0;
|
||||
break;
|
||||
|
||||
case 1: //neratte chu!
|
||||
m_screen->set_visible_area(8,41*8-1,0,30*8-1);
|
||||
spr_dx=0;
|
||||
spr_dy=8;
|
||||
break;
|
||||
|
||||
case 4: //mayjinsen 1&2
|
||||
m_screen->set_visible_area(0,32*8-1,0,28*8-1);
|
||||
break;
|
||||
|
||||
case 10:
|
||||
m_screen->set_visible_area(0,383,0,255);
|
||||
break;
|
||||
|
||||
case 11:
|
||||
m_screen->set_visible_area(0,383,0,383);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
st0016_save_init();
|
||||
}
|
||||
|
||||
|
||||
void st0016_state::draw_bgmap(bitmap_ind16 &bitmap,const rectangle &cliprect, int priority)
|
||||
{
|
||||
gfx_element *gfx = m_gfxdecode->gfx(st0016_ramgfx);
|
||||
int j;
|
||||
//for(j=0x40-8;j>=0;j-=8)
|
||||
for(j=0;j<0x40;j+=8)
|
||||
{
|
||||
if(st0016_vregs[j+1] && ((priority && (st0016_vregs[j+3]==0xff))||((!priority)&&(st0016_vregs[j+3]!=0xff))))
|
||||
{
|
||||
int x,y,code,color,flipx,flipy;
|
||||
int i=st0016_vregs[j+1]*0x1000;
|
||||
for(x=0;x<32*2;x++)
|
||||
for(y=0;y<8*4;y++)
|
||||
{
|
||||
code=st0016_spriteram[i]+256*st0016_spriteram[i+1];
|
||||
color=st0016_spriteram[i+2]&0x3f;
|
||||
|
||||
flipx=st0016_spriteram[i+3]&0x80;
|
||||
flipy=st0016_spriteram[i+3]&0x40;
|
||||
|
||||
if(priority)
|
||||
{
|
||||
gfx->transpen(bitmap,cliprect,
|
||||
code,
|
||||
color,
|
||||
flipx,flipy,
|
||||
x*8+spr_dx,y*8+spr_dy,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT16 *destline;
|
||||
int yloop,xloop;
|
||||
int ypos, xpos;
|
||||
const UINT8 *srcgfx;
|
||||
int gfxoffs;
|
||||
ypos = y*8+spr_dy;//+((st0016_vregs[j+2]==0xaf)?0x50:0);//hack for mayjinsen title screen
|
||||
xpos = x*8+spr_dx;
|
||||
gfxoffs = 0;
|
||||
srcgfx= gfx->get_data(code);
|
||||
|
||||
for (yloop=0; yloop<8; yloop++)
|
||||
{
|
||||
UINT16 drawypos;
|
||||
|
||||
if (!flipy) {drawypos = ypos+yloop;} else {drawypos = (ypos+8-1)-yloop;}
|
||||
destline = &bitmap.pix16(drawypos);
|
||||
|
||||
for (xloop=0; xloop<8; xloop++)
|
||||
{
|
||||
UINT16 drawxpos;
|
||||
int pixdata;
|
||||
pixdata = srcgfx[gfxoffs];
|
||||
|
||||
if (!flipx) { drawxpos = xpos+xloop; } else { drawxpos = (xpos+8-1)-xloop; }
|
||||
|
||||
if (drawxpos > cliprect.max_x)
|
||||
drawxpos -= 512; // wrap around
|
||||
|
||||
if (cliprect.contains(drawxpos, drawypos))
|
||||
{
|
||||
if(st0016_vregs[j+7]==0x12)
|
||||
destline[drawxpos] = (destline[drawxpos] | (pixdata<<4))&0x3ff;
|
||||
else
|
||||
{
|
||||
if(ISMACS2)
|
||||
{
|
||||
if(pixdata)// || destline[drawxpos]==UNUSED_PEN)
|
||||
{
|
||||
destline[drawxpos] = pixdata + (color*16);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pixdata || destline[drawxpos]==UNUSED_PEN)
|
||||
{
|
||||
destline[drawxpos] = pixdata + (color*16);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
gfxoffs++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
i+=4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void st0016_state::st0016_draw_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
draw_bgmap(bitmap,cliprect,0);
|
||||
draw_sprites(bitmap,cliprect);
|
||||
draw_bgmap(bitmap,cliprect,1);
|
||||
}
|
||||
|
||||
UINT32 st0016_state::screen_update_st0016(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
#ifdef MAME_DEBUG
|
||||
if(machine().input().code_pressed_once(KEYCODE_Z))
|
||||
{
|
||||
int h,j;
|
||||
FILE *p=fopen("vram.bin","wb");
|
||||
fwrite(st0016_spriteram,1,0x1000*ST0016_MAX_SPR_BANK,p);
|
||||
fclose(p);
|
||||
|
||||
p=fopen("vram.txt","wt");
|
||||
for(h=0;h<0xc0;h++)
|
||||
fprintf(p,"VREG %.4x - %.4x\n",h,st0016_vregs[h]);
|
||||
for(h=0;h<0x1000*ST0016_MAX_SPR_BANK;h+=8)
|
||||
{
|
||||
fprintf(p,"%.4x - %.4x - ",h,h>>3);
|
||||
for(j=0;j<8;j++)
|
||||
fprintf(p,"%.2x ",st0016_spriteram[h+j]);
|
||||
fprintf(p,"\n");
|
||||
}
|
||||
fclose(p);
|
||||
}
|
||||
#endif
|
||||
|
||||
bitmap.fill(UNUSED_PEN, cliprect);
|
||||
st0016_draw_screen(screen, bitmap, cliprect);
|
||||
return 0;
|
||||
return m_maincpu->update(screen,bitmap,cliprect);
|
||||
}
|
||||
|
||||
VIDEO_START_MEMBER(st0016_state, st0016)
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user