summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Angelo Salese <angelosa@users.noreply.github.com>2014-04-16 01:03:05 +0000
committer Angelo Salese <angelosa@users.noreply.github.com>2014-04-16 01:03:05 +0000
commitd7c246e45da23362b429e89b0b3f9b27c74ed1f8 (patch)
tree8bd77a3a12e288e74bb18122b237fecfc080e2e9 /src
parentcd65549f38dc98857cf33e2ab48bdf61b2d820c4 (diff)
Added ALU opcode 0x89 (FAVG), Last Bronx shows background scene in attract then asserts.
Diffstat (limited to 'src')
-rw-r--r--src/emu/cpu/sharc/compute.inc23
-rw-r--r--src/emu/cpu/sharc/sharc.h1
-rw-r--r--src/emu/cpu/sharc/sharcops.inc1
-rw-r--r--src/mame/drivers/model2.c2
-rw-r--r--src/mame/video/model2.c2
5 files changed, 27 insertions, 2 deletions
diff --git a/src/emu/cpu/sharc/compute.inc b/src/emu/cpu/sharc/compute.inc
index e366e7588f8..30f0a3fbba4 100644
--- a/src/emu/cpu/sharc/compute.inc
+++ b/src/emu/cpu/sharc/compute.inc
@@ -572,6 +572,29 @@ void adsp21062_device::compute_fadd(int rn, int rx, int ry)
m_astat |= AF;
}
+void adsp21062_device::compute_favg(int rn, int rx, int ry)
+{
+ SHARC_REG r;
+ r.f = (FREG(rx) + FREG(ry)) / (float) 2.0f;
+
+ CLEAR_ALU_FLAGS();
+ // AN
+ m_astat |= (r.f < 0.0f) ? AN : 0;
+ // AZ
+ m_astat |= (IS_FLOAT_DENORMAL(r.r) || IS_FLOAT_ZERO(r.r)) ? AZ : 0;
+ // AUS
+ m_stky |= (IS_FLOAT_DENORMAL(r.r)) ? AUS : 0;
+ // AI
+ m_astat |= (IS_FLOAT_NAN(REG(rx)) || IS_FLOAT_NAN(REG(ry))) ? AI : 0;
+ /* TODO: AV flag */
+
+ // AIS
+ if (m_astat & AI) m_stky |= AIS;
+
+ FREG(rn) = r.f;
+ m_astat |= AF;
+}
+
/* Fn = Fx - Fy */
void adsp21062_device::compute_fsub(int rn, int rx, int ry)
{
diff --git a/src/emu/cpu/sharc/sharc.h b/src/emu/cpu/sharc/sharc.h
index 99f36a06ae1..f5ab26bce85 100644
--- a/src/emu/cpu/sharc/sharc.h
+++ b/src/emu/cpu/sharc/sharc.h
@@ -315,6 +315,7 @@ private:
inline void compute_scalb(int rn, int rx, int ry);
inline void compute_fadd(int rn, int rx, int ry);
inline void compute_fsub(int rn, int rx, int ry);
+ inline void compute_favg(int rn, int rx, int ry);
inline void compute_fneg(int rn, int rx);
inline void compute_fcomp(int rx, int ry);
inline void compute_fabs_plus(int rn, int rx, int ry);
diff --git a/src/emu/cpu/sharc/sharcops.inc b/src/emu/cpu/sharc/sharcops.inc
index b11b93f1e22..3980fcc00f9 100644
--- a/src/emu/cpu/sharc/sharcops.inc
+++ b/src/emu/cpu/sharc/sharcops.inc
@@ -823,6 +823,7 @@ void adsp21062_device::COMPUTE(UINT32 opcode)
case 0x62: compute_max(rn, rx, ry); break;
case 0x81: compute_fadd(rn, rx, ry); break;
case 0x82: compute_fsub(rn, rx, ry); break;
+ case 0x89: compute_favg(rn, rx, ry); break;
case 0x8a: compute_fcomp(rx, ry); break;
case 0x91: compute_fabs_plus(rn, rx, ry); break;
case 0xa1: compute_fpass(rn, rx); break;
diff --git a/src/mame/drivers/model2.c b/src/mame/drivers/model2.c
index c10baf62469..d9d5471e975 100644
--- a/src/mame/drivers/model2.c
+++ b/src/mame/drivers/model2.c
@@ -14,7 +14,7 @@
- dynamcop: stalls at stage select screen;
- fvipers: enables timers, but then irq register is empty, hence it crashes with an "interrupt halt" at POST (regression);
- lastbrnx: uses external DMA port 0 for uploading SHARC program, hook-up might not be 100% right;
- - lastbrnx: uses a shitload of unsupported SHARC opcodes (compute_fmul_avg, shift operation 0x11, ALU operation 0x89);
+ - lastbrnx: uses a shitload of unsupported SHARC opcodes (compute_fmul_avg, shift operation 0x11, ALU operation 0x89 (compute_favg));
- manxtt: missing 3d;
- motoraid: stalls after course select;
- pltkidsa: after few secs of gameplay, background 3d disappears and everything reports a collision against the player;
diff --git a/src/mame/video/model2.c b/src/mame/video/model2.c
index 06d81655ceb..99dd8f22056 100644
--- a/src/mame/video/model2.c
+++ b/src/mame/video/model2.c
@@ -2717,7 +2717,7 @@ VIDEO_START_MEMBER(model2_state,model2)
UINT32 model2_state::screen_update_model2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- logerror("--- frame ---\n");
+ //logerror("--- frame ---\n");
bitmap.fill(m_palette->pen(0), cliprect);
m_sys24_bitmap.fill(0, cliprect);