diff --git a/src/mame/drivers/srmp5.c b/src/mame/drivers/srmp5.c index 57304479ede..e38b2a83235 100644 --- a/src/mame/drivers/srmp5.c +++ b/src/mame/drivers/srmp5.c @@ -26,20 +26,32 @@ SX008-12.BIN ; | SX008-13.BIN ; | SX008-14.BIN ; / + +Note: + +attract sound ON/OFF of DIPSW doesn't work. +This is not a bug (real machine behaves the same). */ #include "driver.h" +#include "deprecat.h" #include "cpu/z80/z80.h" #include "cpu/mips/r3000.h" #include "sound/st0016.h" #include "st0016.h" +#define DEBUG_CHAR extern UINT8 *st0016_charram; static UINT32 databank; - -static UINT16 *tileram; +static UINT32 srmp5_vidregs[0x120 / 4]; +static UINT16 *tileram, *palram; static UINT16 *sprram; +static UINT8 cmd1 = 0, cmd2 = 0, cmd_stat = 0; + +#ifdef DEBUG_CHAR +static UINT8 tileduty[0x2000]; +#endif #define SPRITE_GLOBAL_X 0 #define SPRITE_GLOBAL_Y 1 @@ -63,15 +75,49 @@ static UINT16 *sprram; static VIDEO_UPDATE( srmp5 ) { - // sprite/tile flipping is not implemented - int x,y,address,xs,ys,height,width,xw,yw,sprite,xb,yb,sizex,sizey; + int x,y,address,xs,xs2,ys,ys2,height,width,xw,yw,xb,yb,sizex,sizey; UINT16 *sprite_list=sprram; - UINT16 *sprite_list_end=&sprram[0x1000]; //guess + UINT16 *sprite_list_end=&sprram[0x4000]; //guess UINT8 *pixels=(UINT8 *)tileram; const rectangle *visarea = video_screen_get_visible_area(screen); - bitmap_fill(bitmap,cliprect,0); +//Table surface seems to be tiles, but display corrupts when switching the scene if always ON. +//Currently the tiles are OFF. +#ifdef BG_ENABLE + UINT8 tile_width = (srmp5_vidregs[2] >> 0) & 0xFF; + UINT8 tile_height = (srmp5_vidregs[2] >> 8) & 0xFF; + if(tile_width && tile_height) + { + // 16x16 tile + UINT16 *map = &sprram[0x2000]; + for(yw = 0; yw < tile_height; yw++) + { + for(xw = 0; xw < tile_width; xw++) + { + UINT16 tile = map[yw * 128 + xw * 2]; + if(tile >= 0x2000) continue; + address = tile * SPRITE_DATA_GRANULARITY; + for(y = 0; y < 16; y++) + { + for(x = 0; x < 16; x++) + { + UINT8 pen = pixels[address]; + if(pen) + { + UINT16 pixdata=palram[pen]; + *BITMAP_ADDR32(bitmap, yw * 16 + y, xw * 16 + x) = ((pixdata&0x7c00)>>7) | ((pixdata&0x3e0)<<6) | ((pixdata&0x1f)<<19); + } + address++; + } + } + } + } + } + else +#else + bitmap_fill(bitmap,cliprect,0); +#endif while((sprite_list[SUBLIST_OFFSET]&SPRITE_LIST_END_MARKER)==0 && sprite_list>4)&0xf; + width =(sprite_sublist[SPRITE_SIZE]>> 4)&0xf; height=(sprite_sublist[SPRITE_SIZE]>>12)&0xf; sizex=(sprite_sublist[SPRITE_SIZE]>>0)&0xf; sizey=(sprite_sublist[SPRITE_SIZE]>>8)&0xf; - address=sprite*SPRITE_DATA_GRANULARITY; + address=(sprite_sublist[SPRITE_TILE] & ~(sprite_sublist[SPRITE_SIZE] >> 11 & 7))*SPRITE_DATA_GRANULARITY; + y -= (height + 1) * (sizey + 1)-1; for(xw=0;xw<=width;xw++) + { + xb = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (width-xw)*(sizex+1)+x: xw*(sizex+1)+x; for(yw=0;yw<=height;yw++) { - xb=x+xw*(sizex+1); - yb=y+yw*(sizey+1); + yb = yw*(sizey+1)+y; for(ys=0;ys<=sizey;ys++) { + ys2 = (sprite_sublist[SPRITE_PALETTE] & 0x4000) ? ys : (sizey - ys); for(xs=0;xs<=sizex;xs++) { - UINT32 pen=pixels[address&(0x100000-1)]; - + UINT8 pen=pixels[address&(0x100000-1)]; + xs2 = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (sizex - xs) : xs; if(pen) { - if(xb+xs<=visarea->max_x && xb+xs>=visarea->min_x && yb+ys<=visarea->max_y && yb+ys>=visarea->min_y ) + if(xb+xs2<=visarea->max_x && xb+xs2>=visarea->min_x && yb+ys2<=visarea->max_y && yb+ys2>=visarea->min_y ) { - UINT32 pixdata=paletteram32[pen+((sprite_sublist[SPRITE_PALETTE]&0xff)<<8)]; - *BITMAP_ADDR32(bitmap, yb+ys, xb+xs) = ((pixdata&0x7c00)>>7) | ((pixdata&0x3e0)<<6) | ((pixdata&0x1f)<<19); + UINT16 pixdata=palram[pen+((sprite_sublist[SPRITE_PALETTE]&0xff)<<8)]; + *BITMAP_ADDR32(bitmap, yb+ys2, xb+xs2) = ((pixdata&0x7c00)>>7) | ((pixdata&0x3e0)<<6) | ((pixdata&0x1f)<<19); } } ++address; } } - } + } sprite_sublist+=SPRITE_SUBLIST_ENTRY_LENGTH; --sublist_length; } @@ -125,9 +173,32 @@ static VIDEO_UPDATE( srmp5 ) sprite_list+=SPRITE_LIST_ENTRY_LENGTH; } +#ifdef DEBUG_CHAR + { + int i; + for(i = 0; i < 0x2000; i++) + { + if(tileduty[i] == 1) + { + decodechar(screen->machine->gfx[0], i, (UINT8 *)tileram); + tileduty[i] = 0; + } + } + } +#endif return 0; } +static READ32_HANDLER(srmp5_palette_r) +{ + return palram[offset]; +} + +static WRITE32_HANDLER(srmp5_palette_w) +{ + COMBINE_DATA(&palram[offset]); + palette_set_color(space->machine, offset, MAKE_RGB(data << 3 & 0xFF, data >> 2 & 0xFF, data >> 7 & 0xFF)); +} static WRITE32_HANDLER(bank_w) { COMBINE_DATA(&databank); @@ -135,24 +206,25 @@ static WRITE32_HANDLER(bank_w) static READ32_HANDLER(tileram_r) { - return videoram32[offset]; + return tileram[offset]; } static WRITE32_HANDLER(tileram_w) { - COMBINE_DATA(&videoram32[offset]); - tileram[offset]=videoram32[offset]&0xffff; + tileram[offset] = data & 0xFFFF; //lower 16bit only +#ifdef DEBUG_CHAR + tileduty[offset >> 6] = 1; +#endif } static READ32_HANDLER(spr_r) { - return spriteram32[offset]; + return sprram[offset]; } static WRITE32_HANDLER(spr_w) { - COMBINE_DATA(&spriteram32[offset]); - sprram[offset]=spriteram32[offset]; + sprram[offset] = data & 0xFFFF; //lower 16bit only } static READ32_HANDLER(data_r) @@ -164,22 +236,91 @@ static READ32_HANDLER(data_r) return data|(data<<16); } +static UINT8 input_select = 0; + +static WRITE32_HANDLER(input_select_w) +{ + input_select = data & 0x0F; +} + +static READ32_HANDLER(srmp5_inputs_r) +{ + UINT32 ret = 0; + switch(input_select) + { + case 0x01: + ret = input_port_read(space->machine, "IN0"); + break; + case 0x02: + ret = input_port_read(space->machine, "IN1"); + break; + case 0x04: + ret = input_port_read(space->machine, "IN2"); + break; + case 0x00: + case 0x08: + ret = input_port_read(space->machine, "IN3"); + break; + } + return ret; +} + +//almost all cmds are sound related +static WRITE32_HANDLER(cmd1_w) +{ + cmd1 = data & 0xFF; + logerror("cmd1_w %08X\n", data); +} + +static WRITE32_HANDLER(cmd2_w) +{ + cmd2 = data & 0xFF; + cmd_stat = 5; + logerror("cmd2_w %08X\n", data); +} + +static READ32_HANDLER(cmd_stat32_r) +{ + return cmd_stat; +} + +static READ32_HANDLER(srmp5_vidregs_r) +{ + logerror("vidregs read %08X %08X\n", offset << 2, srmp5_vidregs[offset]); + return srmp5_vidregs[offset]; +} + +static WRITE32_HANDLER(srmp5_vidregs_w) +{ + COMBINE_DATA(&srmp5_vidregs[offset]); + if(offset != 0x10C / 4) + logerror("vidregs write %08X %08X\n", offset << 2, srmp5_vidregs[offset]); +} + static ADDRESS_MAP_START( srmp5_mem, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x00000000, 0x000fffff) AM_RAM //maybe 0 - 2fffff ? AM_RANGE(0x002f0000, 0x002f7fff) AM_RAM AM_RANGE(0x01000000, 0x01000003) AM_WRITE(SMH_RAM) // 0xaa .. watchdog ? - AM_RANGE(0x01800004, 0x01800007) AM_READ_PORT("IN0") - AM_RANGE(0x01800008, 0x0180000b) AM_READ_PORT("IN1") + AM_RANGE(0x01800000, 0x01800003) AM_RAM //?1 + AM_RANGE(0x01800004, 0x01800007) AM_READ_PORT("DSW1") + AM_RANGE(0x01800008, 0x0180000b) AM_READ_PORT("DSW2") AM_RANGE(0x0180000c, 0x0180000f) AM_WRITE(bank_w) - AM_RANGE(0x01800010, 0x01800013) AM_READ_PORT("IN2") //multiplexed controls (selected by writes to 1c) - AM_RANGE(0x01800014, 0x01800017) AM_READ_PORT("IN3") - AM_RANGE(0x0180001c, 0x0180001f) AM_WRITE(SMH_RAM)//c1 c2 c4 c8 => mahjong inputs (at $10) - bits 0-3 - AM_RANGE(0x01800200, 0x0180020f) AM_RAM //sound related ? only few writes after boot + AM_RANGE(0x01800010, 0x01800013) AM_READ(srmp5_inputs_r) //multiplexed controls (selected by writes to 1c) + AM_RANGE(0x01800014, 0x01800017) AM_READ_PORT("TEST") + AM_RANGE(0x0180001c, 0x0180001f) AM_WRITE(input_select_w)//c1 c2 c4 c8 => mahjong inputs (at $10) - bits 0-3 + AM_RANGE(0x01800200, 0x01800203) AM_RAM //sound related ? only few writes after boot + AM_RANGE(0x01802000, 0x01802003) AM_WRITE(cmd1_w) + AM_RANGE(0x01802004, 0x01802007) AM_WRITE(cmd2_w) + AM_RANGE(0x01802008, 0x0180200b) AM_READ(cmd_stat32_r) AM_RANGE(0x01a00000, 0x01bfffff) AM_READ(data_r) + AM_RANGE(0x01c00000, 0x01c00003) AM_READNOP // debug? 'Toru' - AM_RANGE(0x0a000000, 0x0a0fffff) AM_READWRITE(spr_r, spr_w) AM_BASE(&spriteram32) - AM_RANGE(0x0a100000, 0x0a1fffff) AM_RAM AM_BASE(&paletteram32) - AM_RANGE(0x0a200000, 0x0a3fffff) AM_READWRITE(tileram_r, tileram_w) AM_BASE(&videoram32) + AM_RANGE(0x0a000000, 0x0a0fffff) AM_READWRITE(spr_r, spr_w) + AM_RANGE(0x0a100000, 0x0a17ffff) AM_READWRITE(srmp5_palette_r, srmp5_palette_w) + //0クリアしないと進まないので + AM_RANGE(0x0a180000, 0x0a180003) AM_READNOP // write 0x00000400 + AM_RANGE(0x0a180000, 0x0a18011f) AM_READWRITE(srmp5_vidregs_r, srmp5_vidregs_w) + AM_RANGE(0x0a200000, 0x0a3fffff) AM_READWRITE(tileram_r, tileram_w) AM_RANGE(0x1eff0000, 0x1eff001f) AM_WRITE(SMH_RAM) AM_RANGE(0x1eff003c, 0x1eff003f) AM_READNOP @@ -190,425 +331,133 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( st0016_mem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1) - 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) AM_RAM_WRITE(st0016_snd_w) AM_BASE(&st0016_sound_regs) - 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 ADDRESS_MAP_END READ8_HANDLER(st0016_dma_r); +static READ8_HANDLER(cmd1_r) +{ + cmd_stat = 0; + return cmd1; +} + +static READ8_HANDLER(cmd2_r) +{ + return cmd2; +} + +static READ8_HANDLER(cmd_stat8_r) +{ + return cmd_stat; +} + static ADDRESS_MAP_START( st0016_io, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w) - AM_RANGE(0xc0, 0xc3) AM_NOP // data from other cpu ? - AM_RANGE(0xe0, 0xe0) AM_WRITENOP + 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(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(0xe7, 0xe7) AM_WRITE(st0016_rom_bank_w) AM_RANGE(0xf0, 0xf0) AM_READ(st0016_dma_r) ADDRESS_MAP_END static INPUT_PORTS_START( srmp5 ) - PORT_START("IN0") - PORT_DIPNAME( 0x0001, 0x0001, "0-0" ) - PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0002, 0x0002, "0-1" ) - PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0004, 0x0004, "0-2" ) - PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0008, 0x0008, "0-3" ) - PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0010, 0x0010, "0-4" ) - PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0020, 0x0020, "0-5" ) - PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0040, 0x0040, "0-6" ) + PORT_START("DSW1") + PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) ) + PORT_DIPSETTING( 0x0001, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x0002, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x0003, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) + PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) ) + PORT_DIPSETTING( 0x0008, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x0010, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x0018, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x0030, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) ) + PORT_DIPNAME( 0x0040, 0x0040, "PUT" ) + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0040, DEF_STR( On ) ) + PORT_DIPNAME( 0x0080, 0x0080, "Unknown" ) + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0080, DEF_STR( On ) ) + PORT_BIT( 0xffffff00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("DSW2") + PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Difficulty ) ) + PORT_DIPSETTING( 0x0000, "8" ) + PORT_DIPSETTING( 0x0001, "7" ) + PORT_DIPSETTING( 0x0002, "6" ) + PORT_DIPSETTING( 0x0003, "5" ) + PORT_DIPSETTING( 0x0007, "4" ) + PORT_DIPSETTING( 0x0006, "1" ) + PORT_DIPSETTING( 0x0005, "2" ) + PORT_DIPSETTING( 0x0004, "3" ) + PORT_DIPNAME( 0x0008, 0x0008, "Kuitan" ) + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0008, DEF_STR( On ) ) + PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Allow_Continue ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0010, DEF_STR( On ) ) + PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) ) + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0020, DEF_STR( On ) ) + PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) ) PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0080, 0x0080, "0-7" ) + PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Test ) ) PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0100, 0x0100, "0-8" ) - PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0200, 0x0200, "0-9" ) - PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0400, 0x0400, "0-a" ) - PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0800, 0x0800, "0-b" ) - PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x1000, 0x1000, "0-c" ) - PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x2000, 0x2000, "0-d" ) - PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x4000, 0x4000, "0-e" ) - PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x8000, 0x8000, "0-f" ) - PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00010000, 0x00010000, "0-10" ) - PORT_DIPSETTING( 0x00010000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00020000, 0x00020000, "0-11" ) - PORT_DIPSETTING( 0x00020000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00040000, 0x00040000, "0-12" ) - PORT_DIPSETTING( 0x00040000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00080000, 0x00080000, "0-13" ) - PORT_DIPSETTING( 0x00080000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00100000, 0x00100000, "0-14" ) - PORT_DIPSETTING( 0x00100000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00200000, 0x00200000, "0-15" ) - PORT_DIPSETTING( 0x00200000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00400000, 0x00400000, "0-16" ) - PORT_DIPSETTING( 0x00400000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00800000, 0x00800000, "0-17" ) - PORT_DIPSETTING( 0x00800000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x01000000, 0x01000000, "0-18" ) - PORT_DIPSETTING( 0x01000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x02000000, 0x02000000, "0-19" ) - PORT_DIPSETTING( 0x02000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x04000000, 0x04000000, "0-1a" ) - PORT_DIPSETTING( 0x04000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x08000000, 0x08000000, "0-1b" ) - PORT_DIPSETTING( 0x08000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x10000000, 0x10000000, "0-1c" ) - PORT_DIPSETTING( 0x10000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x20000000, 0x20000000, "0-1d" ) - PORT_DIPSETTING( 0x20000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x40000000, 0x40000000, "0-1e" ) - PORT_DIPSETTING( 0x40000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x80000000, 0x80000000, "0-1f" ) - PORT_DIPSETTING( 0x80000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) + PORT_BIT ( 0xffffff00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("IN0") + PORT_BIT ( 0xfffffff0, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded + PORT_BIT ( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_D ) + PORT_BIT ( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_H ) + PORT_BIT ( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_L ) + PORT_BIT ( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_START("IN1") - PORT_DIPNAME( 0x0001, 0x0001, "1-0" ) - PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0002, 0x0002, "1-1" ) - PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0004, 0x0004, "1-2" ) - PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0008, 0x0008, "1-3" ) - PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0010, 0x0010, "1-4" ) - PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0020, 0x0020, "1-5" ) - PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0040, 0x0040, "1-6" ) - PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0080, 0x0080, "Test mode" ) - PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0100, 0x0100, "1-8" ) - PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0200, 0x0200, "1-9" ) - PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0400, 0x0400, "1-a" ) - PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0800, 0x0800, "1-b" ) - PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x1000, 0x1000, "1-c" ) - PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x2000, 0x2000, "1-d" ) - PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x4000, 0x4000, "1-e" ) - PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x8000, 0x8000, "1-f" ) - PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - - PORT_DIPNAME( 0x00010000, 0x00010000, "1-10" ) - PORT_DIPSETTING( 0x00010000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00020000, 0x00020000, "1-11" ) - PORT_DIPSETTING( 0x00020000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00040000, 0x00040000, "1-12" ) - PORT_DIPSETTING( 0x00040000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00080000, 0x00080000, "1-13" ) - PORT_DIPSETTING( 0x00080000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00100000, 0x00100000, "1-14" ) - PORT_DIPSETTING( 0x00100000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00200000, 0x00200000, "1-15" ) - PORT_DIPSETTING( 0x00200000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00400000, 0x00400000, "1-16" ) - PORT_DIPSETTING( 0x00400000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00800000, 0x00800000, "1-17" ) - PORT_DIPSETTING( 0x00800000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x01000000, 0x01000000, "1-18" ) - PORT_DIPSETTING( 0x01000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x02000000, 0x02000000, "1-19" ) - PORT_DIPSETTING( 0x02000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x04000000, 0x04000000, "1-1a" ) - PORT_DIPSETTING( 0x04000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x08000000, 0x08000000, "1-1b" ) - PORT_DIPSETTING( 0x08000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x10000000, 0x10000000, "1-1c" ) - PORT_DIPSETTING( 0x10000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x20000000, 0x20000000, "1-1d" ) - PORT_DIPSETTING( 0x20000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x40000000, 0x40000000, "1-1e" ) - PORT_DIPSETTING( 0x40000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x80000000, 0x80000000, "1-1f" ) - PORT_DIPSETTING( 0x80000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) + PORT_BIT ( 0xffffffc0, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded + PORT_BIT ( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_A ) + PORT_BIT ( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_E ) + PORT_BIT ( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_I ) + PORT_BIT ( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_M ) + PORT_BIT ( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) + PORT_BIT ( 0x00000020, IP_ACTIVE_LOW, IPT_START1 ) PORT_START("IN2") - PORT_DIPNAME( 0x0001, 0x0001, "2-0" ) - PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0002, 0x0002, "2-1" ) - PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0004, 0x0004, "2-2" ) - PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0008, 0x0008, "2-3" ) - PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0010, 0x0010, "2-4" ) - PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) - PORT_DIPNAME( 0x0040, 0x0040, "2-5" ) - PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_DIPNAME( 0x0100, 0x0100, "2-8" ) - PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0200, 0x0200, "2-9" ) - PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0400, 0x0400, "2-a" ) - PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0800, 0x0800, "2-b" ) - PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x1000, 0x1000, "2-c" ) - PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x2000, 0x2000, "2-d" ) - PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x4000, 0x4000, "2-e" ) - PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x8000, 0x8000, "2-f" ) - PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - - PORT_DIPNAME( 0x00010000, 0x00010000, "2-10" ) - PORT_DIPSETTING( 0x00010000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00020000, 0x00020000, "2-11" ) - PORT_DIPSETTING( 0x00020000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00040000, 0x00040000, "2-12" ) - PORT_DIPSETTING( 0x00040000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00080000, 0x00080000, "2-13" ) - PORT_DIPSETTING( 0x00080000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00100000, 0x00100000, "2-14" ) - PORT_DIPSETTING( 0x00100000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00200000, 0x00200000, "2-15" ) - PORT_DIPSETTING( 0x00200000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00400000, 0x00400000, "2-16" ) - PORT_DIPSETTING( 0x00400000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00800000, 0x00800000, "2-17" ) - PORT_DIPSETTING( 0x00800000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x01000000, 0x01000000, "2-18" ) - PORT_DIPSETTING( 0x01000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x02000000, 0x02000000, "2-19" ) - PORT_DIPSETTING( 0x02000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x04000000, 0x04000000, "2-1a" ) - PORT_DIPSETTING( 0x04000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x08000000, 0x08000000, "2-1b" ) - PORT_DIPSETTING( 0x08000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x10000000, 0x10000000, "2-1c" ) - PORT_DIPSETTING( 0x10000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x20000000, 0x20000000, "2-1d" ) - PORT_DIPSETTING( 0x20000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x40000000, 0x40000000, "2-1e" ) - PORT_DIPSETTING( 0x40000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x80000000, 0x80000000, "2-1f" ) - PORT_DIPSETTING( 0x80000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) + PORT_BIT ( 0xffffffe0, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded + PORT_BIT ( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_B ) + PORT_BIT ( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_F ) + PORT_BIT ( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_J ) + PORT_BIT ( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_N ) + PORT_BIT ( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_START("IN3") - PORT_DIPNAME( 0x0001, 0x0001, "3-0" ) - PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0002, 0x0002, "3-1" ) - PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0004, 0x0004, "3-2" ) - PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0008, 0x0008, "3-3" ) - PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0010, 0x0010, "3-4" ) - PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0020, 0x0020, "3-5" ) - PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0040, 0x0040, "3-6" ) - PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0080, 0x0080, "3-7" ) - PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0100, 0x0100, "3-8" ) - PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0200, 0x0200, "3-9" ) - PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0400, 0x0400, "3-a" ) - PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0800, 0x0800, "3-b" ) - PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x1000, 0x1000, "3-c" ) - PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x2000, 0x2000, "3-d" ) - PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x4000, 0x4000, "3-e" ) - PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x8000, 0x8000, "3-f" ) - PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + PORT_BIT ( 0xffffff60, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded + PORT_BIT ( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_C ) + PORT_BIT ( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_G ) + PORT_BIT ( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_K ) + PORT_BIT ( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) + PORT_BIT ( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) + PORT_BIT ( 0x00000080, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) + + PORT_START("TEST") + PORT_BIT ( 0x00000080, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_CODE(KEYCODE_F2) + PORT_BIT ( 0xffffff7f, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded - PORT_DIPNAME( 0x00010000, 0x00010000, "3-10" ) - PORT_DIPSETTING( 0x00010000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00020000, 0x00020000, "3-11" ) - PORT_DIPSETTING( 0x00020000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00040000, 0x00040000, "3-12" ) - PORT_DIPSETTING( 0x00040000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00080000, 0x00080000, "3-13" ) - PORT_DIPSETTING( 0x00080000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00100000, 0x00100000, "3-14" ) - PORT_DIPSETTING( 0x00100000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00200000, 0x00200000, "3-15" ) - PORT_DIPSETTING( 0x00200000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00400000, 0x00400000, "3-16" ) - PORT_DIPSETTING( 0x00400000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00800000, 0x00800000, "3-17" ) - PORT_DIPSETTING( 0x00800000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x01000000, 0x01000000, "3-18" ) - PORT_DIPSETTING( 0x01000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x02000000, 0x02000000, "3-19" ) - PORT_DIPSETTING( 0x02000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x04000000, 0x04000000, "3-1a" ) - PORT_DIPSETTING( 0x04000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x08000000, 0x08000000, "3-1b" ) - PORT_DIPSETTING( 0x08000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x10000000, 0x10000000, "3-1c" ) - PORT_DIPSETTING( 0x10000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x20000000, 0x20000000, "3-1d" ) - PORT_DIPSETTING( 0x20000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x40000000, 0x40000000, "3-1e" ) - PORT_DIPSETTING( 0x40000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x80000000, 0x80000000, "3-1f" ) - PORT_DIPSETTING( 0x80000000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) INPUT_PORTS_END static const st0016_interface st0016_config = @@ -616,9 +465,14 @@ static const st0016_interface st0016_config = &st0016_charram }; - static INTERRUPT_GEN( irq4_gen ) +//It seems that interrupt flags are never cleared, so I use last line only. + +static INTERRUPT_GEN( irq4_gen ) { - cpu_set_input_line(device, R3000_IRQ4, ASSERT_LINE); + if(cpu_getiloops(device) == 0) + cpu_set_input_line(device, R3000_IRQ4, ASSERT_LINE); + else + cpu_set_input_line(device, R3000_IRQ4, CLEAR_LINE); } static const r3000_cpu_core config = @@ -628,6 +482,35 @@ static const r3000_cpu_core config = 4096 /* data cache size */ }; +static const gfx_layout tile_16x8x8_layout = +{ + 16,8, + RGN_FRAC(1,1), + 8, + { STEP8(0, 1) }, + { STEP16(0, 8) }, + { STEP8(0, 8*16) }, + 16*8*8 +}; + +#if 0 +static const gfx_layout tile_16x16x8_layout = +{ + 16,16, + RGN_FRAC(1,1), + 8, + { STEP8(0, 1) }, + { STEP16(0, 8) }, + { STEP16(0, 8*16) }, + 16*16*8 +}; +#endif + +static GFXDECODE_START( srmp5 ) + GFXDECODE_ENTRY( "gfx1", 0, tile_16x8x8_layout, 0x0, 0x800 ) +// GFXDECODE_ENTRY( "gfx1", 0, tile_16x16x8_layout, 0x0, 0x800 ) +GFXDECODE_END + static MACHINE_DRIVER_START( srmp5 ) /* basic machine hardware */ MDRV_CPU_ADD("main",Z80,8000000) @@ -638,20 +521,22 @@ static MACHINE_DRIVER_START( srmp5 ) MDRV_CPU_ADD("sub", R3000LE, 25000000) MDRV_CPU_CONFIG(config) MDRV_CPU_PROGRAM_MAP(srmp5_mem,0) - MDRV_CPU_VBLANK_INT("main", irq4_gen) + //256は適当 + MDRV_CPU_VBLANK_INT_HACK(irq4_gen, 256) MDRV_QUANTUM_TIME(HZ(6000)) /* video hardware */ MDRV_SCREEN_ADD("main", RASTER) MDRV_SCREEN_REFRESH_RATE(60) - MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) - MDRV_SCREEN_SIZE(512, 512) - MDRV_SCREEN_VISIBLE_AREA(4, 339, 32, 271) - - MDRV_PALETTE_LENGTH(16*16*4+1) + MDRV_SCREEN_SIZE(96*8, 64*8) + MDRV_SCREEN_VISIBLE_AREA(0*8, 42*8-1, 2*8, 32*8-1) + MDRV_PALETTE_LENGTH(0x1800) +#ifdef DEBUG_CHAR + MDRV_GFXDECODE( srmp5 ) +#endif MDRV_VIDEO_START(st0016) MDRV_VIDEO_UPDATE(srmp5) @@ -683,13 +568,21 @@ ROM_START( srmp5 ) ROM_LOAD( "sx008-05.bin", 0x800000, 0x200000, CRC(0ff5e6f5) SHA1(ab7d021757f341d28db6d7d009c20ec9d7bd83c1) ) ROM_LOAD( "sx008-06.bin", 0xa00000, 0x200000, CRC(ba6fd7c4) SHA1(f086195c5c647e07e77ce2a23e94d28e6ad9ff4f) ) ROM_LOAD( "sx008-07.bin", 0xc00000, 0x200000, CRC(3564485d) SHA1(12464de4e2b6c4df1595183996d1987f0ecffb01) ) +#ifdef DEBUG_CHAR + ROM_REGION( 0x100000, "gfx1", 0) + ROM_FILL( 0, 0x100000, 0x00) +#endif ROM_END static DRIVER_INIT(srmp5) { st0016_game=9; - tileram=(UINT16*)auto_malloc(0x100000); - sprram=(UINT16*)auto_malloc(0x080000); + tileram = (UINT16 *)auto_malloc(0x100000); + sprram = (UINT16 *)auto_malloc(0x080000); + palram = (UINT16 *)auto_malloc(0x040000); +#ifdef DEBUG_CHAR + memset(tileduty, 1, 0x2000); +#endif } -GAME( 1994, srmp5, 0, srmp5, srmp5, srmp5, ROT0, "Seta", "Super Real Mahjong P5", GAME_NOT_WORKING) +GAME( 1994, srmp5, 0, srmp5, srmp5, srmp5, ROT0, "Seta", "Super Real Mahjong P5", GAME_IMPERFECT_GRAPHICS)