mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-23 00:29:47 +00:00
Remove unneeded 16-bit operations.
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
569e1925ce
commit
261433bd6e
@ -182,8 +182,6 @@ namespace EightBit {
|
|||||||
bool jumpConditionalFlag(uint8_t& f, int flag);
|
bool jumpConditionalFlag(uint8_t& f, int flag);
|
||||||
bool callConditionalFlag(uint8_t& f, int flag);
|
bool callConditionalFlag(uint8_t& f, int flag);
|
||||||
|
|
||||||
void sbc(uint8_t& f, register16_t& operand, register16_t value);
|
|
||||||
void adc(uint8_t& f, register16_t& operand, register16_t value);
|
|
||||||
void add(uint8_t& f, register16_t& operand, register16_t value);
|
void add(uint8_t& f, register16_t& operand, register16_t value);
|
||||||
|
|
||||||
static void add(uint8_t& f, uint8_t& operand, uint8_t value, int carry = 0);
|
static void add(uint8_t& f, uint8_t& operand, uint8_t value, int carry = 0);
|
||||||
|
@ -132,34 +132,6 @@ bool EightBit::LR35902::callConditionalFlag(uint8_t& f, int flag) {
|
|||||||
|
|
||||||
#pragma region 16-bit arithmetic
|
#pragma region 16-bit arithmetic
|
||||||
|
|
||||||
void EightBit::LR35902::sbc(uint8_t& f, register16_t& operand, register16_t value) {
|
|
||||||
|
|
||||||
auto before = operand;
|
|
||||||
|
|
||||||
auto carry = (f & CF) >> 4;
|
|
||||||
auto result = before.word - value.word - carry;
|
|
||||||
operand.word = result;
|
|
||||||
|
|
||||||
clearFlag(f, ZF, operand.word);
|
|
||||||
adjustHalfCarrySub(f, before.high, value.high, operand.high);
|
|
||||||
setFlag(f, NF);
|
|
||||||
setFlag(f, CF, result & Bit16);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EightBit::LR35902::adc(uint8_t& f, register16_t& operand, register16_t value) {
|
|
||||||
|
|
||||||
auto before = operand;
|
|
||||||
|
|
||||||
auto carry = (f & CF) >> 4;
|
|
||||||
auto result = before.word + value.word + carry;
|
|
||||||
operand.word = result;
|
|
||||||
|
|
||||||
clearFlag(f, ZF, result);
|
|
||||||
adjustHalfCarryAdd(f, before.high, value.high, operand.high);
|
|
||||||
clearFlag(f, NF);
|
|
||||||
setFlag(f, CF, result & Bit16);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EightBit::LR35902::add(uint8_t& f, register16_t& operand, register16_t value) {
|
void EightBit::LR35902::add(uint8_t& f, register16_t& operand, register16_t value) {
|
||||||
|
|
||||||
auto before = operand;
|
auto before = operand;
|
||||||
|
Loading…
Reference in New Issue
Block a user