- [FIX] Fixed carry flag on instructions RL, RR, RLA i RRA

- [FIX] Fixed flag visualization on debugger
- [NEW] Comencem a treballar en el mòdul gbscreen
This commit is contained in:
2025-01-15 17:40:44 +01:00
parent ab77116dca
commit 8b95945798
4 changed files with 407 additions and 12 deletions

View File

@@ -334,7 +334,7 @@ namespace sm83
void RLA()
{
const bool should_carry = rA & 0x80;
rA = (rA<<1) | (rF&fC);
rA = (rA<<1) | ((rF&fC)>>4);
rF = 0;
if (should_carry) SET_FLAGS(fC);
}
@@ -342,7 +342,7 @@ namespace sm83
void RRA()
{
const bool should_carry = rA & 0x01;
rA = ((rF&fC)<<7) | (rA>>1);
rA = ((rF&fC)<<3) | (rA>>1);
rF = 0;
if (should_carry) SET_FLAGS(fC);
}
@@ -577,7 +577,7 @@ namespace sm83
static inline const uint8_t RL(const uint8_t v)
{
const uint8_t res = (v<<1) | (rF&fC);
const uint8_t res = (v<<1) | ((rF&fC)>>4);
rF=0;
if (res==0) SET_FLAGS(fZ);
if (v&0x80) SET_FLAGS(fC);
@@ -586,7 +586,7 @@ namespace sm83
static inline const uint8_t RR(const uint8_t v)
{
const uint8_t res = ((rF&fC)<<7) | (v>>1);
const uint8_t res = ((rF&fC)<<3) | (v>>1);
rF=0;
if (res==0) SET_FLAGS(fZ);
if (v&1) SET_FLAGS(fC);