armedf.cpp, galivan.cpp: major video config cleanups, converted to screen.set_raw() parameters;

galivan.cpp: added irq acknowledge signal;

nb1414m4.cpp: improved notes, added stub for frame synchronization;
This commit is contained in:
angelosa 2019-12-09 00:55:21 +01:00
parent 5c226e1f99
commit c8f62f483d
9 changed files with 126 additions and 336 deletions

View File

@ -27,9 +27,11 @@ actually bootlegs.
TODO:
- identify and decap the NB1414M4 chip, it could be either a MCU or a fancy blitter chip;
- time over doesn't kill the player in Kozure Ookami, check (1) note;
- Fix Armed F and Tatakae Big Fighter text tilemap usage, they both doesn't use the NB1414M4
(as shown by the per-game kludge)
- kozure: time over doesn't kill the player, check (1) note for further details (kludged to work for now);
- kozure: POST screen should have green as backdrop, this is actually drawn by the text layer but not seen
because being mapped on pen 15 (-> unimplemented opaque flag?)
Notes:
- the initial level color fade in effect in Armed F is confirmed on real HW, i.e. goes from
@ -185,7 +187,7 @@ Stephh's notes (based on the games M68000 code and some tests) :
Tatakae! Big Fighter (c)1989 Nichibutsu
based on armedf.c
based on armedf.cpp
TODO:
- scroll
@ -322,7 +324,6 @@ Notes:
#include "sound/3812intf.h"
#include "sound/dac.h"
#include "sound/volt_reg.h"
#include "screen.h"
#include "speaker.h"
#define LEGION_HACK 0
@ -345,7 +346,6 @@ Notes:
---- ---- ---- --x- coin counter 1
---- ---- ---- ---x coin counter 0
*/
WRITE16_MEMBER(armedf_state::terraf_io_w)
{
if(data & 0x4000 && ((m_vreg & 0x4000) == 0)) //0 -> 1 transition
@ -402,11 +402,15 @@ READ8_MEMBER(armedf_state::soundlatch_clear_r)
WRITE16_MEMBER(armedf_state::irq_lv1_ack_w)
{
if (m_nb1414m4 != nullptr)
m_nb1414m4->vblank_trigger();
m_maincpu->set_input_line(1, CLEAR_LINE);
}
WRITE16_MEMBER(armedf_state::irq_lv2_ack_w)
{
if (m_nb1414m4 != nullptr)
m_nb1414m4->vblank_trigger();
m_maincpu->set_input_line(2, CLEAR_LINE);
}
@ -557,7 +561,7 @@ void armedf_state::armedf_map(address_map &map)
map(0x06d006, 0x06d007).w(FUNC(armedf_state::armedf_fg_scrollx_w));
map(0x06d008, 0x06d009).w(FUNC(armedf_state::armedf_fg_scrolly_w));
map(0x06d00a, 0x06d00b).w(FUNC(armedf_state::sound_command_w));
map(0x06d00c, 0x06d00d).nopw(); //watchdog
map(0x06d00c, 0x06d00d).nopw(); //watchdog?
map(0x06d00e, 0x06d00f).w(FUNC(armedf_state::irq_lv1_ack_w));
}
@ -567,152 +571,6 @@ READ16_MEMBER(bigfghtr_state::latch_r)
return 0;
}
#if 0
// reference code, in case anything goes bad
WRITE16_MEMBER(bigfghtr_state::sharedram_w)
{
data &= mem_mask;
COMBINE_DATA(&m_sharedram[offset]);
switch(offset)
{
case 0x40/2:
m_mcu_input_snippet = (data == 0x100);
m_mcu_jsr_snippet = (data == 0x300);
break;
}
}
READ16_MEMBER(bigfghtr_state::sharedram_r)
{
if(m_mcu_input_snippet)
{
switch(offset+0x600/2)
{
case 0x640/2:
if(m_read_latch)
{
m_read_latch = 0;
return machine().rand(); // TODO
}
break;
case 0x642/2:
return (ioport("DSW0")->read() & 0xffff) ^ 0xffff;
case 0x644/2:
return (ioport("DSW1")->read() & 0xffff) ^ 0xffff;
case 0x646/2:
return (ioport("P1")->read() & 0xffff) ^ 0xffff;
case 0x648/2:
return (ioport("P2")->read() & 0xffff) ^ 0xffff;
}
}
if(m_mcu_jsr_snippet)
{
switch(offset+0x600/2)
{
case 0x640/2:
if(m_read_latch)
{
m_read_latch = 0;
return machine().rand(); // TODO
}
break;
case 0x642/2:
return (ioport("DSW0")->read() & 0xffff) ^ 0xffff;
case 0x644/2:
return (ioport("DSW1")->read() & 0xffff) ^ 0xffff;
case 0x646/2:
return (ioport("P1")->read() & 0xffff) ^ 0xffff;
case 0x648/2:
return (ioport("P2")->read() & 0xffff) ^ 0xffff;
/*
protection controls where the program code should jump to.
example snippet:
00DB2A: 41FA FE86 lea (-$17a,PC), A0; ($d9b2) ;base program vector
00DB2E: 4DF9 0008 0E2A lea $80e2a.l, A6 ;base RAM vector, used by the i8751 to send the value, this value is added to the above A0
00DB34: 3039 0008 0E62 move.w $80e62.l, D0 ;number of snippets to execute
00DB3A: 6100 00F0 bsr $dc2c
*/
/* bp daee, A0 = 0xdd02, A6 = 0x808ca, D0 = 0x80902 */
//case 0x902/2:
// return 0x0001;
//case (0x90a+0x24)/2:
// return 0x0001;
//case (0x902+8)/2:
// return 0x0004; // 0xf86a
/* bp db02, A0 = 0xdc2e, A6 = 0x80912, D0 = 0x8094a */
//case 0x94a/2:
// return 1;
//case (0x94a+8)/2:
// return 0x00dc; // 0xd62e
/* bp db16, A0 = 0xda86, A6 = 0x80c22, D0 = 0x80c5a */
//case 0xc5a/2:
// return 1;
//case (0xc5a+8)/2:
// return 0x0288; // 0x345f4
/* bp db2a, A0 = 0xd9b2, A6 = 0x80e2a, D0 = 0x80e62 */
/* bp db3e, A0 = 0xd8da, A6 = 0x81132, D0 = 0x8116a */
/* bp db52, A0 = 0xd806, A6 = 0x8133a, D0 = 0x81372 */
/* bp db66, A0 = 0xd7aa, A6 = 0x81742, D0 = 0x8177a */
/* bp db7a, A0 = 0xd746, A6 = 0x81b4a, D0 = 0x81b82 */
/* bp db8e, A0 = 0xd672, A6 = 0x81f52, D0 = 0x81f8a */
/* bp dba4, A0 = 0xd5ae, A6 = 0x8205a, D0 = 0x82092 */
/* bp dbba, A0 = 0xd5be, A6 = 0x82862, D0 = 0x8289a */
/* bp dbd0, A0 = 0xd512, A6 = 0x8296a, D0 = 0x829a2 */
/* bp dbe6, A0 = 0xd466, A6 = 0x82d72, D0 = 0x82daa */
/* bp dbfc, A0 = 0xd43e, A6 = 0x8357a, D0 = 0x835b2 */
/* following is separated from the others, dunno why ... */
/* bp dc14, A0 = 0xd3aa, A6 = 0x835a2, D0 = 0x835b2 */
/*case 0x
case 0x94a/2:
return 0x0002*4;
case (0x90a+2*0x40)/2:
case (0x90a+3*0x40)/2:
return 0x0003*4;
case (0x90a+4*0x40)/2:
return 0x000c*4; // 0x13d74
case (0x90a+5*0x40)/2:
return 0x000d*4; // 0x130f6
case (0x90a+6*0x40)/2:
return 0x000e*4; // 0x1817e
case (0x90a+7*0x40)/2:
return 0x0010*4; // 0x15924
//case (0x90a+0x25)/2:
// return 2;*/
}
}
return m_sharedram[offset];
}
#endif
READ8_MEMBER(bigfghtr_state::main_sharedram_r)
{
return m_sharedram[offset];
@ -1220,7 +1078,7 @@ static GFXDECODE_START( gfx_armedf )
GFXDECODE_ENTRY( "gfx1", 0, char_layout, 0*16, 32 )
GFXDECODE_ENTRY( "gfx2", 0, tile_layout, 64*16, 32 )
GFXDECODE_ENTRY( "gfx3", 0, tile_layout, 96*16, 32 )
GFXDECODE_ENTRY( "gfx4", 0, sprite_layout, 32*16, 32 )
GFXDECODE_ENTRY( "gfx4", 0, sprite_layout, 32*16, 32 )
GFXDECODE_END
@ -1255,8 +1113,24 @@ void armedf_state::machine_reset()
m_bg_scrolly = 0;
}
void armedf_state::video_config(machine_config &config, int hchar_start, int vstart, int vend)
{
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
// assume all games on this HW running at ~59.1358Hz (trusted for Big Fighter)
// TODO: recheck if visible area isn't just 320x240 for everything (overscan may be masked by the text layer).
// TODO: bootlegs may not run at this speed
m_screen->set_raw(XTAL(16'000'000)/2,531,hchar_start*8,(64-hchar_start)*8, 255, vstart, vend);
m_screen->set_palette(m_palette);
m_screen->set_screen_update(FUNC(armedf_state::screen_update_armedf));
m_screen->screen_vblank().set(m_spriteram, FUNC(buffered_spriteram16_device::vblank_copy_rising));
void armedf_state::terraf_sound(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_armedf);
PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
BUFFERED_SPRITERAM16(config, m_spriteram);
}
void armedf_state::sound_config(machine_config &config)
{
z80_device &audiocpu(Z80(config, "audiocpu", XTAL(24'000'000)/6)); // 4mhz
audiocpu.set_addrmap(AS_PROGRAM, &armedf_state::sound_map);
@ -1278,37 +1152,21 @@ void armedf_state::terraf_sound(machine_config &config)
void armedf_state::terraf(machine_config &config)
{
/* basic machine hardware */
M68000(config, m_maincpu, XTAL(16'000'000)/2); // 8mhz?
m_maincpu->set_addrmap(AS_PROGRAM, &armedf_state::terraf_map);
m_maincpu->set_vblank_int("screen", FUNC(armedf_state::irq1_line_assert));
NB1414M4(config, m_nb1414m4, 0);
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(57);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
screen.set_size(64*8, 32*8);
screen.set_visarea(12*8, (64-12)*8-1, 1*8, 31*8-1 );
screen.set_palette(m_palette);
screen.set_screen_update(FUNC(armedf_state::screen_update_armedf));
screen.screen_vblank().set(m_spriteram, FUNC(buffered_spriteram16_device::vblank_copy_rising));
video_config(config, 12, 8, 248);
MCFG_VIDEO_START_OVERRIDE(armedf_state,terraf)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_armedf);
PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
terraf_sound(config);
sound_config(config);
}
void armedf_state::terrafjb(machine_config &config)
{
/* basic machine hardware */
M68000(config, m_maincpu, XTAL(16'000'000)/2); // 8mhz
m_maincpu->set_addrmap(AS_PROGRAM, &armedf_state::terraf_map);
m_maincpu->set_vblank_int("screen", FUNC(armedf_state::irq1_line_assert));
@ -1322,23 +1180,9 @@ void armedf_state::terrafjb(machine_config &config)
m_extra->set_addrmap(AS_PROGRAM, &armedf_state::terrafjb_extraz80_map);
m_extra->set_addrmap(AS_IO, &armedf_state::terrafjb_extraz80_portmap);
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(57);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
screen.set_size(64*8, 32*8);
screen.set_visarea(12*8, (64-12)*8-1, 1*8, 31*8-1 );
screen.set_palette(m_palette);
screen.set_screen_update(FUNC(armedf_state::screen_update_armedf));
screen.screen_vblank().set(m_spriteram, FUNC(buffered_spriteram16_device::vblank_copy_rising));
video_config(config, 12, 8, 248);
MCFG_VIDEO_START_OVERRIDE(armedf_state,terraf)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_armedf);
PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@ -1361,7 +1205,6 @@ void armedf_state::terrafb(machine_config &config)
void armedf_state::kozure(machine_config &config)
{
/* basic machine hardware */
M68000(config, m_maincpu, XTAL(16'000'000)/2); // 8mhz
m_maincpu->set_addrmap(AS_PROGRAM, &armedf_state::kozure_map);
m_maincpu->set_vblank_int("screen", FUNC(armedf_state::irq1_line_assert));
@ -1369,29 +1212,15 @@ void armedf_state::kozure(machine_config &config)
NB1414M4(config, m_nb1414m4, 0);
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
screen.set_size(64*8, 32*8);
screen.set_visarea(12*8, (64-12)*8-1, 1*8, 31*8-1 ); // 320 x 240, trusted
screen.set_palette(m_palette);
screen.set_screen_update(FUNC(armedf_state::screen_update_armedf));
screen.screen_vblank().set(m_spriteram, FUNC(buffered_spriteram16_device::vblank_copy_rising));
video_config(config, 12, 8, 248);
MCFG_VIDEO_START_OVERRIDE(armedf_state,terraf)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_armedf);
PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
terraf_sound(config);
sound_config(config);
}
void armedf_state::armedf(machine_config &config)
{
/* basic machine hardware */
M68000(config, m_maincpu, XTAL(16'000'000)/2); // 8mhz
m_maincpu->set_addrmap(AS_PROGRAM, &armedf_state::armedf_map);
m_maincpu->set_vblank_int("screen", FUNC(armedf_state::irq1_line_assert));
@ -1401,23 +1230,9 @@ void armedf_state::armedf(machine_config &config)
audiocpu.set_addrmap(AS_IO, &armedf_state::sound_portmap);
audiocpu.set_periodic_int(FUNC(armedf_state::irq0_line_hold), attotime::from_hz(XTAL(8'000'000)/2/512)); // ?
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(57);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
screen.set_size(64*8, 32*8);
screen.set_visarea(12*8, (64-12)*8-1, 1*8, 31*8-1 );
screen.set_palette(m_palette);
screen.set_screen_update(FUNC(armedf_state::screen_update_armedf));
screen.screen_vblank().set(m_spriteram, FUNC(buffered_spriteram16_device::vblank_copy_rising));
video_config(config, 12, 16, 240);
MCFG_VIDEO_START_OVERRIDE(armedf_state,armedf)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_armedf);
PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@ -1434,7 +1249,6 @@ void armedf_state::armedf(machine_config &config)
void armedf_state::cclimbr2(machine_config &config)
{
/* basic machine hardware */
M68000(config, m_maincpu, XTAL(16'000'000)/2); // 8mhz
m_maincpu->set_addrmap(AS_PROGRAM, &armedf_state::cclimbr2_map);
m_maincpu->set_vblank_int("screen", FUNC(armedf_state::irq2_line_assert));
@ -1446,23 +1260,9 @@ void armedf_state::cclimbr2(machine_config &config)
NB1414M4(config, m_nb1414m4, 0);
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
screen.set_size(64*8, 32*8);
screen.set_visarea(14*8, (64-14)*8-1, 2*8, 30*8-1 );
screen.set_palette(m_palette);
screen.set_screen_update(FUNC(armedf_state::screen_update_armedf));
screen.screen_vblank().set(m_spriteram, FUNC(buffered_spriteram16_device::vblank_copy_rising));
video_config(config, 14, 16, 240);
MCFG_VIDEO_START_OVERRIDE(armedf_state,terraf)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_armedf);
PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@ -1479,7 +1279,6 @@ void armedf_state::cclimbr2(machine_config &config)
void armedf_state::legion_common(machine_config &config)
{
/* basic machine hardware */
M68000(config, m_maincpu, XTAL(16'000'000)/2); // 8mhz
m_maincpu->set_vblank_int("screen", FUNC(armedf_state::irq2_line_assert));
@ -1487,23 +1286,9 @@ void armedf_state::legion_common(machine_config &config)
audiocpu.set_addrmap(AS_PROGRAM, &armedf_state::cclimbr2_soundmap);
audiocpu.set_periodic_int(FUNC(armedf_state::irq0_line_hold), attotime::from_hz(XTAL(8'000'000)/2/512)); // ?
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
screen.set_size(64*8, 32*8);
screen.set_visarea(14*8, (64-14)*8-1, 2*8, 30*8-1 );
screen.set_palette(m_palette);
screen.set_screen_update(FUNC(armedf_state::screen_update_armedf));
screen.screen_vblank().set(m_spriteram, FUNC(buffered_spriteram16_device::vblank_copy_rising));
video_config(config, 14, 16, 240);
MCFG_VIDEO_START_OVERRIDE(armedf_state,terraf)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_armedf);
PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@ -1549,7 +1334,6 @@ void armedf_state::legionjb2(machine_config &config)
void bigfghtr_state::bigfghtr(machine_config &config)
{
M68000(config, m_maincpu, XTAL(16'000'000)/2); // verified
m_maincpu->set_addrmap(AS_PROGRAM, &bigfghtr_state::bigfghtr_map);
m_maincpu->set_vblank_int("screen", FUNC(armedf_state::irq1_line_assert));
@ -1559,22 +1343,10 @@ void bigfghtr_state::bigfghtr(machine_config &config)
mcu.set_addrmap(AS_IO, &bigfghtr_state::bigfghtr_mcu_io_map);
mcu.port_in_cb<1>().set_constant(0xdf); // bit 5: bus contention related?
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_raw(XTAL(16'000'000)/2,531,12*8,(64-12)*8, 254, 1*8, 31*8); // guess, matches 59.3 Hz from reference - measured at 59.1358Hz
screen.set_palette(m_palette);
screen.set_screen_update(FUNC(armedf_state::screen_update_armedf));
screen.screen_vblank().set(m_spriteram, FUNC(buffered_spriteram16_device::vblank_copy_rising));
video_config(config, 12, 8, 248);
MCFG_VIDEO_START_OVERRIDE(armedf_state,armedf)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_armedf);
PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
terraf_sound(config);
sound_config(config);
}
/*************************************

View File

@ -53,6 +53,7 @@ Mighty Guy board layout:
YM3526
***************************************************************************/
#include "emu.h"
#include "includes/cop01.h"

View File

@ -23,11 +23,6 @@ TODO
- bit 3 of ninjemak_gfxbank_w, there currently is a kludge to clear text RAM
but it should really copy stuff from the extra ROM.
- Ninja Emaki has minor protection issues, see NB1414M4 simulation for more info.
- dangarj has unemulated protection at I/Os 0x80-1 for missing sprites.
This is a 1412M2, which is the same chip used in terracre.cpp and cop01.cpp
The protection here is used for a code snippet at 0xf9c0, that of course is the
sprite handling. The code snippet is sum8 with 0x27 at 0x9d74 so no, the
later dangar US version snippet doesn't work
***************************************************************************/
@ -38,7 +33,6 @@ TODO
#include "sound/3526intf.h"
#include "sound/dac.h"
#include "sound/volt_reg.h"
#include "screen.h"
#include "speaker.h"
@ -55,7 +49,15 @@ READ8_MEMBER(galivan_state::soundlatch_clear_r)
READ8_MEMBER(galivan_state::IO_port_c0_r)
{
return (0x58); /* To Avoid Reset on Ufo Robot dangar */
// causes a reset in dangar if value differs.
return (0x58);
}
WRITE8_MEMBER(galivan_state::vblank_ack_w)
{
if (m_nb1414m4 != nullptr)
m_nb1414m4->vblank_trigger();
m_maincpu->set_input_line(0, CLEAR_LINE);
}
void galivan_state::galivan_map(address_map &map)
@ -93,21 +95,20 @@ void galivan_state::io_map(address_map &map)
map(0x43, 0x44).w(FUNC(galivan_state::galivan_scrolly_w));
map(0x45, 0x45).w(FUNC(galivan_state::galivan_sound_command_w));
// map(0x46, 0x46).nopw();
// map(0x47, 0x47).nopw();
map(0xc0, 0xc0).r(FUNC(galivan_state::IO_port_c0_r)); /* dangar needs to return 0x58 */
map(0x47, 0x47).w(FUNC(galivan_state::vblank_ack_w));
map(0xc0, 0xc0).r(FUNC(galivan_state::IO_port_c0_r));
}
void dangarj_state::dangarj_io_map(address_map &map)
{
io_map(map);
// 1412M2
map(0x80, 0x80).rw("prot_chip", FUNC(nb1412m2_device::data_r), FUNC(nb1412m2_device::data_w));
map(0x81, 0x81).w("prot_chip", FUNC(nb1412m2_device::command_w));
}
WRITE8_MEMBER(galivan_state::blit_trigger_w)
{
// TODO: may not be right, diverges with armedf.cpp
m_nb1414m4->exec((m_videoram[0] << 8) | (m_videoram[1] & 0xff),m_videoram,m_scrollx,m_scrolly,m_tx_tilemap);
}
@ -120,8 +121,8 @@ void galivan_state::ninjemak_io_map(address_map &map)
map(0x83, 0x83).portr("SERVICE");
map(0x84, 0x84).portr("DSW1");
map(0x85, 0x85).portr("DSW2").w(FUNC(galivan_state::galivan_sound_command_w));
map(0x86, 0x86).w(FUNC(galivan_state::blit_trigger_w)); // ??
// map(0x87, 0x87).nopw(); // ??
map(0x86, 0x86).w(FUNC(galivan_state::blit_trigger_w));
map(0x87, 0x87).w(FUNC(galivan_state::vblank_ack_w));
}
void galivan_state::sound_map(address_map &map)
@ -142,7 +143,7 @@ void galivan_state::sound_io_map(address_map &map)
/***************
Dip Sitches
Dip Switches
***************/
#define NIHON_JOYSTICK(_n_) \
@ -432,13 +433,24 @@ MACHINE_RESET_MEMBER(galivan_state,ninjemak)
m_ninjemak_dispdisable = 0;
}
void galivan_state::video_config(machine_config &config)
{
BUFFERED_SPRITERAM8(config, m_spriteram);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
// TODO: not measured, ~60 Hz
m_screen->set_raw(XTAL(12'000'000)/2,382,0,32*8, 262, 2*8, 30*8);
m_screen->screen_vblank().set(m_spriteram, FUNC(buffered_spriteram8_device::vblank_copy_rising));
m_screen->set_palette(m_palette);
}
void galivan_state::galivan(machine_config &config)
{
/* basic machine hardware */
Z80(config, m_maincpu, XTAL(12'000'000)/2); /* 6 MHz? */
m_maincpu->set_addrmap(AS_PROGRAM, &galivan_state::galivan_map);
m_maincpu->set_addrmap(AS_IO, &galivan_state::io_map);
m_maincpu->set_vblank_int("screen", FUNC(galivan_state::irq0_line_hold));
m_maincpu->set_vblank_int("screen", FUNC(galivan_state::irq0_line_assert));
z80_device &audiocpu(Z80(config, "audiocpu", XTAL(8'000'000)/2)); /* 4 MHz? */
audiocpu.set_addrmap(AS_PROGRAM, &galivan_state::sound_map);
@ -448,23 +460,12 @@ void galivan_state::galivan(machine_config &config)
MCFG_MACHINE_START_OVERRIDE(galivan_state,galivan)
MCFG_MACHINE_RESET_OVERRIDE(galivan_state,galivan)
/* video hardware */
BUFFERED_SPRITERAM8(config, m_spriteram);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
screen.set_size(32*8, 32*8);
screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1);
screen.set_screen_update(FUNC(galivan_state::screen_update_galivan));
screen.screen_vblank().set(m_spriteram, FUNC(buffered_spriteram8_device::vblank_copy_rising));
screen.set_palette(m_palette);
video_config(config);
MCFG_VIDEO_START_OVERRIDE(galivan_state,galivan)
m_screen->set_screen_update(FUNC(galivan_state::screen_update_galivan));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_galivan);
PALETTE(config, m_palette, FUNC(galivan_state::galivan_palette), 16*16+16*16+256*16, 256);
MCFG_VIDEO_START_OVERRIDE(galivan_state,galivan)
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@ -493,7 +494,7 @@ void galivan_state::ninjemak(machine_config &config)
Z80(config, m_maincpu, XTAL(12'000'000)/2); /* 6 MHz? */
m_maincpu->set_addrmap(AS_PROGRAM, &galivan_state::ninjemak_map);
m_maincpu->set_addrmap(AS_IO, &galivan_state::ninjemak_io_map);
m_maincpu->set_vblank_int("screen", FUNC(galivan_state::irq0_line_hold));
m_maincpu->set_vblank_int("screen", FUNC(galivan_state::irq0_line_assert));
z80_device &audiocpu(Z80(config, "audiocpu", XTAL(8'000'000)/2)); /* 4 MHz? */
audiocpu.set_addrmap(AS_PROGRAM, &galivan_state::sound_map);
@ -506,22 +507,12 @@ void galivan_state::ninjemak(machine_config &config)
NB1414M4(config, m_nb1414m4, 0);
/* video hardware */
BUFFERED_SPRITERAM8(config, m_spriteram);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
screen.set_size(32*8, 32*8);
screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1);
screen.set_screen_update(FUNC(galivan_state::screen_update_ninjemak));
screen.screen_vblank().set(m_spriteram, FUNC(buffered_spriteram8_device::vblank_copy_rising));
screen.set_palette(m_palette);
video_config(config);
MCFG_VIDEO_START_OVERRIDE(galivan_state,ninjemak)
m_screen->set_screen_update(FUNC(galivan_state::screen_update_ninjemak));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_ninjemak);
PALETTE(config, m_palette, FUNC(galivan_state::ninjemak_palette), 8*16+16*16+256*16, 256);
MCFG_VIDEO_START_OVERRIDE(galivan_state,ninjemak)
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@ -536,13 +527,13 @@ void galivan_state::ninjemak(machine_config &config)
vref.add_route(0, "dac2", 1.0, DAC_VREF_POS_INPUT); vref.add_route(0, "dac2", -1.0, DAC_VREF_NEG_INPUT);
}
void galivan_state::youmab(machine_config &config)
{
ninjemak(config);
config.device_remove("nb1414m4");
}
/***************************************************************************
Game driver(s)
@ -1179,6 +1170,7 @@ WRITE8_MEMBER(galivan_state::youmab_86_w)
void galivan_state::init_youmab()
{
// TODO: move all of this to an address map instead
m_maincpu->space(AS_IO).install_write_handler(0x82, 0x82, write8_delegate(*this, FUNC(galivan_state::youmab_extra_bank_w))); // banks rom at 0x8000? writes 0xff and 0x00 before executing code there
m_maincpu->space(AS_PROGRAM).install_read_bank(0x0000, 0x7fff, "bank3");
membank("bank3")->set_base(memregion("maincpu")->base());

View File

@ -8,6 +8,7 @@
#include "machine/nb1414m4.h"
#include "machine/gen_latch.h"
#include "video/bufsprite.h"
#include "screen.h"
#include "emupal.h"
#include "tilemap.h"
@ -15,17 +16,18 @@ class armedf_state : public driver_device
{
public:
armedf_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_extra(*this, "extra"),
m_nb1414m4(*this, "nb1414m4"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_spriteram(*this, "spriteram"),
m_soundlatch(*this, "soundlatch"),
m_spr_pal_clut(*this, "spr_pal_clut"),
m_fg_videoram(*this, "fg_videoram"),
m_bg_videoram(*this, "bg_videoram")
driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_extra(*this, "extra")
, m_nb1414m4(*this, "nb1414m4")
, m_screen(*this, "screen")
, m_gfxdecode(*this, "gfxdecode")
, m_palette(*this, "palette")
, m_spriteram(*this, "spriteram")
, m_soundlatch(*this, "soundlatch")
, m_spr_pal_clut(*this, "spr_pal_clut")
, m_fg_videoram(*this, "fg_videoram")
, m_bg_videoram(*this, "bg_videoram")
{ }
void init_cclimbr2();
@ -37,7 +39,6 @@ public:
void init_terraf();
void init_terrafjb();
void terraf_sound(machine_config &config);
void terraf(machine_config &config);
void terrafb(machine_config &config);
void legion_common(machine_config &config);
@ -55,11 +56,14 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
void video_config(machine_config &config, int hchar_start, int vstart, int vend);
void sound_config(machine_config &config);
// devices
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_extra;
optional_device<nb1414m4_device> m_nb1414m4;
required_device<screen_device> m_screen;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<buffered_spriteram16_device> m_spriteram;

View File

@ -14,6 +14,7 @@
#include "machine/nb1414m4.h"
#include "machine/gen_latch.h"
#include "video/bufsprite.h"
#include "screen.h"
#include "emupal.h"
#include "tilemap.h"
@ -21,14 +22,15 @@ class galivan_state : public driver_device
{
public:
galivan_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_videoram(*this, "videoram"),
m_spriteram(*this, "spriteram"),
m_nb1414m4(*this, "nb1414m4"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch")
driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_videoram(*this, "videoram")
, m_spriteram(*this, "spriteram")
, m_nb1414m4(*this, "nb1414m4")
, m_screen(*this, "screen")
, m_gfxdecode(*this, "gfxdecode")
, m_palette(*this, "palette")
, m_soundlatch(*this, "soundlatch")
{ }
void galivan(machine_config &config);
@ -39,6 +41,7 @@ public:
protected:
void io_map(address_map &map);
void video_config(machine_config &config);
required_device<cpu_device> m_maincpu;
@ -62,6 +65,7 @@ private:
DECLARE_READ8_MEMBER(soundlatch_clear_r);
DECLARE_READ8_MEMBER(IO_port_c0_r);
DECLARE_WRITE8_MEMBER(blit_trigger_w);
DECLARE_WRITE8_MEMBER(vblank_ack_w);
DECLARE_WRITE8_MEMBER(youmab_extra_bank_w);
DECLARE_READ8_MEMBER(youmab_8a_r);
DECLARE_WRITE8_MEMBER(youmab_81_w);
@ -89,6 +93,7 @@ private:
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
optional_device<nb1414m4_device> m_nb1414m4;
required_device<screen_device> m_screen;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;

View File

@ -6,9 +6,14 @@ Nichibutsu 1414M4 device emulation
Written by Angelo Salese, based on researches by Tomasz Slanina with Legion
This is some fancy MCU / blitter that copies text strings in various Nihon Bussan games;
This is some fancy blitter DMA or MCU or even a discrete structure that copies text strings to a 8-bit text layer in
various Nihon Bussan games;
TODO:
- Identify what exactly this "device" is;
- The overlying text layer should actually be a base device for this (and used where not applicable like galivan,
armedf and bigfightr);
- Command triggering condition not understood (and diverges between galivan.cpp and armedf.cpp);
- where is the condition that makes "insert coin" text to properly blink?
- first byte meaning is completely unknown;
- Ninja Emaki triggers unknown commands 0x8000 & 0xff20;
@ -21,9 +26,6 @@ Notes:
11-- ---- ---- ---- src -> dst copy, if destination != 0 fixed src, otherwise do a src -> dst
--xx xxxx xxxx xxxx destination offset in the VRAM tilemap
- I'm sure that this is a shared device, that shares everything. All of the known differences are due of not
understood features of the chip (some bytes in the ROM etc.)
********************************************************************************************************************/
#include "emu.h"
@ -309,6 +311,17 @@ void nb1414m4_device::_0e00(uint16_t mcu_cmd, uint8_t *vram)
}
}
/*****************************************************************************
DEVICE SETTERS
*****************************************************************************/
void nb1414m4_device::vblank_trigger()
{
// TODO: use this for frame number synchronization instead of screen().frame_number()
// real HW references definitely syncs insert coin blinking after POST so whatever is the host actually
// have an interest over vblank signal.
}
void nb1414m4_device::exec(uint16_t mcu_cmd, uint8_t *vram, uint16_t &scrollx, uint16_t &scrolly, tilemap_t *tilemap)
{
/* latch fg scroll values */

View File

@ -13,6 +13,7 @@ public:
nb1414m4_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void exec(uint16_t mcu_cmd, uint8_t *vram, uint16_t &scrollx, uint16_t &scrolly, tilemap_t *tilemap);
void vblank_trigger();
protected:
// device-level overrides

View File

@ -45,7 +45,8 @@ TILE_GET_INFO_MEMBER(armedf_state::get_nb1414m4_tx_tile_info)
{
attributes = m_text_videoram[tile_index + 0x400] & 0xff;
if(tile_index < 0x12) /* don't draw the NB1414M4 params! TODO: could be a better fix */
// TODO: skip drawing the NB1414M4 params, how the HW actually handles this?
if(tile_index < 0x12)
tile_number = attributes = 0x00;
}

View File

@ -193,7 +193,8 @@ TILE_GET_INFO_MEMBER(galivan_state::ninjemak_get_bg_tile_info)
TILE_GET_INFO_MEMBER(galivan_state::ninjemak_get_tx_tile_info)
{
uint16_t index = tile_index;
if (index < 0x12) /* don't draw the NB1414M4 params! TODO: could be a better fix */
// TODO: skip drawing the NB1414M4 params, how the HW actually handles this?
if (index < 0x12)
index = 0x12;
int attr = m_videoram[index + 0x400];