summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar angelosa <lordkale4@gmail.com>2019-09-02 07:35:14 +0200
committerGravatarGravatar angelosa <lordkale4@gmail.com>2019-09-02 07:35:14 +0200
commit4d79bcdb100772c4ebe143602af0f983353c64ed (patch) (github)
treefd3f62d5a3b263d846c31b73da9d7eb28ece50cd
parent11f972772666d2de290d6e65fbae31044129031e (diff)
downloadmame-vrender0_3.tar.bz2
mame-vrender0_3.zip
More accurate vrender0 pipeline inner working, fixes donghaer split screen at the expense of disabling IDLE_SKIP_SPEEDUP, to be worked onvrender0_3
-rw-r--r--src/devices/machine/vrender0.cpp7
-rw-r--r--src/devices/machine/vrender0.h2
-rw-r--r--src/mame/drivers/psattack.cpp1
-rw-r--r--src/mame/video/vrender0.cpp73
-rw-r--r--src/mame/video/vrender0.h4
5 files changed, 66 insertions, 21 deletions
diff --git a/src/devices/machine/vrender0.cpp b/src/devices/machine/vrender0.cpp
index a1fdeedf536..3f2c6f2f5d5 100644
--- a/src/devices/machine/vrender0.cpp
+++ b/src/devices/machine/vrender0.cpp
@@ -120,7 +120,8 @@ void vrender0soc_device::device_add_mconfig(machine_config &config)
m_screen->screen_vblank().set(FUNC(vrender0soc_device::screen_vblank));
m_screen->set_palette(m_palette);
- VIDEO_VRENDER0(config, m_vr0vid, 14318180);
+ // runs at double speed wrt of the CPU clock
+ VIDEO_VRENDER0(config, m_vr0vid, DERIVED_CLOCK(2, 1));
#ifdef IDLE_LOOP_SPEEDUP
m_vr0vid->idleskip_cb().set(FUNC(vrender0soc_device::idle_skip_speedup_w));
#endif
@@ -708,9 +709,11 @@ WRITE_LINE_MEMBER(vrender0soc_device::screen_vblank)
if (state)
{
if (crt_active_vblank_irq() == true)
+ {
IntReq(24); //VRender0 VBlank
- m_vr0vid->execute_flipping();
+ m_vr0vid->execute_flipping();
+ }
}
}
diff --git a/src/devices/machine/vrender0.h b/src/devices/machine/vrender0.h
index 5d2843d74f8..491a3bd840a 100644
--- a/src/devices/machine/vrender0.h
+++ b/src/devices/machine/vrender0.h
@@ -23,7 +23,7 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
-#define IDLE_LOOP_SPEEDUP
+//#define IDLE_LOOP_SPEEDUP
diff --git a/src/mame/drivers/psattack.cpp b/src/mame/drivers/psattack.cpp
index 965592abd9d..5d7656fe778 100644
--- a/src/mame/drivers/psattack.cpp
+++ b/src/mame/drivers/psattack.cpp
@@ -189,6 +189,7 @@ WRITE8_MEMBER( psattack_state::cfcard_regs_w )
READ16_MEMBER( psattack_state::cfcard_data_r )
{
+ // TODO: may not be it (pushes data into stack then never read it other than a comparison check from +0xfc)
return m_ata->read_cs0(0, 0x0000ffff);
}
diff --git a/src/mame/video/vrender0.cpp b/src/mame/video/vrender0.cpp
index b505e69a7e1..d985bb94789 100644
--- a/src/mame/video/vrender0.cpp
+++ b/src/mame/video/vrender0.cpp
@@ -160,6 +160,8 @@ void vr0video_device::device_start()
save_item(NAME(m_render_reset));
save_item(NAME(m_render_start));
save_item(NAME(m_dither_mode));
+
+ m_pipeline_timer = timer_alloc(0);
}
void vr0video_device::set_areas(uint16_t *textureram, uint16_t *frameram)
@@ -179,6 +181,8 @@ void vr0video_device::device_reset()
m_LastPalUpdate = 0xffffffff;
m_DisplayDest = m_DrawDest = m_frameram;
+ // 1100 objects per second at ~80 MHz
+ m_pipeline_timer->adjust(attotime::from_hz(this->clock()/1100), 0, attotime::from_hz(this->clock()/1100));
}
/*****************************************************************************
@@ -521,7 +525,7 @@ int vr0video_device::vrender0_ProcessPacket(uint32_t PacketPtr)
if (Packet0 & 0x81) //Sync or ASync flip
{
m_LastPalUpdate = 0xffffffff; //Force update palette next frame
- return 1;
+ return Packet0 & 0x81;
}
if (Packet0 & 0x200)
@@ -667,6 +671,51 @@ int vr0video_device::vrender0_ProcessPacket(uint32_t PacketPtr)
return 0;
}
+#include "debugger.h"
+
+void vr0video_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ if (id != 0)
+ return;
+
+ if (m_render_start == false)
+ return;
+
+ // bail out if we encountered a flip sync command
+ // pipeline waits until it receives a vblank signal
+ if (m_flip_sync == true)
+ return;
+
+ if ((m_queue_rear & 0x7ff) == (m_queue_front & 0x7ff))
+ return;
+
+ int DoFlip = vrender0_ProcessPacket(m_queue_rear * 32);
+ m_queue_rear ++;
+ m_queue_rear &= 0x7ff;
+ if (DoFlip & 0x01)
+ m_flip_sync = true;
+
+ if (DoFlip & 0x80)
+ {
+ uint32_t B0 = 0x000000;
+ uint32_t B1 = (m_bank1_select == true ? 0x400000 : 0x100000)/2;
+ uint16_t *Front, *Back;
+
+ if (m_display_bank & 1)
+ {
+ Front = (m_frameram + B1);
+ Back = (m_frameram + B0);
+ }
+ else
+ {
+ Front = (m_frameram + B0);
+ Back = (m_frameram + B1);
+ }
+
+ m_DrawDest = ((m_draw_select == true) ? Back : Front);
+ }
+}
+
void vr0video_device::execute_flipping()
{
if (m_render_start == false)
@@ -675,7 +724,6 @@ void vr0video_device::execute_flipping()
uint32_t B0 = 0x000000;
uint32_t B1 = (m_bank1_select == true ? 0x400000 : 0x100000)/2;
uint16_t *Front, *Back;
- int DoFlip = 0;
if (m_display_bank & 1)
{
@@ -691,29 +739,18 @@ void vr0video_device::execute_flipping()
m_DrawDest = ((m_draw_select == true) ? Front : Back);
m_DisplayDest = Front;
- while ((m_queue_rear & 0x7ff) != (m_queue_front & 0x7ff))
+ m_flip_sync = false;
+ if (m_flip_count)
{
- DoFlip = vrender0_ProcessPacket(m_queue_rear * 32);
- m_queue_rear ++;
- m_queue_rear &= 0x7ff;
- if (DoFlip)
- break;
- }
-
- if (DoFlip)
- {
- if (m_flip_count)
- {
- m_flip_count--;
- m_display_bank ^= 1;
- }
+ m_flip_count--;
+ m_display_bank ^= 1;
}
}
uint32_t vr0video_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
const uint32_t width = cliprect.width();
-
+
uint32_t const dx = cliprect.left();
for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
std::copy_n(&m_DisplayDest[(y * 1024) + dx], width, &bitmap.pix16(y, dx));
diff --git a/src/mame/video/vrender0.h b/src/mame/video/vrender0.h
index b68b0a47f0e..c56b4edec6e 100644
--- a/src/mame/video/vrender0.h
+++ b/src/mame/video/vrender0.h
@@ -29,6 +29,7 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
+ void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
int vrender0_ProcessPacket(uint32_t PacketPtr);
@@ -93,6 +94,9 @@ private:
uint16_t *m_DrawDest; //!< frameram pointer to draw buffer area
uint16_t *m_DisplayDest; //!< frameram pointer to display buffer area
+ bool m_flip_sync;
+
+ emu_timer *m_pipeline_timer;
};
DECLARE_DEVICE_TYPE(VIDEO_VRENDER0, vr0video_device)