summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/minx/minxfunc.h
diff options
context:
space:
mode:
author Wilbert Pol <wilbert@jdg.info>2008-06-04 21:32:22 +0000
committer Wilbert Pol <wilbert@jdg.info>2008-06-04 21:32:22 +0000
commit752af71d6ea8405374a7b946a744e8784d7cc37e (patch)
tree291838a7bf39ae6dabf75dcdf019f489e9a9098d /src/emu/cpu/minx/minxfunc.h
parent113d0190626ae5d605836a6a6036df29f8d1c995 (diff)
Fixed flag results for INC, DEC, AND, OR, and XOR instructions in the Nintendo Minx cpu core.
Diffstat (limited to 'src/emu/cpu/minx/minxfunc.h')
-rw-r--r--src/emu/cpu/minx/minxfunc.h40
1 files changed, 36 insertions, 4 deletions
diff --git a/src/emu/cpu/minx/minxfunc.h b/src/emu/cpu/minx/minxfunc.h
index ee170722ef0..ca97450078d 100644
--- a/src/emu/cpu/minx/minxfunc.h
+++ b/src/emu/cpu/minx/minxfunc.h
@@ -53,13 +53,23 @@ INLINE UINT16 ADDC16( UINT16 arg1, UINT16 arg2 )
INLINE UINT8 INC8( UINT8 arg )
{
- return ADD8( arg, 1 );
+ UINT8 old_F = regs.F;
+ UINT8 res = ADD8( arg, 1 );
+ regs.F = ( old_F & ~ ( FLAG_Z ) )
+ | ( ( res ) ? 0 : FLAG_Z )
+ ;
+ return res;
}
INLINE UINT16 INC16( UINT16 arg )
{
- return ADD16( arg, 1 );
+ UINT8 old_F = regs.F;
+ UINT16 res = ADD16( arg, 1 );
+ regs.F = ( old_F & ~ ( FLAG_Z ) )
+ | ( ( res ) ? 0 : FLAG_Z )
+ ;
+ return res;
}
@@ -117,19 +127,33 @@ INLINE UINT16 SUBC16( UINT16 arg1, UINT16 arg2 )
INLINE UINT8 DEC8( UINT8 arg )
{
- return SUB8( arg, 1 );
+ UINT8 old_F = regs.F;
+ UINT8 res = SUB8( arg, 1 );
+ regs.F = ( old_F & ~ ( FLAG_Z ) )
+ | ( ( res ) ? 0 : FLAG_Z )
+ ;
+ return res;
}
INLINE UINT16 DEC16( UINT16 arg )
{
- return SUB16( arg, 1 );
+ UINT8 old_F = regs.F;
+ UINT16 res = SUB16( arg, 1 );
+ regs.F = ( old_F & ~ ( FLAG_Z ) )
+ | ( ( res ) ? 0 : FLAG_Z )
+ ;
+ return res;
}
INLINE UINT8 AND8( UINT8 arg1, UINT8 arg2 )
{
UINT8 res = arg1 & arg2;
+ regs.F = ( regs.F & ~ ( FLAG_S | FLAG_Z ) )
+ | ( ( res & 0x80 ) ? FLAG_S : 0 )
+ | ( ( res ) ? 0 : FLAG_Z )
+ ;
return res;
}
@@ -137,6 +161,10 @@ INLINE UINT8 AND8( UINT8 arg1, UINT8 arg2 )
INLINE UINT8 OR8( UINT8 arg1, UINT8 arg2 )
{
UINT8 res = arg1 | arg2;
+ regs.F = ( regs.F & ~ ( FLAG_S | FLAG_Z ) )
+ | ( ( res & 0x80 ) ? FLAG_S : 0 )
+ | ( ( res ) ? 0 : FLAG_Z )
+ ;
return res;
}
@@ -144,6 +172,10 @@ INLINE UINT8 OR8( UINT8 arg1, UINT8 arg2 )
INLINE UINT8 XOR8( UINT8 arg1, UINT8 arg2 )
{
UINT8 res = arg1 ^ arg2;
+ regs.F = ( regs.F & ~ ( FLAG_S | FLAG_Z ) )
+ | ( ( res & 0x80 ) ? FLAG_S : 0 )
+ | ( ( res ) ? 0 : FLAG_Z )
+ ;
return res;
}