From 65efabec3770a2c27903dd9f9d91a2d012b06b8d Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Sat, 17 Jan 2009 14:07:56 +0000 Subject: [PATCH] Seibu CRTC part 1: [Angelo Salese] * Merged Sengoku Mahjong & Good e Jong video HWs * Added correct scrolling functions for Sengoku Mahjong * Removed some positioning kludges in both drivers Fixed Sengoku Mahjong hopper error after first winning match [Angelo Salese] Removed deprecat dependancy from Good e Jong,one irq wasn't needed at all (points to a reti) [Angelo Salese] --- .gitattributes | 4 +- src/mame/drivers/goodejan.c | 110 +++++++------ src/mame/drivers/sengokmj.c | 73 ++++----- src/mame/includes/sei_crtc.h | 16 ++ src/mame/video/goodejan.c | 124 --------------- src/mame/video/sei_crtc.c | 296 +++++++++++++++++++++++++++++++++++ src/mame/video/sengokmj.c | 148 ------------------ 7 files changed, 406 insertions(+), 365 deletions(-) create mode 100644 src/mame/includes/sei_crtc.h delete mode 100644 src/mame/video/goodejan.c create mode 100644 src/mame/video/sei_crtc.c delete mode 100644 src/mame/video/sengokmj.c diff --git a/.gitattributes b/.gitattributes index 3d2fba8f245..6ee318dfcc9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2429,6 +2429,7 @@ src/mame/includes/segag80r.h svneol=native#text/plain src/mame/includes/segag80v.h svneol=native#text/plain src/mame/includes/segas24.h svneol=native#text/plain src/mame/includes/segas32.h svneol=native#text/plain +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 @@ -3019,7 +3020,6 @@ src/mame/video/goal92.c svneol=native#text/plain src/mame/video/goindol.c svneol=native#text/plain src/mame/video/goldstar.c svneol=native#text/plain src/mame/video/gomoku.c svneol=native#text/plain -src/mame/video/goodejan.c svneol=native#text/plain src/mame/video/gotcha.c svneol=native#text/plain src/mame/video/gottlieb.c svneol=native#text/plain src/mame/video/gotya.c svneol=native#text/plain @@ -3290,9 +3290,9 @@ src/mame/video/segas32.c svneol=native#text/plain src/mame/video/segasyse.c svneol=native#text/plain src/mame/video/segaxbd.c svneol=native#text/plain src/mame/video/segaybd.c svneol=native#text/plain +src/mame/video/sei_crtc.c svneol=native#text/plain src/mame/video/seibuspi.c svneol=native#text/plain src/mame/video/seicross.c svneol=native#text/plain -src/mame/video/sengokmj.c svneol=native#text/plain src/mame/video/senjyo.c svneol=native#text/plain src/mame/video/seta.c svneol=native#text/plain src/mame/video/seta2.c svneol=native#text/plain diff --git a/src/mame/drivers/goodejan.c b/src/mame/drivers/goodejan.c index 691c045f56a..ce2531e5efe 100644 --- a/src/mame/drivers/goodejan.c +++ b/src/mame/drivers/goodejan.c @@ -52,26 +52,23 @@ Notes: #include "driver.h" #include "cpu/nec/nec.h" -#include "deprecat.h" #include "audio/seibu.h" #include "sound/3812intf.h" +#include "includes/sei_crtc.h" #define GOODEJAN_MHZ1 7159090 #define GOODEJAN_MHZ2 16000000 #define GOODEJAN_MHZ3 12000000 -extern UINT16 *goodejan_bgvram, *goodejan_txvram; +extern UINT16 *seibucrtc_sc0vram,*seibucrtc_sc1vram,*seibucrtc_sc2vram,*seibucrtc_sc3vram; +extern UINT16 *seibucrtc_vregs; +extern UINT16 seibucrtc_sc0bank; static UINT16 goodejan_mux_data; -WRITE16_HANDLER( goodejan_bgvram_w ); -WRITE16_HANDLER( goodejan_txvram_w ); -WRITE16_HANDLER( goodejan_bg_scrollx_w ); -WRITE16_HANDLER( goodejan_bg_scrolly_w ); -WRITE16_HANDLER( goodejan_layer_en_w ); -WRITE16_HANDLER( goodejan_gfxbank_w ); - -VIDEO_START( goodejan ); -VIDEO_UPDATE( goodejan ); +WRITE16_HANDLER( goodejan_gfxbank_w ) +{ + seibucrtc_sc0bank_w((data & 0x100)>>8);// = (data & 0x100)>>8; +} /* Multiplexer device for the mahjong panel */ static READ16_HANDLER( mahjong_panel_r ) @@ -98,9 +95,12 @@ static WRITE16_HANDLER( mahjong_panel_w ) static ADDRESS_MAP_START( goodejan_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x00000, 0x0afff) AM_RAM - AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE(goodejan_bgvram_w) AM_BASE(&goodejan_bgvram) + AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE(seibucrtc_sc0vram_w) AM_BASE(&seibucrtc_sc0vram) + AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE(seibucrtc_sc3vram_w) AM_BASE(&seibucrtc_sc3vram) AM_RANGE(0x0d000, 0x0dfff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16) - AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE(goodejan_txvram_w) AM_BASE(&goodejan_txvram) + /*Guess: these two aren't used/initialized at all.*/ + AM_RANGE(0x0e000, 0x0e7ff) AM_RAM_WRITE(seibucrtc_sc1vram_w) AM_BASE(&seibucrtc_sc1vram) + AM_RANGE(0x0e800, 0x0efff) AM_RAM_WRITE(seibucrtc_sc2vram_w) AM_BASE(&seibucrtc_sc2vram) AM_RANGE(0x0f800, 0x0ffff) AM_RAM AM_BASE(&spriteram16) AM_RANGE(0xc0000, 0xfffff) AM_ROM ADDRESS_MAP_END @@ -108,24 +108,21 @@ ADDRESS_MAP_END /*totmejan CRT is at 8000-804f,goodejan is at 8040-807f(808f but not tested)*/ static ADDRESS_MAP_START( common_io_map, ADDRESS_SPACE_IO, 16 ) AM_RANGE(0x9000, 0x9001) AM_WRITE(goodejan_gfxbank_w) - AM_RANGE(0x8020, 0x8023) AM_WRITENOP AM_RANGE(0xb000, 0xb003) AM_WRITENOP AM_RANGE(0xb004, 0xb005) AM_WRITE(mahjong_panel_w) AM_RANGE(0xc000, 0xc001) AM_READ_PORT("DSW1") AM_RANGE(0xc002, 0xc003) AM_READ(mahjong_panel_r) - AM_RANGE(0xc004, 0xc005) AM_READ_PORT("DSW2") // maybe it's a seibu_main_word mirror? + AM_RANGE(0xc004, 0xc005) AM_READ_PORT("DSW2") // switches AM_RANGE(0xd000, 0xd00f) AM_READWRITE(seibu_main_word_r, seibu_main_word_w) ADDRESS_MAP_END static ADDRESS_MAP_START( totmejan_io_map, ADDRESS_SPACE_IO, 16 ) - AM_RANGE(0x801c, 0x801d) AM_WRITE(goodejan_layer_en_w ) + AM_RANGE(0x8000, 0x804f) AM_RAM_WRITE(seibucrtc_vregs_w) AM_BASE(&seibucrtc_vregs) ADDRESS_MAP_END static ADDRESS_MAP_START( goodejan_io_map, ADDRESS_SPACE_IO, 16 ) - AM_RANGE(0x805c, 0x805d) AM_WRITE(goodejan_layer_en_w ) - AM_RANGE(0x8060, 0x8061) AM_WRITE(goodejan_bg_scrollx_w ) - AM_RANGE(0x8062, 0x8063) AM_WRITE(goodejan_bg_scrolly_w ) + AM_RANGE(0x8040, 0x807f) AM_RAM_WRITE(seibucrtc_vregs_w) AM_BASE(&seibucrtc_vregs) ADDRESS_MAP_END static INPUT_PORTS_START( goodejan ) @@ -313,17 +310,17 @@ static const gfx_layout charlayout = }; static GFXDECODE_START( goodejan ) - GFXDECODE_ENTRY( "gfx3", 0, tilelayout, 0x200, 0x40 ) /* Sprites */ - GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0x000, 0x30 ) /* Tiles */ - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0x100, 0x10 ) /* Text */ + GFXDECODE_ENTRY( "spr_gfx", 0,tilelayout, 0x200, 0x40 ) /* Sprites */ + GFXDECODE_ENTRY( "bg_gfx", 0, tilelayout, 0x000, 0x30 ) /* Tiles */ + GFXDECODE_ENTRY( "md_gfx", 0, tilelayout, 0x300, 0x10 ) /* Text */ + GFXDECODE_ENTRY( "fg_gfx", 0, tilelayout, 0x600, 0x10 ) /* Tiles */ + GFXDECODE_ENTRY( "tx_gfx", 0, charlayout, 0x100, 0x10 ) /* Text */ GFXDECODE_END -static INTERRUPT_GEN( goodejan_interrupt ) +static INTERRUPT_GEN( goodejan_irq ) { - if (cpu_getiloops(device)) - cpu_set_input_line_and_vector(device,0,HOLD_LINE,0x208/4); - else - cpu_set_input_line_and_vector(device,0,HOLD_LINE,0x00c/4); + cpu_set_input_line_and_vector(device,0,HOLD_LINE,0x208/4); +/* vector 0x00c is just a reti */ } static MACHINE_DRIVER_START( goodejan ) @@ -332,7 +329,7 @@ static MACHINE_DRIVER_START( goodejan ) MDRV_CPU_ADD("main", V30, GOODEJAN_MHZ2/2) MDRV_CPU_PROGRAM_MAP(goodejan_map,0) MDRV_CPU_IO_MAP(common_io_map,goodejan_io_map) - MDRV_CPU_VBLANK_INT_HACK(goodejan_interrupt,2) + MDRV_CPU_VBLANK_INT("main",goodejan_irq) SEIBU_SOUND_SYSTEM_CPU(GOODEJAN_MHZ1/2) @@ -344,13 +341,13 @@ static MACHINE_DRIVER_START( goodejan ) MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MDRV_SCREEN_SIZE(32*8, 32*8) - MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) + MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) //TODO: dynamic resolution MDRV_GFXDECODE(goodejan) MDRV_PALETTE_LENGTH(0x1000) - MDRV_VIDEO_START(goodejan) - MDRV_VIDEO_UPDATE(goodejan) + MDRV_VIDEO_START(seibu_crtc) + MDRV_VIDEO_UPDATE(seibu_crtc) /* sound hardware */ SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(GOODEJAN_MHZ1/2,GOODEJAN_MHZ2/16) @@ -372,15 +369,20 @@ ROM_START( totmejan ) ROM_CONTINUE( 0x010000, 0x08000 ) ROM_COPY( "audio", 0, 0x018000, 0x08000 ) - ROM_REGION( 0x20000, "gfx1", ROMREGION_ERASEFF | ROMREGION_DISPOSE ) - ROM_LOAD16_BYTE( "3.063", 0x00000, 0x10000, CRC(61b5ae88) SHA1(16105a4e97765454079deda8eaa456d60d44e906) ) - ROM_LOAD16_BYTE( "4.061", 0x00001, 0x10000, CRC(29fb6ad2) SHA1(8a9c4625472daefca7fb73a9ef3717e86c3d632f) ) + ROM_REGION( 0x080000, "spr_gfx", ROMREGION_DISPOSE ) + ROM_LOAD( "e-jan.078", 0x000000, 0x080000, CRC(ff9ee9d8) SHA1(5e49e9a666630ca9867ee96b9d2b8d6f503b25df) ) - ROM_REGION( 0x100000, "gfx2", ROMREGION_DISPOSE ) + ROM_REGION( 0x100000, "bg_gfx", ROMREGION_DISPOSE ) ROM_LOAD( "e-jan.064", 0x000000, 0x100000, CRC(5f6185ee) SHA1(599e4a574672cd1571032e879b3032d06b70e4e2) ) - ROM_REGION( 0x080000, "gfx3", ROMREGION_DISPOSE ) - ROM_LOAD( "e-jan.078", 0x000000, 0x080000, CRC(ff9ee9d8) SHA1(5e49e9a666630ca9867ee96b9d2b8d6f503b25df) ) + ROM_REGION( 0x20000, "md_gfx", ROMREGION_DISPOSE ) + /*Empty*/ + ROM_REGION( 0x20000, "fg_gfx", ROMREGION_DISPOSE ) + /*Empty*/ + + ROM_REGION( 0x20000, "tx_gfx", ROMREGION_ERASEFF | ROMREGION_DISPOSE ) + ROM_LOAD16_BYTE( "3.063", 0x00000, 0x10000, CRC(61b5ae88) SHA1(16105a4e97765454079deda8eaa456d60d44e906) ) + ROM_LOAD16_BYTE( "4.061", 0x00001, 0x10000, CRC(29fb6ad2) SHA1(8a9c4625472daefca7fb73a9ef3717e86c3d632f) ) ROM_REGION( 0x80000, "oki", 0 ) /* ADPCM samples */ ROM_LOAD( "e-jan.0911", 0x00000, 0x80000, CRC(a7fb93c2) SHA1(c2e1300f142032c087c96e1a785af28a6d678947) ) @@ -399,15 +401,20 @@ ROM_START( goodejan ) ROM_CONTINUE( 0x010000, 0x08000 ) ROM_COPY( "audio", 0, 0x018000, 0x08000 ) - ROM_REGION( 0x20000, "gfx1", ROMREGION_ERASEFF | ROMREGION_DISPOSE ) - ROM_LOAD16_BYTE( "3.063", 0x00000, 0x10000, CRC(f355564a) SHA1(35140cc86504d6fdaba00b520d226724bac9f546) ) - ROM_LOAD16_BYTE( "4.061", 0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) ) + ROM_REGION( 0x080000, "spr_gfx", ROMREGION_DISPOSE ) + ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) ) - ROM_REGION( 0x100000, "gfx2", ROMREGION_DISPOSE ) + ROM_REGION( 0x100000, "bg_gfx", ROMREGION_DISPOSE ) ROM_LOAD( "e_jan2scr.064", 0x000000, 0x100000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) ) - ROM_REGION( 0x080000, "gfx3", ROMREGION_DISPOSE ) - ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) ) + ROM_REGION( 0x20000, "md_gfx", ROMREGION_DISPOSE ) + /*Empty*/ + ROM_REGION( 0x20000, "fg_gfx", ROMREGION_DISPOSE ) + /*Empty*/ + + ROM_REGION( 0x20000, "tx_gfx", ROMREGION_ERASEFF | ROMREGION_DISPOSE ) + ROM_LOAD16_BYTE( "3.063", 0x00000, 0x10000, CRC(f355564a) SHA1(35140cc86504d6fdaba00b520d226724bac9f546) ) + ROM_LOAD16_BYTE( "4.061", 0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) ) ROM_REGION( 0x80000, "oki", 0 ) /* ADPCM samples */ ROM_LOAD( "e-jan.911", 0x00000, 0x80000, CRC(6d2cbc35) SHA1(61f47e2a94b8877906224f46d8301a26a0b9e55f) ) @@ -426,15 +433,20 @@ ROM_START( goodejaa ) ROM_CONTINUE( 0x010000, 0x08000 ) ROM_COPY( "audio", 0, 0x018000, 0x08000 ) - ROM_REGION( 0x20000, "gfx1", ROMREGION_ERASEFF | ROMREGION_DISPOSE ) - ROM_LOAD16_BYTE( "3.063", 0x00000, 0x10000, CRC(f355564a) SHA1(35140cc86504d6fdaba00b520d226724bac9f546) ) - ROM_LOAD16_BYTE( "4.061", 0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) ) + ROM_REGION( 0x080000, "spr_gfx", ROMREGION_DISPOSE ) + ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) ) - ROM_REGION( 0x100000, "gfx2", ROMREGION_DISPOSE ) + ROM_REGION( 0x100000, "bg_gfx", ROMREGION_DISPOSE ) ROM_LOAD( "e_jan2scr.064", 0x000000, 0x100000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) ) - ROM_REGION( 0x080000, "gfx3", ROMREGION_DISPOSE ) - ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) ) + ROM_REGION( 0x20000, "md_gfx", ROMREGION_DISPOSE ) + /*Empty*/ + ROM_REGION( 0x20000, "fg_gfx", ROMREGION_DISPOSE ) + /*Empty*/ + + ROM_REGION( 0x20000, "tx_gfx", ROMREGION_ERASEFF | ROMREGION_DISPOSE ) + ROM_LOAD16_BYTE( "3.063", 0x00000, 0x10000, CRC(f355564a) SHA1(35140cc86504d6fdaba00b520d226724bac9f546) ) + ROM_LOAD16_BYTE( "4.061", 0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) ) ROM_REGION( 0x80000, "oki", 0 ) /* ADPCM samples */ ROM_LOAD( "e-jan.911", 0x00000, 0x80000, CRC(6d2cbc35) SHA1(61f47e2a94b8877906224f46d8301a26a0b9e55f) ) diff --git a/src/mame/drivers/sengokmj.c b/src/mame/drivers/sengokmj.c index ed63ead7e11..31985821d34 100644 --- a/src/mame/drivers/sengokmj.c +++ b/src/mame/drivers/sengokmj.c @@ -56,18 +56,13 @@ RSSENGO2.72 chr. #include "cpu/nec/nec.h" #include "audio/seibu.h" #include "sound/3812intf.h" +#include "includes/sei_crtc.h" + +extern UINT16 *seibucrtc_sc0vram,*seibucrtc_sc1vram,*seibucrtc_sc2vram,*seibucrtc_sc3vram; +extern UINT16 *seibucrtc_vregs; -extern UINT16 *sengokmj_bgvram,*sengokmj_mdvram,*sengokmj_fgvram,*sengokmj_txvram; static UINT16 sengokumj_mux_data; - -WRITE16_HANDLER( sengokmj_bgvram_w ); -WRITE16_HANDLER( sengokmj_fgvram_w ); -WRITE16_HANDLER( sengokmj_mdvram_w ); -WRITE16_HANDLER( sengokmj_txvram_w ); -WRITE16_HANDLER( sengokmj_layer_enable_w ); -WRITE16_HANDLER( sengokmj_bg_scrolly_w ); -VIDEO_START( sengokmj ); -VIDEO_UPDATE( sengokmj ); +static UINT8 hopper_io; /* Multiplexer device for the mahjong panel */ static READ16_HANDLER( mahjong_panel_r ) @@ -99,6 +94,8 @@ static WRITE16_HANDLER( sengokmj_out_w ) coin_lockout_w(0,~data & 2); coin_lockout_w(1,~data & 2); coin_counter_w(0,data & 4); + hopper_io = ((data & 1)<<6); +// popmessage("%02x",hopper_io); } static WRITE16_HANDLER( seibu_z80_com_6_mirror_w ) @@ -106,13 +103,18 @@ static WRITE16_HANDLER( seibu_z80_com_6_mirror_w ) seibu_main_word_w(space,6,data,0xffff); } +static READ16_HANDLER( sengokmj_system_r ) +{ + return (input_port_read(space->machine, "SYSTEM") & 0xffbf) | hopper_io; +} + static ADDRESS_MAP_START( sengokmj_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x00000, 0x07fff) AM_RAM AM_RANGE(0x08000, 0x09fff) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size) - AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE(sengokmj_bgvram_w) AM_BASE(&sengokmj_bgvram) - AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE(sengokmj_fgvram_w) AM_BASE(&sengokmj_fgvram) - AM_RANGE(0x0d000, 0x0d7ff) AM_RAM_WRITE(sengokmj_mdvram_w) AM_BASE(&sengokmj_mdvram) - AM_RANGE(0x0d800, 0x0e7ff) AM_RAM_WRITE(sengokmj_txvram_w) AM_BASE(&sengokmj_txvram) + AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE(seibucrtc_sc0vram_w) AM_BASE(&seibucrtc_sc0vram) + AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE(seibucrtc_sc1vram_w) AM_BASE(&seibucrtc_sc1vram) + AM_RANGE(0x0d000, 0x0d7ff) AM_RAM_WRITE(seibucrtc_sc2vram_w) AM_BASE(&seibucrtc_sc2vram) + AM_RANGE(0x0d800, 0x0e7ff) AM_RAM_WRITE(seibucrtc_sc3vram_w) AM_BASE(&seibucrtc_sc3vram) AM_RANGE(0x0e800, 0x0f7ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16) AM_RANGE(0x0f800, 0x0ffff) AM_RAM AM_BASE(&spriteram16) AM_RANGE(0xc0000, 0xfffff) AM_ROM @@ -121,14 +123,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sengokmj_io_map, ADDRESS_SPACE_IO, 16 ) AM_RANGE(0x4000, 0x400f) AM_READWRITE(seibu_main_word_r, seibu_main_word_w) /*Areas from 8000-804f are for the custom Seibu CRTC.*/ -// AM_RANGE(0x8000, 0x800f) AM_WRITE(seibu_main_word_w) -// AM_RANGE(0x8010, 0x801b) AM_WRITENOP - AM_RANGE(0x801c, 0x801d) AM_WRITE(sengokmj_layer_enable_w) -// AM_RANGE(0x801e, 0x801f) AM_WRITENOP -// AM_RANGE(0x8020, 0x802f) AM_WRITENOP - AM_RANGE(0x8022, 0x8023) AM_WRITE(sengokmj_bg_scrolly_w) -// AM_RANGE(0x8030, 0x803f) AM_WRITENOP -// AM_RANGE(0x8040, 0x804f) AM_WRITENOP + AM_RANGE(0x8000, 0x804f) AM_RAM_WRITE(seibucrtc_vregs_w) AM_BASE(&seibucrtc_vregs) AM_RANGE(0x8080, 0x8081) AM_WRITE(seibu_z80_com_6_mirror_w) // AM_RANGE(0x80c0, 0x80c1) AM_WRITE(seibu_z80_com_unk_mirror_w) @@ -137,7 +132,7 @@ static ADDRESS_MAP_START( sengokmj_io_map, ADDRESS_SPACE_IO, 16 ) AM_RANGE(0x8140, 0x8141) AM_WRITE(mahjong_panel_w) AM_RANGE(0xc000, 0xc001) AM_READ_PORT("DSW1") AM_RANGE(0xc002, 0xc003) AM_READ(mahjong_panel_r) - AM_RANGE(0xc004, 0xc005) AM_READ_PORT("DSW2") //switches + AM_RANGE(0xc004, 0xc005) AM_READ(sengokmj_system_r) //switches ADDRESS_MAP_END @@ -145,28 +140,26 @@ static INPUT_PORTS_START( sengokmj ) SEIBU_COIN_INPUTS /* coin inputs read through sound cpu */ PORT_START("DSW1") - PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Demo_Sounds ) ) + PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:1") PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0002, 0x0002, "Re-start" ) + PORT_DIPNAME( 0x0002, 0x0002, "Re-start" ) PORT_DIPLOCATION("SW1:2") PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0004, 0x0004, "Double G" ) + PORT_DIPNAME( 0x0004, 0x0004, "Double G" ) PORT_DIPLOCATION("SW1:3") PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0008, 0x0008, "Double L" ) + PORT_DIPNAME( 0x0008, 0x0008, "Double L" ) PORT_DIPLOCATION("SW1:4") PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0010, 0x0010, "Kamon" ) + PORT_DIPNAME( 0x0010, 0x0010, "Kamon" ) PORT_DIPLOCATION("SW1:5") PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) ) - PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0040, 0x0040, "Out Sw" ) + PORT_DIPUNUSED_DIPLOC( 0x0020, 0x0020, "SW1:6" ) + PORT_DIPNAME( 0x0040, 0x0040, "Out Sw" ) PORT_DIPLOCATION("SW1:7") PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0080, 0x0080, "Hopper" ) + PORT_DIPNAME( 0x0080, 0x0000, "Hopper" ) PORT_DIPLOCATION("SW1:8") //game gives hopper error with this off. PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -182,7 +175,6 @@ static INPUT_PORTS_START( sengokmj ) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("KEY1") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_F ) @@ -230,7 +222,7 @@ static INPUT_PORTS_START( sengokmj ) PORT_START("UNUSED") PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("DSW2") + PORT_START("SYSTEM") PORT_DIPNAME( 0x0001, 0x0001, "Door" ) PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) @@ -247,10 +239,7 @@ static INPUT_PORTS_START( sengokmj ) PORT_DIPNAME( 0x0020, 0x0020, "Cash" ) PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - /* Used, causes "Hopper RunAway" message if you toggle it */ - PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) +// 0x40 Hopper PORT_DIPNAME( 0x0080, 0x0080, "Meter" ) PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) @@ -314,13 +303,13 @@ static MACHINE_DRIVER_START( sengokmj ) MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MDRV_SCREEN_SIZE(64*8, 32*8) - MDRV_SCREEN_VISIBLE_AREA(16*8, 56*8-1, 2*8, 32*8-1) + MDRV_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1) //TODO: dynamic resolution MDRV_GFXDECODE(sengokmj) MDRV_PALETTE_LENGTH(0x800) - MDRV_VIDEO_START(sengokmj) - MDRV_VIDEO_UPDATE(sengokmj) + MDRV_VIDEO_START(seibu_crtc) + MDRV_VIDEO_UPDATE(seibu_crtc) /* sound hardware */ SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(14318180/4,1320000) diff --git a/src/mame/includes/sei_crtc.h b/src/mame/includes/sei_crtc.h new file mode 100644 index 00000000000..9c7c67ba331 --- /dev/null +++ b/src/mame/includes/sei_crtc.h @@ -0,0 +1,16 @@ +/*----------- defined in video -----------*/ + +extern UINT16 *seibucrtc_sc0vram,*seibucrtc_sc1vram,*seibucrtc_sc2vram,*seibucrtc_sc3vram; +extern UINT16 *seibucrtc_vregs; +extern UINT16 seibucrtc_sc0bank; + +/*----------- defined in drivers -----------*/ + +WRITE16_HANDLER( seibucrtc_sc0vram_w ); +WRITE16_HANDLER( seibucrtc_sc1vram_w ); +WRITE16_HANDLER( seibucrtc_sc2vram_w ); +WRITE16_HANDLER( seibucrtc_sc3vram_w ); +WRITE16_HANDLER( seibucrtc_vregs_w ); +void seibucrtc_sc0bank_w(UINT16 data); +VIDEO_START( seibu_crtc ); +VIDEO_UPDATE( seibu_crtc ); diff --git a/src/mame/video/goodejan.c b/src/mame/video/goodejan.c deleted file mode 100644 index c724c69a5bf..00000000000 --- a/src/mame/video/goodejan.c +++ /dev/null @@ -1,124 +0,0 @@ -#include "driver.h" - -static tilemap *bg_tilemap, *tx_tilemap; -UINT16 *goodejan_bgvram,*goodejan_txvram; -static UINT16 goodejan_layer_en; -static UINT16 goodejan_gfx_bank; - -WRITE16_HANDLER( goodejan_bgvram_w ) -{ - COMBINE_DATA(&goodejan_bgvram[offset]); - tilemap_mark_tile_dirty(bg_tilemap,offset); -} - -WRITE16_HANDLER( goodejan_txvram_w ) -{ - COMBINE_DATA(&goodejan_txvram[offset]); - tilemap_mark_tile_dirty(tx_tilemap,offset); -} - -WRITE16_HANDLER( goodejan_layer_en_w ) -{ - /*---- ---- ---x ---- enable sprites*/ - /*---- ---- ---- xxxx enable layers*/ - goodejan_layer_en = data; -} - -/*Not from the Seibu CRTC,it's an external ROM banking.*/ -WRITE16_HANDLER( goodejan_gfxbank_w ) -{ - goodejan_gfx_bank = (data & 0x100)>>8; - tilemap_mark_all_tiles_dirty(bg_tilemap); -} - -static TILE_GET_INFO( goodejan_bg_tile_info ) -{ - int tile = goodejan_bgvram[tile_index]&0x0fff; - int color = (goodejan_bgvram[tile_index]&0xf000)>>12; - - tile|= goodejan_gfx_bank<<12; -// if ((goodejan_bgvram[tile_index]&0x8000)==0x0000) tile+=0x1000; - - SET_TILE_INFO(1, tile, color, 0); -} - -static TILE_GET_INFO( goodejan_tx_tile_info ) -{ - int tile = goodejan_txvram[tile_index]; - int color = (tile >> 12) & 0x0f; - SET_TILE_INFO(2, (tile & 0xfff) + 0x3000, color, 0); -} - -static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri) -{ - int offs,fx,fy,x,y,color,sprite; - int dx,dy,ax,ay; - - for (offs = 0x400-4;offs >= 0;offs -= 4) - { - if ((spriteram16[offs+0]&0x8000)!=0x8000) continue; - sprite = spriteram16[offs+1]; - if ((sprite>>14)!=pri) continue; - sprite &= 0x1fff; - - y = spriteram16[offs+3];//&0x1ff; - x = spriteram16[offs+2];//&0x1ff; - - if (x&0x8000) x=0-(0x200-(x&0x1ff)); - //else x&=0x1ff; - if (y&0x8000) y=0-(0x200-(y&0x1ff)); - //else y&=0x1ff; - - color = spriteram16[offs+0]&0x3f; - fx = spriteram16[offs+0]&0x4000; - fy = 0; /* To do - probably 0x2000 */ - dy = ((spriteram16[offs+0]&0x0380)>>7) + 1; - dx = ((spriteram16[offs+0]&0x1c00)>>10) + 1; - - for (ax=0; axgfx[0], - sprite++, - color,fx,fy,x+ax*16,y+ay*16, - cliprect,TRANSPARENCY_PEN,15); - else - drawgfx(bitmap,machine->gfx[0], - sprite++, - color,fx,fy,x+(dx-1-ax)*16,y+ay*16, - cliprect,TRANSPARENCY_PEN,15); - } - } -} - - -WRITE16_HANDLER( goodejan_bg_scrollx_w ) -{ - tilemap_set_scrollx(bg_tilemap,0, data); -} - -WRITE16_HANDLER( goodejan_bg_scrolly_w ) -{ - tilemap_set_scrolly(bg_tilemap,0, data); -} - -VIDEO_START( goodejan ) -{ - bg_tilemap = tilemap_create(machine, goodejan_bg_tile_info,tilemap_scan_rows, 16,16,32,32); - tx_tilemap = tilemap_create(machine, goodejan_tx_tile_info,tilemap_scan_rows, 8, 8,32,32); - tilemap_set_transparent_pen(tx_tilemap,15); -} - -VIDEO_UPDATE( goodejan ) -{ - bitmap_fill(bitmap, cliprect, screen->machine->pens[0]); //black pen,likely to be selectable by a crt register - - if(!(goodejan_layer_en & 1)) { tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); } - if(!(goodejan_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 2); } - if(!(goodejan_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 1); } - if(!(goodejan_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 0); } - if(!(goodejan_layer_en & 8)) { tilemap_draw(bitmap,cliprect,tx_tilemap,0,0); } - if(!(goodejan_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 3); } - - return 0; -} diff --git a/src/mame/video/sei_crtc.c b/src/mame/video/sei_crtc.c new file mode 100644 index 00000000000..bbcb515a6f0 --- /dev/null +++ b/src/mame/video/sei_crtc.c @@ -0,0 +1,296 @@ +/****************************************************************************************** + +Seibu Custom "CRT Controller" emulation + +by Angelo Salese,based off the old D-Con video HW part by Bryan McPhail + +The (likely) custom Seibu CRTC is used at least in the following games: +Raiden (probably the first game to use it) +*Sengoku Mahjong +*Good e Jong +*Tottemo de Jong +Blood Bros. +Sky Smasher +D-Con +SD Gundam Psycho Salamander no Kyoui +(all games in legionna.c) +(all games in raiden2.c) + +The name "Seibu CRTC" is actually an agglomerate of all the Seibu Customs that are on the +single boards, most if not all of them are shared video chips in the aforementioned games. + +TODO: +- Dynamic Resolution Change (xx10 register?) +- Dynamic Paging register probably incorrect,needs further investigation; +- Merge the aforementioned games and clean-up the code in these drivers; +- Merge the gfxdecode too? +- Fully understand remaining video registers; +- Are the xx80/xxc0 in some games (D-Con/Sengoku Mahjong) another bunch of registers? +- Investigate about the real name(s) of this Seibu "CRT Controller",and if it is really + custom. + +=========================================================================================== + +List of default vregs (title screen): + +*Sengoku Mahjong: +8000: 000F 0013 009F 00BF 00FA 000F 00FA 00FF +8010: 007D 0006 0000 0002 0000 0000 0000 0000 +8020: 0000 0000 0004 0000 0000 0000 0040 01FF +8030: 003E 01FF 003F 01FF 0040 0001 0034 0035 +8040: 0000 A8A8 0003 1C37 0001 0000 0000 0000 + +*Tottemo de Jong +8000: 000F 000F 009F 00BF 00FA 000F 00FA 00FF +8010: 0076 0006 0000 0002 0000 0002 0006 0000 +8020: 0000 0000 0000 0000 0000 0000 01C0 01FF +8030: 003E 01FF 003F 01FF 00C0 01FF 0034 003F +8040: 0000 A8A8 0003 1830 0001 0000 0000 0000 + +*Good e Jong +8040: 000F 000F 009F 00BF 00FA 000F 00FA 00FF +8050: 0076 0006 0000 0002 0000 0002 0006 0000 +8060: 0000 00FA 0000 0000 0000 0000 01C0 01FF +8070: 003E 01FF 003F 01FF 00C0 01FF 0034 003F +8080: 0000 0000 0000 0000 0000 0000 0000 0000 + +*******************************************************************************************/ + +#include "driver.h" +#include "includes/sei_crtc.h" + +static tilemap *sc0_tilemap,*sc2_tilemap,*sc1_tilemap,*sc3_tilemap_0,*sc3_tilemap_1; +UINT16 *seibucrtc_sc0vram,*seibucrtc_sc1vram,*seibucrtc_sc2vram,*seibucrtc_sc3vram; +UINT16 *seibucrtc_vregs; +UINT16 seibucrtc_sc0bank; + +/******************************* +* +* Macros for the video registers +* +*******************************/ + +/******************************* +* 0x1a - Layer Dynamic Paging? +*******************************/ +#define SEIBU_CRTC_DYN_PAGING (seibucrtc_vregs[0x001a/2]) +#define SEIBU_CRTC_SC3_PAGE_SEL (SEIBU_CRTC_DYN_PAGING & 0x0002) + +/******************************* +* 0x1c - Layer Enable +*******************************/ +#define SEIBU_CRTC_LAYER_EN (seibucrtc_vregs[0x001c/2]) +#define SEIBU_CRTC_ENABLE_SC0 (!(SEIBU_CRTC_LAYER_EN & 0x0001)) +#define SEIBU_CRTC_ENABLE_SC2 (!(SEIBU_CRTC_LAYER_EN & 0x0002)) +#define SEIBU_CRTC_ENABLE_SC1 (!(SEIBU_CRTC_LAYER_EN & 0x0004)) +#define SEIBU_CRTC_ENABLE_SC3 (!(SEIBU_CRTC_LAYER_EN & 0x0008)) +#define SEIBU_CRTC_ENABLE_SPR (!(SEIBU_CRTC_LAYER_EN & 0x0010)) + +/************************************ +* 0x20 - Screen 0 (BG) scroll x +************************************/ +#define SEIBU_CRTC_SC0_SX (seibucrtc_vregs[0x0020/2]) + +/************************************ +* 0x22 - Screen 0 (BG) scroll y +************************************/ +#define SEIBU_CRTC_SC0_SY (seibucrtc_vregs[0x0022/2]) + +/************************************ +* 0x24 - Screen 1 (FG) scroll x +************************************/ +#define SEIBU_CRTC_SC1_SX (seibucrtc_vregs[0x0024/2]) + +/************************************ +* 0x26 - Screen 1 (FG) scroll y +************************************/ +#define SEIBU_CRTC_SC1_SY (seibucrtc_vregs[0x0026/2]) + +/************************************ +* 0x28 - Screen 2 (MD) scroll x +************************************/ +#define SEIBU_CRTC_SC2_SX (seibucrtc_vregs[0x0028/2]) + +/************************************ +* 0x2a - Screen 2 (MD) scroll y +************************************/ +#define SEIBU_CRTC_SC2_SY (seibucrtc_vregs[0x002a/2]) + +/************************************ +* 0x2c - Fix screen scroll x (global) +************************************/ +#define SEIBU_CRTC_FIX_SX (seibucrtc_vregs[0x002c/2]) + +/************************************ +* 0x2e - Fix screen scroll y (global) +************************************/ +#define SEIBU_CRTC_FIX_SY (seibucrtc_vregs[0x002e/2]) + + +/******************************* +* +* Write RAM accesses +* +*******************************/ + +WRITE16_HANDLER( seibucrtc_sc0vram_w ) +{ + COMBINE_DATA(&seibucrtc_sc0vram[offset]); + tilemap_mark_tile_dirty(sc0_tilemap,offset); +} + +WRITE16_HANDLER( seibucrtc_sc2vram_w ) +{ + COMBINE_DATA(&seibucrtc_sc2vram[offset]); + tilemap_mark_tile_dirty(sc2_tilemap,offset); +} + +WRITE16_HANDLER( seibucrtc_sc1vram_w ) +{ + COMBINE_DATA(&seibucrtc_sc1vram[offset]); + tilemap_mark_tile_dirty(sc1_tilemap,offset); +} + +WRITE16_HANDLER( seibucrtc_sc3vram_w ) +{ + COMBINE_DATA(&seibucrtc_sc3vram[offset]); + tilemap_mark_tile_dirty(sc3_tilemap_0,offset); + tilemap_mark_tile_dirty(sc3_tilemap_1,offset); +} + +WRITE16_HANDLER( seibucrtc_vregs_w ) +{ + COMBINE_DATA(&seibucrtc_vregs[offset]); +} + +/* Actually external from the CRTC */ +void seibucrtc_sc0bank_w(UINT16 data) +{ + seibucrtc_sc0bank = data & 1; + tilemap_mark_all_tiles_dirty(sc0_tilemap); +} + + +/******************************* +* +* Tilemap info accesses +* +*******************************/ + +static TILE_GET_INFO( seibucrtc_sc0_tile_info ) +{ + int tile = seibucrtc_sc0vram[tile_index] & 0xfff; + int color = (seibucrtc_sc0vram[tile_index] >> 12) & 0x0f; + tile+=(seibucrtc_sc0bank<<12); + SET_TILE_INFO(1, tile, color, 0); +} + +static TILE_GET_INFO( seibucrtc_sc2_tile_info ) +{ + int tile = seibucrtc_sc2vram[tile_index] & 0xfff; + int color = (seibucrtc_sc2vram[tile_index] >> 12) & 0x0f; + SET_TILE_INFO(2, tile, color, 0); +} + +static TILE_GET_INFO( seibucrtc_sc1_tile_info ) +{ + int tile = seibucrtc_sc1vram[tile_index] & 0xfff; + int color = (seibucrtc_sc1vram[tile_index] >> 12) & 0x0f; + SET_TILE_INFO(3, tile, color, 0); +} + +static TILE_GET_INFO( seibucrtc_sc3_tile_info ) +{ + int tile = seibucrtc_sc3vram[tile_index] & 0xfff; + int color = (seibucrtc_sc3vram[tile_index] >> 12) & 0x0f; + SET_TILE_INFO(4, tile, color, 0); +} + +static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri) +{ + int offs,fx,fy,x,y,color,sprite; + int dx,dy,ax,ay; + + for (offs = 0x400-4;offs >= 0;offs -= 4) + { + if ((spriteram16[offs+0]&0x8000)!=0x8000) continue; + sprite = spriteram16[offs+1]; + if ((sprite>>14)!=pri) continue; + sprite &= 0x1fff; + + y = spriteram16[offs+3]; + x = spriteram16[offs+2]; + + if (x&0x8000) x=0-(0x200-(x&0x1ff)); + else x&=0x1ff; + if (y&0x8000) y=0-(0x200-(y&0x1ff)); + else y&=0x1ff; + + color = spriteram16[offs+0]&0x3f; + fx = spriteram16[offs+0]&0x4000; + fy = spriteram16[offs+0]&0x2000; + dy=((spriteram16[offs+0]&0x0380)>>7)+1; + dx=((spriteram16[offs+0]&0x1c00)>>10)+1; + + for (ax=0; axgfx[0], + sprite++, + color,fx,fy,x+ax*16,y+ay*16, + cliprect,TRANSPARENCY_PEN,15); + else + drawgfx(bitmap,machine->gfx[0], + sprite++, + color,fx,fy,x+(dx-1-ax)*16,y+ay*16, + cliprect,TRANSPARENCY_PEN,15); + } + } +} + +/*********************************** +* +* VIDEO_START/VIDEO_UPDATE functions +* +***********************************/ + +VIDEO_START( seibu_crtc ) +{ + sc0_tilemap = tilemap_create(machine, seibucrtc_sc0_tile_info,tilemap_scan_rows,16,16,32,32); + sc2_tilemap = tilemap_create(machine, seibucrtc_sc2_tile_info,tilemap_scan_rows,16,16,32,32); + sc1_tilemap = tilemap_create(machine, seibucrtc_sc1_tile_info,tilemap_scan_rows,16,16,32,32); + sc3_tilemap_0 = tilemap_create(machine, seibucrtc_sc3_tile_info,tilemap_scan_rows, 8, 8,32,32); + sc3_tilemap_1 = tilemap_create(machine, seibucrtc_sc3_tile_info,tilemap_scan_rows, 8, 8,64,32); + + tilemap_set_transparent_pen(sc2_tilemap,15); + tilemap_set_transparent_pen(sc1_tilemap,15); + tilemap_set_transparent_pen(sc3_tilemap_0,15); + tilemap_set_transparent_pen(sc3_tilemap_1,15); + + seibucrtc_sc0bank = 0; +} + +VIDEO_UPDATE( seibu_crtc ) +{ + bitmap_fill(bitmap, cliprect, screen->machine->pens[0x7ff]); //black pen + + tilemap_set_scrollx( sc0_tilemap,0, (SEIBU_CRTC_SC0_SX + SEIBU_CRTC_FIX_SX+64) & 0x1ff ); + tilemap_set_scrolly( sc0_tilemap,0, (SEIBU_CRTC_SC0_SY + SEIBU_CRTC_FIX_SY+1) & 0x1ff ); + tilemap_set_scrollx( sc2_tilemap,0, (SEIBU_CRTC_SC2_SX + SEIBU_CRTC_FIX_SX+64) & 0x1ff ); + tilemap_set_scrolly( sc2_tilemap,0, (SEIBU_CRTC_SC2_SY + SEIBU_CRTC_FIX_SY+1) & 0x1ff ); + tilemap_set_scrollx( sc1_tilemap,0, (SEIBU_CRTC_SC1_SX + SEIBU_CRTC_FIX_SX+64) & 0x1ff ); + tilemap_set_scrolly( sc1_tilemap,0, (SEIBU_CRTC_SC1_SY + SEIBU_CRTC_FIX_SY+1) & 0x1ff ); + tilemap_set_scrollx( SEIBU_CRTC_SC3_PAGE_SEL ? sc3_tilemap_0 : sc3_tilemap_1,0, (SEIBU_CRTC_FIX_SX+64) & 0x1ff ); + tilemap_set_scrolly( SEIBU_CRTC_SC3_PAGE_SEL ? sc3_tilemap_0 : sc3_tilemap_1,0, (SEIBU_CRTC_FIX_SY+1) & 0x1ff ); + + if(SEIBU_CRTC_ENABLE_SC0) { tilemap_draw(bitmap,cliprect,sc0_tilemap,0,0); } + if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen->machine, bitmap,cliprect, 2); } + if(SEIBU_CRTC_ENABLE_SC2) { tilemap_draw(bitmap,cliprect,sc2_tilemap,0,0); } + if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen->machine, bitmap,cliprect, 1); } + if(SEIBU_CRTC_ENABLE_SC1) { tilemap_draw(bitmap,cliprect,sc1_tilemap,0,0); } + if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen->machine, bitmap,cliprect, 0); } + if(SEIBU_CRTC_ENABLE_SC3) { tilemap_draw(bitmap,cliprect,SEIBU_CRTC_SC3_PAGE_SEL ? sc3_tilemap_0 : sc3_tilemap_1,0,0); } + if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen->machine, bitmap,cliprect, 3); } + + return 0; +} diff --git a/src/mame/video/sengokmj.c b/src/mame/video/sengokmj.c deleted file mode 100644 index 5668592fba9..00000000000 --- a/src/mame/video/sengokmj.c +++ /dev/null @@ -1,148 +0,0 @@ -/****************************************************************************************** - -Sengoku Mahjong Video Hardware section - -*******************************************************************************************/ - -#include "driver.h" - -static tilemap *bg_tilemap,*md_tilemap,*fg_tilemap,*tx_tilemap; -UINT16 *sengokmj_bgvram,*sengokmj_mdvram,*sengokmj_fgvram,*sengokmj_txvram; -static UINT16 sengokmj_layer_en; -static UINT16 sengokmj_scrolly; - -WRITE16_HANDLER( sengokmj_bgvram_w ) -{ - COMBINE_DATA(&sengokmj_bgvram[offset]); - tilemap_mark_tile_dirty(bg_tilemap,offset); -} - -WRITE16_HANDLER( sengokmj_mdvram_w ) -{ - COMBINE_DATA(&sengokmj_mdvram[offset]); - tilemap_mark_tile_dirty(md_tilemap,offset); -} - -WRITE16_HANDLER( sengokmj_fgvram_w ) -{ - COMBINE_DATA(&sengokmj_fgvram[offset]); - tilemap_mark_tile_dirty(fg_tilemap,offset); -} - -WRITE16_HANDLER( sengokmj_txvram_w ) -{ - COMBINE_DATA(&sengokmj_txvram[offset]); - tilemap_mark_tile_dirty(tx_tilemap,offset); -} - -WRITE16_HANDLER( sengokmj_layer_enable_w ) -{ - /*---- ---- ---x ---- enable sprites?*/ - /*---- ---- ---- xxxx enable layers*/ - sengokmj_layer_en = data; -} - -WRITE16_HANDLER( sengokmj_bg_scrolly_w ) -{ - sengokmj_scrolly = data; -} - -static TILE_GET_INFO( sengoku_bg_tile_info ) -{ - int tile = sengokmj_bgvram[tile_index]; - int color = (tile >> 12) & 0x0f; - SET_TILE_INFO(1, tile & 0xfff, color, 0); -} - -static TILE_GET_INFO( sengoku_md_tile_info ) -{ - int tile = sengokmj_mdvram[tile_index]; - int color = (tile >> 12) & 0x0f; - SET_TILE_INFO(2, (tile & 0xfff), color, 0); -} - -static TILE_GET_INFO( sengoku_fg_tile_info ) -{ - int tile = sengokmj_fgvram[tile_index]; - int color = (tile >> 12) & 0x0f; - SET_TILE_INFO(3, (tile & 0xfff), color, 0); -} - -static TILE_GET_INFO( sengoku_tx_tile_info ) -{ - int tile = sengokmj_txvram[tile_index]; - int color = (tile >> 12) & 0x0f; - SET_TILE_INFO(4, (tile & 0xfff), color, 0); -} - -static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri) -{ - int offs,fx,fy,x,y,color,sprite; - int dx,dy,ax,ay; - - for (offs = 0x400-4;offs >= 0;offs -= 4) - { - if ((spriteram16[offs+0]&0x8000)!=0x8000) continue; - sprite = spriteram16[offs+1]; - if ((sprite>>14)!=pri) continue; - sprite &= 0x1fff; - - y = spriteram16[offs+3]; - x = 128 + spriteram16[offs+2]; - - if (x&0x8000) x=0-(0x200-(x&0x1ff)); - //else x&=0x1ff; - if (y&0x8000) y=0-(0x200-(y&0x1ff)); - //else y&=0x1ff; - - color = spriteram16[offs+0]&0x3f; - fx = spriteram16[offs+0]&0x40; - fy = 0; /* To do - probably 0x2000 */ - dy = ((spriteram16[offs+0]&0x0380)>>7) + 1; - dx = ((spriteram16[offs+0]&0x1c00)>>10) + 1; - - for (ax=0; axgfx[0], - sprite++, - color,fx,fy,x+ax*16,y+ay*16, - cliprect,TRANSPARENCY_PEN,15); - else - drawgfx(bitmap,machine->gfx[0], - sprite++, - color,fx,fy,x+(dx-1-ax)*16,y+ay*16, - cliprect,TRANSPARENCY_PEN,15); - } - } -} - -VIDEO_START( sengokmj ) -{ - bg_tilemap = tilemap_create(machine, sengoku_bg_tile_info,tilemap_scan_rows,16,16,32,32); - md_tilemap = tilemap_create(machine, sengoku_md_tile_info,tilemap_scan_rows,16,16,32,32); - fg_tilemap = tilemap_create(machine, sengoku_fg_tile_info,tilemap_scan_rows,16,16,32,32); - tx_tilemap = tilemap_create(machine, sengoku_tx_tile_info,tilemap_scan_rows, 8, 8,64,32); - - tilemap_set_transparent_pen(md_tilemap,15); - tilemap_set_transparent_pen(fg_tilemap,15); - tilemap_set_transparent_pen(tx_tilemap,15); -} - -VIDEO_UPDATE( sengokmj ) -{ - bitmap_fill(bitmap, cliprect, screen->machine->pens[0x7ff]); //black pen - tilemap_set_scrolly( bg_tilemap,0, sengokmj_scrolly ); - - if(!(sengokmj_layer_en & 1)) { tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); } - if(!(sengokmj_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 2); } - if(!(sengokmj_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 1); } - if(!(sengokmj_layer_en & 2)) { tilemap_draw(bitmap,cliprect,md_tilemap,0,0); } - if(!(sengokmj_layer_en & 4)) { tilemap_draw(bitmap,cliprect,fg_tilemap,0,0); } - if(!(sengokmj_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 0); } - if(!(sengokmj_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 3); } - if(!(sengokmj_layer_en & 8)) { tilemap_draw(bitmap,cliprect,tx_tilemap,0,0); } - -// popmessage("%04x",sengokmj_layer_en); - return 0; -}