summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/h83002
diff options
context:
space:
mode:
author Luca Elia <lucaelia@mamedev.org>2009-01-28 19:44:29 +0000
committer Luca Elia <lucaelia@mamedev.org>2009-01-28 19:44:29 +0000
commitecd97d30ce9d9cde2cd2fbb9ae85c6c1f343418c (patch)
treecfdc5441949a253a48db5cca9f8887d0ef920d42 /src/emu/cpu/h83002
parent262c1116b95fb8039c4afd83ab32db156d8e1858 (diff)
Implemented a few more H8/3xx instructions, and added funcube to seta2.c [Luca Elia]
New games added or promoted from NOT_WORKING status --------------------------------------------------- Funcube 2 [Luca Elia] Funcube 4 [Luca Elia]
Diffstat (limited to 'src/emu/cpu/h83002')
-rw-r--r--src/emu/cpu/h83002/h8_16.c3
-rw-r--r--src/emu/cpu/h83002/h8ops.h98
2 files changed, 83 insertions, 18 deletions
diff --git a/src/emu/cpu/h83002/h8_16.c b/src/emu/cpu/h83002/h8_16.c
index db5bba39367..f41d6678f4b 100644
--- a/src/emu/cpu/h83002/h8_16.c
+++ b/src/emu/cpu/h83002/h8_16.c
@@ -9,8 +9,9 @@
LE 20070903 Added divxu.b shal.l extu.w dec.l #Imm,Rd subx.b
LE 20080202 Separated 3002/3044/3007, Added or.l shal.l rotl.l not.l neg.l exts.w
sub/or/xor.l #Imm:32,ERd bset/bnot/bclr.b Rn,@ERd bst/bist.b #Imm:3,@ERd bnot.b #Imm:3,@ERd
+ LE 20090128 Added mov.l ers,@aa:16; bild #xx:3,rd; eepmov.b; bnot #xx:3,@aa:8
-****************************************************************************/
+***************************************************************************/
#include "debugger.h"
#include "h8.h"
diff --git a/src/emu/cpu/h83002/h8ops.h b/src/emu/cpu/h83002/h8ops.h
index 738f6215ee5..92837d7bde7 100644
--- a/src/emu/cpu/h83002/h8ops.h
+++ b/src/emu/cpu/h83002/h8ops.h
@@ -98,6 +98,7 @@ static UINT8 h8_bset8(h83xx_state *h8, UINT8 src, UINT8 dst);
static UINT8 h8_bclr8(h83xx_state *h8, UINT8 src, UINT8 dst);
static void h8_btst8(h83xx_state *h8, UINT8 src, UINT8 dst);
static void h8_bld8(h83xx_state *h8, UINT8 src, UINT8 dst); // loads to carry
+static void h8_bild8(h83xx_state *h8, UINT8 src, UINT8 dst); // inverts and loads to carry
static void h8_bor8(h83xx_state *h8, UINT8 src, UINT8 dst); // result in carry
//static void h8_bxor8(h83xx_state *h8, UINT8 src, UINT8 dst);
@@ -324,6 +325,18 @@ static void h8_group0(h83xx_state *h8, UINT16 opcode)
H8_IFETCH_TIMING(4);
H8_WORD_TIMING(2, address24);
break;
+ case 0x8:
+ // mov.l erx, @aa:16
+ address24=h8_mem_read16(h8, h8->pc);
+ h8->pc += 2;
+ if (address24 & 0x8000)
+ address24 |= 0xff0000;
+ udata32=h8_getreg32(h8, ext16 & 0x7);
+ h8_mov32(h8, udata32); // flags only
+ h8_mem_write32(h8, address24, udata32);
+ H8_IFETCH_TIMING(3);
+ H8_WORD_TIMING(2, address24);
+ break;
default:
h8->h8err = 1;
break;
@@ -1698,6 +1711,7 @@ static void h8_group7(h83xx_state *h8, UINT16 opcode)
{
switch((opcode>>8)&7)
{
+ case 7: h8_bild8(h8, bitnr, udata8); H8_IFETCH_TIMING(1); break;
default:
logerror("H8/3xx: Unk. group 7 0-7-1 def %x\n", opcode);
h8->h8err = 1;
@@ -1821,28 +1835,67 @@ static void h8_group7(h83xx_state *h8, UINT16 opcode)
break;
// eepmov
case 0xb:
- if ((opcode & 0xff) == 0xd4)
+ switch (opcode & 0xff)
{
- UINT16 cnt = h8_getreg16(h8, 4);
+ case 0xd4: // eepmov.w
+ {
+ ext16 = h8_mem_read16(h8, h8->pc);
+ h8->pc += 2;
+ if (ext16 != 0x598f)
+ {
+ logerror("H8/3xx: Unk. eepmov form\n");
+ h8->h8err = 1;
+ }
+ else
+ {
+ UINT16 cnt = h8_getreg16(h8, 4);
- H8_IFETCH_TIMING(1);
- H8_BYTE_TIMING((2*cnt)+2, h8->regs[5]);
+ H8_IFETCH_TIMING(2);
+ H8_BYTE_TIMING((2*cnt)+2, h8->regs[5]);
+
+ while (cnt > 0)
+ {
+ h8_mem_write8(h8->regs[6], h8_mem_read8(h8->regs[5]));
+ h8->regs[5]++;
+ h8->regs[6]++;
+ cnt--;
+ }
+ h8_setreg16(h8, 4, 0);
+ }
+ }
+ break;
- // eepmov.w
- while (cnt > 0)
+ case 0x5c: // eepmov.b
{
- h8_mem_write8(h8->regs[6], h8_mem_read8(h8->regs[5]));
- h8->regs[5]++;
- h8->regs[6]++;
- cnt--;
+ ext16 = h8_mem_read16(h8, h8->pc);
+ h8->pc += 2;
+ if (ext16 != 0x598f)
+ {
+ logerror("H8/3xx: Unk. eepmov form\n");
+ h8->h8err = 1;
+ }
+ else
+ {
+ UINT8 cnt = h8_getreg8(h8, 8+4);
+
+ H8_IFETCH_TIMING(2);
+ H8_BYTE_TIMING((2*cnt)+2, h8->regs[5]);
+
+ while (cnt > 0)
+ {
+ h8_mem_write8(h8->regs[6], h8_mem_read8(h8->regs[5]));
+ h8->regs[5]++;
+ h8->regs[6]++;
+ cnt--;
+ }
+ h8_setreg8(h8, 8+4, 0);
+ }
}
- h8_setreg16(h8, 4, 0);
- h8->pc += 2;
- }
- else
- {
- logerror("H8/3xx: Unk. eepmov form\n");
- h8->h8err = 1;
+ break;
+
+ default:
+ logerror("H8/3xx: Unk. eepmov form\n");
+ h8->h8err = 1;
}
break;
// bxx.b #xx:3, @rd
@@ -1948,6 +2001,11 @@ static void h8_group7(h83xx_state *h8, UINT16 opcode)
if(ext16&0x80) h8->h8err = 1;
udata8 = h8_bset8(h8, bitnr, udata8); h8_mem_write8(address24, udata8); H8_IFETCH_TIMING(2); H8_BYTE_TIMING(2, address24);
break;
+ case 0x71:
+ bitnr = (ext16>>4)&7;
+ if(ext16&0x80) h8->h8err = 1;
+ udata8 = h8_bnot8(h8, bitnr, udata8); h8_mem_write8(address24, udata8); H8_IFETCH_TIMING(2); H8_BYTE_TIMING(2, address24);
+ break;
case 0x32:
case 0x62:
bitnr = h8_getreg8(h8, (ext16>>4)&0xf)&7;
@@ -2486,6 +2544,12 @@ static void h8_bld8(h83xx_state *h8, UINT8 bit, UINT8 dst)
h8->h8cflag = (dst >> bit) & 1;
}
+static void h8_bild8(h83xx_state *h8, UINT8 bit, UINT8 dst)
+{
+ // load inverted bit to carry
+ h8->h8cflag = ((~dst) >> bit) & 1;
+}
+
static UINT8 h8_bnot8(h83xx_state *h8, UINT8 src, UINT8 dst)
{
// invert single bit, no effect on C flag