misc/micro3d.cpp: Cleanups: (#12335)
- Use C++ style comments for single line comments - Use reference instead pointers - Add missing items into save state - Reduce unnecessary lines - Fix variable and function namings - Suppress side effects for debugger reads - Use array for noise generator - Constantize variables - Reduce preprocessor defines
This commit is contained in:
parent
a7223092bd
commit
c83f2549bb
@ -208,18 +208,18 @@ void micro3d_state::hostmem(address_map &map)
|
||||
{
|
||||
map(0x000000, 0x143fff).rom();
|
||||
map(0x200000, 0x20ffff).ram().share("nvram");
|
||||
map(0x800000, 0x83ffff).ram().share("shared_ram");
|
||||
map(0x800000, 0x83ffff).ram().share(m_shared_ram);
|
||||
map(0x900000, 0x900001).w(FUNC(micro3d_state::host_drmath_int_w));
|
||||
map(0x920000, 0x920001).portr("INPUTS_C_D");
|
||||
map(0x940000, 0x940001).portr("INPUTS_A_B");
|
||||
map(0x960000, 0x960001).w(FUNC(micro3d_state::micro3d_reset_w));
|
||||
map(0x960000, 0x960001).w(FUNC(micro3d_state::reset_w));
|
||||
map(0x980001, 0x980001).rw("adc", FUNC(adc0844_device::read), FUNC(adc0844_device::write));
|
||||
map(0x9a0000, 0x9a0007).rw(m_vgb, FUNC(tms34010_device::host_r), FUNC(tms34010_device::host_w));
|
||||
map(0x9c0000, 0x9c0001).noprw(); /* Lamps */
|
||||
map(0x9c0000, 0x9c0001).noprw(); // Lamps
|
||||
map(0x9e0000, 0x9e002f).rw("mfp", FUNC(mc68901_device::read), FUNC(mc68901_device::write)).umask16(0xff00);
|
||||
map(0xa00000, 0xa0003f).rw(m_duart, FUNC(mc68681_device::read), FUNC(mc68681_device::write)).umask16(0xff00);
|
||||
map(0xa20000, 0xa20001).r(FUNC(micro3d_state::micro3d_encoder_h_r));
|
||||
map(0xa40002, 0xa40003).r(FUNC(micro3d_state::micro3d_encoder_l_r));
|
||||
map(0xa20000, 0xa20001).r(FUNC(micro3d_state::encoder_h_r));
|
||||
map(0xa40002, 0xa40003).r(FUNC(micro3d_state::encoder_l_r));
|
||||
}
|
||||
|
||||
|
||||
@ -231,12 +231,12 @@ void micro3d_state::hostmem(address_map &map)
|
||||
|
||||
void micro3d_state::vgbmem(address_map &map)
|
||||
{
|
||||
map(0x00000000, 0x007fffff).ram().share("sprite_vram");
|
||||
map(0x00000000, 0x007fffff).ram().share(m_sprite_vram);
|
||||
map(0x00800000, 0x00bfffff).ram();
|
||||
map(0x00c00000, 0x00c0000f).portr("VGB_SW");
|
||||
map(0x00e00000, 0x00e0000f).w(FUNC(micro3d_state::micro3d_xfer3dk_w));
|
||||
map(0x00e00000, 0x00e0000f).w(FUNC(micro3d_state::xfer3dk_w));
|
||||
map(0x02000000, 0x0200ffff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // clut
|
||||
map(0x02600000, 0x0260000f).w(FUNC(micro3d_state::micro3d_creg_w));
|
||||
map(0x02600000, 0x0260000f).w(FUNC(micro3d_state::creg_w));
|
||||
map(0x02c00000, 0x02c0003f).r(FUNC(micro3d_state::vgb_uart_r)).umask16(0x00ff);
|
||||
map(0x02e00000, 0x02e0003f).w(FUNC(micro3d_state::vgb_uart_w)).umask16(0x00ff);
|
||||
map(0x03800000, 0x03dfffff).rom().region("tms_gfx", 0);
|
||||
@ -259,16 +259,16 @@ void micro3d_state::drmath_prg(address_map &map)
|
||||
void micro3d_state::drmath_data(address_map &map)
|
||||
{
|
||||
map(0x00000000, 0x000fffff).rom().region("drmath", 0);
|
||||
map(0x00800000, 0x0083ffff).rw(FUNC(micro3d_state::micro3d_shared_r), FUNC(micro3d_state::micro3d_shared_w));
|
||||
map(0x00400000, 0x004fffff).ram();
|
||||
map(0x00500000, 0x005fffff).ram();
|
||||
map(0x00800000, 0x0083ffff).rw(FUNC(micro3d_state::shared_r), FUNC(micro3d_state::shared_w));
|
||||
map(0x00a00000, 0x00a00003).w(FUNC(micro3d_state::drmath_int_w));
|
||||
map(0x01000000, 0x01000003).w(FUNC(micro3d_state::micro3d_mac1_w));
|
||||
map(0x01000004, 0x01000007).rw(FUNC(micro3d_state::micro3d_mac2_r), FUNC(micro3d_state::micro3d_mac2_w));
|
||||
map(0x01200000, 0x01203fff).ram().share("mac_sram");
|
||||
map(0x01400000, 0x01400003).rw(FUNC(micro3d_state::micro3d_pipe_r), FUNC(micro3d_state::micro3d_fifo_w));
|
||||
map(0x01000000, 0x01000003).w(FUNC(micro3d_state::mac1_w));
|
||||
map(0x01000004, 0x01000007).rw(FUNC(micro3d_state::mac2_r), FUNC(micro3d_state::mac2_w));
|
||||
map(0x01200000, 0x01203fff).ram().share(m_mac_sram);
|
||||
map(0x01400000, 0x01400003).rw(FUNC(micro3d_state::pipe_r), FUNC(micro3d_state::fifo_w));
|
||||
map(0x01600000, 0x01600003).w(FUNC(micro3d_state::drmath_intr2_ack));
|
||||
map(0x01800000, 0x01800003).w(FUNC(micro3d_state::micro3d_alt_fifo_w));
|
||||
map(0x01800000, 0x01800003).w(FUNC(micro3d_state::alt_fifo_w));
|
||||
map(0x03fffff0, 0x03ffffff).rw("scc", FUNC(z80scc_device::ab_dc_r), FUNC(z80scc_device::ab_dc_w)).umask32(0x000000ff);
|
||||
}
|
||||
|
||||
@ -287,9 +287,9 @@ void micro3d_state::soundmem_io(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x07ff).ram();
|
||||
map(0xfd00, 0xfd01).rw("ym2151", FUNC(ym2151_device::read), FUNC(ym2151_device::write));
|
||||
map(0xfe00, 0xfe00).w(FUNC(micro3d_state::micro3d_upd7759_w));
|
||||
map(0xff00, 0xff00).w(FUNC(micro3d_state::micro3d_snd_dac_a));
|
||||
map(0xff01, 0xff01).w(FUNC(micro3d_state::micro3d_snd_dac_b));
|
||||
map(0xfe00, 0xfe00).w(FUNC(micro3d_state::upd7759_w));
|
||||
map(0xff00, 0xff00).w(FUNC(micro3d_state::snd_dac_a));
|
||||
map(0xff01, 0xff01).w(FUNC(micro3d_state::snd_dac_b));
|
||||
}
|
||||
|
||||
void micro3d_state::cpu_space_map(address_map &map)
|
||||
@ -309,7 +309,7 @@ void micro3d_state::micro3d(machine_config &config)
|
||||
{
|
||||
M68000(config, m_maincpu, 32_MHz_XTAL / 2);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, µ3d_state::hostmem);
|
||||
m_maincpu->set_vblank_int("screen", FUNC(micro3d_state::micro3d_vblank));
|
||||
m_maincpu->set_vblank_int("screen", FUNC(micro3d_state::vblank));
|
||||
m_maincpu->set_addrmap(m68000_base_device::AS_CPU_SPACE, µ3d_state::cpu_space_map);
|
||||
|
||||
TMS34010(config, m_vgb, 40_MHz_XTAL);
|
||||
@ -331,10 +331,10 @@ void micro3d_state::micro3d(machine_config &config)
|
||||
I8051(config, m_audiocpu, 11.0592_MHz_XTAL);
|
||||
m_audiocpu->set_addrmap(AS_PROGRAM, µ3d_state::soundmem_prg);
|
||||
m_audiocpu->set_addrmap(AS_IO, µ3d_state::soundmem_io);
|
||||
m_audiocpu->port_in_cb<1>().set(FUNC(micro3d_state::micro3d_sound_p1_r));
|
||||
m_audiocpu->port_out_cb<1>().set(FUNC(micro3d_state::micro3d_sound_p1_w));
|
||||
m_audiocpu->port_in_cb<3>().set(FUNC(micro3d_state::micro3d_sound_p3_r));
|
||||
m_audiocpu->port_out_cb<3>().set(FUNC(micro3d_state::micro3d_sound_p3_w));
|
||||
m_audiocpu->port_in_cb<1>().set(FUNC(micro3d_state::sound_p1_r));
|
||||
m_audiocpu->port_out_cb<1>().set(FUNC(micro3d_state::sound_p1_w));
|
||||
m_audiocpu->port_in_cb<3>().set(FUNC(micro3d_state::sound_p3_r));
|
||||
m_audiocpu->port_out_cb<3>().set(FUNC(micro3d_state::sound_p3_w));
|
||||
|
||||
MC68681(config, m_duart, 3.6864_MHz_XTAL);
|
||||
m_duart->irq_cb().set(FUNC(micro3d_state::duart_irq_handler));
|
||||
@ -390,13 +390,13 @@ void micro3d_state::micro3d(machine_config &config)
|
||||
ym2151.add_route(0, "lspeaker", 0.35);
|
||||
ym2151.add_route(1, "rspeaker", 0.35);
|
||||
|
||||
MICRO3D_SOUND(config, m_noise_1);
|
||||
m_noise_1->add_route(0, "lspeaker", 1.0);
|
||||
m_noise_1->add_route(1, "rspeaker", 1.0);
|
||||
MICRO3D_SOUND(config, m_noise[0]);
|
||||
m_noise[0]->add_route(0, "lspeaker", 1.0);
|
||||
m_noise[0]->add_route(1, "rspeaker", 1.0);
|
||||
|
||||
MICRO3D_SOUND(config, m_noise_2);
|
||||
m_noise_2->add_route(0, "lspeaker", 1.0);
|
||||
m_noise_2->add_route(1, "rspeaker", 1.0);
|
||||
MICRO3D_SOUND(config, m_noise[1]);
|
||||
m_noise[1]->add_route(0, "lspeaker", 1.0);
|
||||
m_noise[1]->add_route(1, "rspeaker", 1.0);
|
||||
}
|
||||
|
||||
void micro3d_state::botss11(machine_config &config)
|
||||
@ -413,7 +413,7 @@ void micro3d_state::botss11(machine_config &config)
|
||||
*************************************/
|
||||
|
||||
ROM_START( f15se )
|
||||
/* Host PCB (MPG DW-00011C-0011-01) */
|
||||
// Host PCB (MPG DW-00011C-0011-01)
|
||||
ROM_REGION( 0x180000, "maincpu", 0 )
|
||||
ROM_LOAD16_BYTE( "110-00001-600.u67", 0x000001, 0x20000, CRC(da507ec7) SHA1(24fb80aa7157a97b53a6efa8f2477aacd0cd621f) )
|
||||
ROM_LOAD16_BYTE( "110-00001-601.u91", 0x000000, 0x20000, CRC(f47648c6) SHA1(a5eac6fcde52ebf750cfcdcf151fcbd859146296) )
|
||||
@ -427,7 +427,7 @@ ROM_START( f15se )
|
||||
ROM_LOAD16_BYTE( "110-00001-009.u95", 0x100000, 0x20000, CRC(33e3b473) SHA1(66deda79ba94f0ed722b399b3fc6062dcdd1a6c9) )
|
||||
ROM_FILL( 0x140000, 0x40000, 0xff )
|
||||
|
||||
/* Dr Math PCB (MPG 010-00002-001) */
|
||||
// Dr Math PCB (MPG 010-00002-001)
|
||||
ROM_REGION32_BE( 0x100000, "drmath", 0 )
|
||||
ROM_LOAD64_BYTE( "110-00001-222.u134", 0x00000, 0x08000, CRC(1aa391a4) SHA1(8bf80c0d0d9a85cbec9d8e18f6b5fc83989c86ce) )
|
||||
ROM_LOAD64_BYTE( "110-00001-225.u126", 0x00001, 0x08000, CRC(bf6eb5a1) SHA1(94320581917ce36ae50ea0ecb53af9e12999e2b1) )
|
||||
@ -444,7 +444,7 @@ ROM_START( f15se )
|
||||
ROM_LOAD16_BYTE( "110-00001-016.u167", 0x40001, 0x20000, CRC(5db4f677) SHA1(25a6fe4c562e4fa4225aa4687dd41920b614e591) )
|
||||
ROM_LOAD16_BYTE( "110-00001-017.u160", 0x40000, 0x20000, CRC(47f9a868) SHA1(7c8a9355893e4a3f3846fd05e0237ffd1404ffee) )
|
||||
|
||||
/* Video Graphics PCB (MPG DW-010-00003-001) */
|
||||
// Video Graphics PCB (MPG DW-010-00003-001)
|
||||
ROM_REGION16_LE( 0x40000, "tms34010", 0 )
|
||||
ROM_LOAD16_BYTE( "110-00002-101.u101", 0x00000, 0x20000, CRC(e99fac71) SHA1(98d1d2134fabc1bad637cbe42cbe9cdc20b32126) )
|
||||
ROM_LOAD16_BYTE( "110-00002-104.u97", 0x00001, 0x20000, CRC(78b9b7c7) SHA1(4bce993dd3aea126e3a9d42ee8c68b8ab47fdba7) )
|
||||
@ -457,7 +457,7 @@ ROM_START( f15se )
|
||||
ROM_LOAD16_BYTE( "110-00002-103.u114", 0x80000, 0x20000, CRC(4d8e8f54) SHA1(d8a23b5fd00ab919dc6d63fc72824d1293073813) )
|
||||
ROM_LOAD16_BYTE( "110-00002-102.u108", 0x80001, 0x20000, CRC(f6488e31) SHA1(d2f9304cc59f5523007592ae76ddd56107cc29e8) )
|
||||
|
||||
/* Sound PCB (MPG 010-00018-002) */
|
||||
// Sound PCB (MPG 010-00018-002)
|
||||
ROM_REGION( 0x08000, "audiocpu", 0 )
|
||||
ROM_LOAD( "110-00004-001.u2", 0x000000, 0x08000, CRC(705685a9) SHA1(311f7cac126a19e8bd555ebf31ff4ec4680ddfa4) )
|
||||
|
||||
@ -466,7 +466,7 @@ ROM_START( f15se )
|
||||
ROM_END
|
||||
|
||||
ROM_START( f15se22 )
|
||||
/* Host PCB (MPG DW-00011C-0011-01) */
|
||||
// Host PCB (MPG DW-00011C-0011-01)
|
||||
ROM_REGION( 0x180000, "maincpu", 0 )
|
||||
ROM_LOAD16_BYTE( "host.u67", 0x000001, 0x20000, CRC(8f495ceb) SHA1(90998ad67e76928ed1a6cae56038b98d1aa2e7b0) )
|
||||
ROM_LOAD16_BYTE( "host.u91", 0x000000, 0x20000, CRC(dfae5ec3) SHA1(29306eed5047e39a0a2350e61ab7126a84cb710b) )
|
||||
@ -480,7 +480,7 @@ ROM_START( f15se22 )
|
||||
ROM_LOAD16_BYTE( "110-00001-009.u95", 0x100000, 0x20000, CRC(33e3b473) SHA1(66deda79ba94f0ed722b399b3fc6062dcdd1a6c9) )
|
||||
ROM_FILL( 0x140000, 0x40000, 0xff )
|
||||
|
||||
/* Dr Math PCB (MPG 010-00002-001) */
|
||||
// Dr Math PCB (MPG 010-00002-001)
|
||||
ROM_REGION32_BE( 0x100000, "drmath", 0 )
|
||||
ROM_LOAD64_BYTE( "122.dth", 0x00000, 0x08000, CRC(9d2032cf) SHA1(8430816756ea92bbe86b94eaa24a6071bf0ef879) )
|
||||
ROM_LOAD64_BYTE( "125.dth", 0x00001, 0x08000, CRC(7718487c) SHA1(609106f55601f84095b64ce2484107779da89149) )
|
||||
@ -497,7 +497,7 @@ ROM_START( f15se22 )
|
||||
ROM_LOAD16_BYTE( "110-00001-016.u167", 0x40001, 0x20000, CRC(5db4f677) SHA1(25a6fe4c562e4fa4225aa4687dd41920b614e591) )
|
||||
ROM_LOAD16_BYTE( "110-00001-017.u160", 0x40000, 0x20000, CRC(47f9a868) SHA1(7c8a9355893e4a3f3846fd05e0237ffd1404ffee) )
|
||||
|
||||
/* Video Graphics PCB (MPG DW-010-00003-001) */
|
||||
// Video Graphics PCB (MPG DW-010-00003-001)
|
||||
ROM_REGION16_LE( 0x40000, "tms34010", 0 )
|
||||
ROM_LOAD16_BYTE( "110-00002-101.u101", 0x00000, 0x20000, CRC(e99fac71) SHA1(98d1d2134fabc1bad637cbe42cbe9cdc20b32126) )
|
||||
ROM_LOAD16_BYTE( "110-00002-104.u97", 0x00001, 0x20000, CRC(78b9b7c7) SHA1(4bce993dd3aea126e3a9d42ee8c68b8ab47fdba7) )
|
||||
@ -510,7 +510,7 @@ ROM_START( f15se22 )
|
||||
ROM_LOAD16_BYTE( "110-00002-103.u114", 0x80000, 0x20000, CRC(4d8e8f54) SHA1(d8a23b5fd00ab919dc6d63fc72824d1293073813) )
|
||||
ROM_LOAD16_BYTE( "110-00002-102.u108", 0x80001, 0x20000, CRC(f6488e31) SHA1(d2f9304cc59f5523007592ae76ddd56107cc29e8) )
|
||||
|
||||
/* Sound PCB (MPG 010-00018-002) */
|
||||
// Sound PCB (MPG 010-00018-002)
|
||||
ROM_REGION( 0x08000, "audiocpu", 0 )
|
||||
ROM_LOAD( "110-00004-001.u2", 0x000000, 0x08000, CRC(705685a9) SHA1(311f7cac126a19e8bd555ebf31ff4ec4680ddfa4) )
|
||||
|
||||
@ -519,7 +519,7 @@ ROM_START( f15se22 )
|
||||
ROM_END
|
||||
|
||||
ROM_START( f15se21 )
|
||||
/* Host PCB (MPG DW-00011C-0011-01) */
|
||||
// Host PCB (MPG DW-00011C-0011-01)
|
||||
ROM_REGION( 0x180000, "maincpu", 0 )
|
||||
ROM_LOAD16_BYTE( "110-00001-500.u67", 0x000001, 0x20000, CRC(6c26806d) SHA1(7cfd2b3b92b0fc6627c92a2013a317ca5abc66a0) )
|
||||
ROM_LOAD16_BYTE( "110-00001-501.u91", 0x000000, 0x20000, CRC(81f02bf7) SHA1(09976746fe4d9c88bd8840f6e7addb09226aa54b) )
|
||||
@ -533,7 +533,7 @@ ROM_START( f15se21 )
|
||||
ROM_LOAD16_BYTE( "110-00001-009.u95", 0x100000, 0x20000, CRC(33e3b473) SHA1(66deda79ba94f0ed722b399b3fc6062dcdd1a6c9) )
|
||||
ROM_FILL( 0x140000, 0x40000, 0xff )
|
||||
|
||||
/* Video Graphics PCB (MPG DW-010-00003-001) */
|
||||
// Video Graphics PCB (MPG DW-010-00003-001)
|
||||
ROM_REGION16_LE( 0x40000, "tms34010", 0 )
|
||||
ROM_LOAD16_BYTE( "001.vgb", 0x000000, 0x20000, CRC(810c142d) SHA1(d37e5ecd716dda65d43cec7bca524c59d3dc9803) )
|
||||
ROM_LOAD16_BYTE( "004.vgb", 0x000001, 0x20000, CRC(b69e1260) SHA1(1a2b69ea7c96b0293b24d87ea46bd4b1d4c56a66) )
|
||||
@ -546,7 +546,7 @@ ROM_START( f15se21 )
|
||||
ROM_LOAD16_BYTE( "110-00002-103.u114", 0x80000, 0x20000, CRC(4d8e8f54) SHA1(d8a23b5fd00ab919dc6d63fc72824d1293073813) )
|
||||
ROM_LOAD16_BYTE( "110-00002-102.u108", 0x80001, 0x20000, CRC(f6488e31) SHA1(d2f9304cc59f5523007592ae76ddd56107cc29e8) )
|
||||
|
||||
/* Dr Math PCB (MPG 010-00002-001) */
|
||||
// Dr Math PCB (MPG 010-00002-001)
|
||||
ROM_REGION32_BE( 0x100000, "drmath", 0 )
|
||||
ROM_LOAD64_BYTE( "122.dth", 0x00000, 0x08000, CRC(9d2032cf) SHA1(8430816756ea92bbe86b94eaa24a6071bf0ef879) )
|
||||
ROM_LOAD64_BYTE( "125.dth", 0x00001, 0x08000, CRC(7718487c) SHA1(609106f55601f84095b64ce2484107779da89149) )
|
||||
@ -563,7 +563,7 @@ ROM_START( f15se21 )
|
||||
ROM_LOAD16_BYTE( "110-00001-016.u167", 0x40001, 0x20000, CRC(5db4f677) SHA1(25a6fe4c562e4fa4225aa4687dd41920b614e591) )
|
||||
ROM_LOAD16_BYTE( "110-00001-017.u160", 0x40000, 0x20000, CRC(47f9a868) SHA1(7c8a9355893e4a3f3846fd05e0237ffd1404ffee) )
|
||||
|
||||
/* Sound PCB (MPG 010-00018-002) */
|
||||
// Sound PCB (MPG 010-00018-002)
|
||||
ROM_REGION( 0x08000, "audiocpu", 0 )
|
||||
ROM_LOAD( "110-00004-001.u2", 0x000000, 0x08000, CRC(705685a9) SHA1(311f7cac126a19e8bd555ebf31ff4ec4680ddfa4) )
|
||||
|
||||
@ -572,7 +572,7 @@ ROM_START( f15se21 )
|
||||
ROM_END
|
||||
|
||||
ROM_START( botss )
|
||||
/* Host PCB (MPG DW-00011C-0011-01) */
|
||||
// Host PCB (MPG DW-00011C-0011-01)
|
||||
ROM_REGION( 0x180000, "maincpu", 0 )
|
||||
ROM_LOAD16_BYTE( "110-00153-100.u67", 0x000001, 0x20000, CRC(338aa9c3) SHA1(3d10329a5df80ab1761fd3953eb3872a72f26bef) )
|
||||
ROM_LOAD16_BYTE( "110-00153-101.u91", 0x000000, 0x20000, CRC(3278279e) SHA1(570935988c776283cdcd5aa13d71a75f0a466099) )
|
||||
@ -586,7 +586,7 @@ ROM_START( botss )
|
||||
ROM_LOAD16_BYTE( "110-00013-009.u95", 0x100000, 0x20000, CRC(6c595d1e) SHA1(89fdc30166ba1e9706798547195bdf6875a02e96) )
|
||||
ROM_FILL( 0x140000, 0x40000, 0xff )
|
||||
|
||||
/* Dr Math PCB (MPG 010-00002-001) */
|
||||
// Dr Math PCB (MPG 010-00002-001)
|
||||
ROM_REGION32_BE( 0x100000, "drmath", 0 )
|
||||
ROM_LOAD64_BYTE( "110-00013-122.u134", 0x000000, 0x08000, CRC(bf60c487) SHA1(5ce80e89d9a24b627b0e97bf36a4e71c2eff4324) )
|
||||
ROM_LOAD64_BYTE( "110-00013-125.u126", 0x000001, 0x08000, CRC(b0dccf4a) SHA1(e8bfd622c006985b724cdbd3ad14c33e9ed27c6c) )
|
||||
@ -607,7 +607,7 @@ ROM_START( botss )
|
||||
ROM_LOAD16_BYTE( "110-00023-201.u101", 0x000000, 0x20000, CRC(7dc05f7d) SHA1(4d202b229cf4690d92491311e9ff14034b19c35c) )
|
||||
ROM_LOAD16_BYTE( "110-00023-204.u97", 0x000001, 0x20000, CRC(925fd08a) SHA1(fb06413debbffcd63b018f374f25b0d8e419c739) )
|
||||
|
||||
/* Video Graphics PCB (MPG DW-010-00002-002) */
|
||||
// Video Graphics PCB (MPG DW-010-00002-002)
|
||||
ROM_REGION16_LE( 0xc0000, "tms_gfx", 0 )
|
||||
ROM_LOAD16_BYTE( "110-00023-205.u124", 0x000000, 0x20000, CRC(5482e0c4) SHA1(492afac1862f2899cd734d1e57ca978ed6a906d5) )
|
||||
ROM_LOAD16_BYTE( "110-00023-206.u121", 0x000001, 0x20000, CRC(a55e5d19) SHA1(86fbcb425103ae9fff381357339af349848fc3f2) )
|
||||
@ -616,7 +616,7 @@ ROM_START( botss )
|
||||
ROM_LOAD16_BYTE( "110-00023-203.u114", 0x080000, 0x20000, CRC(b1dacbb1) SHA1(323531b6919eed4a963d6aad871f1fd34203e698) )
|
||||
ROM_LOAD16_BYTE( "110-00023-202.u108", 0x080001, 0x20000, CRC(ac0d3179) SHA1(f4c67d59d913ead0f8a6d42e2ca66857ebf01602) )
|
||||
|
||||
/* Sound PCB (MPG 010-00018-002) */
|
||||
// Sound PCB (MPG 010-00018-002)
|
||||
ROM_REGION( 0x10000, "audiocpu", 0 )
|
||||
ROM_LOAD( "110-00014-001.u2", 0x000000, 0x08000, CRC(307fcb6d) SHA1(0cf63a39ac8920be6532974311804529d7218545) )
|
||||
|
||||
@ -624,16 +624,16 @@ ROM_START( botss )
|
||||
ROM_LOAD( "110-00013-001.u17", 0x000000, 0x40000, CRC(015a0b17) SHA1(f229c9aa59f0e6b25b818f9513997a8685e33982) )
|
||||
|
||||
ROM_REGION( 0x10000, "plds", 0 )
|
||||
/* Host */
|
||||
ROM_LOAD( "120-00001-306.u77", 0x000000, 0x00310, CRC(60282a45) SHA1(8621b64fa00fa556c09d7d1566480cd442a8e655) ) /* AmPAL23S8-20 */
|
||||
// Host
|
||||
ROM_LOAD( "120-00001-306.u77", 0x000000, 0x00310, CRC(60282a45) SHA1(8621b64fa00fa556c09d7d1566480cd442a8e655) ) // AmPAL23S8-20
|
||||
|
||||
/* Dr. Math */
|
||||
ROM_LOAD( "mac1_u173_a.bin", 0x000000, 0x014c7, CRC(78040232) SHA1(c9adc1db76b4ee5ee08f4a11caae77993b23cc30) ) /* EPS448 */
|
||||
ROM_LOAD( "mac2_u166_a.bin", 0x000000, 0x014c7, CRC(c85c4c66) SHA1(fab07ad0611de7d2c2af9b6fa262d574e238bd9f) ) /* EPS448 */
|
||||
// Dr. Math
|
||||
ROM_LOAD( "mac1_u173_a.bin", 0x000000, 0x014c7, CRC(78040232) SHA1(c9adc1db76b4ee5ee08f4a11caae77993b23cc30) ) // EPS448
|
||||
ROM_LOAD( "mac2_u166_a.bin", 0x000000, 0x014c7, CRC(c85c4c66) SHA1(fab07ad0611de7d2c2af9b6fa262d574e238bd9f) ) // EPS448
|
||||
ROM_END
|
||||
|
||||
ROM_START( botss11 )
|
||||
/* Host PCB (MPG DW-00011C-0011-02) */
|
||||
// Host PCB (MPG DW-00011C-0011-02)
|
||||
ROM_REGION( 0x180000, "maincpu", 0 )
|
||||
ROM_LOAD16_BYTE( "110-00013-300.u67", 0x000001, 0x20000, CRC(7f74362a) SHA1(41611ba8e6eb5d6b3dfe88e1cede7d9fb5472e40) )
|
||||
ROM_LOAD16_BYTE( "110-00013-301.u91", 0x000000, 0x20000, CRC(a8100d1e) SHA1(69d3cac6f67563c0796560f7b874d7660720027d) )
|
||||
@ -647,7 +647,7 @@ ROM_START( botss11 )
|
||||
ROM_LOAD16_BYTE( "110-00013-109.u95", 0x100000, 0x20000, CRC(6c595d1e) SHA1(89fdc30166ba1e9706798547195bdf6875a02e96) )
|
||||
ROM_FILL( 0x140000, 0x40000, 0xff )
|
||||
|
||||
/* Dr Math PCB (MPG 010-00002-001) */
|
||||
// Dr Math PCB (MPG 010-00002-001)
|
||||
ROM_REGION32_BE( 0x100000, "drmath", 0 )
|
||||
ROM_LOAD64_BYTE( "110-00013-122.u134", 0x000000, 0x08000, CRC(bf60c487) SHA1(5ce80e89d9a24b627b0e97bf36a4e71c2eff4324) )
|
||||
ROM_LOAD64_BYTE( "110-00013-125.u126", 0x000001, 0x08000, CRC(b0dccf4a) SHA1(e8bfd622c006985b724cdbd3ad14c33e9ed27c6c) )
|
||||
@ -668,7 +668,7 @@ ROM_START( botss11 )
|
||||
ROM_LOAD16_BYTE( "110-00023-101.u101", 0x000000, 0x20000, CRC(6aada23d) SHA1(85dbf9b20e4f17cb21922637763654d6cae80dfd) )
|
||||
ROM_LOAD16_BYTE( "110-00023-104.u97", 0x000001, 0x20000, CRC(715cac9d) SHA1(2aa0c563dc1fe4d02fa1ecbaed16f720f899fdc4) )
|
||||
|
||||
/* Video Graphics PCB (MPG DW-010-00002-002) */
|
||||
// Video Graphics PCB (MPG DW-010-00002-002)
|
||||
ROM_REGION16_LE( 0xc0000, "tms_gfx", 0 )
|
||||
ROM_LOAD16_BYTE( "110-00023-105.u124", 0x000000, 0x20000, CRC(5482e0c4) SHA1(492afac1862f2899cd734d1e57ca978ed6a906d5) )
|
||||
ROM_LOAD16_BYTE( "110-00023-106.u121", 0x000001, 0x20000, CRC(a55e5d19) SHA1(86fbcb425103ae9fff381357339af349848fc3f2) )
|
||||
@ -677,7 +677,7 @@ ROM_START( botss11 )
|
||||
ROM_LOAD16_BYTE( "110-00023-103.u114", 0x080000, 0x20000, CRC(4e486e70) SHA1(04ee16cfadd43dbe9ed5bd8330c21a718d63a8f4) )
|
||||
ROM_LOAD16_BYTE( "110-00023-102.u108", 0x080001, 0x20000, CRC(441e8490) SHA1(6cfe30cea3fa297b71e881fbddad6d65a96e4386) )
|
||||
|
||||
/* Sound PCB (MPG 010-00018-002) */
|
||||
// Sound PCB (MPG 010-00018-002)
|
||||
ROM_REGION( 0x10000, "audiocpu", 0 )
|
||||
ROM_LOAD( "110-00014-001.u2", 0x000000, 0x08000, CRC(307fcb6d) SHA1(0cf63a39ac8920be6532974311804529d7218545) )
|
||||
|
||||
|
@ -40,8 +40,7 @@ public:
|
||||
m_vgb_uart(*this, "uart"),
|
||||
m_palette(*this, "palette"),
|
||||
m_duart(*this, "duart"),
|
||||
m_noise_1(*this, "noise_1"),
|
||||
m_noise_2(*this, "noise_2"),
|
||||
m_noise(*this, "noise_%u", 1U),
|
||||
m_adc(*this, "adc"),
|
||||
m_vertex(*this, "vertex"),
|
||||
m_sound_sw(*this, "SOUND_SW"),
|
||||
@ -93,8 +92,7 @@ private:
|
||||
required_device<scn2651_device> m_vgb_uart;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<mc68681_device> m_duart;
|
||||
required_device<micro3d_sound_device> m_noise_1;
|
||||
required_device<micro3d_sound_device> m_noise_2;
|
||||
required_device_array<micro3d_sound_device, 2> m_noise;
|
||||
optional_device<adc0844_device> m_adc;
|
||||
required_memory_region m_vertex;
|
||||
|
||||
@ -106,13 +104,13 @@ private:
|
||||
required_shared_ptr<uint16_t> m_shared_ram;
|
||||
uint8_t m_m68681_tx0 = 0;
|
||||
|
||||
/* Sound */
|
||||
// Sound
|
||||
uint8_t m_sound_port_latch[4]{};
|
||||
|
||||
/* Hardware version-check latch for BOTSS 1.1a */
|
||||
// Hardware version-check latch for BOTSS 1.1a
|
||||
uint8_t m_botss_latch = 0;
|
||||
|
||||
/* MAC */
|
||||
// MAC
|
||||
required_shared_ptr<uint32_t> m_mac_sram;
|
||||
emu_timer *m_mac_done_timer = nullptr;
|
||||
uint32_t m_sram_r_addr = 0;
|
||||
@ -122,18 +120,18 @@ private:
|
||||
uint32_t m_mac_stat = 0;
|
||||
uint32_t m_mac_inst = 0;
|
||||
|
||||
/* 2D video */
|
||||
// 2D video
|
||||
required_shared_ptr<uint16_t> m_sprite_vram;
|
||||
uint16_t m_creg = 0;
|
||||
uint16_t m_xfer3dk = 0;
|
||||
|
||||
/* 3D pipeline */
|
||||
// 3D pipeline
|
||||
uint32_t m_pipe_data = 0;
|
||||
uint32_t m_pipeline_state = 0;
|
||||
int32_t m_vtx_fifo[512]{};
|
||||
uint32_t m_fifo_idx = 0;
|
||||
uint32_t m_draw_cmd = 0;
|
||||
int m_draw_state = 0;
|
||||
uint32_t m_draw_state = 0;
|
||||
int32_t m_x_min = 0;
|
||||
int32_t m_x_max = 0;
|
||||
int32_t m_y_min = 0;
|
||||
@ -142,43 +140,43 @@ private:
|
||||
int32_t m_z_max = 0;
|
||||
int32_t m_x_mid = 0;
|
||||
int32_t m_y_mid = 0;
|
||||
int m_dpram_bank = 0;
|
||||
uint32_t m_dpram_bank = 0;
|
||||
uint32_t m_draw_dpram[1024]{};
|
||||
std::unique_ptr<uint16_t[]> m_frame_buffers[2];
|
||||
std::unique_ptr<uint16_t[]> m_tmp_buffer;
|
||||
int m_drawing_buffer = 0;
|
||||
int m_display_buffer = 0;
|
||||
uint8_t m_drawing_buffer = 0;
|
||||
uint8_t m_display_buffer = 0;
|
||||
|
||||
void vgb_uart_w(offs_t offset, uint8_t data);
|
||||
uint8_t vgb_uart_r(offs_t offset);
|
||||
void micro3d_mac1_w(uint32_t data);
|
||||
uint32_t micro3d_mac2_r();
|
||||
void micro3d_mac2_w(uint32_t data);
|
||||
uint16_t micro3d_encoder_h_r();
|
||||
uint16_t micro3d_encoder_l_r();
|
||||
void mac1_w(uint32_t data);
|
||||
uint32_t mac2_r();
|
||||
void mac2_w(uint32_t data);
|
||||
uint16_t encoder_h_r();
|
||||
uint16_t encoder_l_r();
|
||||
uint8_t adc_volume_r();
|
||||
uint16_t botss_140000_r();
|
||||
uint16_t botss_180000_r();
|
||||
void micro3d_reset_w(uint16_t data);
|
||||
void reset_w(uint16_t data);
|
||||
void host_drmath_int_w(uint16_t data);
|
||||
void micro3d_shared_w(offs_t offset, uint32_t data);
|
||||
uint32_t micro3d_shared_r(offs_t offset);
|
||||
void shared_w(offs_t offset, uint32_t data);
|
||||
uint32_t shared_r(offs_t offset);
|
||||
void drmath_int_w(uint32_t data);
|
||||
void drmath_intr2_ack(uint32_t data);
|
||||
void micro3d_creg_w(uint16_t data);
|
||||
void micro3d_xfer3dk_w(uint16_t data);
|
||||
void micro3d_fifo_w(uint32_t data);
|
||||
void micro3d_alt_fifo_w(uint32_t data);
|
||||
uint32_t micro3d_pipe_r();
|
||||
void micro3d_snd_dac_a(uint8_t data);
|
||||
void micro3d_snd_dac_b(uint8_t data);
|
||||
void micro3d_sound_p1_w(uint8_t data);
|
||||
void micro3d_sound_p3_w(uint8_t data);
|
||||
uint8_t micro3d_sound_p1_r();
|
||||
uint8_t micro3d_sound_p3_r();
|
||||
INTERRUPT_GEN_MEMBER(micro3d_vblank);
|
||||
void creg_w(uint16_t data);
|
||||
void xfer3dk_w(uint16_t data);
|
||||
void fifo_w(uint32_t data);
|
||||
void alt_fifo_w(uint32_t data);
|
||||
uint32_t pipe_r();
|
||||
void snd_dac_a(uint8_t data);
|
||||
void snd_dac_b(uint8_t data);
|
||||
void sound_p1_w(uint8_t data);
|
||||
void sound_p3_w(uint8_t data);
|
||||
uint8_t sound_p1_r();
|
||||
uint8_t sound_p3_r();
|
||||
INTERRUPT_GEN_MEMBER(vblank);
|
||||
TIMER_CALLBACK_MEMBER(mac_done_callback);
|
||||
void micro3d_upd7759_w(uint8_t data);
|
||||
void upd7759_w(uint8_t data);
|
||||
void duart_irq_handler(int state);
|
||||
uint8_t duart_input_r();
|
||||
void duart_output_w(uint8_t data);
|
||||
@ -186,7 +184,7 @@ private:
|
||||
void tms_interrupt(int state);
|
||||
TMS340X0_SCANLINE_IND16_CB_MEMBER(scanline_update);
|
||||
|
||||
/* 3D graphics */
|
||||
// 3D graphics
|
||||
int inside(micro3d_vtx *v, enum planes plane);
|
||||
micro3d_vtx intersect(micro3d_vtx *v1, micro3d_vtx *v2, enum planes plane);
|
||||
inline void write_span(uint32_t y, uint32_t x);
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "micro3d_a.h"
|
||||
|
||||
|
||||
#define MM5837_CLOCK 100000
|
||||
static constexpr u32 MM5837_CLOCK = 100000;
|
||||
|
||||
|
||||
/*************************************
|
||||
@ -21,7 +21,7 @@
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/* Borrowed from segasnd.c */
|
||||
// Borrowed from segasnd.c
|
||||
inline void micro3d_sound_device::m3d_filter_state::configure(double r, double c)
|
||||
{
|
||||
capval = 0;
|
||||
@ -52,7 +52,7 @@ inline double micro3d_sound_device::m3d_filter_state::step_cr_filter(double inpu
|
||||
|
||||
void micro3d_sound_device::lp_filter::init(double fsval)
|
||||
{
|
||||
/* Section 1 */
|
||||
// Section 1
|
||||
proto_coef[0].a0 = 1.0;
|
||||
proto_coef[0].a1 = 0;
|
||||
proto_coef[0].a2 = 0;
|
||||
@ -60,7 +60,7 @@ void micro3d_sound_device::lp_filter::init(double fsval)
|
||||
proto_coef[0].b1 = 0.765367;
|
||||
proto_coef[0].b2 = 1.0;
|
||||
|
||||
/* Section 2 */
|
||||
// Section 2
|
||||
proto_coef[1].a0 = 1.0;
|
||||
proto_coef[1].a1 = 0;
|
||||
proto_coef[1].a2 = 0;
|
||||
@ -73,27 +73,23 @@ void micro3d_sound_device::lp_filter::init(double fsval)
|
||||
std::fill(std::begin(history), std::end(history), 0);
|
||||
}
|
||||
|
||||
static void prewarp(double *a0, double *a1, double *a2,double fc, double fs)
|
||||
static void prewarp(double &a0, double &a1, double &a2, double fc, double fs)
|
||||
{
|
||||
double wp, pi;
|
||||
double pi = 4.0 * atan(1.0);
|
||||
double wp = 2.0 * fs * tan(pi * fc / fs);
|
||||
|
||||
pi = 4.0 * atan(1.0);
|
||||
wp = 2.0 * fs * tan(pi * fc / fs);
|
||||
|
||||
*a2 = *a2 / (wp * wp);
|
||||
*a1 = *a1 / wp;
|
||||
a2 = a2 / (wp * wp);
|
||||
a1 = a1 / wp;
|
||||
}
|
||||
|
||||
static void bilinear(double a0, double a1, double a2,
|
||||
double b0, double b1, double b2,
|
||||
double *k, double fs, float *coef)
|
||||
double &k, double fs, float *coef)
|
||||
{
|
||||
double ad, bd;
|
||||
double ad = 4. * a2 * fs * fs + 2. * a1 * fs + a0;
|
||||
double bd = 4. * b2 * fs * fs + 2. * b1* fs + b0;
|
||||
|
||||
ad = 4. * a2 * fs * fs + 2. * a1 * fs + a0;
|
||||
bd = 4. * b2 * fs * fs + 2. * b1* fs + b0;
|
||||
|
||||
*k *= ad/bd;
|
||||
k *= ad / bd;
|
||||
|
||||
*coef++ = (2. * b0 - 8. * b2 * fs * fs) / bd;
|
||||
*coef++ = (4. * b2 * fs * fs - 2. * b1 * fs + b0) / bd;
|
||||
@ -116,9 +112,9 @@ void micro3d_sound_device::lp_filter::recompute(double k, double q, double fc)
|
||||
double b1 = proto_coef[nInd].b1 / q;
|
||||
double b2 = proto_coef[nInd].b2;
|
||||
|
||||
prewarp(&a0, &a1, &a2, fc, fs);
|
||||
prewarp(&b0, &b1, &b2, fc, fs);
|
||||
bilinear(a0, a1, a2, b0, b1, b2, &k, fs, c);
|
||||
prewarp(a0, a1, a2, fc, fs);
|
||||
prewarp(b0, b1, b2, fc, fs);
|
||||
bilinear(a0, a1, a2, b0, b1, b2, k, fs, c);
|
||||
|
||||
c += 4;
|
||||
}
|
||||
@ -128,13 +124,10 @@ void micro3d_sound_device::lp_filter::recompute(double k, double q, double fc)
|
||||
|
||||
void micro3d_sound_device::noise_sh_w(u8 data)
|
||||
{
|
||||
if (~data & 8)
|
||||
if (BIT(~data, 3))
|
||||
{
|
||||
if (m_dac_data != m_dac[data & 3])
|
||||
{
|
||||
double q;
|
||||
double fc;
|
||||
|
||||
m_stream->update();
|
||||
|
||||
m_dac[data & 3] = m_dac_data;
|
||||
@ -144,8 +137,8 @@ void micro3d_sound_device::noise_sh_w(u8 data)
|
||||
else
|
||||
m_gain = expf(-(float)(m_dac[VCA]) / 25.0f) * 10.0f;
|
||||
|
||||
q = 0.75/255 * (255 - m_dac[VCQ]) + 0.1;
|
||||
fc = 4500.0/255 * (255 - m_dac[VCF]) + 100;
|
||||
double q = 0.75/255 * (255 - m_dac[VCQ]) + 0.1;
|
||||
double fc = 4500.0/255 * (255 - m_dac[VCF]) + 100;
|
||||
|
||||
m_filter.recompute(m_gain, q, fc);
|
||||
}
|
||||
@ -182,7 +175,7 @@ micro3d_sound_device::micro3d_sound_device(const machine_config &mconfig, const
|
||||
|
||||
void micro3d_sound_device::device_start()
|
||||
{
|
||||
/* Allocate the stream */
|
||||
// Allocate the stream
|
||||
m_stream = stream_alloc(0, 2, machine().sample_rate());
|
||||
m_filter.init(machine().sample_rate());
|
||||
|
||||
@ -191,6 +184,28 @@ void micro3d_sound_device::device_start()
|
||||
m_noise_filters[2].configure(2.7e3 + 270, 0.15e-6);
|
||||
m_noise_filters[3].configure(2.7e3 + 0, 0.082e-6);
|
||||
// m_noise_filters[4].configure(33e3, 0.1e-6);
|
||||
|
||||
save_item(NAME(m_dac_data));
|
||||
save_item(NAME(m_dac));
|
||||
save_item(NAME(m_gain));
|
||||
save_item(NAME(m_noise_shift));
|
||||
save_item(NAME(m_noise_value));
|
||||
save_item(NAME(m_noise_subcount));
|
||||
|
||||
save_item(NAME(m_filter.history));
|
||||
save_item(NAME(m_filter.coef));
|
||||
save_item(NAME(m_filter.fs));
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
save_item(NAME(m_filter.proto_coef[i].a0), i);
|
||||
save_item(NAME(m_filter.proto_coef[i].a1), i);
|
||||
save_item(NAME(m_filter.proto_coef[i].a2), i);
|
||||
save_item(NAME(m_filter.proto_coef[i].b0), i);
|
||||
save_item(NAME(m_filter.proto_coef[i].b1), i);
|
||||
save_item(NAME(m_filter.proto_coef[i].b2), i);
|
||||
}
|
||||
save_item(STRUCT_MEMBER(m_noise_filters, capval));
|
||||
save_item(STRUCT_MEMBER(m_noise_filters, exponent));
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -213,30 +228,25 @@ void micro3d_sound_device::device_reset()
|
||||
void micro3d_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
{
|
||||
lp_filter *iir = &m_filter;
|
||||
float pan_l, pan_r;
|
||||
|
||||
auto &fl = outputs[0];
|
||||
auto &fr = outputs[1];
|
||||
|
||||
/* Clear the buffers */
|
||||
// Clear the buffers
|
||||
fl.fill(0);
|
||||
fr.fill(0);
|
||||
|
||||
if (m_gain == 0)
|
||||
return;
|
||||
|
||||
pan_l = (float)(255 - m_dac[PAN]) / 255.0f;
|
||||
pan_r = (float)(m_dac[PAN]) / 255.0f;
|
||||
float pan_l = (float)(255 - m_dac[PAN]) / 255.0f;
|
||||
float pan_r = (float)(m_dac[PAN]) / 255.0f;
|
||||
|
||||
for (int sampindex = 0; sampindex < fl.samples(); sampindex++)
|
||||
{
|
||||
unsigned int i;
|
||||
float *hist1_ptr,*hist2_ptr,*coef_ptr;
|
||||
float output,new_hist,history1,history2;
|
||||
float input, white;
|
||||
int step;
|
||||
|
||||
/* Update the noise source */
|
||||
// Update the noise source
|
||||
for (step = 2000000 / (2000000/8); step >= m_noise_subcount; step -= m_noise_subcount)
|
||||
{
|
||||
m_noise_shift = (m_noise_shift << 1) | (((m_noise_shift >> 13) ^ (m_noise_shift >> 16)) & 1);
|
||||
@ -244,10 +254,10 @@ void micro3d_sound_device::sound_stream_update(sound_stream &stream, std::vector
|
||||
m_noise_subcount = 2000000 / MM5837_CLOCK;
|
||||
}
|
||||
m_noise_subcount -= step;
|
||||
input = (float)m_noise_value - 0.5f;
|
||||
white = input;
|
||||
float input = (float)m_noise_value - 0.5f;
|
||||
float white = input;
|
||||
|
||||
/* Pink noise filtering */
|
||||
// Pink noise filtering
|
||||
m_noise_filters[0].capval = 0.99765 * m_noise_filters[0].capval + input * 0.0990460;
|
||||
m_noise_filters[1].capval = 0.96300 * m_noise_filters[1].capval + input * 0.2965164;
|
||||
m_noise_filters[2].capval = 0.57000 * m_noise_filters[2].capval + input * 1.0526913;
|
||||
@ -256,21 +266,21 @@ void micro3d_sound_device::sound_stream_update(sound_stream &stream, std::vector
|
||||
input += white;
|
||||
input *= 200.0f;
|
||||
|
||||
coef_ptr = &iir->coef[0];
|
||||
float *coef_ptr = &iir->coef[0];
|
||||
|
||||
hist1_ptr = &iir->history[0];
|
||||
hist2_ptr = hist1_ptr + 1;
|
||||
float *hist1_ptr = &iir->history[0];
|
||||
float *hist2_ptr = hist1_ptr + 1;
|
||||
|
||||
/* 1st number of coefficients array is overall input scale factor, * or filter gain */
|
||||
output = input * (*coef_ptr++);
|
||||
// 1st number of coefficients array is overall input scale factor, * or filter gain
|
||||
float output = input * (*coef_ptr++);
|
||||
|
||||
for (i = 0 ; i < 2; i++)
|
||||
for (u32 i = 0 ; i < 2; i++)
|
||||
{
|
||||
history1 = *hist1_ptr;
|
||||
history2 = *hist2_ptr;
|
||||
float history1 = *hist1_ptr;
|
||||
float history2 = *hist2_ptr;
|
||||
|
||||
output = output - history1 * (*coef_ptr++);
|
||||
new_hist = output - history2 * (*coef_ptr++);
|
||||
float new_hist = output - history2 * (*coef_ptr++);
|
||||
|
||||
output = new_hist + history1 * (*coef_ptr++);
|
||||
output = output + history2 * (*coef_ptr++);
|
||||
|
@ -36,8 +36,8 @@ private:
|
||||
|
||||
struct biquad
|
||||
{
|
||||
double a0, a1, a2; /* Numerator coefficients */
|
||||
double b0, b1, b2; /* Denominator coefficients */
|
||||
double a0, a1, a2; // Numerator coefficients
|
||||
double b0, b1, b2; // Denominator coefficients
|
||||
};
|
||||
|
||||
struct lp_filter
|
||||
|
@ -22,7 +22,7 @@
|
||||
*
|
||||
*************************************/
|
||||
|
||||
#define MAC_CLK XTAL(10'000'000)
|
||||
static constexpr XTAL MAC_CLK = XTAL(10'000'000);
|
||||
#define VTXROM_FMT(x) (((x) << 14) | ((x) & (1 << 15) ? 0xc0000000 : 0))
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ uint8_t micro3d_state::duart_input_r()
|
||||
*/
|
||||
void micro3d_state::duart_output_w(uint8_t data)
|
||||
{
|
||||
m_audiocpu->set_input_line(INPUT_LINE_RESET, data & 0x20 ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_audiocpu->set_input_line(INPUT_LINE_RESET, BIT(data, 5) ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -109,9 +109,7 @@ inline constexpr int64_t micro3d_state::micro3d_vtx::dot_product(micro3d_vtx con
|
||||
|
||||
static inline int64_t normalised_multiply(int32_t a, int32_t b)
|
||||
{
|
||||
int64_t result;
|
||||
|
||||
result = (int64_t)a * (int64_t)b;
|
||||
int64_t const result = (int64_t)a * (int64_t)b;
|
||||
return result >> 14;
|
||||
}
|
||||
|
||||
@ -121,41 +119,35 @@ TIMER_CALLBACK_MEMBER(micro3d_state::mac_done_callback)
|
||||
m_mac_stat = 0;
|
||||
}
|
||||
|
||||
void micro3d_state::micro3d_mac1_w(uint32_t data)
|
||||
void micro3d_state::mac1_w(uint32_t data)
|
||||
{
|
||||
m_vtx_addr = (data & 0x3ffff);
|
||||
m_sram_w_addr = (data >> 18) & 0xfff;
|
||||
}
|
||||
|
||||
uint32_t micro3d_state::micro3d_mac2_r()
|
||||
uint32_t micro3d_state::mac2_r()
|
||||
{
|
||||
return (m_mac_inst << 1) | m_mac_stat;
|
||||
}
|
||||
|
||||
void micro3d_state::micro3d_mac2_w(uint32_t data)
|
||||
void micro3d_state::mac2_w(uint32_t data)
|
||||
{
|
||||
uint32_t cnt = data & 0xff;
|
||||
uint32_t inst = (data >> 8) & 0x1f;
|
||||
uint32_t const inst = (data >> 8) & 0x1f;
|
||||
uint32_t mac_cycles = 1;
|
||||
|
||||
uint32_t mrab11;
|
||||
uint32_t vtx_addr;
|
||||
uint32_t sram_r_addr;
|
||||
uint32_t sram_w_addr;
|
||||
uint32_t *mac_sram;
|
||||
|
||||
m_mac_stat = BIT(data, 13);
|
||||
m_mac_inst = inst & 0x7;
|
||||
m_mrab11 = (data >> 18) & (1 << 11);
|
||||
m_sram_r_addr = (data >> 18) & 0xfff;
|
||||
|
||||
mrab11 = m_mrab11;
|
||||
vtx_addr = m_vtx_addr;
|
||||
sram_r_addr = m_sram_r_addr;
|
||||
sram_w_addr = m_sram_w_addr;
|
||||
mac_sram = m_mac_sram;
|
||||
uint32_t const mrab11 = m_mrab11;
|
||||
uint32_t vtx_addr = m_vtx_addr;
|
||||
uint32_t sram_r_addr = m_sram_r_addr;
|
||||
uint32_t sram_w_addr = m_sram_w_addr;
|
||||
uint32_t *mac_sram = m_mac_sram;
|
||||
|
||||
if (data & (1 << 14))
|
||||
if (BIT(data, 14))
|
||||
m_drmath->set_input_line(AM29000_INTR0, CLEAR_LINE);
|
||||
|
||||
switch (inst)
|
||||
@ -168,10 +160,9 @@ void micro3d_state::micro3d_mac2_w(uint32_t data)
|
||||
case 0x09: cnt += 0x100; [[fallthrough]];
|
||||
case 0x08:
|
||||
{
|
||||
int i;
|
||||
const uint16_t *rom = (uint16_t*)m_vertex->base();
|
||||
|
||||
for (i = 0; i <= cnt; ++i)
|
||||
for (int i = 0; i <= cnt; ++i)
|
||||
{
|
||||
int64_t acc;
|
||||
micro3d_vtx v1;
|
||||
@ -207,10 +198,9 @@ void micro3d_state::micro3d_mac2_w(uint32_t data)
|
||||
case 0x0d: cnt += 0x100; [[fallthrough]];
|
||||
case 0x0c:
|
||||
{
|
||||
int i;
|
||||
const uint16_t *rom = (uint16_t*)m_vertex->base();
|
||||
|
||||
for (i = 0; i <= cnt; ++i)
|
||||
for (int i = 0; i <= cnt; ++i)
|
||||
{
|
||||
int64_t acc;
|
||||
micro3d_vtx v1;
|
||||
@ -240,10 +230,9 @@ void micro3d_state::micro3d_mac2_w(uint32_t data)
|
||||
}
|
||||
case 0x0f:
|
||||
{
|
||||
int i;
|
||||
const uint16_t *rom = (uint16_t*)m_vertex->base();
|
||||
|
||||
for (i = 0; i <= cnt; ++i, vtx_addr += 4)
|
||||
for (int i = 0; i <= cnt; ++i, vtx_addr += 4)
|
||||
{
|
||||
mac_sram[sram_w_addr++] = VTXROM_FMT(rom[vtx_addr + 0]);
|
||||
mac_sram[sram_w_addr++] = VTXROM_FMT(rom[vtx_addr + 1]);
|
||||
@ -254,7 +243,7 @@ void micro3d_state::micro3d_mac2_w(uint32_t data)
|
||||
mac_cycles = 8 * cnt;
|
||||
break;
|
||||
}
|
||||
/* Dot product of SRAM vectors with single SRAM vector */
|
||||
// Dot product of SRAM vectors with single SRAM vector
|
||||
case 0x11: cnt += 0x100; [[fallthrough]];
|
||||
case 0x10:
|
||||
{
|
||||
@ -279,7 +268,7 @@ void micro3d_state::micro3d_mac2_w(uint32_t data)
|
||||
mac_cycles = 10 * cnt;
|
||||
break;
|
||||
}
|
||||
/* Dot product of SRAM vectors with SRAM vectors */
|
||||
// Dot product of SRAM vectors with SRAM vectors
|
||||
case 0x16: cnt += 0x100; [[fallthrough]];
|
||||
case 0x15: cnt += 0x100; [[fallthrough]];
|
||||
case 0x14:
|
||||
@ -310,7 +299,7 @@ void micro3d_state::micro3d_mac2_w(uint32_t data)
|
||||
break;
|
||||
}
|
||||
|
||||
/* TODO: Calculate a better estimate for timing */
|
||||
// TODO: Calculate a better estimate for timing
|
||||
if (m_mac_stat)
|
||||
m_mac_done_timer->adjust(attotime::from_hz(MAC_CLK) * mac_cycles);
|
||||
|
||||
@ -327,18 +316,18 @@ void micro3d_state::micro3d_mac2_w(uint32_t data)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
uint16_t micro3d_state::micro3d_encoder_h_r()
|
||||
uint16_t micro3d_state::encoder_h_r()
|
||||
{
|
||||
uint16_t x_encoder = m_joystick_x.read_safe(0);
|
||||
uint16_t y_encoder = m_joystick_y.read_safe(0);
|
||||
uint16_t const x_encoder = m_joystick_x.read_safe(0);
|
||||
uint16_t const y_encoder = m_joystick_y.read_safe(0);
|
||||
|
||||
return (y_encoder & 0xf00) | ((x_encoder & 0xf00) >> 8);
|
||||
}
|
||||
|
||||
uint16_t micro3d_state::micro3d_encoder_l_r()
|
||||
uint16_t micro3d_state::encoder_l_r()
|
||||
{
|
||||
uint16_t x_encoder = m_joystick_x.read_safe(0);
|
||||
uint16_t y_encoder = m_joystick_y.read_safe(0);
|
||||
uint16_t const x_encoder = m_joystick_x.read_safe(0);
|
||||
uint16_t const y_encoder = m_joystick_y.read_safe(0);
|
||||
|
||||
return ((y_encoder & 0xff) << 8) | (x_encoder & 0xff);
|
||||
}
|
||||
@ -355,13 +344,15 @@ int micro3d_state::botss_hwchk_r()
|
||||
|
||||
uint16_t micro3d_state::botss_140000_r()
|
||||
{
|
||||
m_botss_latch = 0;
|
||||
if (!machine().side_effects_disabled())
|
||||
m_botss_latch = 0;
|
||||
return 0xffff;
|
||||
}
|
||||
|
||||
uint16_t micro3d_state::botss_180000_r()
|
||||
{
|
||||
m_botss_latch = 1;
|
||||
if (!machine().side_effects_disabled())
|
||||
m_botss_latch = 1;
|
||||
return 0xffff;
|
||||
}
|
||||
|
||||
@ -371,12 +362,11 @@ uint16_t micro3d_state::botss_180000_r()
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void micro3d_state::micro3d_reset_w(uint16_t data)
|
||||
void micro3d_state::reset_w(uint16_t data)
|
||||
{
|
||||
data >>= 8;
|
||||
m_drmath->set_input_line(INPUT_LINE_RESET, data & 1 ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_vgb->set_input_line(INPUT_LINE_RESET, data & 2 ? CLEAR_LINE : ASSERT_LINE);
|
||||
/* TODO: Joystick reset? */
|
||||
m_drmath->set_input_line(INPUT_LINE_RESET, BIT(data, 8) ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_vgb->set_input_line(INPUT_LINE_RESET, BIT(data, 9) ? CLEAR_LINE : ASSERT_LINE);
|
||||
// TODO: Joystick reset?
|
||||
}
|
||||
|
||||
void micro3d_state::host_drmath_int_w(uint16_t data)
|
||||
@ -392,13 +382,13 @@ void micro3d_state::host_drmath_int_w(uint16_t data)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void micro3d_state::micro3d_shared_w(offs_t offset, uint32_t data)
|
||||
void micro3d_state::shared_w(offs_t offset, uint32_t data)
|
||||
{
|
||||
m_shared_ram[offset * 2 + 1] = data & 0xffff;
|
||||
m_shared_ram[offset * 2 + 0] = data >> 16;
|
||||
}
|
||||
|
||||
uint32_t micro3d_state::micro3d_shared_r(offs_t offset)
|
||||
uint32_t micro3d_state::shared_r(offs_t offset)
|
||||
{
|
||||
return (m_shared_ram[offset * 2] << 16) | m_shared_ram[offset * 2 + 1];
|
||||
}
|
||||
@ -432,26 +422,25 @@ void micro3d_state::drmath_intr2_ack(uint32_t data)
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
void micro3d_state::micro3d_snd_dac_a(uint8_t data)
|
||||
void micro3d_state::snd_dac_a(uint8_t data)
|
||||
{
|
||||
m_noise_1->dac_w(data);
|
||||
m_noise_2->dac_w(data);
|
||||
m_noise[0]->dac_w(data);
|
||||
m_noise[1]->dac_w(data);
|
||||
}
|
||||
|
||||
void micro3d_state::micro3d_snd_dac_b(uint8_t data)
|
||||
void micro3d_state::snd_dac_b(uint8_t data)
|
||||
{
|
||||
/* TODO: This controls upd7759 volume */
|
||||
// TODO: This controls upd7759 volume
|
||||
}
|
||||
|
||||
void micro3d_state::micro3d_sound_p1_w(uint8_t data)
|
||||
void micro3d_state::sound_p1_w(uint8_t data)
|
||||
{
|
||||
m_sound_port_latch[1] = data;
|
||||
|
||||
micro3d_sound_device *noise = (data & 4) ? m_noise_2 : m_noise_1;
|
||||
noise->noise_sh_w(data);
|
||||
m_noise[BIT(data, 2)]->noise_sh_w(data);
|
||||
}
|
||||
|
||||
void micro3d_state::micro3d_sound_p3_w(uint8_t data)
|
||||
void micro3d_state::sound_p3_w(uint8_t data)
|
||||
{
|
||||
// preserve RXD input
|
||||
m_sound_port_latch[3] = (m_sound_port_latch[3] & 1) | (data & ~1);
|
||||
@ -461,17 +450,17 @@ void micro3d_state::micro3d_sound_p3_w(uint8_t data)
|
||||
m_upd7759->reset_w(!BIT(data, 4));
|
||||
}
|
||||
|
||||
uint8_t micro3d_state::micro3d_sound_p1_r()
|
||||
uint8_t micro3d_state::sound_p1_r()
|
||||
{
|
||||
return (m_sound_port_latch[1] & 0x7f) | m_sound_sw->read();
|
||||
}
|
||||
|
||||
uint8_t micro3d_state::micro3d_sound_p3_r()
|
||||
uint8_t micro3d_state::sound_p3_r()
|
||||
{
|
||||
return (m_sound_port_latch[3] & 0xf7) | (m_upd7759->busy_r() ? 0x08 : 0);
|
||||
}
|
||||
|
||||
void micro3d_state::micro3d_upd7759_w(uint8_t data)
|
||||
void micro3d_state::upd7759_w(uint8_t data)
|
||||
{
|
||||
m_upd7759->port_w(data);
|
||||
m_upd7759->start_w(0);
|
||||
@ -503,7 +492,7 @@ void micro3d_state::init_botss()
|
||||
{
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
|
||||
/* Required to pass the hardware version check */
|
||||
// Required to pass the hardware version check
|
||||
space.install_read_handler(0x140000, 0x140001, read16smo_delegate(*this, FUNC(micro3d_state::botss_140000_r)));
|
||||
space.install_read_handler(0x180000, 0x180001, read16smo_delegate(*this, FUNC(micro3d_state::botss_180000_r)));
|
||||
|
||||
@ -513,6 +502,16 @@ void micro3d_state::init_botss()
|
||||
void micro3d_state::machine_start()
|
||||
{
|
||||
m_mac_done_timer = timer_alloc(FUNC(micro3d_state::mac_done_callback), this);
|
||||
|
||||
save_item(NAME(m_m68681_tx0));
|
||||
save_item(NAME(m_sound_port_latch));
|
||||
save_item(NAME(m_botss_latch));
|
||||
save_item(NAME(m_sram_r_addr));
|
||||
save_item(NAME(m_sram_w_addr));
|
||||
save_item(NAME(m_vtx_addr));
|
||||
save_item(NAME(m_mrab11));
|
||||
save_item(NAME(m_mac_stat));
|
||||
save_item(NAME(m_mac_inst));
|
||||
}
|
||||
|
||||
void micro3d_state::machine_reset()
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
#include "cpu/am29000/am29000.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
@ -41,10 +43,36 @@ enum
|
||||
|
||||
void micro3d_state::video_start()
|
||||
{
|
||||
/* Allocate 512x12 x 2 3D frame buffers */
|
||||
m_frame_buffers[0] = std::make_unique<uint16_t[]>(1024 * 512);
|
||||
m_frame_buffers[1] = std::make_unique<uint16_t[]>(1024 * 512);
|
||||
// Allocate 512x12 x 2 3D frame buffers
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
m_frame_buffers[i] = std::make_unique<uint16_t[]>(1024 * 512);
|
||||
save_pointer(NAME(m_frame_buffers[i]), 1024 * 512, i);
|
||||
}
|
||||
|
||||
m_tmp_buffer = std::make_unique<uint16_t[]>(1024 * 512);
|
||||
save_pointer(NAME(m_tmp_buffer), 1024 * 512);
|
||||
|
||||
save_item(NAME(m_creg));
|
||||
save_item(NAME(m_xfer3dk));
|
||||
save_item(NAME(m_pipe_data));
|
||||
save_item(NAME(m_pipeline_state));
|
||||
save_item(NAME(m_vtx_fifo));
|
||||
save_item(NAME(m_fifo_idx));
|
||||
save_item(NAME(m_draw_cmd));
|
||||
save_item(NAME(m_draw_state));
|
||||
save_item(NAME(m_x_min));
|
||||
save_item(NAME(m_x_max));
|
||||
save_item(NAME(m_y_min));
|
||||
save_item(NAME(m_y_max));
|
||||
save_item(NAME(m_z_min));
|
||||
save_item(NAME(m_z_max));
|
||||
save_item(NAME(m_x_mid));
|
||||
save_item(NAME(m_y_mid));
|
||||
save_item(NAME(m_dpram_bank));
|
||||
save_item(NAME(m_draw_dpram));
|
||||
save_item(NAME(m_drawing_buffer));
|
||||
save_item(NAME(m_display_buffer));
|
||||
}
|
||||
|
||||
|
||||
@ -69,14 +97,14 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(micro3d_state::scanline_update)
|
||||
uint16_t const *const src = &m_sprite_vram[(params->rowaddr << 8) & 0x7fe00];
|
||||
uint16_t *dest = &bitmap.pix(scanline);
|
||||
int coladdr = params->coladdr;
|
||||
int sd_11_7 = (m_creg & 0x1f) << 7;
|
||||
int const sd_11_7 = (m_creg & 0x1f) << 7;
|
||||
|
||||
scanline = std::max((scanline - params->veblnk), 0);
|
||||
uint16_t const *frame_src = m_frame_buffers[m_display_buffer].get() + (scanline << 10);
|
||||
|
||||
/* TODO: XFER3DK - X/Y offsets for 3D */
|
||||
// TODO: XFER3DK - X/Y offsets for 3D
|
||||
|
||||
/* Copy the non-blanked portions of this scanline */
|
||||
// Copy the non-blanked portions of this scanline
|
||||
for (int x = params->heblnk; x < params->hsblnk; x += 2)
|
||||
{
|
||||
uint16_t pix = src[coladdr++ & 0x1ff];
|
||||
@ -102,7 +130,7 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(micro3d_state::scanline_update)
|
||||
}
|
||||
}
|
||||
|
||||
void micro3d_state::micro3d_creg_w(uint16_t data)
|
||||
void micro3d_state::creg_w(uint16_t data)
|
||||
{
|
||||
if (~data & 0x80)
|
||||
m_vgb->set_input_line(0, CLEAR_LINE);
|
||||
@ -110,7 +138,7 @@ void micro3d_state::micro3d_creg_w(uint16_t data)
|
||||
m_creg = data;
|
||||
}
|
||||
|
||||
void micro3d_state::micro3d_xfer3dk_w(uint16_t data)
|
||||
void micro3d_state::xfer3dk_w(uint16_t data)
|
||||
{
|
||||
m_xfer3dk = data;
|
||||
}
|
||||
@ -234,31 +262,30 @@ micro3d_state::micro3d_vtx micro3d_state::intersect(micro3d_vtx *v1, micro3d_vtx
|
||||
|
||||
inline void micro3d_state::write_span(uint32_t y, uint32_t x)
|
||||
{
|
||||
uint32_t *draw_dpram = m_draw_dpram;
|
||||
int addr = y << 1;
|
||||
int const addr = y << 1;
|
||||
|
||||
if (draw_dpram[addr] == 0x3ff000)
|
||||
if (m_draw_dpram[addr] == 0x3ff000)
|
||||
{
|
||||
draw_dpram[addr] = (x << 12) | x;
|
||||
m_draw_dpram[addr] = (x << 12) | x;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Check start */
|
||||
// Check start
|
||||
if (x < (m_draw_dpram[addr] & 0x3ff))
|
||||
{
|
||||
draw_dpram[addr] &= ~0x3ff;
|
||||
draw_dpram[addr] |= x;
|
||||
m_draw_dpram[addr] &= ~0x3ff;
|
||||
m_draw_dpram[addr] |= x;
|
||||
}
|
||||
/* Check end */
|
||||
if (x > (draw_dpram[addr] >> 12))
|
||||
// Check end
|
||||
if (x > (m_draw_dpram[addr] >> 12))
|
||||
{
|
||||
draw_dpram[addr] &= ~0x3ff000;
|
||||
draw_dpram[addr] |= (x << 12);
|
||||
m_draw_dpram[addr] &= ~0x3ff000;
|
||||
m_draw_dpram[addr] |= (x << 12);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* This is the same algorithm used in the 3D tests */
|
||||
// This is the same algorithm used in the 3D tests
|
||||
void micro3d_state::draw_line(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2)
|
||||
{
|
||||
uint32_t tmp2;
|
||||
@ -270,15 +297,8 @@ void micro3d_state::draw_line(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2
|
||||
|
||||
if (x2 < x1)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
tmp = x1;
|
||||
x1 = x2;
|
||||
x2 = tmp;
|
||||
|
||||
tmp = y1;
|
||||
y1 = y2;
|
||||
y2 = tmp;
|
||||
std::swap<uint32_t>(x1, x2);
|
||||
std::swap<uint32_t>(y1, y2);
|
||||
}
|
||||
|
||||
dx = x2 - x1;
|
||||
@ -364,16 +384,14 @@ void micro3d_state::draw_line(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2
|
||||
|
||||
void micro3d_state::rasterise_spans(uint32_t min_y, uint32_t max_y, uint32_t attr)
|
||||
{
|
||||
int y;
|
||||
int color = attr & 0xfff;
|
||||
int const color = attr & 0xfff;
|
||||
|
||||
if ((attr >> 24) == 0x85)
|
||||
{
|
||||
for (y = min_y; y <= max_y; ++y)
|
||||
for (int y = min_y; y <= max_y; ++y)
|
||||
{
|
||||
int x;
|
||||
int addr = y << 1;
|
||||
uint16_t *dest = &m_tmp_buffer[y * 1024];
|
||||
int const addr = y << 1;
|
||||
uint16_t *const dest = &m_tmp_buffer[y * 1024];
|
||||
|
||||
if (m_draw_dpram[addr] == 0x3ff000)
|
||||
{
|
||||
@ -381,10 +399,10 @@ void micro3d_state::rasterise_spans(uint32_t min_y, uint32_t max_y, uint32_t att
|
||||
}
|
||||
else
|
||||
{
|
||||
int start = m_draw_dpram[addr] & 0x3ff;
|
||||
int end = (m_draw_dpram[addr] >> 12) & 0x3ff;
|
||||
int const start = m_draw_dpram[addr] & 0x3ff;
|
||||
int const end = (m_draw_dpram[addr] >> 12) & 0x3ff;
|
||||
|
||||
for (x = start; x <= end; ++x)
|
||||
for (int x = start; x <= end; ++x)
|
||||
dest[x] = color;
|
||||
}
|
||||
}
|
||||
@ -410,11 +428,10 @@ void micro3d_state::rasterise_spans(uint32_t min_y, uint32_t max_y, uint32_t att
|
||||
int noise_val = (attr >> 12) & 0x3ff;
|
||||
int noise_taps = 0;
|
||||
|
||||
for (y = min_y; y <= max_y; ++y)
|
||||
for (int y = min_y; y <= max_y; ++y)
|
||||
{
|
||||
int x;
|
||||
int addr = y << 1;
|
||||
uint16_t *dest = &m_tmp_buffer[y * 1024];
|
||||
int const addr = y << 1;
|
||||
uint16_t *const dest = &m_tmp_buffer[y * 1024];
|
||||
|
||||
if (m_draw_dpram[addr] == 0x3ff000)
|
||||
{
|
||||
@ -422,10 +439,10 @@ void micro3d_state::rasterise_spans(uint32_t min_y, uint32_t max_y, uint32_t att
|
||||
}
|
||||
else
|
||||
{
|
||||
int start = m_draw_dpram[addr] & 0x3ff;
|
||||
int end = (m_draw_dpram[addr] >> 12) & 0x3ff;
|
||||
int const start = m_draw_dpram[addr] & 0x3ff;
|
||||
int const end = (m_draw_dpram[addr] >> 12) & 0x3ff;
|
||||
|
||||
for (x = start; x <= end; ++x)
|
||||
for (int x = start; x <= end; ++x)
|
||||
{
|
||||
int fb;
|
||||
|
||||
@ -444,27 +461,26 @@ int micro3d_state::clip_triangle(micro3d_vtx *v, micro3d_vtx *vout, int num_vert
|
||||
{
|
||||
micro3d_vtx clip_out[10];
|
||||
|
||||
int i;
|
||||
int prev_i = num_vertices - 1;
|
||||
int clip_verts = 0;
|
||||
|
||||
for (i = 0; i < num_vertices; ++i)
|
||||
for (int i = 0; i < num_vertices; ++i)
|
||||
{
|
||||
int v1_in = inside(&v[i], plane);
|
||||
int v2_in = inside(&v[prev_i], plane);
|
||||
|
||||
/* Edge is inside */
|
||||
// Edge is inside
|
||||
if (v1_in && v2_in)
|
||||
{
|
||||
clip_out[clip_verts++] = v[i];
|
||||
}
|
||||
/* Edge is leaving */
|
||||
// Edge is leaving
|
||||
else if (v1_in && !v2_in)
|
||||
{
|
||||
clip_out[clip_verts++] = intersect(&v[i], &v[prev_i], plane);
|
||||
clip_out[clip_verts++] = v[i];
|
||||
}
|
||||
/* Edge is entering */
|
||||
// Edge is entering
|
||||
else if (!v1_in && v2_in)
|
||||
{
|
||||
clip_out[clip_verts++] = intersect(&v[i], &v[prev_i], plane);
|
||||
@ -479,13 +495,12 @@ int micro3d_state::clip_triangle(micro3d_vtx *v, micro3d_vtx *vout, int num_vert
|
||||
|
||||
void micro3d_state::draw_triangles(uint32_t attr)
|
||||
{
|
||||
int i;
|
||||
bool triangles = false;
|
||||
int vertices = m_fifo_idx / 3;
|
||||
int const vertices = m_fifo_idx / 3;
|
||||
int min_y = 0x3ff;
|
||||
int max_y = 0;
|
||||
|
||||
/* This satisifes the burst write test */
|
||||
// This satisifes the burst write test
|
||||
if (vertices == 0)
|
||||
{
|
||||
int y;
|
||||
@ -497,10 +512,9 @@ void micro3d_state::draw_triangles(uint32_t attr)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Draw triangles as fans */
|
||||
for (i = 2; i < vertices; ++i)
|
||||
// Draw triangles as fans
|
||||
for (int i = 2; i < vertices; ++i)
|
||||
{
|
||||
int k;
|
||||
int clip_vertices = 3;
|
||||
|
||||
micro3d_vtx vo, vm, vn;
|
||||
@ -522,25 +536,25 @@ void micro3d_state::draw_triangles(uint32_t attr)
|
||||
vclip_list[1] = vm;
|
||||
vclip_list[2] = vn;
|
||||
|
||||
/* Clip against near Z and far Z planes */
|
||||
// Clip against near Z and far Z planes
|
||||
clip_vertices = clip_triangle(vclip_list, vclip_list, clip_vertices, CLIP_Z_MIN);
|
||||
clip_vertices = clip_triangle(vclip_list, vclip_list, clip_vertices, CLIP_Z_MAX);
|
||||
|
||||
/* Perform perspective divide */
|
||||
for (k = 0; k < clip_vertices; ++k)
|
||||
// Perform perspective divide
|
||||
for (int k = 0; k < clip_vertices; ++k)
|
||||
{
|
||||
vclip_list[k].x = vclip_list[k].x * m_z_min / vclip_list[k].z;
|
||||
vclip_list[k].y = vclip_list[k].y * m_z_min / vclip_list[k].z;
|
||||
vclip_list[k].z = 0;
|
||||
}
|
||||
|
||||
/* Perform screen-space clipping */
|
||||
// Perform screen-space clipping
|
||||
clip_vertices = clip_triangle(vclip_list, vclip_list, clip_vertices, CLIP_Y_MAX);
|
||||
clip_vertices = clip_triangle(vclip_list, vclip_list, clip_vertices, CLIP_X_MIN);
|
||||
clip_vertices = clip_triangle(vclip_list, vclip_list, clip_vertices, CLIP_X_MAX);
|
||||
clip_vertices = clip_triangle(vclip_list, vclip_list, clip_vertices, CLIP_Y_MIN);
|
||||
|
||||
/* Rasterise */
|
||||
// Rasterise
|
||||
if (clip_vertices >= 3)
|
||||
{
|
||||
micro3d_vtx a = vclip_list[0];
|
||||
@ -554,7 +568,7 @@ void micro3d_state::draw_triangles(uint32_t attr)
|
||||
b.x += m_x_mid;
|
||||
b.y += m_y_mid;
|
||||
|
||||
/* Keep track of the y-extents so we don't have to scan every line later */
|
||||
// Keep track of the y-extents so we don't have to scan every line later
|
||||
if (a.y < min_y)
|
||||
min_y = a.y;
|
||||
if (a.y > max_y)
|
||||
@ -565,10 +579,10 @@ void micro3d_state::draw_triangles(uint32_t attr)
|
||||
if (b.y > max_y)
|
||||
max_y = b.y;
|
||||
|
||||
/* Draw the first line of the triangle/fan */
|
||||
// Draw the first line of the triangle/fan
|
||||
draw_line(a.x, a.y, b.x, b.y);
|
||||
|
||||
for (k = 2; k < clip_vertices; ++k)
|
||||
for (int k = 2; k < clip_vertices; ++k)
|
||||
{
|
||||
micro3d_vtx c = vclip_list[k];
|
||||
|
||||
@ -617,9 +631,9 @@ bc000000-1fc DPRAM address for read access
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
void micro3d_state::micro3d_fifo_w(uint32_t data)
|
||||
void micro3d_state::fifo_w(uint32_t data)
|
||||
{
|
||||
uint32_t opcode = data >> 24;
|
||||
uint32_t const opcode = data >> 24;
|
||||
|
||||
switch (m_draw_state)
|
||||
{
|
||||
@ -642,14 +656,13 @@ void micro3d_state::micro3d_fifo_w(uint32_t data)
|
||||
}
|
||||
case 0xbc:
|
||||
{
|
||||
uint32_t dpram_r_addr = (((data & 0x01ff) << 1) | m_dpram_bank);
|
||||
uint32_t const dpram_r_addr = (((data & 0x01ff) << 1) | m_dpram_bank);
|
||||
m_pipe_data = m_draw_dpram[dpram_r_addr];
|
||||
m_drmath->set_input_line(AM29000_INTR1, ASSERT_LINE);
|
||||
break;
|
||||
}
|
||||
case 0x80:
|
||||
{
|
||||
int addr;
|
||||
m_fifo_idx = 0;
|
||||
m_draw_state = STATE_DRAW_VTX_DATA;
|
||||
|
||||
@ -657,19 +670,19 @@ void micro3d_state::micro3d_fifo_w(uint32_t data)
|
||||
* TODO: Not sure this is the right place for it -
|
||||
* causes monitor mode draw tests to fail
|
||||
*/
|
||||
for (addr = 0; addr < 512; ++addr)
|
||||
for (int addr = 0; addr < 512; ++addr)
|
||||
m_draw_dpram[addr << 1] = 0x3ff000;
|
||||
|
||||
break;
|
||||
}
|
||||
case 0xf8:
|
||||
{
|
||||
/* 3D pipeline health LEDs toggle */
|
||||
// 3D pipeline health LEDs toggle
|
||||
break;
|
||||
}
|
||||
case 0xd8:
|
||||
{
|
||||
/* TODO: We shouldn't need this extra buffer - is there some sort of sync missing? */
|
||||
// TODO: We shouldn't need this extra buffer - is there some sort of sync missing?
|
||||
memcpy(m_frame_buffers[m_drawing_buffer].get(), m_tmp_buffer.get(), 512*1024*2);
|
||||
m_drawing_buffer ^= 1;
|
||||
m_vgb->set_input_line(0, ASSERT_LINE);
|
||||
@ -717,18 +730,19 @@ void micro3d_state::micro3d_fifo_w(uint32_t data)
|
||||
}
|
||||
}
|
||||
|
||||
void micro3d_state::micro3d_alt_fifo_w(uint32_t data)
|
||||
void micro3d_state::alt_fifo_w(uint32_t data)
|
||||
{
|
||||
m_vtx_fifo[m_fifo_idx++] = VTX_SEX(data);
|
||||
}
|
||||
|
||||
uint32_t micro3d_state::micro3d_pipe_r()
|
||||
uint32_t micro3d_state::pipe_r()
|
||||
{
|
||||
m_drmath->set_input_line(AM29000_INTR1, CLEAR_LINE);
|
||||
if (!machine().side_effects_disabled())
|
||||
m_drmath->set_input_line(AM29000_INTR1, CLEAR_LINE);
|
||||
return m_pipe_data;
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(micro3d_state::micro3d_vblank)
|
||||
INTERRUPT_GEN_MEMBER(micro3d_state::vblank)
|
||||
{
|
||||
// mc68901_int_gen(machine(), GPIP7);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user