Hooked up NB1414M4 priority bit, fixing video text priority in all the games in the Armed F driver [Angelo Salese]

This commit is contained in:
Angelo Salese 2011-04-22 23:24:57 +00:00
parent 10e187e5c4
commit 598cebb186
3 changed files with 41 additions and 96 deletions

View File

@ -21,12 +21,8 @@ actually bootlegs.
68000 + Z80 68000 + Z80
TODO: TODO:
- simulate the mcu/blitter (particularly needed in terrafu and legion) - identify and decap the NB1414M4 chip, it could be either a MCU or a fancy blitter chip;
-- or figure out which chip it is, decap it, and emulate it.
- time over doesn't kill the player in Kozure Ookami; - time over doesn't kill the player in Kozure Ookami;
- intro in Terra Force isn't right, the square panels should be cleared after every
animation is played, almost likely to not be protection related;
- priorities, especially with the text layer (Terra Force);
- sprites use a RAM clut for colors, used for color cycling effects. Examples are: - sprites use a RAM clut for colors, used for color cycling effects. Examples are:
- "2" logo in Crazy Climber 2 title screen; - "2" logo in Crazy Climber 2 title screen;
- ship rays on Armed F title screen; - ship rays on Armed F title screen;
@ -197,18 +193,8 @@ static WRITE16_HANDLER( terraf_io_w )
armedf_state *state = space->machine().driver_data<armedf_state>(); armedf_state *state = space->machine().driver_data<armedf_state>();
if(data & 0x4000 && ((state->m_vreg & 0x4000) == 0)) //0 -> 1 transition if(data & 0x4000 && ((state->m_vreg & 0x4000) == 0)) //0 -> 1 transition
{
/* latch fg scroll values */
state->m_fg_scrollx = (state->m_text_videoram[0x0d] & 0xff) | ((state->m_text_videoram[0x0e] & 0x3) << 8);
state->m_fg_scrolly = (state->m_text_videoram[0x0b] & 0xff) | ((state->m_text_videoram[0x0c] & 0x3) << 8);
/* process the command */
nb_1414m4_exec(space,(state->m_text_videoram[0] << 8) | (state->m_text_videoram[1] & 0xff)); nb_1414m4_exec(space,(state->m_text_videoram[0] << 8) | (state->m_text_videoram[1] & 0xff));
/* mark tiles dirty */
tilemap_mark_all_tiles_dirty(state->m_tx_tilemap);
}
COMBINE_DATA(&state->m_vreg); COMBINE_DATA(&state->m_vreg);
coin_counter_w(space->machine(), 0, (data & 1) >> 0); coin_counter_w(space->machine(), 0, (data & 1) >> 0);
@ -236,8 +222,10 @@ static WRITE16_HANDLER( bootleg_io_w )
{ {
armedf_state *state = space->machine().driver_data<armedf_state>(); armedf_state *state = space->machine().driver_data<armedf_state>();
//if(data & 0x4000 && ((state->m_vreg & 0x4000) == 0)) //0 -> 1 transition if(data & 0x4000 && ((state->m_vreg & 0x4000) == 0)) //0 -> 1 transition
// cputag_set_input_line(space->machine(), "extra", 0, HOLD_LINE); {
// NOP
}
COMBINE_DATA(&state->m_vreg); COMBINE_DATA(&state->m_vreg);
@ -1631,14 +1619,14 @@ static DRIVER_INIT( cclimbr2 )
*************************************/ *************************************/
/* YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR, COMPANY, FULLNAME, FLAGS */ /* YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR, COMPANY, FULLNAME, FLAGS */
GAME( 1987, legion, 0, legion, legion, legion, ROT270, "Nichibutsu", "Legion - Spinner-87 (World ver 2.03)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_COLORS ) GAME( 1987, legion, 0, legion, legion, legion, ROT270, "Nichibutsu", "Legion - Spinner-87 (World ver 2.03)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS )
GAME( 1987, legiono, legion, legiono, legion, legiono, ROT270, "Nichibutsu", "Chouji Meikyuu Legion (Japan bootleg ver 1.05)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_COLORS ) /* bootleg? */ GAME( 1987, legiono, legion, legiono, legion, legiono, ROT270, "Nichibutsu", "Chouji Meikyuu Legion (Japan bootleg ver 1.05)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS ) /* bootleg? */
GAME( 1987, terraf, 0, terraf, terraf, terraf, ROT0, "bootleg", "Terra Force (bootleg)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_COLORS ) //world bootleg? GAME( 1987, terraf, 0, terraf, terraf, terraf, ROT0, "bootleg", "Terra Force (bootleg)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS ) //world bootleg?
GAME( 1987, terrafb, terraf, terrafb, terraf, terrafb, ROT0, "bootleg", "Terra Force (Japan bootleg with additional Z80)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_COLORS) GAME( 1987, terrafb, terraf, terrafb, terraf, terrafb, ROT0, "bootleg", "Terra Force (Japan bootleg with additional Z80)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS )
GAME( 1987, terrafu, terraf, terraf, terraf, terrafu, ROT0, "Nichibutsu USA", "Terra Force (US set 1)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_COLORS ) GAME( 1987, terrafu, terraf, terraf, terraf, terrafu, ROT0, "Nichibutsu USA", "Terra Force (US set 1)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS )
GAME( 1987, terrafa, terraf, terraf, terraf, terrafu, ROT0, "Nichibutsu USA", "Terra Force (US set 2)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_COLORS ) //world? GAME( 1987, terrafa, terraf, terraf, terraf, terrafu, ROT0, "Nichibutsu USA", "Terra Force (US set 2)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS ) //world?
GAME( 1987, kozure, 0, kozure, kozure, kozure, ROT0, "Nichibutsu", "Kozure Ookami (Japan)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS | GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) GAME( 1987, kozure, 0, kozure, kozure, kozure, ROT0, "Nichibutsu", "Kozure Ookami (Japan)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS )
GAME( 1988, cclimbr2, 0, cclimbr2, cclimbr2, cclimbr2, ROT0, "Nichibutsu", "Crazy Climber 2 (Japan)", GAME_SUPPORTS_SAVE| GAME_IMPERFECT_COLORS ) GAME( 1988, cclimbr2, 0, cclimbr2, cclimbr2, cclimbr2, ROT0, "Nichibutsu", "Crazy Climber 2 (Japan)", GAME_SUPPORTS_SAVE| GAME_IMPERFECT_GRAPHICS )
GAME( 1988, cclimbr2a,cclimbr2, cclimbr2, cclimbr2, cclimbr2, ROT0, "Nichibutsu", "Crazy Climber 2 (Japan, Harder)", GAME_SUPPORTS_SAVE| GAME_IMPERFECT_COLORS ) GAME( 1988, cclimbr2a,cclimbr2, cclimbr2, cclimbr2, cclimbr2, ROT0, "Nichibutsu", "Crazy Climber 2 (Japan, Harder)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS )
GAME( 1988, armedf, 0, armedf, armedf, armedf, ROT270, "Nichibutsu", "Armed Formation", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_COLORS ) GAME( 1988, armedf, 0, armedf, armedf, armedf, ROT270, "Nichibutsu", "Armed Formation", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS )
GAME( 1988, armedff, armedf, armedf, armedf, armedf, ROT270, "Nichibutsu (Fillmore license)", "Armed Formation (Fillmore license)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_COLORS ) GAME( 1988, armedff, armedf, armedf, armedf, armedf, ROT270, "Nichibutsu (Fillmore license)", "Armed Formation (Fillmore license)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_GRAPHICS )

View File

@ -8,11 +8,11 @@ This is some fancy MCU / blitter that copies text strings in various Nihon Bussa
TODO: TODO:
- Device-ify this; - Device-ify this;
- merge implementations
- where is the condition that makes "insert coin" text to properly blink? - where is the condition that makes "insert coin" text to properly blink?
- first byte meaning is completely unknown; - first byte meaning is completely unknown;
- Kozure Ookami "credit X" message during attract mode completely clears the status bar, dunno how it's supposed to - Kozure Ookami "credit X" message during attract mode completely clears the status bar, dunno how it's supposed to
be displayed; be displayed;
- (after device-ifization) hook this up for Ninja Emaki;
Notes: Notes:
- Just before any string in the "MCU" rom, there's a control byte, this meaning is as follows: - Just before any string in the "MCU" rom, there's a control byte, this meaning is as follows:
@ -37,10 +37,10 @@ static void nichibutsu_1414m4_dma(address_space *space,UINT16 src,UINT16 dst,UIN
for(i=0;i<size;i++) for(i=0;i<size;i++)
{ {
if(i+dst+0x000 < 18) if(i+dst+0x000 < 18) //avoid param overwrite
continue; continue;
state->m_text_videoram[i+dst+0x000] = (condition) ? (data[i+(0)+src] & 0xff) : 0x00; state->m_text_videoram[i+dst+0x000] = (condition) ? (data[i+(0)+src] & 0xff) : data[0x320];
state->m_text_videoram[i+dst+0x400] = data[i+(size)+src] & 0xff; state->m_text_videoram[i+dst+0x400] = data[i+(size)+src] & 0xff;
} }
} }
@ -52,7 +52,7 @@ static void nichibutsu_1414m4_fill(address_space *space,UINT16 dst,UINT8 tile,UI
for(i=0;i<0x400;i++) for(i=0;i<0x400;i++)
{ {
if(i+dst+0x000 < 18) if(i+dst+0x000 < 18) //avoid param overwrite
continue; continue;
state->m_text_videoram[i+dst+0x000] = tile; state->m_text_videoram[i+dst+0x000] = tile;
@ -276,6 +276,13 @@ static void nichibutsu_1414m4_0e00(address_space *space,UINT16 mcu_cmd)
void nb_1414m4_exec(address_space *space,UINT16 mcu_cmd) void nb_1414m4_exec(address_space *space,UINT16 mcu_cmd)
{ {
armedf_state *state = space->machine().driver_data<armedf_state>();
/* latch fg scroll values */
state->m_fg_scrollx = (state->m_text_videoram[0x0d] & 0xff) | ((state->m_text_videoram[0x0e] & 0x3) << 8);
state->m_fg_scrolly = (state->m_text_videoram[0x0b] & 0xff) | ((state->m_text_videoram[0x0c] & 0x3) << 8);
/* process the command */
switch(mcu_cmd & 0xff00) switch(mcu_cmd & 0xff00)
{ {
/* title screen / continue screens */ /* title screen / continue screens */
@ -293,4 +300,7 @@ void nb_1414m4_exec(address_space *space,UINT16 mcu_cmd)
popmessage("NB 1414M4 executes %04x command, contact MAMEdev\n",mcu_cmd); popmessage("NB 1414M4 executes %04x command, contact MAMEdev\n",mcu_cmd);
break; break;
} }
/* mark tiles dirty */
tilemap_mark_all_tiles_dirty(state->m_tx_tilemap);
} }

View File

@ -37,37 +37,20 @@ static TILE_GET_INFO( get_tx_tile_info )
int tile_number = state->m_text_videoram[tile_index] & 0xff; int tile_number = state->m_text_videoram[tile_index] & 0xff;
int attributes; int attributes;
/* TODO: Armed F doesn't seem to use the NB1414M4! */
if (state->m_scroll_type == 1) if (state->m_scroll_type == 1)
attributes = state->m_text_videoram[tile_index + 0x800] & 0xff; attributes = state->m_text_videoram[tile_index + 0x800] & 0xff;
else else
{
attributes = state->m_text_videoram[tile_index + 0x400] & 0xff; attributes = state->m_text_videoram[tile_index + 0x400] & 0xff;
SET_TILE_INFO( if(tile_index < 0x12) /* don't draw the NB1414M4 params! TODO: could be a better fix */
0, tile_number = attributes = 0x00;
tile_number + 256 * (attributes & 0x3),
attributes >> 4,
0);
}
static TILE_GET_INFO( get_legion_tx_tile_info )
{
armedf_state *state = machine.driver_data<armedf_state>();
int tile_number = state->m_text_videoram[tile_index] & 0xff;
if(tile_index<0x10) tile_number=0x20;
int attributes;
attributes = state->m_text_videoram[tile_index + 0x400] & 0xff;
tileinfo->category = 0;
if((attributes & 0x3) == 3)
{
tileinfo->category = 1;
} }
/* bit 3 controls priority, (0) nb1414m4 has priority over all the other video layers */
tileinfo->category = (attributes & 0x8) >> 3;
SET_TILE_INFO( SET_TILE_INFO(
0, 0,
tile_number + 256 * (attributes & 0x3), tile_number + 256 * (attributes & 0x3),
@ -123,7 +106,7 @@ VIDEO_START( armedf )
break; break;
case 2: /* legion */ case 2: /* legion */
state->m_tx_tilemap = tilemap_create(machine, get_legion_tx_tile_info, armedf_scan_type3, 8, 8, 64, 32); state->m_tx_tilemap = tilemap_create(machine, get_tx_tile_info, armedf_scan_type3, 8, 8, 64, 32);
break; break;
default: default:
@ -153,16 +136,6 @@ WRITE16_HANDLER( armedf_text_videoram_w )
tilemap_mark_tile_dirty(state->m_tx_tilemap, offset & 0x7ff); tilemap_mark_tile_dirty(state->m_tx_tilemap, offset & 0x7ff);
else else
tilemap_mark_tile_dirty(state->m_tx_tilemap, offset & 0xbff); tilemap_mark_tile_dirty(state->m_tx_tilemap, offset & 0xbff);
/*
if (offset < 0x10)
logerror("%04x %04x %04x %04x %04x %04x %04x %04x-%04x %04x %04x %04x %04x %04x %04x %04x (%04x)\n",
state->m_text_videoram[0], state->m_text_videoram[1], state->m_text_videoram[2],
state->m_text_videoram[3], state->m_text_videoram[4], state->m_text_videoram[5],
state->m_text_videoram[6], state->m_text_videoram[7], state->m_text_videoram[8],
state->m_text_videoram[9], state->m_text_videoram[10], state->m_text_videoram[11],
state->m_text_videoram[12], state->m_text_videoram[13], state->m_text_videoram[14],
state->m_text_videoram[15], offset);
*/
} }
WRITE16_HANDLER( armedf_fg_videoram_w ) WRITE16_HANDLER( armedf_fg_videoram_w )
@ -306,50 +279,24 @@ SCREEN_UPDATE( armedf )
} }
bitmap_fill(bitmap, cliprect , 0xff); bitmap_fill(bitmap, cliprect , 0xff);
if(state->m_scroll_type == 2) /* legion / legiono */ tilemap_draw(bitmap, cliprect, state->m_tx_tilemap, TILEMAP_DRAW_CATEGORY(1), 0);
{
tilemap_draw(bitmap, cliprect, state->m_tx_tilemap, 1, 0);
}
if (state->m_vreg & 0x0800) tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, 0, 0);
tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, 0, 0);
#if 0
if(state->m_vreg & 0x0800)
{
tilemap_draw(bitmap, cliprect, state->m_bg_tilemap, 0, 0);
}
else
{
bitmap_fill(bitmap, cliprect , get_black_pen(screen->machine()) & 0x0f);
}
#endif
if ((state->m_vreg & 0x0030) == 0x0030)
tilemap_draw(bitmap, cliprect, state->m_tx_tilemap, 0, 0);
if (sprite_enable) if (sprite_enable)
draw_sprites(screen->machine(), bitmap, cliprect, 2); draw_sprites(screen->machine(), bitmap, cliprect, 2);
if ((state->m_vreg & 0x0030) == 0x0020)
tilemap_draw(bitmap, cliprect, state->m_tx_tilemap, 0, 0);
tilemap_draw(bitmap, cliprect, state->m_fg_tilemap, 0, 0); tilemap_draw(bitmap, cliprect, state->m_fg_tilemap, 0, 0);
if ((state->m_vreg & 0x0030) == 0x0010)
tilemap_draw(bitmap, cliprect, state->m_tx_tilemap, 0, 0);
if (sprite_enable) if (sprite_enable)
draw_sprites(screen->machine(), bitmap, cliprect, 1); draw_sprites(screen->machine(), bitmap, cliprect, 1);
if ((state->m_vreg & 0x0030) == 0x0000)
tilemap_draw(bitmap, cliprect, state->m_tx_tilemap, 0, 0);
if (sprite_enable) if (sprite_enable)
draw_sprites(screen->machine(), bitmap, cliprect, 0); draw_sprites(screen->machine(), bitmap, cliprect, 0);
tilemap_draw(bitmap, cliprect, state->m_tx_tilemap, TILEMAP_DRAW_CATEGORY(0), 0);
return 0; return 0;
} }