- [FIX] RLCA(), RLA(), RRCA() i RRA() calculaven mal el carry i m'estaven tornant loco
This commit is contained in:
14
z80.cpp
14
z80.cpp
@@ -166,6 +166,8 @@ namespace z80
|
||||
t+=3;
|
||||
if (addr>=0x4000) memory[addr] = value;
|
||||
if (z80debug::isbreak(addr, 4)) z80debug::stop();
|
||||
//if (z80debug::debugging())
|
||||
z80debug::setmemmodified(addr);
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -427,30 +429,38 @@ namespace z80
|
||||
|
||||
void RLCA()
|
||||
{
|
||||
const bool should_carry = rA & 0x80;
|
||||
rA = (rA>>7) | (rA<<1);
|
||||
KEEP_FLAGS(fS | fZ | fP);
|
||||
SET_FLAGS(rA & (fX | fY | fC));
|
||||
if (should_carry) SET_FLAGS(fC);
|
||||
}
|
||||
|
||||
void RRCA()
|
||||
{
|
||||
const bool should_carry = rA & 0x01;
|
||||
rA = (rA<<7) | (rA>>1);
|
||||
KEEP_FLAGS(fS | fZ | fP);
|
||||
SET_FLAGS(rA & (fX | fY | fC));
|
||||
if (should_carry) SET_FLAGS(fC);
|
||||
}
|
||||
|
||||
void RLA()
|
||||
{
|
||||
const bool should_carry = rA & 0x80;
|
||||
rA = (rA<<1) | (rF&fC);
|
||||
KEEP_FLAGS(fS | fZ | fP);
|
||||
SET_FLAGS(rA & (fX | fY | fC));
|
||||
SET_FLAGS(rA & (fX | fY));
|
||||
if (should_carry) SET_FLAGS(fC);
|
||||
}
|
||||
|
||||
void RRA()
|
||||
{
|
||||
const bool should_carry = rA & 0x01;
|
||||
rA = ((rF&fC)<<7) | (rA>>1);
|
||||
KEEP_FLAGS(fS | fZ | fP);
|
||||
SET_FLAGS(rA & (fX | fY | fC));
|
||||
SET_FLAGS(rA & (fX | fY));
|
||||
if (should_carry) SET_FLAGS(fC);
|
||||
}
|
||||
|
||||
void RRD()
|
||||
|
||||
Reference in New Issue
Block a user