Emulator: Do not store overflown bits
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "ruc/format/print.h"
|
#include "ruc/format/print.h"
|
||||||
|
#include "ruc/meta/assert.h"
|
||||||
|
|
||||||
CPU::CPU(uint32_t frequency)
|
CPU::CPU(uint32_t frequency)
|
||||||
: ProcessingUnit(frequency)
|
: ProcessingUnit(frequency)
|
||||||
@@ -60,8 +61,12 @@ void CPU::add(uint8_t opcode, uint8_t immediate)
|
|||||||
|
|
||||||
// A = A + r
|
// A = A + r
|
||||||
m_a += immediate;
|
m_a += immediate;
|
||||||
|
|
||||||
|
// Drop overflown bits, the 'A' register is 8-bit
|
||||||
|
m_a &= 0xff;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
VERIFY_NOT_REACHED();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user