summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Vas Crabb <cuavas@users.noreply.github.com>2016-06-26 23:51:31 +1000
committer GitHub <noreply@github.com>2016-06-26 23:51:31 +1000
commita467a8c05710c1254726cd32776e514f692fa529 (patch)
treee4eb2d94929781ef0b4fb2b320a8dca5a9f92cec
parent847ecb65a6ade8cc453c8027d646d281c2599521 (diff)
parentdb2e1349946b48e4fd3b11270a4a073f66ae767e (diff)
Merge pull request #1000 from MooglyGuy/master
Fix LDUH, LDSH, LDUHA, and LDSHA opcodes in the SPARC core [Ryan Holtz]
-rw-r--r--src/devices/cpu/sparc/mb86901.cpp9
-rw-r--r--src/devices/cpu/sparc/sparc.h1
2 files changed, 8 insertions, 2 deletions
diff --git a/src/devices/cpu/sparc/mb86901.cpp b/src/devices/cpu/sparc/mb86901.cpp
index 2c32279b267..1e419ab0e44 100644
--- a/src/devices/cpu/sparc/mb86901.cpp
+++ b/src/devices/cpu/sparc/mb86901.cpp
@@ -163,6 +163,7 @@ void mb86901_device::device_start()
state_add(SPARC_WIM, "WIM", m_wim).formatstr("%08X");
state_add(SPARC_TBR, "TBR", m_tbr).formatstr("%08X");
state_add(SPARC_Y, "Y", m_y).formatstr("%08X");
+ state_add(SPARC_ANNUL, "ANNUL", m_annul).formatstr("%d");
state_add(SPARC_ICC, "icc", m_icc).formatstr("%4s");
state_add(SPARC_CWP, "CWP", m_cwp).formatstr("%2d");
char regname[3] = "g0";
@@ -365,7 +366,7 @@ UINT32 mb86901_device::read_sized_word(UINT8 asi, UINT32 address, int size)
}
else if (size == 2)
{
- return m_program->read_word(address) << ((1 - (address & 1)) * 16);
+ return m_program->read_word(address) << ((2 - (address & 2)) * 8);
}
else
{
@@ -392,7 +393,7 @@ void mb86901_device::write_sized_word(UINT8 asi, UINT32 address, UINT32 data, in
}
else if (size == 2)
{
- m_program->write_word(address, data >> ((1 - (address & 1)) * 16));
+ m_program->write_word(address, data >> ((2 - (address & 2)) * 8));
}
else
{
@@ -1953,9 +1954,13 @@ void mb86901_device::execute_load(UINT32 op)
else if ((address & 3) == 2) halfword = data & 0xffff;
if (LDSH || LDSHA)
+ {
word0 = (((INT32)halfword) << 16) >> 16;
+ }
else
+ {
word0 = halfword;
+ }
}
else
{
diff --git a/src/devices/cpu/sparc/sparc.h b/src/devices/cpu/sparc/sparc.h
index b9fd75dbee5..aa424114f3d 100644
--- a/src/devices/cpu/sparc/sparc.h
+++ b/src/devices/cpu/sparc/sparc.h
@@ -248,6 +248,7 @@ enum
SPARC_TBR,
SPARC_Y,
+ SPARC_ANNUL,
SPARC_ICC,
SPARC_CWP,