diff options
author | mooglyguy <therealmogminer@gmail.com> | 2018-07-20 02:27:17 +0200 |
---|---|---|
committer | mooglyguy <therealmogminer@gmail.com> | 2018-07-21 10:07:00 +0200 |
commit | eed782f1e3123685a1f368e51577629122542308 (patch) | |
tree | 816a9e97527d05e0b433a12b293628ffd41a7e10 | |
parent | bbfb764647e46dedb81283f89836deaba4f96f68 (diff) |
ps2sony: Some basic VU1 support, major file reshuffling, nw
-rw-r--r-- | scripts/src/cpu.lua | 6 | ||||
-rw-r--r-- | scripts/src/machine.lua | 130 | ||||
-rw-r--r-- | scripts/src/sound.lua | 12 | ||||
-rw-r--r-- | scripts/src/video.lua | 22 | ||||
-rw-r--r-- | scripts/target/mame/mess.lua | 44 | ||||
-rw-r--r-- | src/devices/cpu/mips/mips3.cpp | 9 | ||||
-rw-r--r-- | src/devices/cpu/mips/mips3.h | 2 | ||||
-rw-r--r-- | src/devices/cpu/mips/mips3com.cpp | 1 | ||||
-rw-r--r-- | src/devices/cpu/mips/mips3drc.cpp | 1 | ||||
-rw-r--r-- | src/devices/cpu/mips/mips3fe.cpp | 1 | ||||
-rw-r--r-- | src/devices/cpu/mips/ps2vif1.cpp (renamed from src/mame/machine/ps2vif1.cpp) | 25 | ||||
-rw-r--r-- | src/devices/cpu/mips/ps2vif1.h (renamed from src/mame/machine/ps2vif1.h) | 19 | ||||
-rw-r--r-- | src/devices/cpu/mips/ps2vu.cpp (renamed from src/devices/cpu/mips/sonyvu.cpp) | 180 | ||||
-rw-r--r-- | src/devices/cpu/mips/ps2vu.h (renamed from src/devices/cpu/mips/sonyvu.h) | 39 | ||||
-rw-r--r-- | src/devices/cpu/mips/r3000.cpp | 2 | ||||
-rw-r--r-- | src/devices/cpu/mips/vudasm.cpp | 44 | ||||
-rw-r--r-- | src/devices/cpu/mips/vudasm.h | 2 | ||||
-rw-r--r-- | src/devices/machine/iopcdvd.cpp (renamed from src/mame/machine/iopcdvd.cpp) | 6 | ||||
-rw-r--r-- | src/devices/machine/iopcdvd.h (renamed from src/mame/machine/iopcdvd.h) | 8 | ||||
-rw-r--r-- | src/devices/machine/iopdma.cpp (renamed from src/mame/machine/iopdma.cpp) | 5 | ||||
-rw-r--r-- | src/devices/machine/iopdma.h (renamed from src/mame/machine/iopdma.h) | 10 | ||||
-rw-r--r-- | src/devices/machine/iopintc.cpp (renamed from src/mame/machine/iopintc.cpp) | 4 | ||||
-rw-r--r-- | src/devices/machine/iopintc.h (renamed from src/mame/machine/iopintc.h) | 8 | ||||
-rw-r--r-- | src/devices/machine/iopsio2.cpp (renamed from src/mame/machine/iopsio2.cpp) | 6 | ||||
-rw-r--r-- | src/devices/machine/iopsio2.h (renamed from src/mame/machine/iopsio2.h) | 8 | ||||
-rw-r--r-- | src/devices/machine/ioptimer.cpp (renamed from src/mame/machine/ioptimer.cpp) | 4 | ||||
-rw-r--r-- | src/devices/machine/ioptimer.h (renamed from src/mame/machine/ioptimer.h) | 9 | ||||
-rw-r--r-- | src/devices/machine/ps2dma.cpp (renamed from src/mame/machine/ps2dma.cpp) | 20 | ||||
-rw-r--r-- | src/devices/machine/ps2dma.h (renamed from src/mame/machine/ps2dma.h) | 22 | ||||
-rw-r--r-- | src/devices/machine/ps2intc.cpp (renamed from src/mame/machine/ps2intc.cpp) | 5 | ||||
-rw-r--r-- | src/devices/machine/ps2intc.h (renamed from src/mame/machine/ps2intc.h) | 8 | ||||
-rw-r--r-- | src/devices/machine/ps2mc.cpp (renamed from src/mame/machine/ps2mc.cpp) | 6 | ||||
-rw-r--r-- | src/devices/machine/ps2mc.h (renamed from src/mame/machine/ps2mc.h) | 8 | ||||
-rw-r--r-- | src/devices/machine/ps2pad.cpp (renamed from src/mame/machine/ps2pad.cpp) | 6 | ||||
-rw-r--r-- | src/devices/machine/ps2pad.h (renamed from src/mame/machine/ps2pad.h) | 8 | ||||
-rw-r--r-- | src/devices/machine/ps2sif.cpp (renamed from src/mame/machine/ps2sif.cpp) | 7 | ||||
-rw-r--r-- | src/devices/machine/ps2sif.h (renamed from src/mame/machine/ps2sif.h) | 8 | ||||
-rw-r--r-- | src/devices/machine/ps2timer.cpp (renamed from src/mame/machine/ps2timer.cpp) | 4 | ||||
-rw-r--r-- | src/devices/machine/ps2timer.h (renamed from src/mame/machine/ps2timer.h) | 9 | ||||
-rw-r--r-- | src/devices/sound/iopspu.cpp (renamed from src/mame/audio/iopspu.cpp) | 4 | ||||
-rw-r--r-- | src/devices/sound/iopspu.h (renamed from src/mame/audio/iopspu.h) | 8 | ||||
-rw-r--r-- | src/devices/video/ps2gif.cpp (renamed from src/mame/machine/ps2gif.cpp) | 3 | ||||
-rw-r--r-- | src/devices/video/ps2gif.h (renamed from src/mame/machine/ps2gif.h) | 9 | ||||
-rw-r--r-- | src/devices/video/ps2gs.cpp (renamed from src/mame/video/ps2gs.cpp) | 22 | ||||
-rw-r--r-- | src/devices/video/ps2gs.h (renamed from src/mame/video/ps2gs.h) | 15 | ||||
-rw-r--r-- | src/emu/debug/debugbuf.cpp | 14 | ||||
-rw-r--r-- | src/mame/drivers/ps2sony.cpp | 29 |
47 files changed, 596 insertions, 226 deletions
diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua index afb115313a3..456a7412131 100644 --- a/scripts/src/cpu.lua +++ b/scripts/src/cpu.lua @@ -1263,8 +1263,10 @@ if (CPUS["MIPS"]~=null) then MAME_DIR .. "src/devices/cpu/mips/mips3fe.cpp", MAME_DIR .. "src/devices/cpu/mips/mips3fe.h", MAME_DIR .. "src/devices/cpu/mips/mips3drc.cpp", - MAME_DIR .. "src/devices/cpu/mips/sonyvu.cpp", - MAME_DIR .. "src/devices/cpu/mips/sonyvu.h", + MAME_DIR .. "src/devices/cpu/mips/ps2vu.cpp", + MAME_DIR .. "src/devices/cpu/mips/ps2vu.h", + MAME_DIR .. "src/devices/cpu/mips/ps2vif1.cpp", + MAME_DIR .. "src/devices/cpu/mips/ps2vif1.h", } end diff --git a/scripts/src/machine.lua b/scripts/src/machine.lua index 7f65e8ac024..08f26d2ad5c 100644 --- a/scripts/src/machine.lua +++ b/scripts/src/machine.lua @@ -3568,4 +3568,134 @@ if (MACHINES["I8291A"]~=null) then } end +--------------------------------------------------- +-- +--@src/devices/machine/ps2dma.h,MACHINES["PS2DMAC"] = true +--------------------------------------------------- + +if (MACHINES["PS2DMAC"]~=null) then + files { + MAME_DIR .. "src/devices/machine/ps2dma.cpp", + MAME_DIR .. "src/devices/machine/ps2dma.h", + } +end + +--------------------------------------------------- +-- +--@src/devices/machine/ps2intc.h,MACHINES["PS2INTC"] = true +--------------------------------------------------- + +if (MACHINES["PS2INTC"]~=null) then + files { + MAME_DIR .. "src/devices/machine/ps2intc.cpp", + MAME_DIR .. "src/devices/machine/ps2intc.h", + } +end + +--------------------------------------------------- +-- +--@src/devices/machine/ps2mc.h,MACHINES["PS2MC"] = true +--------------------------------------------------- + +if (MACHINES["PS2MC"]~=null) then + files { + MAME_DIR .. "src/devices/machine/ps2mc.cpp", + MAME_DIR .. "src/devices/machine/ps2mc.h", + } +end + +--------------------------------------------------- +-- +--@src/devices/machine/ps2pad.h,MACHINES["PS2PAD"] = true +--------------------------------------------------- + +if (MACHINES["PS2PAD"]~=null) then + files { + MAME_DIR .. "src/devices/machine/ps2pad.cpp", + MAME_DIR .. "src/devices/machine/ps2pad.h", + } +end + +--------------------------------------------------- +-- +--@src/devices/machine/ps2sif.h,MACHINES["PS2SIF"] = true +--------------------------------------------------- + +if (MACHINES["PS2SIF"]~=null) then + files { + MAME_DIR .. "src/devices/machine/ps2sif.cpp", + MAME_DIR .. "src/devices/machine/ps2sif.h", + } +end + +--------------------------------------------------- +-- +--@src/devices/machine/ps2timer.h,MACHINES["PS2TIMER"] = true +--------------------------------------------------- +if (MACHINES["PS2TIMER"]~=null) then + files { + MAME_DIR .. "src/devices/machine/ps2timer.cpp", + MAME_DIR .. "src/devices/machine/ps2timer.h", + } +end + +--------------------------------------------------- +-- +--@src/devices/machine/iopcdvd.h,MACHINES["IOPCDVD"] = true +--------------------------------------------------- + +if (MACHINES["IOPCDVD"]~=null) then + files { + MAME_DIR .. "src/devices/machine/iopcdvd.cpp", + MAME_DIR .. "src/devices/machine/iopcdvd.h", + } +end + +--------------------------------------------------- +-- +--@src/devices/machine/iopdma.h,MACHINES["IOPDMA"] = true +--------------------------------------------------- + +if (MACHINES["IOPDMA"]~=null) then + files { + MAME_DIR .. "src/devices/machine/iopdma.cpp", + MAME_DIR .. "src/devices/machine/iopdma.h", + } +end + +--------------------------------------------------- +-- +--@src/devices/machine/iopintc.h,MACHINES["IOPINTC"] = true +--------------------------------------------------- + +if (MACHINES["IOPINTC"]~=null) then + files { + MAME_DIR .. "src/devices/machine/iopintc.cpp", + MAME_DIR .. "src/devices/machine/iopintc.h", + } +end + +--------------------------------------------------- +-- +--@src/devices/machine/iopsio2.h,MACHINES["IOPSIO2"] = true +--------------------------------------------------- + +if (MACHINES["IOPSIO2"]~=null) then + files { + MAME_DIR .. "src/devices/machine/iopsio2.cpp", + MAME_DIR .. "src/devices/machine/iopsio2.h", + } +end + +--------------------------------------------------- +-- +--@src/devices/machine/ioptimer.h,MACHINES["IOPTIMER"] = true +--------------------------------------------------- + +if (MACHINES["IOPTIMER"]~=null) then + files { + MAME_DIR .. "src/devices/machine/ioptimer.cpp", + MAME_DIR .. "src/devices/machine/ioptimer.h", + } +end diff --git a/scripts/src/sound.lua b/scripts/src/sound.lua index a67c71ed782..f8e7f0f20a1 100644 --- a/scripts/src/sound.lua +++ b/scripts/src/sound.lua @@ -1471,3 +1471,15 @@ if (SOUNDS["UPD934G"]~=null) then MAME_DIR .. "src/devices/sound/upd934g.h", } end + +--------------------------------------------------- +-- +--@src/devices/sound/iopspu.h,SOUNDS["IOPSPU"] = true +--------------------------------------------------- + +if (SOUNDS["IOPSPU"]~=null) then + files { + MAME_DIR .. "src/devices/sound/iopspu.cpp", + MAME_DIR .. "src/devices/sound/iopspu.h", + } +end diff --git a/scripts/src/video.lua b/scripts/src/video.lua index dc25ec8c581..c014a026fad 100644 --- a/scripts/src/video.lua +++ b/scripts/src/video.lua @@ -1090,3 +1090,25 @@ if (VIDEOS["NEREID"]~=null) then MAME_DIR .. "src/devices/video/nereid.h", } end + +-------------------------------------------------- +-- +--@src/devices/video/ps2gif.h,VIDEOS["PS2GIF"] = true +-------------------------------------------------- +if (VIDEOS["PS2GIF"]~=null) then + files { + MAME_DIR .. "src/devices/video/ps2gif.cpp", + MAME_DIR .. "src/devices/video/ps2gif.h", + } +end + +-------------------------------------------------- +-- +--@src/devices/video/ps2gs.h,VIDEOS["PS2GS"] = true +-------------------------------------------------- +if (VIDEOS["PS2GS"]~=null) then + files { + MAME_DIR .. "src/devices/video/ps2gs.cpp", + MAME_DIR .. "src/devices/video/ps2gs.h", + } +end diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 3ba22ef4866..71aa52b0e9f 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -271,6 +271,7 @@ SOUNDS["MEA8000"] = true SOUNDS["DAVE"] = true --SOUNDS["LC7535"] = true SOUNDS["UPD934G"] = true +SOUNDS["IOPSPU"] = true -------------------------------------------------- -- specify available video cores @@ -360,6 +361,8 @@ VIDEOS["MGA2064W"] = true VIDEOS["PPU2C0X"] = true VIDEOS["DP8510"] = true VIDEOS["MB88303"] = true +VIDEOS["PS2GS"] = true +VIDEOS["PS2GIF"] = true -------------------------------------------------- -- specify available machine cores @@ -642,6 +645,17 @@ MACHINES["ADC0844"] = true MACHINES["28FXXX"] = true -- MACHINES["GEN_FIFO"] = true MACHINES["Z80DAISY"] = true +MACHINES["PS2DMAC"] = true +MACHINES["PS2INTC"] = true +MACHINES["PS2MC"] = true +MACHINES["PS2PAD"] = true +MACHINES["PS2SIF"] = true +MACHINES["PS2TIMER"] = true +MACHINES["IOPCDVD"] = true +MACHINES["IOPDMA"] = true +MACHINES["IOPINTC"] = true +MACHINES["IOPSIO2"] = true +MACHINES["IOPTIMER"] = true -------------------------------------------------- -- specify available bus cores @@ -3064,36 +3078,6 @@ files { MAME_DIR .. "src/mame/drivers/pve500.cpp", MAME_DIR .. "src/mame/drivers/smc777.cpp", MAME_DIR .. "src/mame/drivers/ps2sony.cpp", - MAME_DIR .. "src/mame/machine/ps2dma.cpp", - MAME_DIR .. "src/mame/machine/ps2dma.h", - MAME_DIR .. "src/mame/machine/ps2gif.cpp", - MAME_DIR .. "src/mame/machine/ps2gif.h", - MAME_DIR .. "src/mame/machine/ps2intc.cpp", - MAME_DIR .. "src/mame/machine/ps2intc.h", - MAME_DIR .. "src/mame/machine/ps2mc.cpp", - MAME_DIR .. "src/mame/machine/ps2mc.h", - MAME_DIR .. "src/mame/machine/ps2pad.cpp", - MAME_DIR .. "src/mame/machine/ps2pad.h", - MAME_DIR .. "src/mame/machine/ps2sif.cpp", - MAME_DIR .. "src/mame/machine/ps2sif.h", - MAME_DIR .. "src/mame/machine/ps2timer.cpp", - MAME_DIR .. "src/mame/machine/ps2timer.h", - MAME_DIR .. "src/mame/machine/ps2vif1.cpp", - MAME_DIR .. "src/mame/machine/ps2vif1.h", - MAME_DIR .. "src/mame/machine/iopcdvd.cpp", - MAME_DIR .. "src/mame/machine/iopcdvd.h", - MAME_DIR .. "src/mame/machine/iopdma.cpp", - MAME_DIR .. "src/mame/machine/iopdma.h", - MAME_DIR .. "src/mame/machine/iopintc.cpp", - MAME_DIR .. "src/mame/machine/iopintc.h", - MAME_DIR .. "src/mame/machine/iopsio2.cpp", - MAME_DIR .. "src/mame/machine/iopsio2.h", - MAME_DIR .. "src/mame/machine/ioptimer.cpp", - MAME_DIR .. "src/mame/machine/ioptimer.h", - MAME_DIR .. "src/mame/audio/iopspu.cpp", - MAME_DIR .. "src/mame/audio/iopspu.h", - MAME_DIR .. "src/mame/video/ps2gs.cpp", - MAME_DIR .. "src/mame/video/ps2gs.h", } createMESSProjects(_target, _subtarget, "sord") diff --git a/src/devices/cpu/mips/mips3.cpp b/src/devices/cpu/mips/mips3.cpp index a06067ed3ef..e9d5f17b318 100644 --- a/src/devices/cpu/mips/mips3.cpp +++ b/src/devices/cpu/mips/mips3.cpp @@ -13,11 +13,11 @@ #include "mips3.h" #include "mips3com.h" #include "mips3dsm.h" - +#include "ps2vu.h" #define ENABLE_OVERFLOWS (0) #define ENABLE_EE_ELF_LOADER (0) -#define ENABLE_EE_DECI2 (0) +#define ENABLE_EE_DECI2 (1) /*************************************************************************** HELPER MACROS @@ -3035,7 +3035,7 @@ void r5900le_device::handle_extra_cop2(uint32_t op) { if (BIT(op, 24-field)) { - fd[field] = m_core->vacc[field] + fs[field] + ft[bc]; + fd[field] = m_core->vacc[field] + fs[field] * ft[bc]; } } } @@ -3216,12 +3216,11 @@ void r5900le_device::handle_extra_cop2(uint32_t op) const uint32_t bc = op & 3; float *fs = m_core->vfr[rs]; float *ft = m_core->vfr[rt]; - float *fd = m_core->vfr[rd]; for (int field = 0; field < 4; field++) { if (BIT(op, 24-field)) { - fd[field] = m_core->vacc[field] + fs[field] * ft[bc]; + m_core->vacc[field] += fs[field] * ft[bc]; } } } diff --git a/src/devices/cpu/mips/mips3.h b/src/devices/cpu/mips/mips3.h index 653d8ce6841..429cdd1f753 100644 --- a/src/devices/cpu/mips/mips3.h +++ b/src/devices/cpu/mips/mips3.h @@ -18,8 +18,8 @@ MIPS III/IV emulator. #include "divtlb.h" #include "cpu/drcfe.h" #include "cpu/drcuml.h" -#include "sonyvu.h" +class sonyvu0_device; // NEC VR4300 series is MIPS III with 32-bit address bus and slightly custom COP0/TLB DECLARE_DEVICE_TYPE(VR4300BE, vr4300be_device) diff --git a/src/devices/cpu/mips/mips3com.cpp b/src/devices/cpu/mips/mips3com.cpp index 32fdfe9ec95..294dd6b20e5 100644 --- a/src/devices/cpu/mips/mips3com.cpp +++ b/src/devices/cpu/mips/mips3com.cpp @@ -10,6 +10,7 @@ #include "emu.h" #include "mips3com.h" +#include "ps2vu.h" /*************************************************************************** diff --git a/src/devices/cpu/mips/mips3drc.cpp b/src/devices/cpu/mips/mips3drc.cpp index 3be62994a27..b91727751fe 100644 --- a/src/devices/cpu/mips/mips3drc.cpp +++ b/src/devices/cpu/mips/mips3drc.cpp @@ -28,6 +28,7 @@ #include "mips3com.h" #include "mips3fe.h" #include "mips3dsm.h" +#include "ps2vu.h" #include "cpu/drcfe.h" #include "cpu/drcuml.h" #include "cpu/drcumlsh.h" diff --git a/src/devices/cpu/mips/mips3fe.cpp b/src/devices/cpu/mips/mips3fe.cpp index bfaf0c682d2..ff0c59797d9 100644 --- a/src/devices/cpu/mips/mips3fe.cpp +++ b/src/devices/cpu/mips/mips3fe.cpp @@ -11,6 +11,7 @@ #include "emu.h" #include "mips3fe.h" #include "mips3com.h" +#include "ps2vu.h" //************************************************************************** diff --git a/src/mame/machine/ps2vif1.cpp b/src/devices/cpu/mips/ps2vif1.cpp index 11aba89b0ba..9cc6135a852 100644 --- a/src/mame/machine/ps2vif1.cpp +++ b/src/devices/cpu/mips/ps2vif1.cpp @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 VU1 interface (VIF1) device skeleton +* Sony PlayStation 2 VU1 interface device skeleton * * To Do: * Everything @@ -12,8 +12,11 @@ */ #include "ps2vif1.h" +#include "ps2vu.h" +#include "video/ps2gs.h" +#include "video/ps2gif.h" -DEFINE_DEVICE_TYPE(SONYPS2_VIF1, ps2_vif1_device, "ps2vif1", "Playstation 2 VIF1") +DEFINE_DEVICE_TYPE(SONYPS2_VIF1, ps2_vif1_device, "ps2vif1", "PlayStation 2 VIF1") /*static*/ const size_t ps2_vif1_device::BUFFER_SIZE = 0x40; /*static*/ const uint32_t ps2_vif1_device::FORMAT_SIZE[] = { @@ -26,7 +29,7 @@ DEFINE_DEVICE_TYPE(SONYPS2_VIF1, ps2_vif1_device, "ps2vif1", "Playstation 2 VIF1 ps2_vif1_device::ps2_vif1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SONYPS2_VIF1, tag, owner, clock) , device_execute_interface(mconfig, *this) - , m_gif(*this, finder_base::DUMMY_TAG) + , m_gs(*this, finder_base::DUMMY_TAG) , m_vu1(*this, finder_base::DUMMY_TAG) { } @@ -510,13 +513,25 @@ void ps2_vif1_device::decode_vifcode() logerror("%s: MODE: %03x\n", machine().describe_context(), m_mode); break; case 0x06: /* MSKPATH3 */ - m_gif->set_path3_mask(BIT(m_code, 15)); + m_gs->interface()->set_path3_mask(BIT(m_code, 15)); logerror("%s: MSKPATH3: %d\n", machine().describe_context(), BIT(m_code, 15)); break; case 0x07: /* Oh hi, MARK */ m_mark = (uint16_t)m_code; logerror("%s: MARK: %04x\n", machine().describe_context(), (uint16_t)m_mark); break; + case 0x14: /* MSCAL */ + logerror("%s: MSCAL %04x\n", machine().describe_context(), (uint16_t)m_code); + if (m_vu1->running()) + { + m_icount--; + return; + } + else + { + m_vu1->start((uint16_t)m_code); + } + break; case 0x20: /* STMASK */ m_data_needed = 1; m_data_index = 0; @@ -585,7 +600,7 @@ void ps2_vif1_device::decode_vifcode() if (trigger_interrupt) { - printf("******************\n"); + //printf("******************\n"); } } diff --git a/src/mame/machine/ps2vif1.h b/src/devices/cpu/mips/ps2vif1.h index 462e5e5533b..3ad1dcb1c86 100644 --- a/src/mame/machine/ps2vif1.h +++ b/src/devices/cpu/mips/ps2vif1.h @@ -2,30 +2,31 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 VU1 interface (VIF1) device skeleton +* Sony PlayStation 2 VU1 interface device skeleton * * To Do: * Everything * */ -#ifndef MAME_MACHINE_PS2VIF1_H -#define MAME_MACHINE_PS2VIF1_H +#ifndef DEVICES_MACHINE_VIF1_H +#define DEVICES_MACHINE_VIF1_H #pragma once #include "emu.h" -#include "cpu/mips/sonyvu.h" -#include "ps2gif.h" + +class ps2_gs_device; +class sonyvu1_device; class ps2_vif1_device : public device_t, public device_execute_interface { public: template <typename T, typename U> - ps2_vif1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&gif_tag, U &&vu1_tag) + ps2_vif1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&gs_tag, U &&vu1_tag) : ps2_vif1_device(mconfig, tag, owner, clock) { - m_gif.set_tag(std::forward<T>(gif_tag)); + m_gs.set_tag(std::forward<T>(gs_tag)); m_vu1.set_tag(std::forward<U>(vu1_tag)); } @@ -105,7 +106,7 @@ protected: FMT_V4_5 = 0x0f, }; - required_device<ps2_gif_device> m_gif; + required_device<ps2_gs_device> m_gs; required_device<sonyvu1_device> m_vu1; int m_icount; @@ -156,4 +157,4 @@ protected: DECLARE_DEVICE_TYPE(SONYPS2_VIF1, ps2_vif1_device) -#endif // MAME_MACHINE_PS2VIF1_H
\ No newline at end of file +#endif // DEVICES_MACHINE_PS2VIF1_H
\ No newline at end of file diff --git a/src/devices/cpu/mips/sonyvu.cpp b/src/devices/cpu/mips/ps2vu.cpp index 550956cdd52..fa4a1fd96b8 100644 --- a/src/devices/cpu/mips/sonyvu.cpp +++ b/src/devices/cpu/mips/ps2vu.cpp @@ -10,18 +10,20 @@ */ #include "emu.h" -#include "sonyvu.h" +#include "ps2vu.h" +#include "ps2vif1.h" +#include "video/ps2gs.h" #include "vudasm.h" #include "debugger.h" -DEFINE_DEVICE_TYPE(SONYVU0, sonyvu0_device, "sonyvu0", "Sony PlayStation 2 VU0") -DEFINE_DEVICE_TYPE(SONYVU1, sonyvu1_device, "sonyvu1", "Sony PlayStation 2 VU1") +DEFINE_DEVICE_TYPE(SONYPS2_VU0, sonyvu0_device, "sonyvu0", "Sony PlayStation 2 VU0") +DEFINE_DEVICE_TYPE(SONYPS2_VU1, sonyvu1_device, "sonyvu1", "Sony PlayStation 2 VU1") sonyvu_device::sonyvu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor micro_cons, address_map_constructor vu_cons, chip_type chiptype, uint32_t mem_size) : cpu_device(mconfig, type, tag, owner, clock) - , m_micro_config("micro", ENDIANNESS_LITTLE, 64, 12, 0, micro_cons) - , m_vu_config("vu", ENDIANNESS_LITTLE, 32, 12, 0, vu_cons) + , m_micro_config("micro", ENDIANNESS_BIG, 64, 12, 0, micro_cons) + , m_vu_config("vu", ENDIANNESS_BIG, 32, 12, 0, vu_cons) , m_micro_space(nullptr) , m_vu_space(nullptr) , m_mem_size(mem_size) @@ -38,22 +40,45 @@ sonyvu_device::sonyvu_device(const machine_config &mconfig, device_type type, co , m_i(0.0f) , m_q(0.0f) , m_pc(0) + , m_delay_pc(0) + , m_start_pc(0) , m_running(false) , m_icount(0) { } sonyvu0_device::sonyvu0_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : sonyvu_device(mconfig, SONYVU0, tag, owner, clock, address_map_constructor(FUNC(sonyvu0_device::micro_map), this), address_map_constructor(FUNC(sonyvu0_device::vu_map), this), CHIP_TYPE_VU0, 0x1000) + : sonyvu_device(mconfig, SONYPS2_VU0, tag, owner, clock, address_map_constructor(FUNC(sonyvu0_device::micro_map), this), address_map_constructor(FUNC(sonyvu0_device::vu_map), this), CHIP_TYPE_VU0, 0x1000) , m_vu1(*this, finder_base::DUMMY_TAG) { } sonyvu1_device::sonyvu1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : sonyvu_device(mconfig, SONYVU1, tag, owner, clock, address_map_constructor(FUNC(sonyvu1_device::micro_map), this), address_map_constructor(FUNC(sonyvu1_device::vu_map), this), CHIP_TYPE_VU0, 0x4000) + : sonyvu_device(mconfig, SONYPS2_VU1, tag, owner, clock, address_map_constructor(FUNC(sonyvu1_device::micro_map), this), address_map_constructor(FUNC(sonyvu1_device::vu_map), this), CHIP_TYPE_VU0, 0x4000) + , m_gs(*this, finder_base::DUMMY_TAG) + , m_vif(*this, "vif") { } +MACHINE_CONFIG_START(sonyvu1_device::device_add_mconfig) + MCFG_DEVICE_ADD(m_vif, SONYPS2_VIF1, 294912000/2, m_gs, DEVICE_SELF) +MACHINE_CONFIG_END + +ps2_vif1_device* sonyvu1_device::interface() +{ + return m_vif.target(); +} + +READ64_MEMBER(sonyvu1_device::vif_r) +{ + return m_vif->mmio_r(space, offset, mem_mask); +} + +WRITE64_MEMBER(sonyvu1_device::vif_w) +{ + m_vif->mmio_w(space, offset, data, mem_mask); +} + void sonyvu_device::device_start() { // set our instruction counter @@ -82,8 +107,11 @@ void sonyvu_device::device_start() save_item(NAME(m_i)); save_item(NAME(m_q)); save_item(NAME(m_pc)); + save_item(NAME(m_delay_pc)); + save_item(NAME(m_start_pc)); state_add(STATE_GENPC, "GENPC", m_pc).noshow(); + state_add(STATE_GENPCBASE, "CURPC", m_pc).noshow(); state_add(SONYVU_TPC, "TPC", m_pc); state_add(SONYVU_SF, "SF", m_status_flag); state_add(SONYVU_MF, "MF", m_mac_flag); @@ -134,6 +162,8 @@ void sonyvu_device::device_reset() m_i = 0.0f; m_q = 0.0f; m_pc = 0; + m_delay_pc = ~0; + m_start_pc = 0; m_v[3] = 1.0f; @@ -331,6 +361,13 @@ void sonyvu_device::execute_run() debugger_instruction_hook(m_pc); const uint64_t op = m_micro_mem[(m_pc & m_mem_mask) >> 3]; + m_pc += 8; + if (m_delay_pc != ~0) + { + m_pc = m_delay_pc; + m_delay_pc = ~0; + } + execute_upper((uint32_t)(op >> 32)); if (op & OP_UPPER_I) { @@ -342,13 +379,16 @@ void sonyvu_device::execute_run() execute_lower((uint32_t)op); } - m_pc += 8; m_icount--; } } void sonyvu_device::execute_upper(const uint32_t op) { + const int rs = (op >> 11) & 31; + const int rt = (op >> 16) & 31; + const int rd = (op >> 6) & 31; + switch (op & 0x3f) { case 0x00: case 0x01: case 0x02: case 0x03: // ADDbc @@ -358,7 +398,20 @@ void sonyvu_device::execute_upper(const uint32_t op) printf("Unsupported VU instruction: SUBbc\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; break; case 0x08: case 0x09: case 0x0a: case 0x0b: // MADDbc - printf("Unsupported VU instruction: MADDbc\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; + if (rd) + { + const uint32_t bc = op & 3; + float *fs = m_vfr[rs]; + float *ft = m_vfr[rt]; + float *fd = m_vfr[rd]; + for (int field = 0; field < 4; field++) + { + if (BIT(op, 24-field)) + { + fd[field] = m_acc[field] + fs[field] * ft[bc]; + } + } + } break; case 0x0c: case 0x0d: case 0x0e: case 0x0f: // MSUBbc printf("Unsupported VU instruction: MSUBbc\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; @@ -444,14 +497,37 @@ void sonyvu_device::execute_upper(const uint32_t op) printf("Unsupported VU instruction: SUBAbc\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; break; case 0x08: case 0x09: case 0x0a: case 0x0b: // MADDAbc - printf("Unsupported VU instruction: MADDAbc\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; + if (rd) + { + const uint32_t bc = op & 3; + float *fs = m_vfr[rs]; + float *ft = m_vfr[rt]; + for (int field = 0; field < 4; field++) + { + if (BIT(op, 24-field)) + { + m_acc[field] += fs[field] * ft[bc]; + } + } + } break; case 0x0c: case 0x0d: case 0x0e: case 0x0f: // MSUBAbc printf("Unsupported VU instruction: MSUBAbc\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; break; case 0x18: case 0x19: case 0x1a: case 0x1b: // MULAbc - printf("Unsupported VU instruction: MULAbc\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; + { + const uint32_t bc = op & 3; + float *fs = m_vfr[rs]; + float *ft = m_vfr[rt]; + for (int field = 0; field < 4; field++) + { + if (BIT(op, 24-field)) + { + m_acc[field] = fs[field] * ft[bc]; + } + } break; + } case 0x10: // ITOF0 printf("Unsupported VU instruction: ITOF0\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; break; @@ -546,6 +622,11 @@ void sonyvu_device::execute_upper(const uint32_t op) void sonyvu_device::execute_lower(const uint32_t op) { + const int rd = (op >> 6) & 31; + const int rs = (op >> 11) & 31; + const int rt = (op >> 16) & 31; + const int dest = (op >> 21) & 15; + switch ((op >> 25) & 0x7f) { case 0x00: // LQ @@ -561,7 +642,8 @@ void sonyvu_device::execute_lower(const uint32_t op) printf("Unsupported VU instruction: ISW\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; break; case 0x08: // IADDIU - printf("Unsupported VU instruction: IADDIU\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; + if (rt) + m_vcr[rt] = (uint16_t)(m_vcr[rs] + (op & 0x7ff)); break; case 0x09: // ISUBIU printf("Unsupported VU instruction: ISUBIU\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; @@ -606,10 +688,12 @@ void sonyvu_device::execute_lower(const uint32_t op) printf("Unsupported VU instruction: B\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; break; case 0x21: // BAL - printf("Unsupported VU instruction: BAL\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; + if (rt) + m_vcr[rt] = m_pc + 8; + m_delay_pc = (m_pc + (immediate_s11(op) * 8)) & m_mem_mask; break; case 0x24: // JR - printf("Unsupported VU instruction: JR\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; + m_delay_pc = m_vcr[rs] & m_mem_mask; break; case 0x25: // JALR printf("Unsupported VU instruction: JALR\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; @@ -639,17 +723,51 @@ void sonyvu_device::execute_lower(const uint32_t op) uint8_t type4_op = ((op & 0x7c0) >> 4) | (op & 3); switch (type4_op) { - case 0x30: // MOVE - printf("Unsupported VU instruction: MOVE\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; + case 0x30: + if (rs == 0 && rt == 0 && dest == 0) + { // NOP + } + else + { // MOVE + printf("Unsupported VU instruction: MOVE\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; + } break; case 0x31: // MR32 printf("Unsupported VU instruction: MR32\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; break; case 0x34: // LQI - printf("Unsupported VU instruction: LQI\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; - break; + { + if (rt) + { + uint16_t addr = (m_vcr[rs] << 2) & m_mem_mask; + float* vumem = reinterpret_cast<float*>(&m_vu_mem[0]); + float* base = m_vfr[rt]; + for (int field = 0; field < 4; field++) + { + if (BIT(op, 24-field)) + { + base[field] = vumem[addr + field]; + } + } + m_vcr[rs] = (uint16_t)(m_vcr[rs] + 1); + } + break; + } case 0x35: // SQI - printf("Unsupported VU instruction: SQI\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; + if (rt) + { + uint16_t addr = (m_vcr[rt] << 2) & m_mem_mask; + float* vumem = reinterpret_cast<float*>(&m_vu_mem[0]); + float* base = m_vfr[rs]; + for (int field = 0; field < 4; field++) + { + if (BIT(op, 24-field)) + { + vumem[addr + field] = base[field]; + } + } + m_vcr[rt] = (uint16_t)(m_vcr[rt] + 1); + } break; case 0x36: // LQD printf("Unsupported VU instruction: LQD\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; @@ -758,19 +876,23 @@ void sonyvu_device::execute_lower(const uint32_t op) switch (op & 0x3f) { case 0x30: // IADD - printf("Unsupported VU instruction: IADD\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; + if (rd) + m_vcr[rd] = (uint16_t)(m_vcr[rs] + m_vcr[rt]); break; case 0x31: // ISUB - printf("Unsupported VU instruction: ISUB\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; + if (rd) + m_vcr[rd] = (uint16_t)(m_vcr[rs] - m_vcr[rt]); break; case 0x32: // IADDI printf("Unsupported VU instruction: IADDI\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; break; case 0x34: // IAND - printf("Unsupported VU instruction: IAND\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; + if (rd) + m_vcr[rd] = (uint16_t)(m_vcr[rs] & m_vcr[rt]); break; case 0x35: // IOR - printf("Unsupported VU instruction: IOR\n"); fflush(stdout); fatalerror("Unsupported VU instruction\n"); break; + if (rd) + m_vcr[rd] = (uint16_t)(m_vcr[rs] | m_vcr[rt]); break; default: logerror("%s: %08x: Unknown lower opcode %08x\n", machine().describe_context(), m_pc, op); @@ -876,3 +998,15 @@ void sonyvu_device::write_micro_mem(uint32_t address, uint64_t data) { m_micro_mem[(address & m_mem_mask) >> 3] = data; } + +void sonyvu_device::start(uint32_t address) +{ + m_pc = address & m_mem_mask; + m_running = true; +} + +int16_t sonyvu_device::immediate_s11(const uint32_t op) +{ + int16_t sval = (int16_t)(op << 5); + return sval >> 5; +} diff --git a/src/devices/cpu/mips/sonyvu.h b/src/devices/cpu/mips/ps2vu.h index 17536c24fe5..542ce80e64e 100644 --- a/src/devices/cpu/mips/sonyvu.h +++ b/src/devices/cpu/mips/ps2vu.h @@ -9,11 +9,14 @@ * */ -#ifndef MAME_CPU_MIPS_SONYVU_H -#define MAME_CPU_MIPS_SONYVU_H +#ifndef MAME_CPU_MIPS_PS2VU_H +#define MAME_CPU_MIPS_PS2VU_H #pragma once +class ps2_gs_device; +class ps2_vif1_device; + enum { SONYVU_TPC, @@ -79,6 +82,9 @@ public: void write_micro_mem(uint32_t address, uint64_t data); float* vector_regs() { return m_v; } + bool running() const { return m_running; } + void start(uint32_t address); + protected: enum chip_type { @@ -122,6 +128,8 @@ protected: void execute_upper(const uint32_t op); void execute_lower(const uint32_t op); + static int16_t immediate_s11(const uint32_t op); + // address spaces const address_space_config m_micro_config; const address_space_config m_vu_config; @@ -137,7 +145,7 @@ protected: uint32_t* m_vimem; float m_vfr[32][4]; // 0..3 = x..w - uint32_t m_vcr[16]; + uint32_t m_vcr[32]; float m_acc[4]; float* m_v; @@ -150,6 +158,9 @@ protected: float m_q; uint32_t m_pc; + uint32_t m_delay_pc; + uint32_t m_start_pc; + bool m_running; int m_icount; @@ -158,17 +169,33 @@ protected: class sonyvu1_device : public sonyvu_device { public: + template <typename T> + sonyvu1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&gs_tag) + : sonyvu1_device(mconfig, tag, owner, clock) + { + m_gs.set_tag(std::forward<T>(gs_tag)); + } + sonyvu1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + ps2_vif1_device* interface(); + + DECLARE_READ64_MEMBER(vif_r); + DECLARE_WRITE64_MEMBER(vif_w); + protected: virtual void device_start() override; virtual void device_reset() override; + virtual void device_add_mconfig(machine_config &config) override; virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; void micro_map(address_map &map); void vu_map(address_map &map); + required_device<ps2_gs_device> m_gs; + required_device<ps2_vif1_device> m_vif; + float m_p; }; @@ -203,7 +230,7 @@ protected: uint32_t m_cmsar1; }; -DECLARE_DEVICE_TYPE(SONYVU1, sonyvu1_device) -DECLARE_DEVICE_TYPE(SONYVU0, sonyvu0_device) +DECLARE_DEVICE_TYPE(SONYPS2_VU1, sonyvu1_device) +DECLARE_DEVICE_TYPE(SONYPS2_VU0, sonyvu0_device) -#endif // MAME_CPU_MIPS_SONYVU_H
\ No newline at end of file +#endif // MAME_CPU_MIPS_PS2VU_H
\ No newline at end of file diff --git a/src/devices/cpu/mips/r3000.cpp b/src/devices/cpu/mips/r3000.cpp index ab17dab98d3..a0084fd4c48 100644 --- a/src/devices/cpu/mips/r3000.cpp +++ b/src/devices/cpu/mips/r3000.cpp @@ -15,7 +15,7 @@ #define ENABLE_OVERFLOWS (0) -#define ENABLE_IOP_KPUTS (0) +#define ENABLE_IOP_KPUTS (1) /*************************************************************************** diff --git a/src/devices/cpu/mips/vudasm.cpp b/src/devices/cpu/mips/vudasm.cpp index da376798d92..e3f7ab470d8 100644 --- a/src/devices/cpu/mips/vudasm.cpp +++ b/src/devices/cpu/mips/vudasm.cpp @@ -112,9 +112,9 @@ void sonyvu_disassembler::dasm_upper(uint32_t pc, uint32_t op, std::ostream &str case 0x04: case 0x05: case 0x06: case 0x07: util::stream_format(stream, "suba%s.%s ACC%s %s%s %s%s", bc, dest, destc, VFREG[rs], destc, VFREG[rt], bc); break; case 0x08: case 0x09: case 0x0a: case 0x0b: - util::stream_format(stream, "madda%s.%s ACC%s %s%s %s%s", bc, dest, destc, VFREG[rs], destc, VFREG[rt], bc); break; + util::stream_format(stream, "madda%s.%s ACC%s %s%s %s%s", bc, dest, destc, VFREG[rs], destc, VFREG[rt], bc); break; case 0x0c: case 0x0d: case 0x0e: case 0x0f: - util::stream_format(stream, "msuba%s.%s ACC%s %s%s %s%s", bc, dest, destc, VFREG[rs], destc, VFREG[rt], bc); break; + util::stream_format(stream, "msuba%s.%s ACC%s %s%s %s%s", bc, dest, destc, VFREG[rs], destc, VFREG[rt], bc); break; case 0x10: util::stream_format(stream, "itof0.%s %s%s %s%s", dest, VFREG[rt], destc, VFREG[rs], dest); break; case 0x11: util::stream_format(stream, "itof4.%s %s%s %s%s", dest, VFREG[rt], destc, VFREG[rs], dest); break; case 0x12: util::stream_format(stream, "itof12.%s %s%s %s%s", dest, VFREG[rt], destc, VFREG[rs], dest); break; @@ -124,7 +124,7 @@ void sonyvu_disassembler::dasm_upper(uint32_t pc, uint32_t op, std::ostream &str case 0x16: util::stream_format(stream, "ftoi12.%s %s%s %s%s", dest, VFREG[rt], destc, VFREG[rs], dest); break; case 0x17: util::stream_format(stream, "ftoi15.%s %s%s %s%s", dest, VFREG[rt], destc, VFREG[rs], dest); break; case 0x18: case 0x19: case 0x1a: case 0x1b: - util::stream_format(stream, "mula%s.%s ACC%s %s%s %s%s", bc, dest, destc, VFREG[rs], destc, VFREG[rt], bc); break; + util::stream_format(stream, "mula%s.%s ACC%s %s%s %s%s", bc, dest, destc, VFREG[rs], destc, VFREG[rt], bc); break; case 0x1c: util::stream_format(stream, "mulaq.%s ACC%s %s%s Q", dest, destc, VFREG[rs], destc); break; case 0x1d: util::stream_format(stream, "abs.%s %s%s %s%s", dest, VFREG[rt], destc, VFREG[rs], dest); break; case 0x1e: util::stream_format(stream, "mulai.%s ACC%s %s%s I", dest, destc, VFREG[rs], destc); break; @@ -262,7 +262,10 @@ void sonyvu_disassembler::dasm_lower(uint32_t pc, uint32_t op, std::ostream &str switch (type4_op) { case 0x30: // MOVE - util::stream_format(stream, "move.%s %s%s %s%s", dest, VFREG[rt], destc, VFREG[rs], dest); + if (((op >> 21) & 15) == 0 && rt == 0 && rs == 0) + util::stream_format(stream, "nop"); + else + util::stream_format(stream, "move.%s %s%s %s%s", dest, VFREG[rt], destc, VFREG[rs], dest); break; case 0x31: // MR32 util::stream_format(stream, "mr32.%s %s%s %s%s", dest, VFREG[rt], destc, VFREG[rs], dest); @@ -386,7 +389,7 @@ void sonyvu_disassembler::dasm_lower(uint32_t pc, uint32_t op, std::ostream &str util::stream_format(stream, "isub %s, %s, %s", VIREG[rd], VIREG[rs], VIREG[rt]); break; case 0x32: // IADDI - util::stream_format(stream, "iaddi %s, %s, %s", VIREG[rt], VIREG[rs], signed_5bit(op)); + util::stream_format(stream, "iaddi %s, %s, %s", VIREG[rt], VIREG[rs], signed_5bit_rd(op)); break; case 0x34: // IAND util::stream_format(stream, "iand %s, %s, %s", VIREG[rd], VIREG[rs], VIREG[rt]); @@ -424,11 +427,11 @@ std::string sonyvu_disassembler::signed_5bit(uint16_t val) return util::string_format("$%x", sval); } -std::string sonyvu_disassembler::signed_11bit(uint16_t val) +std::string sonyvu_disassembler::signed_5bit_rd(uint16_t val) { - int16_t sval = (int32_t)val; - sval <<= 5; - sval >>= 5; + int16_t sval = (int32_t)((val >> 6) & 0x1f); + sval <<= 11; + sval >>= 11; if (sval < 0) return util::string_format("-$%x", -sval); @@ -436,26 +439,33 @@ std::string sonyvu_disassembler::signed_11bit(uint16_t val) return util::string_format("$%x", sval); } -std::string sonyvu_disassembler::signed_11bit_x8(uint16_t val) +std::string sonyvu_disassembler::unsigned_11bit(uint16_t val) +{ + val <<= 5; + val >>= 5; + return util::string_format("$%x", val); +} + +std::string sonyvu_disassembler::signed_11bit(uint16_t val) { int16_t sval = (int32_t)val; sval <<= 5; sval >>= 5; if (sval < 0) - return util::string_format("-$%x", -sval * 8); + return util::string_format("-$%x", -sval); else - return util::string_format("$%x", sval * 8); + return util::string_format("$%x", sval); } -std::string sonyvu_disassembler::signed_15bit(uint16_t val) +std::string sonyvu_disassembler::signed_11bit_x8(uint16_t val) { int16_t sval = (int32_t)val; - sval <<= 1; - sval >>= 1; + sval <<= 5; + sval >>= 5; if (sval < 0) - return util::string_format("-$%x", -sval); + return util::string_format("-$%x", -sval * 8); else - return util::string_format("$%x", sval); + return util::string_format("$%x", sval * 8); } diff --git a/src/devices/cpu/mips/vudasm.h b/src/devices/cpu/mips/vudasm.h index 0ff2ad67adc..a2bbf5fb310 100644 --- a/src/devices/cpu/mips/vudasm.h +++ b/src/devices/cpu/mips/vudasm.h @@ -24,6 +24,8 @@ private: void dasm_upper(uint32_t pc, uint32_t op, std::ostream &stream); void dasm_lower(uint32_t pc, uint32_t op, std::ostream &stream); std::string signed_5bit(uint16_t val); + std::string signed_5bit_rd(uint16_t val); + std::string unsigned_11bit(uint16_t val); std::string signed_11bit(uint16_t val); std::string signed_11bit_x8(uint16_t val); std::string signed_15bit(uint16_t val); diff --git a/src/mame/machine/iopcdvd.cpp b/src/devices/machine/iopcdvd.cpp index 16c8eb25973..24c7136221c 100644 --- a/src/mame/machine/iopcdvd.cpp +++ b/src/devices/machine/iopcdvd.cpp @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 disc controller device skeleton +* Sony PlayStation 2 disc controller device skeleton * * To Do: * Everything @@ -11,9 +11,9 @@ #include "iopcdvd.h" -/*static*/ const size_t iop_cdvd_device::BUFFER_SIZE = 16; // Total guess +DEFINE_DEVICE_TYPE(SONYIOP_CDVD, iop_cdvd_device, "iopcdvd", "PlayStation 2 disc controller") -DEFINE_DEVICE_TYPE(SONYIOP_CDVD, iop_cdvd_device, "iopcdvd", "Playstation 2 disc controller") +/*static*/ const size_t iop_cdvd_device::BUFFER_SIZE = 16; // Total guess iop_cdvd_device::iop_cdvd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SONYIOP_CDVD, tag, owner, clock) diff --git a/src/mame/machine/iopcdvd.h b/src/devices/machine/iopcdvd.h index c9e8b4b2315..ddc164760cb 100644 --- a/src/mame/machine/iopcdvd.h +++ b/src/devices/machine/iopcdvd.h @@ -2,15 +2,15 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 disc controller device skeleton +* Sony PlayStation 2 disc controller device skeleton * * To Do: * Everything * */ -#ifndef MAME_MACHINE_IOPCDVD_H -#define MAME_MACHINE_IOPCDVD_H +#ifndef DEVICES_MACHINE_IOPCDVD_H +#define DEVICES_MACHINE_IOPCDVD_H #pragma once @@ -70,4 +70,4 @@ protected: DECLARE_DEVICE_TYPE(SONYIOP_CDVD, iop_cdvd_device) -#endif // MAME_MACHINE_IOPCDVD_H
\ No newline at end of file +#endif // DEVICES_MACHINE_IOPCDVD_H
\ No newline at end of file diff --git a/src/mame/machine/iopdma.cpp b/src/devices/machine/iopdma.cpp index bc0dfd8b980..883a03eafd0 100644 --- a/src/mame/machine/iopdma.cpp +++ b/src/devices/machine/iopdma.cpp @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 IOP DMA device skeleton +* Sony PlayStation 2 IOP DMAC device skeleton * * To Do: * Everything @@ -11,8 +11,9 @@ #include "emu.h" #include "iopdma.h" +#include "cpu/mips/ps2vu.h" -DEFINE_DEVICE_TYPE(SONYIOP_DMA, iop_dma_device, "iopdma", "Sony IOP DMA") +DEFINE_DEVICE_TYPE(SONYIOP_DMA, iop_dma_device, "iopdma", "PlayStation 2 IOP DMAC") iop_dma_device::iop_dma_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SONYIOP_DMA, tag, owner, clock) diff --git a/src/mame/machine/iopdma.h b/src/devices/machine/iopdma.h index 338f1287228..36e38556026 100644 --- a/src/mame/machine/iopdma.h +++ b/src/devices/machine/iopdma.h @@ -2,15 +2,15 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 IOP DMA device skeleton +* Sony PlayStation 2 IOP DMAC device skeleton * * To Do: * Everything * */ -#ifndef MAME_MACHINE_IOPDMA_H -#define MAME_MACHINE_IOPDMA_H +#ifndef DEVICES_MACHINE_IOPDMA_H +#define DEVICES_MACHINE_IOPDMA_H #pragma once @@ -18,7 +18,7 @@ #include "ps2sif.h" #include "iopintc.h" #include "iopsio2.h" -#include "audio/iopspu.h" +#include "sound/iopspu.h" class iop_dma_device : public device_t, public device_execute_interface { @@ -161,4 +161,4 @@ protected: DECLARE_DEVICE_TYPE(SONYIOP_DMA, iop_dma_device) -#endif // MAME_MACHINE_IOPDMA_H +#endif // DEVICES_MACHINE_IOPDMA_H
\ No newline at end of file diff --git a/src/mame/machine/iopintc.cpp b/src/devices/machine/iopintc.cpp index f1ca66ed85b..9cace039047 100644 --- a/src/mame/machine/iopintc.cpp +++ b/src/devices/machine/iopintc.cpp @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 IOP interrupt controller device skeleton +* Sony PlayStation 2 IOP interrupt controller device skeleton * * To Do: * Everything @@ -11,7 +11,7 @@ #include "iopintc.h" -DEFINE_DEVICE_TYPE(SONYIOP_INTC, iop_intc_device, "iopintc", "Playstation 2 IOP INTC") +DEFINE_DEVICE_TYPE(SONYIOP_INTC, iop_intc_device, "iopintc", "PlayStation 2 IOP INTC") iop_intc_device::iop_intc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SONYIOP_INTC, tag, owner, clock) diff --git a/src/mame/machine/iopintc.h b/src/devices/machine/iopintc.h index dc3e68ab6c5..d58b1ef52c7 100644 --- a/src/mame/machine/iopintc.h +++ b/src/devices/machine/iopintc.h @@ -2,15 +2,15 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 IOP interrupt controller device skeleton +* Sony PlayStation 2 IOP interrupt controller device skeleton * * To Do: * Everything * */ -#ifndef MAME_MACHINE_IOPINTC_H -#define MAME_MACHINE_IOPINTC_H +#ifndef DEVICES_MACHINE_IOPINTC_H +#define DEVICES_MACHINE_IOPINTC_H #pragma once @@ -58,4 +58,4 @@ protected: DECLARE_DEVICE_TYPE(SONYIOP_INTC, iop_intc_device) -#endif // MAME_MACHINE_IOPINTC_H
\ No newline at end of file +#endif // DEVICES_MACHINE_IOPINTC_H
\ No newline at end of file diff --git a/src/mame/machine/iopsio2.cpp b/src/devices/machine/iopsio2.cpp index 69a3896266f..a779d8d4631 100644 --- a/src/mame/machine/iopsio2.cpp +++ b/src/devices/machine/iopsio2.cpp @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 SIO2 device skeleton +* Sony PlayStation 2 IOP SIO2 device skeleton * * To Do: * Everything @@ -11,9 +11,9 @@ #include "iopsio2.h" -/*static*/ const size_t iop_sio2_device::BUFFER_SIZE = 512; // total guess based on memcard block size +DEFINE_DEVICE_TYPE(SONYIOP_SIO2, iop_sio2_device, "iopsio2", "PlayStation 2 IOP SIO2") -DEFINE_DEVICE_TYPE(SONYIOP_SIO2, iop_sio2_device, "iopsio2", "Playstation 2 SIO2") +/*static*/ const size_t iop_sio2_device::BUFFER_SIZE = 512; // total guess based on memcard block size iop_sio2_device::iop_sio2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SONYIOP_SIO2, tag, owner, clock) diff --git a/src/mame/machine/iopsio2.h b/src/devices/machine/iopsio2.h index 915a5294e28..bfe69680c5c 100644 --- a/src/mame/machine/iopsio2.h +++ b/src/devices/machine/iopsio2.h @@ -2,15 +2,15 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 SIO2 device skeleton +* Sony PlayStation 2 IOP SIO2 device skeleton * * To Do: * Everything * */ -#ifndef MAME_MACHINE_IOPSIO2_H -#define MAME_MACHINE_IOPSIO2_H +#ifndef DEVICES_MACHINE_IOPSIO2_H +#define DEVICES_MACHINE_IOPSIO2_H #pragma once @@ -87,4 +87,4 @@ protected: DECLARE_DEVICE_TYPE(SONYIOP_SIO2, iop_sio2_device) -#endif // MAME_MACHINE_IOPSIO2_H
\ No newline at end of file +#endif // DEVICES_MACHINE_IOPSIO2_H
\ No newline at end of file diff --git a/src/mame/machine/ioptimer.cpp b/src/devices/machine/ioptimer.cpp index 5a5fa0ed592..31c6c4fd6f2 100644 --- a/src/mame/machine/ioptimer.cpp +++ b/src/devices/machine/ioptimer.cpp @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 IOP Timer device skeleton +* Sony PlayStation 2 IOP timer device skeleton * * To Do: * Everything @@ -12,7 +12,7 @@ #include "emu.h" #include "ioptimer.h" -DEFINE_DEVICE_TYPE(SONYIOP_TIMER, iop_timer_device, "ioptimer", "Sony IOP Timer") +DEFINE_DEVICE_TYPE(SONYIOP_TIMER, iop_timer_device, "ioptimer", "PlayStation 2 IOP timer") iop_timer_device::iop_timer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SONYIOP_TIMER, tag, owner, clock) diff --git a/src/mame/machine/ioptimer.h b/src/devices/machine/ioptimer.h index a109474d5ce..dcaaf0a9004 100644 --- a/src/mame/machine/ioptimer.h +++ b/src/devices/machine/ioptimer.h @@ -2,19 +2,18 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 IOP Timer device skeleton +* Sony PlayStation 2 IOP timer device skeleton * * To Do: * Everything * */ -#ifndef MAME_MACHINE_IOPTIMER_H -#define MAME_MACHINE_IOPTIMER_H +#ifndef DEVICES_MACHINE_IOPTIMER_H +#define DEVICES_MACHINE_IOPTIMER_H #pragma once - #define MCFG_IOP_TIMER_IRQ_CALLBACK(_write) \ downcast<iop_timer_device &>(*device).set_int_cb(DEVCB_##_write); @@ -96,4 +95,4 @@ protected: DECLARE_DEVICE_TYPE(SONYIOP_TIMER, iop_timer_device) -#endif // MAME_MACHINE_IOPTIMER_H +#endif // DEVICES_MACHINE_IOPTIMER_H
\ No newline at end of file diff --git a/src/mame/machine/ps2dma.cpp b/src/devices/machine/ps2dma.cpp index 5d331fb69d0..5bb422398bd 100644 --- a/src/mame/machine/ps2dma.cpp +++ b/src/devices/machine/ps2dma.cpp @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 DMAC device skeleton +* Sony PlayStation 2 EE DMA controller device skeleton * * To Do: * Everything @@ -12,8 +12,10 @@ #include "ps2sif.h" #include "ps2dma.h" #include "cpu/mips/mips3.h" +#include "cpu/mips/ps2vif1.h" +#include "video/ps2gif.h" -DEFINE_DEVICE_TYPE(SONYPS2_DMAC, ps2_dmac_device, "ps2dmac", "EE Core DMAC") +DEFINE_DEVICE_TYPE(SONYPS2_DMAC, ps2_dmac_device, "ps2dmac", "PlayStation 2 EE DMAC") ps2_dmac_device::ps2_dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SONYPS2_DMAC, tag, owner, clock) @@ -21,8 +23,8 @@ ps2_dmac_device::ps2_dmac_device(const machine_config &mconfig, const char *tag, , m_ee(*this, finder_base::DUMMY_TAG) , m_ram(*this, finder_base::DUMMY_TAG) , m_sif(*this, finder_base::DUMMY_TAG) - , m_gif(*this, finder_base::DUMMY_TAG) - , m_vif1(*this, finder_base::DUMMY_TAG) + , m_gs(*this, finder_base::DUMMY_TAG) + , m_vu1(*this, finder_base::DUMMY_TAG) , m_icount(0) { } @@ -129,7 +131,7 @@ void ps2_dmac_device::transfer_vif1() if (count) { //logerror("%s: DMAC VIF1 quadword count: %08x\n", machine().describe_context(), count); - if (m_vif1->fifo_available(4)) + if (m_vu1->interface()->fifo_available(4)) { uint32_t addr = channel.addr(); if (BIT(addr, 31)) @@ -141,7 +143,7 @@ void ps2_dmac_device::transfer_vif1() words[word] = space.read_dword(addr); addr += 4; } - m_vif1->dma_write(((uint64_t)words[3] << 32) | words[2], ((uint64_t)words[1] << 32) | words[0]); + m_vu1->interface()->dma_write(((uint64_t)words[3] << 32) | words[2], ((uint64_t)words[1] << 32) | words[0]); channel.set_addr(channel.addr() + 0x10); channel.set_quadword_count(count - 1); } @@ -151,7 +153,7 @@ void ps2_dmac_device::transfer_vif1() logerror("%s: DMAC VIF1 end tag\n", machine().describe_context()); transfer_finish(VIF1); } - else if (m_vif1->fifo_available(2)) + else if (m_vu1->interface()->fifo_available(2)) { logerror("%s: DMAC VIF1 following source tag\n", machine().describe_context()); uint32_t tag_addr = channel.tag_addr(); @@ -164,7 +166,7 @@ void ps2_dmac_device::transfer_vif1() words[word] = space.read_dword(tag_addr); tag_addr += 4; } - m_vif1->tag_write(words); + m_vu1->interface()->tag_write(words); follow_source_tag(VIF1); } } @@ -193,7 +195,7 @@ void ps2_dmac_device::transfer_gif() words[word] = space.read_dword(addr); addr += 4; } - m_gif->write_path3(((uint64_t)words[3] << 32) | words[2], ((uint64_t)words[1] << 32) | words[0]); + m_gs->interface()->write_path3(((uint64_t)words[3] << 32) | words[2], ((uint64_t)words[1] << 32) | words[0]); channel.set_addr(channel.addr() + 0x10); channel.set_quadword_count(count - 1); } diff --git a/src/mame/machine/ps2dma.h b/src/devices/machine/ps2dma.h index b076188cdac..134dfbe328a 100644 --- a/src/mame/machine/ps2dma.h +++ b/src/devices/machine/ps2dma.h @@ -2,34 +2,34 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 DMAC device skeleton +* Sony PlayStation 2 EE DMA controller device skeleton * * To Do: * Everything * */ -#ifndef MAME_MACHINE_PS2DMAC_H -#define MAME_MACHINE_PS2DMAC_H +#ifndef DEVICES_MACHINE_PS2DMAC_H +#define DEVICES_MACHINE_PS2DMAC_H #pragma once #include "emu.h" -#include "ps2gif.h" -#include "ps2vif1.h" +#include "video/ps2gs.h" +#include "cpu/mips/ps2vu.h" class ps2_dmac_device : public device_t, public device_execute_interface { public: template <typename T, typename U, typename V, typename W, typename X> - ps2_dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&ee_tag, U &&ram_tag, V &&sif_tag, W &&gif_tag, X &&vif1_tag) + ps2_dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&ee_tag, U &&ram_tag, V &&sif_tag, W &&gs_tag, X &&vu1_tag) : ps2_dmac_device(mconfig, tag, owner, clock) { m_ee.set_tag(std::forward<T>(ee_tag)); m_ram.set_tag(std::forward<U>(ram_tag)); m_sif.set_tag(std::forward<V>(sif_tag)); - m_gif.set_tag(std::forward<W>(gif_tag)); - m_vif1.set_tag(std::forward<X>(vif1_tag)); + m_gs.set_tag(std::forward<W>(gs_tag)); + m_vu1.set_tag(std::forward<X>(vu1_tag)); } ps2_dmac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); @@ -128,8 +128,8 @@ protected: required_device<cpu_device> m_ee; required_shared_ptr<uint64_t> m_ram; required_device<ps2_sif_device> m_sif; - required_device<ps2_gif_device> m_gif; - required_device<ps2_vif1_device> m_vif1; + required_device<ps2_gs_device> m_gs; + required_device<sonyvu1_device> m_vu1; int m_icount; @@ -148,4 +148,4 @@ protected: DECLARE_DEVICE_TYPE(SONYPS2_DMAC, ps2_dmac_device) -#endif // MAME_MACHINE_PS2DMAC_H
\ No newline at end of file +#endif // DEVICES_MACHINE_PS2DMAC_H
\ No newline at end of file diff --git a/src/mame/machine/ps2intc.cpp b/src/devices/machine/ps2intc.cpp index 0c9819ec6d8..57ce3172316 100644 --- a/src/mame/machine/ps2intc.cpp +++ b/src/devices/machine/ps2intc.cpp @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 EE interrupt controller device skeleton +* Sony PlayStation 2 EE interrupt controller device skeleton * * To Do: * Everything @@ -10,8 +10,9 @@ */ #include "ps2intc.h" +#include "cpu/mips/ps2vu.h" -DEFINE_DEVICE_TYPE(SONYPS2_INTC, ps2_intc_device, "ps2intc", "Playstation 2 EE INTC") +DEFINE_DEVICE_TYPE(SONYPS2_INTC, ps2_intc_device, "ps2intc", "PlayStation 2 EE INTC") ps2_intc_device::ps2_intc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SONYPS2_INTC, tag, owner, clock) diff --git a/src/mame/machine/ps2intc.h b/src/devices/machine/ps2intc.h index b77769e2dd6..34825264085 100644 --- a/src/mame/machine/ps2intc.h +++ b/src/devices/machine/ps2intc.h @@ -2,15 +2,15 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 EE interrupt controller device skeleton +* Sony PlayStation 2 EE interrupt controller device skeleton * * To Do: * Everything * */ -#ifndef MAME_MACHINE_PS2INTC_H -#define MAME_MACHINE_PS2INTC_H +#ifndef DEVICES_MACHINE_PS2INTC_H +#define DEVICES_MACHINE_PS2INTC_H #pragma once @@ -67,4 +67,4 @@ protected: DECLARE_DEVICE_TYPE(SONYPS2_INTC, ps2_intc_device) -#endif // MAME_MACHINE_PS2INTC_H
\ No newline at end of file +#endif // DEVICES_MACHINE_PS2INTC_H
\ No newline at end of file diff --git a/src/mame/machine/ps2mc.cpp b/src/devices/machine/ps2mc.cpp index 854180dfc05..88f76b717c5 100644 --- a/src/mame/machine/ps2mc.cpp +++ b/src/devices/machine/ps2mc.cpp @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 memory card skeleton +* Sony PlayStation 2 memory card device skeleton * * To Do: * Everything @@ -11,11 +11,11 @@ #include "ps2mc.h" +DEFINE_DEVICE_TYPE(SONYPS2_MC, ps2_mc_device, "ps2mc", "PlayStation 2 Memory Card") + /*static*/ const size_t ps2_mc_device::BUFFER_SIZE = 512; // Total guess /*static*/ const uint8_t ps2_mc_device::DEFAULT_TERMINATOR = 0x55; -DEFINE_DEVICE_TYPE(SONYPS2_MC, ps2_mc_device, "ps2mc", "PlayStation 2 Memory Card") - ps2_mc_device::ps2_mc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SONYPS2_MC, tag, owner, clock) { diff --git a/src/mame/machine/ps2mc.h b/src/devices/machine/ps2mc.h index efca9e5ab8b..f6b291d595f 100644 --- a/src/mame/machine/ps2mc.h +++ b/src/devices/machine/ps2mc.h @@ -2,15 +2,15 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 memory card skeleton +* Sony PlayStation 2 memory card device skeleton * * To Do: * Everything * */ -#ifndef MAME_MACHINE_PS2MC_H -#define MAME_MACHINE_PS2MC_H +#ifndef DEVICES_MACHINE_PS2MC_H +#define DEVICES_MACHINE_PS2MC_H #pragma once @@ -72,4 +72,4 @@ protected: DECLARE_DEVICE_TYPE(SONYPS2_MC, ps2_mc_device) -#endif // MAME_MACHINE_PS2MC_H
\ No newline at end of file +#endif // DEVICES_MACHINE_PS2MC_H
\ No newline at end of file diff --git a/src/mame/machine/ps2pad.cpp b/src/devices/machine/ps2pad.cpp index 1c34ebfd6fa..5ec69f7c624 100644 --- a/src/mame/machine/ps2pad.cpp +++ b/src/devices/machine/ps2pad.cpp @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 DualShock 2 ('pad') device skeleton +* Sony DualShock 2 device skeleton * * To Do: * Everything @@ -11,9 +11,9 @@ #include "ps2pad.h" -/*static*/ const size_t ps2_pad_device::BUFFER_SIZE = 64; // Total guess +DEFINE_DEVICE_TYPE(SONYPS2_PAD, ps2_pad_device, "ps2pad", "Sony DualShock 2") -DEFINE_DEVICE_TYPE(SONYPS2_PAD, ps2_pad_device, "ps2pad", "DualShock 2") +/*static*/ const size_t ps2_pad_device::BUFFER_SIZE = 64; // Total guess ps2_pad_device::ps2_pad_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SONYPS2_PAD, tag, owner, clock) diff --git a/src/mame/machine/ps2pad.h b/src/devices/machine/ps2pad.h index da04362bcca..166372b378b 100644 --- a/src/mame/machine/ps2pad.h +++ b/src/devices/machine/ps2pad.h @@ -2,15 +2,15 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 DualShock 2 ('pad') device skeleton +* Sony DualShock 2 device skeleton * * To Do: * Everything * */ -#ifndef MAME_MACHINE_PS2PAD_H -#define MAME_MACHINE_PS2PAD_H +#ifndef DEVICES_MACHINE_PS2PAD_H +#define DEVICES_MACHINE_PS2PAD_H #pragma once @@ -75,4 +75,4 @@ protected: DECLARE_DEVICE_TYPE(SONYPS2_PAD, ps2_pad_device) -#endif // MAME_MACHINE_PS2PAD_H
\ No newline at end of file +#endif // DEVICES_MACHINE_PS2PAD_H
\ No newline at end of file diff --git a/src/mame/machine/ps2sif.cpp b/src/devices/machine/ps2sif.cpp index 454e707f373..26c09293774 100644 --- a/src/mame/machine/ps2sif.cpp +++ b/src/devices/machine/ps2sif.cpp @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 SIF device skeleton +* Sony PlayStation 2 SIF device skeleton * * To Do: * Everything @@ -10,10 +10,11 @@ */ #include "ps2sif.h" +#include "cpu/mips/ps2vu.h" -/*static*/ const size_t ps2_sif_device::MAX_FIFO_DEPTH = 0x20; +DEFINE_DEVICE_TYPE(SONYPS2_SIF, ps2_sif_device, "ps2sif", "PlayStation 2 SIF") -DEFINE_DEVICE_TYPE(SONYPS2_SIF, ps2_sif_device, "ps2sif", "Playstation 2 SIF") +/*static*/ const size_t ps2_sif_device::MAX_FIFO_DEPTH = 0x20; ps2_sif_device::ps2_sif_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SONYPS2_SIF, tag, owner, clock) diff --git a/src/mame/machine/ps2sif.h b/src/devices/machine/ps2sif.h index 2b1dd978047..8a19586d502 100644 --- a/src/mame/machine/ps2sif.h +++ b/src/devices/machine/ps2sif.h @@ -2,15 +2,15 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 SIF device skeleton +* Sony PlayStation 2 SIF device skeleton * * To Do: * Everything * */ -#ifndef MAME_MACHINE_PS2SIF_H -#define MAME_MACHINE_PS2SIF_H +#ifndef DEVICES_MACHINE_PS2SIF_H +#define DEVICES_MACHINE_PS2SIF_H #pragma once @@ -58,4 +58,4 @@ protected: DECLARE_DEVICE_TYPE(SONYPS2_SIF, ps2_sif_device) -#endif // MAME_MACHINE_PS2SIF_H
\ No newline at end of file +#endif // DEVICES_MACHINE_PS2SIF_H
\ No newline at end of file diff --git a/src/mame/machine/ps2timer.cpp b/src/devices/machine/ps2timer.cpp index 8e3327b2c26..70970a6784a 100644 --- a/src/mame/machine/ps2timer.cpp +++ b/src/devices/machine/ps2timer.cpp @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 Timer device skeleton +* Sony PlayStation 2 EE timer device skeleton * * To Do: * Everything @@ -12,7 +12,7 @@ #include "emu.h" #include "ps2timer.h" -DEFINE_DEVICE_TYPE(SONYPS2_TIMER, ps2_timer_device, "ps2timer", "EE Core Timer") +DEFINE_DEVICE_TYPE(SONYPS2_TIMER, ps2_timer_device, "ps2timer", "PlayStation 2 EE Core Timer") ps2_timer_device::ps2_timer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SONYPS2_TIMER, tag, owner, clock) diff --git a/src/mame/machine/ps2timer.h b/src/devices/machine/ps2timer.h index 902bf93af0a..425fc89798b 100644 --- a/src/mame/machine/ps2timer.h +++ b/src/devices/machine/ps2timer.h @@ -2,19 +2,18 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 Timer device skeleton +* Sony PlayStation 2 EE timer device skeleton * * To Do: * Everything * */ -#ifndef MAME_MACHINE_PS2TIMER_H -#define MAME_MACHINE_PS2TIMER_H +#ifndef DEVICES_MACHINE_PS2TIMER_H +#define DEVICES_MACHINE_PS2TIMER_H #pragma once - class ps2_timer_device : public device_t { public: @@ -114,4 +113,4 @@ protected: DECLARE_DEVICE_TYPE(SONYPS2_TIMER, ps2_timer_device) -#endif // MAME_MACHINE_PS2TIMER_H +#endif // DEVICES_MACHINE_PS2TIMER_H
\ No newline at end of file diff --git a/src/mame/audio/iopspu.cpp b/src/devices/sound/iopspu.cpp index bc60f19c48b..9701fc85be4 100644 --- a/src/mame/audio/iopspu.cpp +++ b/src/devices/sound/iopspu.cpp @@ -2,7 +2,7 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 IOP SPU device skeleton +* Sony PlayStation 2 IOP SPU device skeleton * * To Do: * Everything @@ -11,7 +11,7 @@ #include "iopspu.h" -DEFINE_DEVICE_TYPE(SONYIOP_SPU, iop_spu_device, "iopspu", "Playstation 2 IOP SPU") +DEFINE_DEVICE_TYPE(SONYIOP_SPU, iop_spu_device, "iopspu", "PlayStation 2 IOP SPU") iop_spu_device::iop_spu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SONYIOP_SPU, tag, owner, clock) diff --git a/src/mame/audio/iopspu.h b/src/devices/sound/iopspu.h index 02a6e699b7a..41176cf7738 100644 --- a/src/mame/audio/iopspu.h +++ b/src/devices/sound/iopspu.h @@ -2,15 +2,15 @@ // copyright-holders:Ryan Holtz /****************************************************************************** * -* Sony Playstation 2 IOP SPU device skeleton +* Sony PlayStation 2 IOP SPU device skeleton * * To Do: * Everything * */ -#ifndef MAME_MACHINE_IOPSPU_H -#define MAME_MACHINE_IOPSPU_H +#ifndef DEVICES_MACHINE_IOPSPU_H +#define DEVICES_MACHINE_IOPSPU_H #pragma once @@ -98,4 +98,4 @@ protected: DECLARE_DEVICE_TYPE(SONYIOP_SPU, iop_spu_device) -#endif // MAME_MACHINE_IOPSPU_H
\ No newline at end of file +#endif // DEVICES_MACHINE_IOPSPU_H
\ No newline at end of file diff --git a/src/mame/machine/ps2gif.cpp b/src/devices/video/ps2gif.cpp index f894d380bdf..f95c6547500 100644 --- a/src/mame/machine/ps2gif.cpp +++ b/src/devices/video/ps2gif.cpp @@ -10,6 +10,8 @@ */ #include "ps2gif.h" +#include "ps2gs.h" +#include "cpu/mips/ps2vu.h" DEFINE_DEVICE_TYPE(SONYPS2_GIF, ps2_gif_device, "ps2gif", "Playstation 2 GIF") @@ -253,4 +255,3 @@ void ps2_gif_device::set_path3_mask(bool masked) { m_p3mask = masked; } - diff --git a/src/mame/machine/ps2gif.h b/src/devices/video/ps2gif.h index c5e6169f45c..387e6f50e4c 100644 --- a/src/mame/machine/ps2gif.h +++ b/src/devices/video/ps2gif.h @@ -9,13 +9,14 @@ * */ -#ifndef MAME_MACHINE_PS2GIF_H -#define MAME_MACHINE_PS2GIF_H +#ifndef DEVICES_VIDEO_PS2GIF_H +#define DEVICES_VIDEO_PS2GIF_H #pragma once #include "emu.h" -#include "video/ps2gs.h" + +class ps2_gs_device; class ps2_gif_device : public device_t { @@ -106,4 +107,4 @@ protected: DECLARE_DEVICE_TYPE(SONYPS2_GIF, ps2_gif_device) -#endif // MAME_MACHINE_PS2GIF_H
\ No newline at end of file +#endif // DEVICES_VIDEO_PS2GIF_H
\ No newline at end of file diff --git a/src/mame/video/ps2gs.cpp b/src/devices/video/ps2gs.cpp index a6811a28e70..1e5957b1873 100644 --- a/src/mame/video/ps2gs.cpp +++ b/src/devices/video/ps2gs.cpp @@ -10,6 +10,8 @@ */ #include "ps2gs.h" +#include "ps2gif.h" +#include "cpu/mips/ps2vu.h" DEFINE_DEVICE_TYPE(SONYPS2_GS, ps2_gs_device, "ps2gs", "Playstation 2 GS") @@ -42,9 +44,14 @@ DEFINE_DEVICE_TYPE(SONYPS2_GS, ps2_gs_device, "ps2gs", "Playstation 2 GS") ps2_gs_device::ps2_gs_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SONYPS2_GS, tag, owner, clock) , m_intc(*this, finder_base::DUMMY_TAG) + , m_gif(*this, "gif") { } +MACHINE_CONFIG_START(ps2_gs_device::device_add_mconfig) + MCFG_DEVICE_ADD(m_gif, SONYPS2_GIF, DEVICE_SELF) +MACHINE_CONFIG_END + void ps2_gs_device::device_start() { save_item(NAME(m_bitbltbuf)); @@ -730,3 +737,18 @@ void ps2_gs_device::vblank_end() else m_csr |= CSR_FIELD_ODD; } + +ps2_gif_device* ps2_gs_device::interface() +{ + return m_gif.target(); +} + +READ32_MEMBER(ps2_gs_device::gif_r) +{ + return m_gif->read(space, offset, mem_mask); +} + +WRITE32_MEMBER(ps2_gs_device::gif_w) +{ + m_gif->write(space, offset, data, mem_mask); +}
\ No newline at end of file diff --git a/src/mame/video/ps2gs.h b/src/devices/video/ps2gs.h index fadb259cadb..986041c675a 100644 --- a/src/mame/video/ps2gs.h +++ b/src/devices/video/ps2gs.h @@ -9,14 +9,16 @@ * */ -#ifndef MAME_MACHINE_PS2GS_H -#define MAME_MACHINE_PS2GS_H +#ifndef DEVICES_VIDEO_PS2GS_H +#define DEVICES_VIDEO_PS2GS_H #pragma once #include "emu.h" #include "machine/ps2intc.h" +class ps2_gif_device; + class ps2_gs_device : public device_t { public: @@ -37,6 +39,11 @@ public: DECLARE_WRITE64_MEMBER(regs_w); + DECLARE_READ32_MEMBER(gif_r); + DECLARE_WRITE32_MEMBER(gif_w); + + ps2_gif_device* interface(); + void reg_write(const uint8_t reg, const uint64_t value); void write_packed(const uint8_t reg, const uint64_t hi, const uint64_t lo); @@ -46,6 +53,7 @@ public: protected: virtual void device_start() override; virtual void device_reset() override; + virtual void device_add_mconfig(machine_config &config) override; void copy_dword_from_host(uint64_t data); @@ -161,6 +169,7 @@ protected: }; required_device<ps2_intc_device> m_intc; + required_device<ps2_gif_device> m_gif; std::unique_ptr<uint32_t[]> m_ram; std::unique_ptr<vertex_t[]> m_vertices; @@ -301,4 +310,4 @@ protected: DECLARE_DEVICE_TYPE(SONYPS2_GS, ps2_gs_device) -#endif // MAME_MACHINE_PS2GS_H
\ No newline at end of file +#endif // DEVICES_VIDEO_PS2GS_H
\ No newline at end of file diff --git a/src/emu/debug/debugbuf.cpp b/src/emu/debug/debugbuf.cpp index b61814ef4e5..909b8af36ad 100644 --- a/src/emu/debug/debugbuf.cpp +++ b/src/emu/debug/debugbuf.cpp @@ -719,7 +719,7 @@ void debug_disasm_buffer::debug_data_buffer::setup_methods() m_do_r64 = [this](offs_t pc) -> u64 { fill(pc, 2); const u32 *src = get_ptr<u32>(pc); - return src[0] | (u64(src[1]) << 32); + return u64(src[0]) | (u64(src[1]) << 32); }; } break; @@ -782,7 +782,7 @@ void debug_disasm_buffer::debug_data_buffer::setup_methods() m_do_r64 = [this](offs_t pc) -> u64 { fill(pc, 4); const u16 *src = get_ptr<u16>(pc); - return src[0] | (src[1] << 16) | (u64(src[2]) << 32) | (u64(src[3]) << 48); + return u64(src[0]) | (u64(src[1]) << 16) | (u64(src[2]) << 32) | (u64(src[3]) << 48); }; } break; @@ -815,7 +815,7 @@ void debug_disasm_buffer::debug_data_buffer::setup_methods() m_do_r64 = [this](offs_t pc) -> u64 { fill(pc, 4); const u16 *src = get_ptr<u16>(pc); - return (u64(src[0]) << 48) | (u64(src[1]) << 32) | u32(src[2] << 16) | src[3]; + return (u64(src[0]) << 48) | (u64(src[1]) << 32) | u64(src[2] << 16) | u64(src[3]); }; } break; @@ -872,7 +872,7 @@ void debug_disasm_buffer::debug_data_buffer::setup_methods() m_do_r64 = [this](offs_t pc) -> u64 { fill(pc, 8); const u8 *src = get_ptr<u8>(pc); - return src[0] | (src[1] << 8) | (src[2] << 16) | u32(src[3] << 24) | + return u64(src[0]) | (u64(src[1]) << 8) | (u64(src[2]) << 16) | (u64(src[3]) << 24) | (u64(src[4]) << 32) | (u64(src[5]) << 40) | (u64(src[6]) << 48) | (u64(src[7]) << 56); }; } @@ -920,8 +920,8 @@ void debug_disasm_buffer::debug_data_buffer::setup_methods() m_do_r64 = [this](offs_t pc) -> u64 { fill(pc, 8); const u8 *src = get_ptr<u8>(pc); - return (u64(src[0]) << 56) | (u64(src[1]) << 32) | (u64(src[2]) << 40) | (u64(src[3]) << 32) | - (src[4] << 24) | (src[5] << 16) | (src[6] << 8) | src[7]; + return (u64(src[0]) << 56) | (u64(src[1]) << 48) | (u64(src[2]) << 40) | (u64(src[3]) << 32) | + (u64(src[4]) << 24) | (u64(src[5]) << 16) | (u64(src[6]) << 8) | u64(src[7]); }; } break; @@ -945,7 +945,7 @@ void debug_disasm_buffer::debug_data_buffer::setup_methods() m_do_r64 = [this](offs_t pc) -> u64 { fill(pc, 64); const u16 *src = reinterpret_cast<u16 *>(&m_buffer[0]) + ((pc - m_lstart) >> 4); - return src[0] | (src[1] << 16) | (u64(src[2]) << 32) | (u64(src[3]) << 48); + return u64(src[0]) | (u64(src[1]) << 16) | (u64(src[2]) << 32) | (u64(src[3]) << 48); }; break; } diff --git a/src/mame/drivers/ps2sony.cpp b/src/mame/drivers/ps2sony.cpp index d6a11058e40..7f35628d188 100644 --- a/src/mame/drivers/ps2sony.cpp +++ b/src/mame/drivers/ps2sony.cpp @@ -158,11 +158,10 @@ iLinkSGUID=0x-------- #include "emu.h" -#include "audio/iopspu.h" - #include "cpu/mips/mips3.h" #include "cpu/mips/r3000.h" -#include "cpu/mips/sonyvu.h" +#include "cpu/mips/ps2vu.h" +#include "cpu/mips/ps2vif1.h" #include "machine/iopcdvd.h" #include "machine/iopdma.h" @@ -171,15 +170,16 @@ iLinkSGUID=0x-------- #include "machine/ioptimer.h" #include "machine/ps2dma.h" -#include "machine/ps2gif.h" #include "machine/ps2intc.h" #include "machine/ps2mc.h" #include "machine/ps2pad.h" #include "machine/ps2sif.h" #include "machine/ps2timer.h" -#include "machine/ps2vif1.h" + +#include "sound/iopspu.h" #include "video/ps2gs.h" +#include "video/ps2gif.h" #include "emupal.h" #include "screen.h" @@ -201,9 +201,7 @@ public: , m_iop_spu(*this, "iop_spu") , m_iop_cdvd(*this, "iop_cdvd") , m_iop_sio2(*this, "iop_sio2") - , m_gif(*this, "gif") , m_gs(*this, "gs") - , m_vif1(*this, "vif1") , m_vu0(*this, "vu0") , m_vu1(*this, "vu1") , m_pad(*this, "pad%u", 0U) @@ -266,9 +264,7 @@ protected: required_device<iop_spu_device> m_iop_spu; required_device<iop_cdvd_device> m_iop_cdvd; required_device<iop_sio2_device> m_iop_sio2; - required_device<ps2_gif_device> m_gif; required_device<ps2_gs_device> m_gs; - required_device<ps2_vif1_device> m_vif1; required_device<sonyvu0_device> m_vu0; required_device<sonyvu1_device> m_vu1; required_device_array<ps2_pad_device, 2> m_pad; @@ -580,7 +576,7 @@ TIMER_CALLBACK_MEMBER(ps2sony_state::vblank) WRITE8_MEMBER(ps2sony_state::debug_w) { - //printf("%c", (char)data); + printf("%c", (char)data); } WRITE64_MEMBER(ps2sony_state::ee_iop_ram_w) @@ -688,9 +684,9 @@ void ps2sony_state::mem_map(address_map &map) map(0x10001000, 0x100017ff).rw(m_timer[2], FUNC(ps2_timer_device::read), FUNC(ps2_timer_device::write)).umask64(0x00000000ffffffff); map(0x10001800, 0x10001fff).rw(m_timer[3], FUNC(ps2_timer_device::read), FUNC(ps2_timer_device::write)).umask64(0x00000000ffffffff); map(0x10002000, 0x10002fff).rw(FUNC(ps2sony_state::ipu_r), FUNC(ps2sony_state::ipu_w)).umask64(0x00000000ffffffff); - map(0x10003000, 0x100030af).rw(m_gif, FUNC(ps2_gif_device::read), FUNC(ps2_gif_device::write)); + map(0x10003000, 0x100030af).rw(m_gs, FUNC(ps2_gs_device::gif_r), FUNC(ps2_gs_device::gif_w)); map(0x10004000, 0x1000400f).mirror(0xff0).rw(FUNC(ps2sony_state::vif0_fifo_r), FUNC(ps2sony_state::vif0_fifo_w)); - map(0x10005000, 0x1000500f).mirror(0xff0).rw(m_vif1, FUNC(ps2_vif1_device::mmio_r), FUNC(ps2_vif1_device::mmio_w)); + map(0x10005000, 0x1000500f).mirror(0xff0).rw(m_vu1, FUNC(sonyvu1_device::vif_r), FUNC(sonyvu1_device::vif_w)); map(0x10006000, 0x1000600f).mirror(0xff0).rw(FUNC(ps2sony_state::gif_fifo_r), FUNC(ps2sony_state::gif_fifo_w)); map(0x10007000, 0x1000701f).mirror(0xfe0).rw(FUNC(ps2sony_state::ipu_fifo_r), FUNC(ps2sony_state::ipu_fifo_w)); map(0x10008000, 0x1000dfff).rw(m_dmac, FUNC(ps2_dmac_device::channel_r), FUNC(ps2_dmac_device::channel_w)).umask64(0x00000000ffffffff);; @@ -745,10 +741,8 @@ MACHINE_CONFIG_START(ps2sony_state::ps2sony) MCFG_MIPS3_DCACHE_SIZE(16384) MCFG_DEVICE_PROGRAM_MAP(mem_map) - MCFG_DEVICE_ADD(m_vu0, SONYVU0, 294'912'000, m_vu1) - MCFG_DEVICE_ADD(m_vu1, SONYVU1, 294'912'000) - - MCFG_DEVICE_ADD(m_vif1, SONYPS2_VIF1, 294912000/2, m_gif, m_vu1) + MCFG_DEVICE_ADD(m_vu0, SONYPS2_VU0, 294'912'000, m_vu1) + MCFG_DEVICE_ADD(m_vu1, SONYPS2_VU1, 294'912'000, m_gs) MCFG_DEVICE_ADD(m_timer[0], SONYPS2_TIMER, 294912000/2, true) MCFG_DEVICE_ADD(m_timer[1], SONYPS2_TIMER, 294912000/2, true) @@ -757,9 +751,8 @@ MACHINE_CONFIG_START(ps2sony_state::ps2sony) MCFG_DEVICE_ADD(m_intc, SONYPS2_INTC, m_maincpu) MCFG_DEVICE_ADD(m_gs, SONYPS2_GS, 294912000/2, m_intc) - MCFG_DEVICE_ADD(m_dmac, SONYPS2_DMAC, 294912000/2, m_maincpu, m_ram, m_sif, m_gif, m_vif1) + MCFG_DEVICE_ADD(m_dmac, SONYPS2_DMAC, 294912000/2, m_maincpu, m_ram, m_sif, m_gs, m_vu1) MCFG_DEVICE_ADD(m_sif, SONYPS2_SIF, m_intc) - MCFG_DEVICE_ADD(m_gif, SONYPS2_GIF, m_gs) MCFG_DEVICE_ADD(m_iop, SONYPS2_IOP, XTAL(67'737'600)/2) MCFG_DEVICE_PROGRAM_MAP(iop_map) |