Skip to content

Commit 7be6bba

Browse files
committed
nwk-tr.cpp: revert back to one k001604
1 parent 11cd461 commit 7be6bba

File tree

1 file changed

+31
-36
lines changed

1 file changed

+31
-36
lines changed

src/mame/konami/nwk-tr.cpp

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -259,20 +259,19 @@ class nwktr_state : public driver_device
259259
m_audiocpu(*this, "audiocpu"),
260260
m_dsp(*this, "dsp%u", 1U),
261261
m_k056800(*this, "k056800"),
262-
m_k001604(*this, "k001604_%u", 1U),
262+
m_k001604(*this, "k001604"),
263263
m_konppc(*this, "konppc"),
264264
m_adc12138(*this, "adc12138"),
265265
m_voodoo(*this, "voodoo%u", 0U),
266-
m_palette(*this, "palette%u", 1U),
266+
m_palette(*this, "palette"),
267267
m_sharc_dataram(*this, "sharc%u_dataram", 0U),
268268
m_jvs_host(*this, "jvs_host"),
269269
m_gn676_lan(*this, "gn676_lan"),
270270
m_cgboard_bank(*this, "cgboard_%u_bank", 0U),
271271
m_in(*this, "IN%u", 0U),
272272
m_dsw(*this, "DSW"),
273273
m_analog(*this, "ANALOG%u", 1U),
274-
m_pcb_digit(*this, "pcbdigit%u", 0U),
275-
m_cg_view(*this, "cg_view")
274+
m_pcb_digit(*this, "pcbdigit%u", 0U)
276275
{ }
277276

278277
void nwktr(machine_config &config);
@@ -296,11 +295,11 @@ class nwktr_state : public driver_device
296295
required_device<cpu_device> m_audiocpu;
297296
required_device_array<adsp21062_device, 2> m_dsp;
298297
required_device<k056800_device> m_k056800;
299-
required_device_array<k001604_device, 2> m_k001604;
298+
required_device<k001604_device> m_k001604;
300299
required_device<konppc_device> m_konppc;
301300
required_device<adc12138_device> m_adc12138;
302301
required_device_array<generic_voodoo_device, 2> m_voodoo;
303-
required_device_array<palette_device, 2> m_palette;
302+
required_device<palette_device> m_palette;
304303
optional_shared_ptr_array<uint32_t, 2> m_sharc_dataram;
305304
required_device<konppc_jvs_host_device> m_jvs_host;
306305
required_device<konami_gn676_lan_device> m_gn676_lan;
@@ -309,13 +308,13 @@ class nwktr_state : public driver_device
309308
required_ioport m_dsw;
310309
required_ioport_array<5> m_analog;
311310
output_finder<2> m_pcb_digit;
312-
memory_view m_cg_view;
313311

314312
emu_timer *m_sound_irq_timer = nullptr;
315313
bool m_exrgb = false;
316314

317315
uint8_t sysreg_r(offs_t offset);
318316
void sysreg_w(offs_t offset, uint8_t data);
317+
void cg_view_select(int view);
319318
void soundtimer_en_w(uint16_t data);
320319
void soundtimer_count_w(uint16_t data);
321320
double adc12138_input_callback(uint8_t input);
@@ -332,12 +331,12 @@ class nwktr_state : public driver_device
332331

333332
uint32_t nwktr_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
334333
{
335-
bitmap.fill(m_palette[0]->pen(0), cliprect);
334+
bitmap.fill(m_palette->pen(0), cliprect);
336335

337336
int const board = m_exrgb ? 1 : 0;
338337

339338
m_voodoo[board]->update(bitmap, cliprect);
340-
m_k001604[0]->draw_front_layer(screen, bitmap, cliprect); // K001604 on slave board doesn't seem to output anything. Bug or intended?
339+
m_k001604->draw_front_layer(screen, bitmap, cliprect);
341340

342341
return 0;
343342
}
@@ -417,20 +416,25 @@ void nwktr_state::sysreg_w(offs_t offset, uint8_t data)
417416

418417
m_konppc->set_cgboard_id((data >> 4) & 0x3);
419418

420-
// Racing Jam sets CG board ID to 2 when writing to the tilemap chip.
421-
// This could mean broadcast to both CG boards?
419+
/*
420+
Racing Jam sets both EXID bits when writing to the tilemap chip before POST. This means
421+
writing to both CG boards at the tilemap chip simultaneously. However, broadcasting
422+
read/write handlers currently isn't supported and likely will never be for preventing
423+
possible race conditions. Due to the way Konami configured this hardware in such an
424+
illegal manner, we'll cheat by only using one K001604 instead to show all the tilemap
425+
graphics can properly display during POST (and pass "both" tilemap IC tests).
426+
*/
422427

423-
m_exrgb = BIT(data, 0); // Select which CG Board outputs signal
428+
// cg_view_select((data >> 4) & 0x3); This normally selects which CG board to read/write to (see above note)
424429

425-
m_cg_view.select(m_konppc->get_cgboard_id() ? 1 : 0);
430+
m_exrgb = BIT(data, 0); // Select which CG Board outputs signal
426431
break;
427432

428433
default:
429434
break;
430435
}
431436
}
432437

433-
434438
/*****************************************************************************/
435439

436440
TIMER_CALLBACK_MEMBER(nwktr_state::sound_irq)
@@ -479,18 +483,19 @@ void nwktr_state::machine_start()
479483
save_item(NAME(m_exrgb));
480484
}
481485

486+
void nwktr_state::machine_reset()
487+
{
488+
m_dsp[0]->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
489+
m_dsp[1]->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
490+
}
491+
482492
void nwktr_state::ppc_map(address_map &map)
483493
{
484494
map(0x00000000, 0x003fffff).ram().share(m_work_ram);
485-
map(0x74000000, 0x7407ffff).view(m_cg_view);
486-
m_cg_view[0](0x74000000, 0x740000ff).rw(m_k001604[0], FUNC(k001604_device::reg_r), FUNC(k001604_device::reg_w));
487-
m_cg_view[0](0x74010000, 0x7401ffff).ram().w(m_palette[0], FUNC(palette_device::write32)).share("palette1");
488-
m_cg_view[0](0x74020000, 0x7403ffff).rw(m_k001604[0], FUNC(k001604_device::tile_r), FUNC(k001604_device::tile_w));
489-
m_cg_view[0](0x74040000, 0x7407ffff).rw(m_k001604[0], FUNC(k001604_device::char_r), FUNC(k001604_device::char_w));
490-
m_cg_view[1](0x74000000, 0x740000ff).rw(m_k001604[1], FUNC(k001604_device::reg_r), FUNC(k001604_device::reg_w));
491-
m_cg_view[1](0x74010000, 0x7401ffff).ram().w(m_palette[1], FUNC(palette_device::write32)).share("palette2");
492-
m_cg_view[1](0x74020000, 0x7403ffff).rw(m_k001604[1], FUNC(k001604_device::tile_r), FUNC(k001604_device::tile_w));
493-
m_cg_view[1](0x74040000, 0x7407ffff).rw(m_k001604[1], FUNC(k001604_device::char_r), FUNC(k001604_device::char_w));
495+
map(0x74000000, 0x740000ff).rw(m_k001604, FUNC(k001604_device::reg_r), FUNC(k001604_device::reg_w));
496+
map(0x74010000, 0x7401ffff).ram().w(m_palette, FUNC(palette_device::write32)).share("palette");
497+
map(0x74020000, 0x7403ffff).rw(m_k001604, FUNC(k001604_device::tile_r), FUNC(k001604_device::tile_w));
498+
map(0x74040000, 0x7407ffff).rw(m_k001604, FUNC(k001604_device::char_r), FUNC(k001604_device::char_w));
494499
map(0x78000000, 0x7800ffff).rw(m_konppc, FUNC(konppc_device::cgboard_dsp_shared_r_ppc), FUNC(konppc_device::cgboard_dsp_shared_w_ppc));
495500
map(0x780c0000, 0x780c0003).rw(m_konppc, FUNC(konppc_device::cgboard_dsp_comm_r_ppc), FUNC(konppc_device::cgboard_dsp_comm_w_ppc));
496501
map(0x7d000000, 0x7d00ffff).r(FUNC(nwktr_state::sysreg_r));
@@ -636,12 +641,6 @@ double nwktr_state::adc12138_input_callback(uint8_t input)
636641
return (double)(value) / 4095.0;
637642
}
638643

639-
void nwktr_state::machine_reset()
640-
{
641-
m_dsp[0]->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
642-
m_dsp[1]->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
643-
}
644-
645644
void nwktr_state::nwktr(machine_config &config)
646645
{
647646
// basic machine hardware
@@ -693,14 +692,10 @@ void nwktr_state::nwktr(machine_config &config)
693692
screen.set_raw(XTAL(64'000'000) / 4, 644, 44, 44 + 512, 450, 31, 31 + 400);
694693
screen.set_screen_update(FUNC(nwktr_state::screen_update));
695694

696-
PALETTE(config, m_palette[0]).set_format(4, raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 10,5,0>, 65536 / 4);
697-
PALETTE(config, m_palette[1]).set_format(4, raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 10,5,0>, 65536 / 4);
698-
699-
K001604(config, m_k001604[0], 0);
700-
m_k001604[0]->set_palette(m_palette[0]);
695+
PALETTE(config, m_palette).set_format(4, raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 10,5,0>, 65536 / 4);
701696

702-
K001604(config, m_k001604[1], 0);
703-
m_k001604[1]->set_palette(m_palette[1]);
697+
K001604(config, m_k001604, 0);
698+
m_k001604->set_palette(m_palette); // see sysreg_w case 7 for why we're only use one K001604 instead of two
704699

705700
SPEAKER(config, "lspeaker").front_left();
706701
SPEAKER(config, "rspeaker").front_right();

0 commit comments

Comments
 (0)