diff options
author | Ivan Vangelista <mesgnet@yahoo.it> | 2018-05-31 15:12:17 +0200 |
---|---|---|
committer | Ivan Vangelista <mesgnet@yahoo.it> | 2018-05-31 15:12:17 +0200 |
commit | 708c3c437b2e5484202bd6f85d22799cb9f5191b (patch) | |
tree | ae8cfea3be0bd35ebfa7101d207807878c288637 | |
parent | be74444c1502d3a6a663d473e67af997074bb635 (diff) |
gaelco3d.cpp: device_finder (nw)
-rw-r--r-- | src/mame/drivers/gaelco3d.cpp | 125 | ||||
-rw-r--r-- | src/mame/includes/gaelco3d.h | 135 | ||||
-rw-r--r-- | src/mame/video/gaelco3d.cpp | 12 |
3 files changed, 135 insertions, 137 deletions
diff --git a/src/mame/drivers/gaelco3d.cpp b/src/mame/drivers/gaelco3d.cpp index b8bb7535756..f2c9e376379 100644 --- a/src/mame/drivers/gaelco3d.cpp +++ b/src/mame/drivers/gaelco3d.cpp @@ -148,7 +148,6 @@ REF. 970429 #include "emu.h" #include "includes/gaelco3d.h" -#include "cpu/adsp2100/adsp2100.h" #include "cpu/m68000/m68000.h" #include "cpu/tms32031/tms32031.h" @@ -192,34 +191,21 @@ void gaelco3d_state::machine_start() MACHINE_RESET_MEMBER(gaelco3d_state,common) { - uint16_t *src; - int i; - m_framenum = 0; /* boot the ADSP chip */ - src = (uint16_t *)memregion("user1")->base(); - for (i = 0; i < (src[3] & 0xff) * 8; i++) + uint16_t *src = (uint16_t *)memregion("user1")->base(); + for (int i = 0; i < (src[3] & 0xff) * 8; i++) { uint32_t opcode = ((src[i*4+0] & 0xff) << 16) | ((src[i*4+1] & 0xff) << 8) | (src[i*4+2] & 0xff); m_adsp_ram_base[i] = opcode; } - /* allocate a timer for feeding the autobuffer */ - m_adsp_autobuffer_timer = machine().device<timer_device>("adsp_timer"); - - membank("bank1")->configure_entries(0, 256, memregion("user1")->base(), 0x4000); - membank("bank1")->set_entry(0); + m_adsp_bank->configure_entries(0, 256, memregion("user1")->base(), 0x4000); + m_adsp_bank->set_entry(0); /* keep the TMS32031 halted until the code is ready to go */ m_tms->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); - - for (i = 0; i < SOUND_CHANNELS; i++) - { - char buffer[10]; - sprintf(buffer, "dac%d", i + 1); - m_dmadac[i] = machine().device<dmadac_sound_device>(buffer); - } } @@ -502,7 +488,9 @@ WRITE16_MEMBER(gaelco3d_state::adsp_control_w) /* see if SPORT1 got disabled */ if ((data & 0x0800) == 0) { - dmadac_enable(&m_dmadac[0], SOUND_CHANNELS, 0); + for (uint8_t i = 0; i < SOUND_CHANNELS; i++) + m_dmadac[i]->enable(0); + m_adsp_autobuffer_timer->reset(); } break; @@ -511,7 +499,9 @@ WRITE16_MEMBER(gaelco3d_state::adsp_control_w) /* autobuffer off: nuke the timer, and disable the DAC */ if ((data & 0x0002) == 0) { - dmadac_enable(&m_dmadac[0], SOUND_CHANNELS, 0); + for (uint8_t i = 0; i < SOUND_CHANNELS; i++) + m_dmadac[i]->enable(0); + m_adsp_autobuffer_timer->reset(); } break; @@ -530,7 +520,7 @@ WRITE16_MEMBER(gaelco3d_state::adsp_rombank_w) { if (LOG) logerror("adsp_rombank_w(%d) = %04X\n", offset, data); - membank("bank1")->set_entry((offset & 1) * 0x80 + (data & 0x7f)); + m_adsp_bank->set_entry((offset & 1) * 0x80 + (data & 0x7f)); } @@ -549,7 +539,10 @@ TIMER_DEVICE_CALLBACK_MEMBER(gaelco3d_state::adsp_autobuffer_irq) /* copy the current data into the buffer */ // logerror("ADSP buffer: I%d=%04X incs=%04X size=%04X\n", m_adsp_ireg, reg, m_adsp_incs, m_adsp_size); if (m_adsp_incs) - dmadac_transfer(&m_dmadac[0], SOUND_CHANNELS, m_adsp_incs, SOUND_CHANNELS * m_adsp_incs, m_adsp_size / (SOUND_CHANNELS * m_adsp_incs), (int16_t *)&m_adsp_fastram_base[reg - 0x3800]); + { + for (uint8_t i = 0; i < SOUND_CHANNELS; i++) + m_dmadac[i]->transfer(i, m_adsp_incs, SOUND_CHANNELS * m_adsp_incs, m_adsp_size / (SOUND_CHANNELS * m_adsp_incs), (int16_t *)&m_adsp_fastram_base[reg - 0x3800]); + } /* increment it */ reg += m_adsp_size; @@ -577,7 +570,7 @@ WRITE32_MEMBER(gaelco3d_state::adsp_tx_callback) /* check if SPORT1 is enabled */ if (m_adsp_control_regs[SYSCONTROL_REG] & 0x0800) /* bit 11 */ { - /* we only support autobuffer here (wich is what this thing uses), bail if not enabled */ + /* we only support autobuffer here (which is what this thing uses), bail if not enabled */ if (m_adsp_control_regs[S1_AUTOBUF_REG] & 0x0002) /* bit 1 */ { /* get the autobuffer registers */ @@ -591,7 +584,7 @@ WRITE32_MEMBER(gaelco3d_state::adsp_tx_callback) lreg = m_adsp_ireg; /* now get the register contents in a more legible format */ - /* we depend on register indexes to be continuous (wich is the case in our core) */ + /* we depend on register indexes to be continuous (which is the case in our core) */ source = m_adsp->state_int(ADSP2100_I0 + m_adsp_ireg); m_adsp_incs = m_adsp->state_int(ADSP2100_M0 + mreg); m_adsp_size = m_adsp->state_int(ADSP2100_L0 + lreg); @@ -613,10 +606,13 @@ WRITE32_MEMBER(gaelco3d_state::adsp_tx_callback) /* now put it down to samples, so we know what the channel frequency has to be */ sample_period *= 16 * SOUND_CHANNELS; - dmadac_set_frequency(&m_dmadac[0], SOUND_CHANNELS, ATTOSECONDS_TO_HZ(sample_period.attoseconds())); - dmadac_enable(&m_dmadac[0], SOUND_CHANNELS, 1); + for (uint8_t i = 0; i < SOUND_CHANNELS; i++) + { + m_dmadac[i]->set_frequency(ATTOSECONDS_TO_HZ(sample_period.attoseconds())); + m_dmadac[i]->enable(1); + } - /* fire off a timer wich will hit every half-buffer */ + /* fire off a timer which will hit every half-buffer */ sample_period = (sample_period * m_adsp_size) / (SOUND_CHANNELS * m_adsp_incs); m_adsp_autobuffer_timer->adjust(sample_period, 0, sample_period); @@ -628,7 +624,8 @@ WRITE32_MEMBER(gaelco3d_state::adsp_tx_callback) } /* if we get there, something went wrong. Disable playing */ - dmadac_enable(&m_dmadac[0], SOUND_CHANNELS, 0); + for (uint8_t i = 0; i < SOUND_CHANNELS; i++) + m_dmadac[i]->enable(0); /* remove timer */ m_adsp_autobuffer_timer->reset(); @@ -738,7 +735,7 @@ void gaelco3d_state::adsp_program_map(address_map &map) void gaelco3d_state::adsp_data_map(address_map &map) { map(0x0000, 0x0001).w(this, FUNC(gaelco3d_state::adsp_rombank_w)); - map(0x0000, 0x1fff).bankr("bank1"); + map(0x0000, 0x1fff).bankr("adspbank"); map(0x2000, 0x2000).r(m_soundlatch, FUNC(generic_latch_8_device::read)).umask16(0x00ff); map(0x2000, 0x2000).w(this, FUNC(gaelco3d_state::sound_status_w)); map(0x3800, 0x39ff).ram().share("adsp_fastram"); /* 512 words internal RAM */ @@ -927,59 +924,59 @@ INPUT_PORTS_END MACHINE_CONFIG_START(gaelco3d_state::gaelco3d) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, 15000000) + MCFG_DEVICE_ADD(m_maincpu, M68000, 15000000) MCFG_DEVICE_PROGRAM_MAP(main_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", gaelco3d_state, vblank_gen) - MCFG_DEVICE_ADD("tms", TMS32031, 60000000) + MCFG_DEVICE_ADD(m_tms, TMS32031, 60000000) MCFG_DEVICE_PROGRAM_MAP(tms_map) MCFG_TMS3203X_MCBL(true) MCFG_TMS3203X_IACK_CB(WRITE8(*this, gaelco3d_state, tms_iack_w)) - MCFG_DEVICE_ADD("adsp", ADSP2115, 16000000) + MCFG_DEVICE_ADD(m_adsp, ADSP2115, 16000000) MCFG_ADSP21XX_SPORT_TX_CB(WRITE32(*this, gaelco3d_state, adsp_tx_callback)) MCFG_DEVICE_PROGRAM_MAP(adsp_program_map) MCFG_DEVICE_DATA_MAP(adsp_data_map) - MCFG_EEPROM_SERIAL_93C66_ADD("eeprom") + MCFG_EEPROM_SERIAL_93C66_ADD(m_eeprom) MCFG_EEPROM_SERIAL_ENABLE_STREAMING() MCFG_QUANTUM_TIME(attotime::from_hz(6000)) MCFG_TIMER_DRIVER_ADD("adsp_timer", gaelco3d_state, adsp_autobuffer_irq) - MCFG_DEVICE_ADD("serial", GAELCO_SERIAL, 0) + MCFG_DEVICE_ADD(m_serial, GAELCO_SERIAL, 0) MCFG_GAELCO_SERIAL_IRQ_HANDLER(WRITELINE(*this, gaelco3d_state, ser_irq)) - MCFG_DEVICE_ADD("mainlatch", LS259, 0) // IC5 on bottom board next to EEPROM - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE("serial", gaelco_serial_device, tr_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE("serial", gaelco_serial_device, rts_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE("eeprom", eeprom_serial_93cxx_device, di_write)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE("eeprom", eeprom_serial_93cxx_device, clk_write)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE("eeprom", eeprom_serial_93cxx_device, cs_write)) + MCFG_DEVICE_ADD(m_mainlatch, LS259, 0) // IC5 on bottom board next to EEPROM + MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(m_serial, gaelco_serial_device, tr_w)) + MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(m_serial, gaelco_serial_device, rts_w)) + MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(m_eeprom, eeprom_serial_93cxx_device, di_write)) + MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(m_eeprom, eeprom_serial_93cxx_device, clk_write)) + MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(m_eeprom, eeprom_serial_93cxx_device, cs_write)) MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, gaelco3d_state, tms_reset_w)) MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, gaelco3d_state, tms_irq_w)) MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, gaelco3d_state, unknown_13a_w)) - MCFG_DEVICE_ADD("outlatch", LS259, 0) // IC2 on top board near edge connector + MCFG_DEVICE_ADD(m_outlatch, LS259, 0) // IC2 on top board near edge connector MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, gaelco3d_state, tms_control3_w)) MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, gaelco3d_state, radikalb_lamp_w)) MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, gaelco3d_state, unknown_137_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE("serial", gaelco_serial_device, irq_enable)) + MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(m_serial, gaelco_serial_device, irq_enable)) MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, gaelco3d_state, analog_port_clock_w)) MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, gaelco3d_state, analog_port_latch_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE("serial", gaelco_serial_device, unknown_w)) + MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(m_serial, gaelco_serial_device, unknown_w)) - MCFG_GENERIC_LATCH_8_ADD("soundlatch") - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("adsp", ADSP2115_IRQ2)) + MCFG_GENERIC_LATCH_8_ADD(m_soundlatch) + MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE(m_adsp, ADSP2115_IRQ2)) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_ADD(m_screen, RASTER) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) MCFG_SCREEN_SIZE(576, 432) MCFG_SCREEN_VISIBLE_AREA(0, 575, 0, 431) - MCFG_SCREEN_UPDATE_DRIVER(gaelco3d_state, screen_update_gaelco3d) + MCFG_SCREEN_UPDATE_DRIVER(gaelco3d_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette") @@ -987,16 +984,16 @@ MACHINE_CONFIG_START(gaelco3d_state::gaelco3d) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("dac1", DMADAC) + MCFG_DEVICE_ADD(m_dmadac[0], DMADAC) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) /* speedup: front mono */ - MCFG_DEVICE_ADD("dac2", DMADAC) + MCFG_DEVICE_ADD(m_dmadac[1], DMADAC) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) /* speedup: left rear */ - MCFG_DEVICE_ADD("dac3", DMADAC) + MCFG_DEVICE_ADD(m_dmadac[2], DMADAC) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) /* speedup: right rear */ - MCFG_DEVICE_ADD("dac4", DMADAC) + MCFG_DEVICE_ADD(m_dmadac[3], DMADAC) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) /* speedup: seat speaker */ MACHINE_CONFIG_END @@ -1256,29 +1253,17 @@ ROM_END /************************************* * - * Driver init - * - *************************************/ - -void gaelco3d_state::init_gaelco3d() -{ -} - - - -/************************************* - * * Game drivers * *************************************/ -GAME( 1996, speedup, 0, gaelco3d, speedup, gaelco3d_state, init_gaelco3d, ROT0, "Gaelco", "Speed Up (Version 1.20)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1996, speedup10, speedup, gaelco3d, speedup, gaelco3d_state, init_gaelco3d, ROT0, "Gaelco", "Speed Up (Version 1.00)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1996, speedup, 0, gaelco3d, speedup, gaelco3d_state, empty_init, ROT0, "Gaelco", "Speed Up (Version 1.20)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1996, speedup10, speedup, gaelco3d, speedup, gaelco3d_state, empty_init, ROT0, "Gaelco", "Speed Up (Version 1.00)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1997, surfplnt, 0, gaelco3d, surfplnt, gaelco3d_state, init_gaelco3d, ROT0, "Gaelco (Atari license)", "Surf Planet (Version 4.1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE) -GAME( 1997, surfplnt40, surfplnt, gaelco3d, surfplnt, gaelco3d_state, init_gaelco3d, ROT0, "Gaelco (Atari license)", "Surf Planet (Version 4.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE) +GAME( 1997, surfplnt, 0, gaelco3d, surfplnt, gaelco3d_state, empty_init, ROT0, "Gaelco (Atari license)", "Surf Planet (Version 4.1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE) +GAME( 1997, surfplnt40, surfplnt, gaelco3d, surfplnt, gaelco3d_state, empty_init, ROT0, "Gaelco (Atari license)", "Surf Planet (Version 4.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE) -GAME( 1998, radikalb, 0, gaelco3d2, radikalb, gaelco3d_state, init_gaelco3d, ROT0, "Gaelco", "Radikal Bikers (Version 2.02)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE) -GAME( 1998, radikalba, radikalb, gaelco3d2, radikalb, gaelco3d_state, init_gaelco3d, ROT0, "Gaelco (Atari license)", "Radikal Bikers (Version 2.02, Atari license)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE) +GAME( 1998, radikalb, 0, gaelco3d2, radikalb, gaelco3d_state, empty_init, ROT0, "Gaelco", "Radikal Bikers (Version 2.02)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE) +GAME( 1998, radikalba, radikalb, gaelco3d2, radikalb, gaelco3d_state, empty_init, ROT0, "Gaelco (Atari license)", "Radikal Bikers (Version 2.02, Atari license)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE) -GAME( 1999, footbpow, 0, footbpow, footbpow, gaelco3d_state, init_gaelco3d, ROT0, "Gaelco", "Football Power", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_CONTROLS ) +GAME( 1999, footbpow, 0, footbpow, footbpow, gaelco3d_state, empty_init, ROT0, "Gaelco", "Football Power", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_CONTROLS ) diff --git a/src/mame/includes/gaelco3d.h b/src/mame/includes/gaelco3d.h index 8aa9c02c07b..3387df698f1 100644 --- a/src/mame/includes/gaelco3d.h +++ b/src/mame/includes/gaelco3d.h @@ -20,41 +20,6 @@ #define SOUND_CHANNELS 4 -struct gaelco3d_object_data -{ - uint32_t tex, color; - float ooz_dx, ooz_dy, ooz_base; - float uoz_dx, uoz_dy, uoz_base; - float voz_dx, voz_dy, voz_base; - float z0; -}; - -class gaelco3d_state; - -class gaelco3d_renderer : public poly_manager<float, gaelco3d_object_data, 1, 2000> -{ -public: - gaelco3d_renderer(gaelco3d_state &state); - - bitmap_ind16 &screenbits() { return m_screenbits; } - uint32_t polygons() { uint32_t result = m_polygons; m_polygons = 0; return result; } - - void render_poly(screen_device &screen, uint32_t *polydata); - -private: - gaelco3d_state &m_state; - bitmap_ind16 m_screenbits; - bitmap_ind16 m_zbuffer; - uint32_t m_polygons; - offs_t m_texture_size; - offs_t m_texmask_size; - std::unique_ptr<uint8_t[]> m_texture; - std::unique_ptr<uint8_t[]> m_texmask; - - void render_noz_noperspective(int32_t scanline, const extent_t &extent, const gaelco3d_object_data &extra, int threadid); - void render_normal(int32_t scanline, const extent_t &extent, const gaelco3d_object_data &extra, int threadid); - void render_alphablend(int32_t scanline, const extent_t &extent, const gaelco3d_object_data &extra, int threadid); -}; class gaelco3d_state : public driver_device { @@ -65,21 +30,74 @@ public: m_m68k_ram_base(*this,"m68k_ram_base",0), m_tms_comm_base(*this,"tms_comm_base",0), m_adsp_control_regs(*this,"adsp_regs"), - m_adsp_fastram_base(*this,"adsp_fastram") , - m_maincpu(*this, "maincpu"), - m_adsp(*this, "adsp"), - m_eeprom(*this, "eeprom"), - m_tms(*this, "tms"), - m_serial(*this, "serial"), - m_screen(*this, "screen"), - m_soundlatch(*this, "soundlatch"), - m_mainlatch(*this, "mainlatch"), - m_outlatch(*this, "outlatch"), - m_paletteram16(*this, "paletteram"), - m_paletteram32(*this, "paletteram"), - m_analog(*this, {"ANALOG0", "ANALOG1", "ANALOG2", "ANALOG3"}) - { } + m_adsp_fastram_base(*this,"adsp_fastram"), + m_maincpu(*this, "maincpu"), + m_adsp(*this, "adsp"), + m_eeprom(*this, "eeprom"), + m_tms(*this, "tms"), + m_dmadac(*this, "dac%u", 0U), + m_serial(*this, "serial"), + m_screen(*this, "screen"), + m_soundlatch(*this, "soundlatch"), + m_mainlatch(*this, "mainlatch"), + m_outlatch(*this, "outlatch"), + m_adsp_autobuffer_timer(*this, "adsp_timer"), + m_paletteram16(*this, "paletteram"), + m_paletteram32(*this, "paletteram"), + m_analog(*this, {"ANALOG0", "ANALOG1", "ANALOG2", "ANALOG3"}), + m_adsp_bank(*this, "adspbank") + { } + + void footbpow(machine_config &config); + void gaelco3d2(machine_config &config); + void gaelco3d(machine_config &config); + + DECLARE_CUSTOM_INPUT_MEMBER(analog_bit_r); + DECLARE_CUSTOM_INPUT_MEMBER(fp_analog_bit_r); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + struct gaelco3d_object_data + { + uint32_t tex, color; + float ooz_dx, ooz_dy, ooz_base; + float uoz_dx, uoz_dy, uoz_base; + float voz_dx, voz_dy, voz_base; + float z0; + }; + + class gaelco3d_renderer : public poly_manager<float, gaelco3d_object_data, 1, 2000> + { + public: + gaelco3d_renderer(gaelco3d_state &state); + ~gaelco3d_renderer() {} + + bitmap_ind16 &screenbits() { return m_screenbits; } + uint32_t polygons() { uint32_t result = m_polygons; m_polygons = 0; return result; } + + void render_poly(screen_device &screen, uint32_t *polydata); + + protected: + gaelco3d_state &m_state; + + private: + bitmap_ind16 m_screenbits; + bitmap_ind16 m_zbuffer; + uint32_t m_polygons; + offs_t m_texture_size; + offs_t m_texmask_size; + std::unique_ptr<uint8_t[]> m_texture; + std::unique_ptr<uint8_t[]> m_texmask; + + void render_noz_noperspective(int32_t scanline, const extent_t &extent, const gaelco3d_object_data &extra, int threadid); + void render_normal(int32_t scanline, const extent_t &extent, const gaelco3d_object_data &extra, int threadid); + void render_alphablend(int32_t scanline, const extent_t &extent, const gaelco3d_object_data &extra, int threadid); + }; + +private: required_shared_ptr<uint32_t> m_adsp_ram_base; required_shared_ptr<uint16_t> m_m68k_ram_base; required_shared_ptr<uint16_t> m_tms_comm_base; @@ -89,15 +107,18 @@ public: required_device<adsp21xx_device> m_adsp; required_device<eeprom_serial_93cxx_device> m_eeprom; required_device<cpu_device> m_tms; + required_device_array<dmadac_sound_device, SOUND_CHANNELS> m_dmadac; required_device<gaelco_serial_device> m_serial; required_device<screen_device> m_screen; required_device<generic_latch_8_device> m_soundlatch; required_device<ls259_device> m_mainlatch; required_device<ls259_device> m_outlatch; + required_device<timer_device> m_adsp_autobuffer_timer; optional_shared_ptr<uint16_t> m_paletteram16; optional_shared_ptr<uint32_t> m_paletteram32; optional_ioport_array<4> m_analog; + required_memory_bank m_adsp_bank; uint8_t m_sound_status; offs_t m_tms_offset_xor; @@ -107,18 +128,17 @@ public: uint8_t m_fp_clock; uint8_t m_fp_state; uint8_t m_framenum; - timer_device *m_adsp_autobuffer_timer; uint8_t m_adsp_ireg; offs_t m_adsp_ireg_base; offs_t m_adsp_incs; offs_t m_adsp_size; - dmadac_sound_device *m_dmadac[SOUND_CHANNELS]; std::unique_ptr<rgb_t[]> m_palette; std::unique_ptr<uint32_t[]> m_polydata_buffer; uint32_t m_polydata_count; int m_lastscan; int m_video_changed; std::unique_ptr<gaelco3d_renderer> m_poly; + DECLARE_WRITE16_MEMBER(irq_ack_w); DECLARE_READ16_MEMBER(sound_status_r); DECLARE_WRITE16_MEMBER(sound_status_w); @@ -139,25 +159,18 @@ public: DECLARE_WRITE32_MEMBER(gaelco3d_render_w); DECLARE_WRITE16_MEMBER(gaelco3d_paletteram_w); DECLARE_WRITE32_MEMBER(gaelco3d_paletteram_020_w); - DECLARE_CUSTOM_INPUT_MEMBER(analog_bit_r); DECLARE_WRITE_LINE_MEMBER(ser_irq); DECLARE_READ16_MEMBER(eeprom_data_r); - void init_gaelco3d(); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; + DECLARE_MACHINE_RESET(gaelco3d2); DECLARE_MACHINE_RESET(common); - uint32_t screen_update_gaelco3d(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_gen); TIMER_DEVICE_CALLBACK_MEMBER(adsp_autobuffer_irq); void gaelco3d_render(screen_device &screen); DECLARE_WRITE32_MEMBER(adsp_tx_callback); DECLARE_WRITE_LINE_MEMBER(fp_analog_clock_w); - DECLARE_CUSTOM_INPUT_MEMBER(fp_analog_bit_r); - void footbpow(machine_config &config); - void gaelco3d2(machine_config &config); - void gaelco3d(machine_config &config); + void adsp_data_map(address_map &map); void adsp_program_map(address_map &map); void main020_map(address_map &map); diff --git a/src/mame/video/gaelco3d.cpp b/src/mame/video/gaelco3d.cpp index 95644d1338a..7769f6f36eb 100644 --- a/src/mame/video/gaelco3d.cpp +++ b/src/mame/video/gaelco3d.cpp @@ -25,7 +25,7 @@ #define IS_POLYEND(x) (((x) ^ ((x) >> 1)) & 0x4000) -gaelco3d_renderer::gaelco3d_renderer(gaelco3d_state &state) +gaelco3d_state::gaelco3d_renderer::gaelco3d_renderer(gaelco3d_state &state) : poly_manager<float, gaelco3d_object_data, 1, 2000>(state.machine()), m_state(state), m_screenbits(state.m_screen->width(), state.m_screen->height()), @@ -110,7 +110,7 @@ void gaelco3d_state::video_start() (repeat these two for each additional point in the fan) */ -void gaelco3d_renderer::render_poly(screen_device &screen, uint32_t *polydata) +void gaelco3d_state::gaelco3d_renderer::render_poly(screen_device &screen, uint32_t *polydata) { float midx = screen.width() / 2; float midy = screen.height() / 2; @@ -201,7 +201,7 @@ void gaelco3d_renderer::render_poly(screen_device &screen, uint32_t *polydata) -void gaelco3d_renderer::render_noz_noperspective(int32_t scanline, const extent_t &extent, const gaelco3d_object_data &object, int threadid) +void gaelco3d_state::gaelco3d_renderer::render_noz_noperspective(int32_t scanline, const extent_t &extent, const gaelco3d_object_data &object, int threadid) { float zbase = recip_approx(object.ooz_base); float uoz_step = object.uoz_dx * zbase; @@ -240,7 +240,7 @@ void gaelco3d_renderer::render_noz_noperspective(int32_t scanline, const extent_ } -void gaelco3d_renderer::render_normal(int32_t scanline, const extent_t &extent, const gaelco3d_object_data &object, int threadid) +void gaelco3d_state::gaelco3d_renderer::render_normal(int32_t scanline, const extent_t &extent, const gaelco3d_object_data &object, int threadid) { float ooz_dx = object.ooz_dx; float uoz_dx = object.uoz_dx; @@ -290,7 +290,7 @@ void gaelco3d_renderer::render_normal(int32_t scanline, const extent_t &extent, } -void gaelco3d_renderer::render_alphablend(int32_t scanline, const extent_t &extent, const gaelco3d_object_data &object, int threadid) +void gaelco3d_state::gaelco3d_renderer::render_alphablend(int32_t scanline, const extent_t &extent, const gaelco3d_object_data &object, int threadid) { float ooz_dx = object.ooz_dx; float uoz_dx = object.uoz_dx; @@ -425,7 +425,7 @@ WRITE32_MEMBER(gaelco3d_state::gaelco3d_paletteram_020_w) * *************************************/ -uint32_t gaelco3d_state::screen_update_gaelco3d(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t gaelco3d_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { int ret; |