diff options
Diffstat (limited to 'src/mame/includes/model2.h')
-rw-r--r-- | src/mame/includes/model2.h | 291 |
1 files changed, 194 insertions, 97 deletions
diff --git a/src/mame/includes/model2.h b/src/mame/includes/model2.h index 288d597855c..82c2617d021 100644 --- a/src/mame/includes/model2.h +++ b/src/mame/includes/model2.h @@ -6,7 +6,11 @@ #include "machine/eepromser.h" #include "machine/i8251.h" #include "cpu/i960/i960.h" +#include "cpu/mb86233/mb86233.h" +#include "cpu/sharc/sharc.h" #include "cpu/mb86235/mb86235.h" +#include "machine/bankdev.h" +#include "machine/gen_fifo.h" #include "sound/scsp.h" #include "machine/315-5881_crypt.h" #include "machine/315-5838_317-0229_comp.h" @@ -24,22 +28,19 @@ class model2_state : public driver_device public: model2_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_workram(*this, "workram"), - m_bufferram(*this, "bufferram"), m_textureram0(*this, "textureram0"), m_textureram1(*this, "textureram1"), + m_workram(*this, "workram"), + m_bufferram(*this, "bufferram"), m_soundram(*this, "soundram"), - m_tgp_program(*this, "tgp_program"), - m_tgpx4_program(*this, "tgpx4_program"), m_maincpu(*this,"maincpu"), m_dsbz80(*this, DSBZ80_TAG), m_m1audio(*this, M1AUDIO_TAG), m_uart(*this, "uart"), m_m2comm(*this, "m2comm"), m_audiocpu(*this, "audiocpu"), - m_tgp(*this, "tgp"), - m_dsp(*this, "dsp"), - m_tgpx4(*this, "tgpx4"), + m_copro_fifo_in(*this, "copro_fifo_in"), + m_copro_fifo_out(*this, "copro_fifo_out"), m_drivecpu(*this, "drivecpu"), m_eeprom(*this, "eeprom"), m_screen(*this, "screen"), @@ -47,6 +48,7 @@ public: m_scsp(*this, "scsp"), m_cryptdevice(*this, "315_5881"), m_0229crypt(*this, "317_0229"), + m_copro_data(*this, "copro_data"), m_in(*this, "IN%u", 0), m_dsw(*this, "DSW"), m_steer(*this, "STEER"), @@ -57,18 +59,41 @@ public: m_lightgun_ports(*this, {"P1_Y", "P1_X", "P2_Y", "P2_X"}) { } - required_shared_ptr<uint32_t> m_workram; - required_shared_ptr<uint32_t> m_bufferram; - std::unique_ptr<uint16_t[]> m_palram; - std::unique_ptr<uint16_t[]> m_colorxlat; + /* Public for access by the rendering functions */ required_shared_ptr<uint32_t> m_textureram0; required_shared_ptr<uint32_t> m_textureram1; + std::unique_ptr<uint16_t[]> m_palram; + std::unique_ptr<uint16_t[]> m_colorxlat; std::unique_ptr<uint16_t[]> m_lumaram; + uint8_t m_gamma_table[256]; + model2_renderer *m_poly; + + /* Public for access by the ioports */ + DECLARE_CUSTOM_INPUT_MEMBER(daytona_gearbox_r); + DECLARE_CUSTOM_INPUT_MEMBER(rchase2_devices_r); + + /* Public for access by MCFG */ + TIMER_DEVICE_CALLBACK_MEMBER(model2_interrupt); + uint16_t crypt_read_callback(uint32_t addr); + DECLARE_MACHINE_START(model2); + + + /* Public for access by GAME() */ + DECLARE_DRIVER_INIT(overrev); + DECLARE_DRIVER_INIT(pltkids); + DECLARE_DRIVER_INIT(rchase2); + DECLARE_DRIVER_INIT(manxttdx); + DECLARE_DRIVER_INIT(doa); + DECLARE_DRIVER_INIT(zerogun); + DECLARE_DRIVER_INIT(sgt24h); + DECLARE_DRIVER_INIT(srallyc); + +protected: + required_shared_ptr<uint32_t> m_workram; + required_shared_ptr<uint32_t> m_bufferram; std::unique_ptr<uint16_t[]> m_fbvramA; std::unique_ptr<uint16_t[]> m_fbvramB; optional_shared_ptr<uint16_t> m_soundram; - optional_shared_ptr<uint32_t> m_tgp_program; - optional_shared_ptr<uint64_t> m_tgpx4_program; required_device<i960_cpu_device> m_maincpu; optional_device<dsbz80_device> m_dsbz80; // Z80-based MPEG Digital Sound Board @@ -76,9 +101,8 @@ public: required_device<i8251_device> m_uart; optional_device<m2comm_device> m_m2comm; // Model 2 communication board optional_device<cpu_device> m_audiocpu; - optional_device<cpu_device> m_tgp; - optional_device<cpu_device> m_dsp; - optional_device<mb86235_device> m_tgpx4; + required_device<generic_fifo_u32_device> m_copro_fifo_in; + required_device<generic_fifo_u32_device> m_copro_fifo_out; optional_device<cpu_device> m_drivecpu; required_device<eeprom_serial_93cxx_device> m_eeprom; required_device<screen_device> m_screen; @@ -86,6 +110,7 @@ public: optional_device<scsp_device> m_scsp; optional_device<sega_315_5881_crypt_device> m_cryptdevice; optional_device<sega_315_5838_comp_device> m_0229crypt; + optional_memory_region m_copro_data; optional_ioport_array<5> m_in; required_ioport m_dsw; @@ -102,15 +127,6 @@ public: timer_device *m_timers[4]; int m_ctrlmode; int m_analog_channel; - int m_dsp_type; - int m_copro_fifoin_rpos; - int m_copro_fifoin_wpos; - std::unique_ptr<uint32_t[]> m_copro_fifoin_data; - int m_copro_fifoin_num; - int m_copro_fifoout_rpos; - int m_copro_fifoout_wpos; - std::unique_ptr<uint32_t[]> m_copro_fifoout_data; - int m_copro_fifoout_num; uint16_t m_cmd_data; uint8_t m_driveio_comm_data; int m_iop_write_num; @@ -120,7 +136,6 @@ public: uint32_t m_geo_read_start_address; uint32_t m_geo_write_start_address; - model2_renderer *m_poly; raster_state *m_raster; geo_state *m_geo; bitmap_rgb32 m_sys24_bitmap; @@ -130,9 +145,22 @@ public: uint8_t m_gearsel; uint8_t m_lightgun_mux; + // Coprocessor communications + DECLARE_READ32_MEMBER(copro_prg_r); + DECLARE_WRITE32_MEMBER(copro_prg_w); + DECLARE_READ32_MEMBER(copro_ctl1_r); + DECLARE_WRITE32_MEMBER(copro_ctl1_w); + DECLARE_READ32_MEMBER(copro_status_r); + + // Geometrizer communications + DECLARE_WRITE32_MEMBER(geo_ctl1_w); + DECLARE_READ32_MEMBER(geo_prg_r); + DECLARE_WRITE32_MEMBER(geo_prg_w); + DECLARE_READ32_MEMBER(geo_r); + DECLARE_WRITE32_MEMBER(geo_w); + + // Everything else DECLARE_READ8_MEMBER(model2_crx_in_r); - DECLARE_CUSTOM_INPUT_MEMBER(daytona_gearbox_r); - DECLARE_CUSTOM_INPUT_MEMBER(rchase2_devices_r); DECLARE_READ32_MEMBER(timers_r); DECLARE_WRITE32_MEMBER(timers_w); DECLARE_READ16_MEMBER(palette_r); @@ -146,19 +174,6 @@ public: DECLARE_WRITE32_MEMBER(videoctl_w); DECLARE_WRITE32_MEMBER(rchase2_devices_w); DECLARE_WRITE32_MEMBER(srallyc_devices_w); - DECLARE_READ32_MEMBER(copro_prg_r); - DECLARE_WRITE32_MEMBER(copro_prg_w); - DECLARE_READ32_MEMBER(copro_ctl1_r); - DECLARE_WRITE32_MEMBER(copro_ctl1_w); - DECLARE_WRITE32_MEMBER(copro_function_port_w); - DECLARE_READ32_MEMBER(copro_fifo_r); - DECLARE_WRITE32_MEMBER(copro_fifo_w); - DECLARE_WRITE32_MEMBER(copro_sharc_iop_w); - DECLARE_WRITE32_MEMBER(geo_ctl1_w); - DECLARE_READ32_MEMBER(geo_prg_r); - DECLARE_WRITE32_MEMBER(geo_prg_w); - DECLARE_READ32_MEMBER(geo_r); - DECLARE_WRITE32_MEMBER(geo_w); DECLARE_READ8_MEMBER(hotd_lightgun_r); DECLARE_WRITE32_MEMBER(hotd_lightgun_w); DECLARE_READ32_MEMBER(irq_request_r); @@ -175,8 +190,6 @@ public: void geo_init(memory_region *polygon_rom); DECLARE_READ32_MEMBER(render_mode_r); DECLARE_WRITE32_MEMBER(render_mode_w); - DECLARE_WRITE32_MEMBER(model2o_tex_w0); - DECLARE_WRITE32_MEMBER(model2o_tex_w1); DECLARE_READ16_MEMBER(lumaram_r); DECLARE_WRITE16_MEMBER(lumaram_w); DECLARE_READ16_MEMBER(fbvram_bankA_r); @@ -185,57 +198,24 @@ public: DECLARE_WRITE16_MEMBER(fbvram_bankB_w); DECLARE_WRITE32_MEMBER(model2_3d_zclip_w); DECLARE_WRITE16_MEMBER(model2snd_ctrl); - DECLARE_READ32_MEMBER(copro_sharc_input_fifo_r); - DECLARE_WRITE32_MEMBER(copro_sharc_output_fifo_w); - DECLARE_READ32_MEMBER(copro_sharc_buffer_r); - DECLARE_WRITE32_MEMBER(copro_sharc_buffer_w); - DECLARE_READ32_MEMBER(copro_tgp_buffer_r); - DECLARE_WRITE32_MEMBER(copro_tgp_buffer_w); DECLARE_READ8_MEMBER(tgpid_r); - DECLARE_READ32_MEMBER(copro_status_r); DECLARE_READ32_MEMBER(polygon_count_r); DECLARE_READ8_MEMBER(driveio_portg_r); DECLARE_READ8_MEMBER(driveio_porth_r); DECLARE_WRITE8_MEMBER(driveio_port_w); void push_geo_data(uint32_t data); - DECLARE_DRIVER_INIT(overrev); - DECLARE_DRIVER_INIT(pltkids); - DECLARE_DRIVER_INIT(rchase2); - DECLARE_DRIVER_INIT(manxttdx); - DECLARE_DRIVER_INIT(srallyc); - DECLARE_DRIVER_INIT(doa); - DECLARE_DRIVER_INIT(zerogun); - DECLARE_DRIVER_INIT(sgt24h); - DECLARE_MACHINE_START(model2); - DECLARE_MACHINE_START(srallyc); - DECLARE_MACHINE_RESET(model2o); DECLARE_VIDEO_START(model2); - DECLARE_MACHINE_RESET(model2); - DECLARE_MACHINE_RESET(model2b); - DECLARE_MACHINE_RESET(model2c); DECLARE_MACHINE_RESET(model2_common); DECLARE_MACHINE_RESET(model2_scsp); uint32_t screen_update_model2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); // DECLARE_WRITE_LINE_MEMBER(screen_vblank_model2); // DECLARE_WRITE_LINE_MEMBER(sound_ready_w); TIMER_DEVICE_CALLBACK_MEMBER(model2_timer_cb); - TIMER_DEVICE_CALLBACK_MEMBER(model2_interrupt); - TIMER_DEVICE_CALLBACK_MEMBER(model2c_interrupt); DECLARE_WRITE8_MEMBER(scsp_irq); - DECLARE_READ_LINE_MEMBER(copro_tgp_fifoin_pop_ok); - DECLARE_READ32_MEMBER(copro_tgp_fifoin_pop); - DECLARE_WRITE32_MEMBER(copro_tgp_fifoout_push); DECLARE_READ8_MEMBER(virtuacop_lightgun_r); DECLARE_READ8_MEMBER(virtuacop_lightgun_offscreen_r); - uint16_t crypt_read_callback(uint32_t addr); - - bool copro_fifoin_pop(device_t *device, uint32_t *result,uint32_t offset, uint32_t mem_mask); - void copro_fifoin_push(device_t *device, uint32_t data, uint32_t offset, uint32_t mem_mask); - uint32_t copro_fifoout_pop(address_space &space, uint32_t offset, uint32_t mem_mask); - void copro_fifoout_push(device_t *device, uint32_t data,uint32_t offset,uint32_t mem_mask); - void model2_3d_frame_start( void ); void geo_parse( void ); void model2_3d_frame_end( bitmap_rgb32 &bitmap, const rectangle &cliprect ); @@ -246,8 +226,7 @@ public: void model2_scsp(machine_config &config); void sj25_0207_01(machine_config &config); - void copro_sharc_map(address_map &map); - void copro_tgp_map(address_map &map); + void drive_io_map(address_map &map); void drive_map(address_map &map); void geo_sharc_map(address_map &map); @@ -255,33 +234,35 @@ public: void model2_5881_mem(address_map &map); void model2_snd(address_map &map); - uint8_t m_gamma_table[256]; - void debug_init(); void debug_commands( int ref, const std::vector<std::string> ¶ms ); void debug_geo_dasm_command(int ref, const std::vector<std::string> ¶ms); void debug_tri_dump_command(int ref, const std::vector<std::string> ¶ms); void debug_help_command(int ref, const std::vector<std::string> ¶ms); -protected: virtual void video_start() override; -private: - void tri_list_dump(FILE *dst); - uint32_t m_intreq; uint32_t m_intena; uint32_t m_coproctl; uint32_t m_coprocnt; - uint32_t m_geoctl; - uint32_t m_geocnt; - uint32_t m_videocontrol; + int m_port_1c00004; int m_port_1c00006; int m_port_1c00010; int m_port_1c00012; int m_port_1c00014; + virtual void copro_halt() = 0; + virtual void copro_boot() = 0; + +private: + void tri_list_dump(FILE *dst); + + uint32_t m_geoctl; + uint32_t m_geocnt; + uint32_t m_videocontrol; + bool m_render_unk; bool m_render_mode; bool m_render_test_mode; @@ -331,23 +312,96 @@ private: /***************************** * - * Model 2 + * Model 2/2A TGP support + * + *****************************/ + +class model2_tgp_state : public model2_state +{ +public: + model2_tgp_state(const machine_config &mconfig, device_type type, const char *tag) + : model2_state(mconfig, type, tag), + m_copro_tgp(*this, "copro_tgp"), + m_copro_tgp_program(*this, "copro_tgp_program"), + m_copro_tgp_tables(*this, "copro_tgp_tables"), + m_copro_tgp_bank(*this, "copro_tgp_bank") + {} + + DECLARE_MACHINE_START(model2_tgp); + DECLARE_MACHINE_START(srallyc); + +protected: + required_device<mb86234_device> m_copro_tgp; + required_shared_ptr<uint32_t> m_copro_tgp_program; + required_region_ptr<uint32_t> m_copro_tgp_tables; + required_device<address_map_bank_device> m_copro_tgp_bank; + + u32 m_copro_tgp_bank_reg; + u32 m_copro_sincos_base; + u32 m_copro_inv_base; + u32 m_copro_isqrt_base; + u32 m_copro_atan_base[4]; + + DECLARE_READ32_MEMBER(copro_tgp_buffer_r); + DECLARE_WRITE32_MEMBER(copro_tgp_buffer_w); + DECLARE_WRITE32_MEMBER(copro_function_port_w); + DECLARE_READ32_MEMBER(copro_fifo_r); + DECLARE_WRITE32_MEMBER(copro_fifo_w); + DECLARE_WRITE32_MEMBER(tex0_w); + DECLARE_WRITE32_MEMBER(tex1_w); + + DECLARE_READ32_MEMBER(copro_tgp_fifoin_pop); + DECLARE_WRITE32_MEMBER(copro_tgp_fifoout_push); + DECLARE_WRITE32_MEMBER(copro_tgp_bank_w); + DECLARE_READ32_MEMBER(copro_tgp_memory_r); + DECLARE_WRITE32_MEMBER(copro_tgp_memory_w); + + DECLARE_WRITE32_MEMBER(copro_sincos_w); + DECLARE_READ32_MEMBER(copro_sincos_r); + DECLARE_WRITE32_MEMBER(copro_inv_w); + DECLARE_READ32_MEMBER(copro_inv_r); + DECLARE_WRITE32_MEMBER(copro_isqrt_w); + DECLARE_READ32_MEMBER(copro_isqrt_r); + DECLARE_WRITE32_MEMBER(copro_atan_w); + DECLARE_READ32_MEMBER(copro_atan_r); + + DECLARE_MACHINE_RESET(model2_tgp); + + void model2_tgp_mem(address_map &map); + + void copro_tgp_prog_map(address_map &map); + void copro_tgp_data_map(address_map &map); + void copro_tgp_bank_map(address_map &map); + void copro_tgp_io_map(address_map &map); + void copro_tgp_rf_map(address_map &map); + + virtual void copro_halt() override; + virtual void copro_boot() override; +}; + +/***************************** + * + * Model 2 support * *****************************/ -class model2o_state : public model2_state +class model2o_state : public model2_tgp_state { public: model2o_state(const machine_config &mconfig, device_type type, const char *tag) - : model2_state(mconfig, type, tag) + : model2_tgp_state(mconfig, type, tag) {} + DECLARE_MACHINE_RESET(model2o); + + void daytona(machine_config &config); + void model2o(machine_config &config); + +protected: DECLARE_READ32_MEMBER(daytona_unk_r); DECLARE_READ8_MEMBER(model2o_in_r); DECLARE_READ32_MEMBER(fifo_control_2o_r); - void daytona(machine_config &config); - void model2o(machine_config &config); void model2o_mem(address_map &map); }; @@ -399,19 +453,23 @@ private: * *****************************/ -class model2a_state : public model2_state +class model2a_state : public model2_tgp_state { public: model2a_state(const machine_config &mconfig, device_type type, const char *tag) - : model2_state(mconfig, type, tag) + : model2_tgp_state(mconfig, type, tag) {} + DECLARE_MACHINE_RESET(model2a); + void manxtt(machine_config &config); void manxttdx(machine_config &config); void model2a(machine_config &config); void model2a_0229(machine_config &config); void model2a_5881(machine_config &config); void srallyc(machine_config &config); + +protected: void model2a_crx_mem(address_map &map); void model2a_5881_mem(address_map &map); }; @@ -426,19 +484,40 @@ class model2b_state : public model2_state { public: model2b_state(const machine_config &mconfig, device_type type, const char *tag) - : model2_state(mconfig, type, tag) + : model2_state(mconfig, type, tag), + m_copro_adsp(*this, "copro_adsp") {} + DECLARE_MACHINE_RESET(model2b); + DECLARE_MACHINE_START(model2b); + DECLARE_MACHINE_START(srallyc); + void model2b(machine_config &config); void model2b_0229(machine_config &config); void model2b_5881(machine_config &config); void indy500(machine_config &config); void rchase2(machine_config &config); + +protected: + required_device<adsp21062_device> m_copro_adsp; + + DECLARE_WRITE32_MEMBER(copro_function_port_w); + DECLARE_READ32_MEMBER(copro_fifo_r); + DECLARE_WRITE32_MEMBER(copro_fifo_w); + DECLARE_WRITE32_MEMBER(copro_sharc_iop_w); + DECLARE_READ32_MEMBER(copro_sharc_buffer_r); + DECLARE_WRITE32_MEMBER(copro_sharc_buffer_w); + void model2b_crx_mem(address_map &map); void model2b_5881_mem(address_map &map); // TODO: split into own class void rchase2_iocpu_map(address_map &map); void rchase2_ioport_map(address_map &map); + + void copro_sharc_map(address_map &map); + + virtual void copro_halt() override; + virtual void copro_boot() override; }; /***************************** @@ -451,19 +530,37 @@ class model2c_state : public model2_state { public: model2c_state(const machine_config &mconfig, device_type type, const char *tag) - : model2_state(mconfig, type, tag) + : model2_state(mconfig, type, tag), + m_copro_tgpx4(*this, "copro_tgpx4"), + m_copro_tgpx4_program(*this, "copro_tgpx4_program") {} - DECLARE_READ32_MEMBER(fifo_control_2c_r); + DECLARE_MACHINE_RESET(model2c); + DECLARE_MACHINE_START(model2c); + DECLARE_MACHINE_START(srallyc); void model2c(machine_config &config); void model2c_5881(machine_config &config); void overrev2c(machine_config &config); void stcc(machine_config &config); + +protected: + required_device<mb86235_device> m_copro_tgpx4; + required_shared_ptr<uint64_t> m_copro_tgpx4_program; + + DECLARE_WRITE32_MEMBER(copro_function_port_w); + DECLARE_READ32_MEMBER(copro_fifo_r); + DECLARE_WRITE32_MEMBER(copro_fifo_w); + + TIMER_DEVICE_CALLBACK_MEMBER(model2c_interrupt); + void model2c_crx_mem(address_map &map); void model2c_5881_mem(address_map &map); void copro_tgpx4_map(address_map &map); void copro_tgpx4_data_map(address_map &map); + + virtual void copro_halt() override; + virtual void copro_boot() override; }; /***************************** |