hng64: Added preliminary hook-up for multi-byte chain mode for sprites, used by Buriki One and the two Samurai Shodown games [David Haywood, Angelo Salese]

hng64: Fixed back plane color, thus giving characteristic blue background for POST screen [Angelo Salese]
hng64: Improved Dual Port emulation, fixing the POST errors about it  [Angelo Salese]
This commit is contained in:
Angelo Salese 2009-11-21 18:37:59 +00:00
parent f3d64920aa
commit 1bae8ae070
2 changed files with 82 additions and 54 deletions

View File

@ -454,6 +454,7 @@ or Fatal Fury for example).
static int hng64_mcu_type = 0; static int hng64_mcu_type = 0;
static UINT32 fake_mcu_time; static UINT32 fake_mcu_time;
static UINT16 hng_mcu_en;
#define FIGHT_MCU 1 #define FIGHT_MCU 1
#define SHOOT_MCU 2 #define SHOOT_MCU 2
#define RACING_MCU 3 #define RACING_MCU 3
@ -634,15 +635,15 @@ static READ32_HANDLER( hng64_sysregs_r )
mame_system_time systime; mame_system_time systime;
mame_get_base_datetime(space->machine, &systime); mame_get_base_datetime(space->machine, &systime);
//if(((offset*4) & 0xff00) == 0x2100) // if((offset*4) != 0x1084)
// printf("HNG64 port read (PC=%08x) 0x%08x\n", cpu_get_pc(space->cpu),offset*4); // printf("HNG64 port read (PC=%08x) 0x%08x\n", cpu_get_pc(space->cpu),offset*4);
switch(offset*4) switch(offset*4)
{ {
case 0x001c: return mame_rand(space->machine); // hng64 hangs on start-up if zero. case 0x001c: return mame_rand(space->machine); // hng64 hangs on start-up if zero.
//case 0x106c: //case 0x106c:
//case 0x107c: //case 0x107c:
case 0x1084: return 0x00000002; //??? case 0x1084: return 0x00000002; //MCU->MIPS latch port
//case 0x108c: //case 0x108c:
case 0x1104: return hng64_interrupt_level_request; case 0x1104: return hng64_interrupt_level_request;
case 0x1254: return 0x00000000; //dma status, 0x800 case 0x1254: return 0x00000000; //dma status, 0x800
@ -709,15 +710,19 @@ static WRITE32_HANDLER( hng64_sysregs_w )
COMBINE_DATA (&hng64_sysregs[offset]); COMBINE_DATA (&hng64_sysregs[offset]);
switch(offset*4) switch(offset*4)
{ {
case 0x111c: /* irq ack */ break; case 0x1084: //MIPS->MCU latch port
hng_mcu_en = (data & 0xff); //command-based, i.e. doesn't control halt line and such?
printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, hng64_sysregs[offset], cpu_get_pc(space->cpu));
break;
case 0x111c: /*irq ack */ break;
case 0x1204: hng_dma_start = hng64_sysregs[offset]; break; case 0x1204: hng_dma_start = hng64_sysregs[offset]; break;
case 0x1214: hng_dma_dst = hng64_sysregs[offset]; break; case 0x1214: hng_dma_dst = hng64_sysregs[offset]; break;
case 0x1224: case 0x1224:
hng_dma_len = hng64_sysregs[offset]; hng_dma_len = hng64_sysregs[offset];
hng64_do_dma(space); hng64_do_dma(space);
break; break;
default: //default:
logerror("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, hng64_sysregs[offset], cpu_get_pc(space->cpu)); //printf("HNG64 writing to SYSTEM Registers 0x%08x == 0x%08x. (PC=%08x)\n", offset*4, hng64_sysregs[offset], cpu_get_pc(space->cpu));
} }
} }
@ -745,7 +750,9 @@ static READ32_HANDLER( fight_io_r )
case 0x000: return 0x00000400; case 0x000: return 0x00000400;
case 0x004: return input_port_read(space->machine, "SYSTEM"); case 0x004: return input_port_read(space->machine, "SYSTEM");
case 0x008: return input_port_read(space->machine, "P1_P2"); case 0x008: return input_port_read(space->machine, "P1_P2");
case 0x600: return no_machine_error_code; case 0x600:
printf("%04x\n",hng_mcu_en);
return no_machine_error_code;
} }
return hng64_dualport[offset]; return hng64_dualport[offset];
@ -787,10 +794,13 @@ static READ32_HANDLER( shoot_io_r )
{ {
case 0x000: case 0x000:
{ {
if(cpu_get_pc(space->cpu) == 0x8000e040 || cpu_get_pc(space->cpu) == 0x80012fc0) //i/o init 1 if(fake_mcu_time < 0x100)//i/o init
{
fake_mcu_time++;
return 0x400; return 0x400;
}
return 0; else
return 0x000;
} }
case 0x010: return input_port_read(space->machine, "D_IN"); case 0x010: return input_port_read(space->machine, "D_IN");
case 0x018: case 0x018:
@ -833,7 +843,20 @@ static READ32_HANDLER( racing_io_r )
static READ32_HANDLER( hng64_dualport_r ) static READ32_HANDLER( hng64_dualport_r )
{ {
printf("dualport R %08x %08x (PC=%08x)\n", offset*4, hng64_dualport[offset], cpu_get_pc(space->cpu)); // printf("dualport R %08x %08x (PC=%08x)\n", offset*4, hng64_dualport[offset], cpu_get_pc(space->cpu));
/*
command table:
0x0b = ? mode input polling (sams64, bbust2, sams64_2 & roadedge) (*)
0x0c = cut down connections, treats the dualport to be normal RAM
0x11 = ? mode input polling (fatfurwa, xrally, buriki) (*)
0x20 = asks for MCU machine code
(*) 0x11 is followed by 0x0b if the latter is used, JVS-esque indirect/direct mode?
*/
if(hng_mcu_en == 0x0c)
return hng64_dualport[offset];
switch(hng64_mcu_type) switch(hng64_mcu_type)
{ {
@ -843,12 +866,12 @@ static READ32_HANDLER( hng64_dualport_r )
case SAMSHO_MCU: return samsho_io_r(space, offset,0xffffffff); case SAMSHO_MCU: return samsho_io_r(space, offset,0xffffffff);
} }
return mame_rand(space->machine)&0xffffffff; return hng64_dualport[offset];
} }
static WRITE32_HANDLER( hng64_dualport_w ) static WRITE32_HANDLER( hng64_dualport_w )
{ {
printf("dualport WRITE %08x %08x (PC=%08x)\n", offset*4, hng64_dualport[offset], cpu_get_pc(space->cpu)); // printf("dualport WRITE %08x %08x (PC=%08x)\n", offset*4, hng64_dualport[offset], cpu_get_pc(space->cpu));
COMBINE_DATA (&hng64_dualport[offset]); COMBINE_DATA (&hng64_dualport[offset]);
} }
@ -1733,13 +1756,12 @@ static MACHINE_RESET(hyperneo)
cputag_set_input_line(machine, "comm", INPUT_LINE_RESET, PULSE_LINE); // reset the CPU and let 'er rip cputag_set_input_line(machine, "comm", INPUT_LINE_RESET, PULSE_LINE); // reset the CPU and let 'er rip
// cputag_set_input_line(machine, "comm", INPUT_LINE_HALT, ASSERT_LINE); // hold on there pardner... // cputag_set_input_line(machine, "comm", INPUT_LINE_HALT, ASSERT_LINE); // hold on there pardner...
// "Display List" init - ugly // "Display List" init - ugly
activeBuffer = 0 ; activeBuffer = 0 ;
/* For simulate MCU stepping */ /* For simulate MCU stepping */
fake_mcu_time = 0; fake_mcu_time = 0;
hng_mcu_en = 0;
} }
static PALETTE_INIT( hng64 ) static PALETTE_INIT( hng64 )

View File

@ -51,24 +51,14 @@ static struct polygon *polys ;
* *
* UINT32 | Bytes | Use * UINT32 | Bytes | Use
* -------+-76543210-+---------------- * -------+-76543210-+----------------
* 0 | xxxx---- | y position * 0 | yyyy yyyy yyyy yyyy xxxx xxxx xxxx xxxx | x/y position
* 0 | ----xxxx | x position * 1 | YYYY YYYY YYYY YYYY XXXX XXXX XXXX XXXX | x/y zoom
* 1 | xxxx---- | y zoom * 2 | ???? ???? ???? ???? ---- ---I cccc CCCC | unknown, 'Inline' chain flag, x/y chain
* 1 | ----xxxx | x zoom * 3 | ---- ---- bppp pppp ---- ---- ---- ---- | bpp select, palette entry
* 2 | ------x- | x chain * 4 | ---- --fF ???? tttt tttt tttt tttt tttt | flip bits, unknown, tile number
* 2 | -------x | y chain * 5 | ---- ---- ---- ---- ---- ---- ---- ---- | not used ??
* 2 | xxxx---- | end of sprite list - though it surely contains more info ! * 6 | ---- ---- ---- ---- ---- ---- ---- ---- | not used ??
* 2 | ----oo-- | not used ?? * 7 | ---- ---- ---- ---- ---- ---- ---- ---- | not used ??
* 3 | --xx---- | palette entry
* 3 | --x----- | (bit 0x8) - maybe a graphics bank selector
* 3 | oo--oooo | not used ?
* 4 | --xxxxxx | tile number
* 4 | --x----- | (bit 0x2) - x flip
* 4 | --x----- | (bit 0x1) - y flip
* 4 | oo------ | not used ??
* 5 | oooooooo | not used ??
* 6 | oooooooo | not used ??
* 7 | oooooooo | not used ??
*/ */
/* xxxx---- | I think this part of UINT32 2 is interesting as more than just a list end marker (AJG) /* xxxx---- | I think this part of UINT32 2 is interesting as more than just a list end marker (AJG)
@ -80,37 +70,25 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
UINT32 *source = hng64_spriteram; UINT32 *source = hng64_spriteram;
UINT32 *finish = hng64_spriteram + 0xb000/4; UINT32 *finish = hng64_spriteram + 0xb000/4;
/* find end of list? */
while( source<finish)
{
int endlist;
endlist=(source[2]&0xffff0000)>>16;
if (endlist == 0x07ff) break;
source+=8;
}
// for (int iii = 0; iii < 0x0f; iii++) // for (int iii = 0; iii < 0x0f; iii++)
// mame_printf_debug("%.8x ", hng64_videoregs[iii]) ; // mame_printf_debug("%.8x ", hng64_videoregs[iii]) ;
// mame_printf_debug("\n") ; // mame_printf_debug("\n") ;
finish = hng64_spriteram; while( source<finish )
/* draw backwards .. */
while( source>finish )
{ {
int xpos, ypos, tileno,chainx,chainy,xflip; int xpos, ypos, tileno,chainx,chainy,xflip;
int xdrw,ydrw,pal,xinc,yinc,yflip; int xdrw,ydrw,pal,xinc,yinc,yflip;
int chaini;
UINT32 zoomx,zoomy; UINT32 zoomx,zoomy;
//float foomX, foomY; //float foomX, foomY;
source-=8;
ypos = (source[0]&0xffff0000)>>16; ypos = (source[0]&0xffff0000)>>16;
xpos = (source[0]&0x0000ffff)>>0; xpos = (source[0]&0x0000ffff)>>0;
tileno=(source[4]&0x00ffffff); tileno=(source[4]&0x0007ffff);
chainx=(source[2]&0x000000f0)>>4; chainx=(source[2]&0x000000f0)>>4;
chainy=(source[2]&0x0000000f); chainy=(source[2]&0x0000000f);
chaini=(source[2]&0x00000100);
zoomy = (source[1]&0xffff0000)>>16; zoomy = (source[1]&0xffff0000)>>16;
zoomx = (source[1]&0x0000ffff)>>0; zoomx = (source[1]&0x0000ffff)>>0;
@ -199,10 +177,38 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
{ {
for(xdrw=0;xdrw<=chainx;xdrw++) for(xdrw=0;xdrw<=chainx;xdrw++)
{ {
drawgfxzoom_transpen(bitmap,cliprect,gfx,tileno,pal,xflip,yflip,xpos+(xinc*xdrw),ypos+(yinc*ydrw),zoomx,zoomy/*0x10000*/,0); if (!chaini)
{
pdrawgfxzoom_transpen(bitmap,cliprect,gfx,tileno,pal,xflip,yflip,xpos+(xinc*xdrw),ypos+(yinc*ydrw),zoomx,zoomy/*0x10000*/,machine->priority_bitmap, 0,0);
tileno++; tileno++;
} }
else // inline chain mode, used by ss64
{
tileno=(source[4]&0x0007ffff);
pal =(source[3]&0x00ff0000)>>16;
//xflip=(source[4]&0x02000000)>>25;
//yflip=(source[4]&0x01000000)>>24;
if (source[3]&0x00800000)
{
gfx= machine->gfx[4];
} }
else
{
gfx= machine->gfx[5];
tileno>>=1;
}
pdrawgfxzoom_transpen(bitmap,cliprect,gfx,tileno,pal,xflip,yflip,xpos+(xinc*xdrw),ypos+(yinc*ydrw),zoomx,zoomy/*0x10000*/,machine->priority_bitmap, 0,0);
source +=8;
}
}
}
if (!chaini) source +=8;
} }
} }
@ -1124,7 +1130,8 @@ static void hng64_drawtilemap( bitmap_t *bitmap, const rectangle *cliprect, int
VIDEO_UPDATE( hng64 ) VIDEO_UPDATE( hng64 )
{ {
bitmap_fill(bitmap, 0, get_black_pen(screen->machine)); bitmap_fill(bitmap, 0, screen->machine->pens[0]); //<- user selectable pen too?
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0x00);
// the tilemap auto animation and moveable tilebases means that they end up // the tilemap auto animation and moveable tilebases means that they end up
// dirty most frames anyway, even with manual tracking // dirty most frames anyway, even with manual tracking
@ -1146,7 +1153,6 @@ VIDEO_UPDATE( hng64 )
transition_control(bitmap, cliprect) ; transition_control(bitmap, cliprect) ;
/*
popmessage("%08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x", popmessage("%08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x",
hng64_videoregs[0x00], hng64_videoregs[0x00],
hng64_videoregs[0x01], hng64_videoregs[0x01],
@ -1163,7 +1169,7 @@ VIDEO_UPDATE( hng64 )
hng64_videoregs[0x0c], hng64_videoregs[0x0c],
hng64_videoregs[0x0d], hng64_videoregs[0x0d],
hng64_videoregs[0x0e]); hng64_videoregs[0x0e]);
*/
// tilemap0 per layer flags // tilemap0 per layer flags
// 0840 - startup tests, 8x8x4 layer // 0840 - startup tests, 8x8x4 layer