Commit cb86cd11 authored by Tim Allen's avatar Tim Allen

Update to v106r72 release.

byuu says:

For this WIP, I added more TLCS900H instructions. All of the
ADC,ADD,SBB/SBC,SUB,AND,OR,XOR.CP,PUSH,POP instructions are in.

Still an incredible amount of work left to do on this core ... it has all kinds
of novel instructions that aren't on any other processors.

Still no disassembler support yet, so I can't even test what I'm doing. Fun!
parent 1a889ae2
Pipeline #42232061 failed with stage
in 9 minutes and 58 seconds
......@@ -30,7 +30,7 @@ using namespace nall;
namespace Emulator {
static const string Name = "higan";
static const string Version = "106.71";
static const string Version = "106.72";
static const string Author = "byuu";
static const string License = "GPLv3";
static const string Website = "https://byuu.org/";
......
template<> auto TLCS900H::algorithmAdd<Byte>(uint8 target, uint8 source, uint1 carry) -> uint8 {
template<> auto TLCS900H::parity(Byte data) const -> bool {
data ^= data >> 4;
data ^= data >> 2;
data ^= data >> 1;
return !(data & 1);
}
template<> auto TLCS900H::parity(Word data) const -> bool {
data ^= data >> 8;
data ^= data >> 4;
data ^= data >> 2;
data ^= data >> 1;
return !(data & 1);
}
template<> auto TLCS900H::parity(Long data) const -> bool {
return Undefined;
}
//
template<typename Size> auto TLCS900H::algorithmAdd(Size target, Size source, uint1 carry) -> Size {
uint64 result = target + source + carry;
CF = result.bit(8);
CF = result.bit(Size::bits());
NF = 0;
VF = uint8(~(target ^ source) & (target ^ result)).bit(7);
HF = uint8(target ^ source ^ result).bit(4);
ZF = uint8(result) == 0;
SF = result.bit(7);
VF = Size(~(target ^ source) & (target ^ result)).negative();
HF = Size(target ^ source ^ result).bit(4);
if constexpr(isLong<Size>()) HF = Undefined;
ZF = Size(result).zero();
SF = result.negative();
return result;
}
template<> auto TLCS900H::algorithmAdd<Word>(uint16 target, uint16 source, uint1 carry) -> uint16 {
uint64 result = target + source + carry;
CF = result.bit(16);
template<typename Size> auto TLCS900H::algorithmAnd(Size target, Size source) -> Size {
Size result = target & source;
CF = 0;
NF = 0;
VF = uint16(~(target ^ source) & (target ^ result)).bit(15);
HF = uint16(target ^ source ^ result).bit(4);
ZF = uint16(result) == 0;
SF = result.bit(15);
VF = parity(result);
HF = 1;
ZF = result.zero();
SF = result.negative();
return result;
}
template<> auto TLCS900H::algorithmAdd<Long>(uint32 target, uint32 source, uint1 carry) -> uint32 {
uint64 result = target + source + carry;
CF = result.bit(32);
template<typename Size> auto TLCS900H::algorithmOr(Size target, Size source) -> Size {
Size result = target | source;
CF = 0;
NF = 0;
VF = parity(result);
HF = 0;
ZF = result.zero();
SF = result.negative();
return result;
}
template<typename Size> auto TLCS900H::algorithmSubtract(Size target, Size source, uint1 carry) -> Size {
uint64 result = target - source - carry;
CF = result.bit(Size::bits());
NF = 1;
VF = Size((target ^ source) & (target ^ result)).negative();
HF = Size(target ^ source ^ result).bit(4);
if constexpr(isLong<Size>()) HF = Undefined;
ZF = Size(result).zero();
SF = result.negative();
return result;
}
template<typename Size> auto TLCS900H::algorithmXor(Size target, Size source) -> Size {
Size result = target ^ source;
CF = 0;
NF = 0;
VF = uint32(~(target ^ source) & (target ^ result)).bit(31);
HF = undefined;
ZF = uint32(result) == 0;
SF = result.bit(31);
VF = parity(result);
HF = 0;
ZF = result.zero();
SF = result.negative();
return result;
}
auto TLCS900H::condition(uint4 code) -> bool {
switch(code) {
case 0: return 0 == 1; //F (false)
case 1: return (SF ^ VF) == 1; //LT (signed less than)
case 2: return (ZF | (SF ^ VF)) == 1; //LE (signed less than or equal)
case 3: return (CF | ZF) == 1; //ULE (unsigned less than or equal)
case 4: return VF == 1; //OV (overflow)
case 5: return SF == 1; //MI (minus)
case 6: return ZF == 1; //EQ (equal)
case 7: return CF == 1; //ULT (unsigned less than)
case 8: return 0 == 0; //T (true)
case 9: return (SF ^ VF) == 0; //GE (signed greater than or equal)
case 10: return (ZF | (SF ^ VF)) == 0; //GT (signed greater than)
case 11: return (CF | ZF) == 0; //UGT (unsigned greater than)
case 12: return VF == 0; //NOV (no overflow)
case 13: return SF == 0; //PL (plus)
case 14: return ZF == 0; //NE (not equal)
case 15: return CF == 0; //UGE (unsigned greater than or equal)
} unreachable;
}
template<> auto TLCS900H::registerLookup<Byte>(uint3 code) -> Register {
return {0xe0 | code >> 1 << 2 | code & 1 ^ 1}; //W, A, B, C, D, E, H, L
}
template<> auto TLCS900H::registerLookup<Word>(uint3 code) -> Register {
return {0xe0 | code << 2}; //WA, BC, DE, HL, IX, IY, IZ, SP
}
template<> auto TLCS900H::registerLookup<Long>(uint3 code) -> Register {
return {0xe0 | code << 2}; //XWA, XBC, XDE, XHL, XIX, XIY, XIZ, XSP
}
auto TLCS900H::instruction() -> void {
auto data = fetch();
static const Register registers[] = {W, A, B, C, D, E, H, L};
Register register;
Memory memory;
switch(data) {
case 0x00: return instructionNoOperation();
case 0x04: return; //undefined
case 0x02: return instructionPush<Word>(r.sr);
case 0x03: return instructionPop<Word>(r.sr);
case 0x04: return (void)Undefined;
case 0x09: return instructionPush<Byte>(Immediate{fetch<Byte>()});
case 0x0b: return instructionPush<Word>(Immediate{fetch<Word>()});
case 0x12: return instructionComplementCarry();
case 0x1f: return; //undefined
case 0x14: return instructionPush<Byte>(A);
case 0x15: return instructionPop<Byte>(A);
case 0x18: return instructionPush<Byte>(r.sr.f);
case 0x19: return instructionPop<Byte>(r.sr.f);
case 0x1f: return (void)Undefined;
case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f:
return instructionPush<Word>(registerLookup<Word>(data));
case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f:
return instructionPush<Long>(registerLookup<Long>(data));
case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f:
return instructionPop<Word>(registerLookup<Word>(data));
case 0x58: case 0x59: case 0x5a: case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f:
return instructionPop<Long>(registerLookup<Long>(data));
case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87:
memory = {read<Long>(register)};
......@@ -53,36 +84,37 @@ auto TLCS900H::instruction() -> void {
return instructionSourceMemory<Byte>(memory);
case 0xc3:
data = fetch();
memory = {read<Long>(Register{data & ~3})};
memory = {read<Long>(Register{data})};
if((data & 3) == 1) memory.value += (int16)fetch<uint16>();
if((data & 3) == 2) memory.value += (int8)read<Byte>(Register{fetch()});
if((data & 3) == 3) memory.value += (int16)read<Word>(Register{fetch() & ~1});
if((data & 3) == 3) memory.value += (int16)read<Word>(Register{fetch()});
return instructionSourceMemory<Byte>(memory);
case 0xc4:
data = fetch();
register = {data & ~3};
register = {data};
if((data & 3) == 0) write<Long>(register, read<Long>(register) - 1);
if((data & 3) == 1) write<Long>(register, read<Long>(register) - 2);
if((data & 3) == 2) write<Long>(register, read<Long>(register) - 4);
if((data & 3) == 3) Undefined;
memory = {read<Long>(register)};
return instructionSourceMemory<Byte>(memory);
case 0xc5:
data = fetch();
register = {data & ~3};
register = {data};
memory = {read<Long>(register)};
instructionSourceMemory<Byte>(memory);
if((data & 3) == 0) write<Long>(register, read<Long>(register) + 1);
if((data & 3) == 1) write<Long>(register, read<Long>(register) + 2);
if((data & 3) == 2) write<Long>(register, read<Long>(register) + 4);
if((data & 3) == 3) Undefined;
return;
case 0xc6:
//undefined
return;
return (void)Undefined;
case 0xc7:
register = {fetch()};
return instructionRegister<Byte>(register);
case 0xc8: case 0xc9: case 0xca: case 0xcb: case 0xcc: case 0xcd: case 0xce: case 0xcf:
register = registers[data & 7];
register = registerLookup<Byte>(data);
return instructionRegister<Byte>(register);
case 0xd0:
......@@ -96,36 +128,37 @@ auto TLCS900H::instruction() -> void {
return instructionSourceMemory<Word>(memory);
case 0xd3:
data = fetch();
memory = {read<Long>(Register{data & ~3})};
memory = {read<Long>(Register{data})};
if((data & 3) == 1) memory.value += (int16)fetch<uint16>();
if((data & 3) == 2) memory.value += (int8)read<Byte>(Register{fetch()});
if((data & 3) == 3) memory.value += (int16)read<Word>(Register{fetch() & ~1});
if((data & 3) == 3) memory.value += (int16)read<Word>(Register{fetch()});
return instructionSourceMemory<Word>(memory);
case 0xd4:
data = fetch();
register = {data & ~3};
register = {data};
if((data & 3) == 0) write<Long>(register, read<Long>(register) - 1);
if((data & 3) == 1) write<Long>(register, read<Long>(register) - 2);
if((data & 3) == 2) write<Long>(register, read<Long>(register) - 4);
if((data & 3) == 3) Undefined;
memory = {read<Long>(register)};
return instructionSourceMemory<Word>(memory);
case 0xd5:
data = fetch();
register = {data & ~3};
register = {data};
memory = {read<Long>(register)};
instructionSourceMemory<Word>(memory);
if((data & 3) == 0) write<Long>(register, read<Long>(register) + 1);
if((data & 3) == 1) write<Long>(register, read<Long>(register) + 2);
if((data & 3) == 2) write<Long>(register, read<Long>(register) + 4);
if((data & 3) == 3) Undefined;
return;
case 0xd6:
//undefined
return;
return (void)Undefined;
case 0xd7:
register = {fetch() & ~1};
register = {fetch()};
return instructionRegister<Word>(register);
case 0xd8: case 0xd9: case 0xda: case 0xdb: case 0xdc: case 0xdd: case 0xde: case 0xdf:
register = registers[data & 7];
register = registerLookup<Word>(data);
return instructionRegister<Word>(register);
case 0xe0:
......@@ -139,36 +172,37 @@ auto TLCS900H::instruction() -> void {
return instructionSourceMemory<Long>(memory);
case 0xe3:
data = fetch();
memory = {read<Long>(Register{data & ~3})};
memory = {read<Long>(Register{data})};
if((data & 3) == 1) memory.value += (int16)fetch<uint16>();
if((data & 3) == 2) memory.value += (int8)read<Byte>(Register{fetch()});
if((data & 3) == 3) memory.value += (int16)read<Word>(Register{fetch() & ~1});
if((data & 3) == 3) memory.value += (int16)read<Word>(Register{fetch()});
return instructionSourceMemory<Long>(memory);
case 0xe4:
data = fetch();
register = {data & ~3};
register = {data};
if((data & 3) == 0) write<Long>(register, read<Long>(register) - 1);
if((data & 3) == 1) write<Long>(register, read<Long>(register) - 2);
if((data & 3) == 2) write<Long>(register, read<Long>(register) - 4);
if((data & 3) == 3) Undefined;
memory = {read<Long>(register)};
return instructionSourceMemory<Long>(memory);
case 0xe5:
data = fetch();
register = {data & ~3};
register = {data};
memory = {read<Long>(register)};
instructionSourceMemory<Long>(memory);
if((data & 3) == 0) write<Long>(register, read<Long>(register) + 1);
if((data & 3) == 1) write<Long>(register, read<Long>(register) + 2);
if((data & 3) == 2) write<Long>(register, read<Long>(register) + 4);
if((data & 3) == 3) Undefined;
return;
case 0xe6:
//undefined
return;
return (void)Undefined;
case 0xe7:
register = {fetch() & ~3};
register = {fetch()};
return instructionRegister<Long>(register);
case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef:
register = registers[data & 7];
register = registerLookup<Long>(data);
return instructionRegister<Long>(register);
case 0xf0:
......@@ -182,31 +216,32 @@ auto TLCS900H::instruction() -> void {
return instructionTargetMemory(memory);
case 0xf3:
data = fetch();
memory = {read<Long>(Register{data & ~3})};
memory = {read<Long>(Register{data})};
if((data & 3) == 1) memory.value += (int16)fetch<uint16>();
if((data & 3) == 2) memory.value += (int8)read<Byte>(Register{fetch()});
if((data & 3) == 3) memory.value += (int16)read<Word>(Register{fetch() & ~1});
if((data & 3) == 3) memory.value += (int16)read<Word>(Register{fetch()});
return instructionTargetMemory(memory);
case 0xf4:
data = fetch();
register = {data & ~3};
register = {data};
if((data & 3) == 0) write<Long>(register, read<Long>(register) - 1);
if((data & 3) == 1) write<Long>(register, read<Long>(register) - 2);
if((data & 3) == 2) write<Long>(register, read<Long>(register) - 4);
if((data & 3) == 3) Undefined;
memory = {read<Long>(register)};
return instructionTargetMemory(memory);
case 0xf5:
data = fetch();
register = {data & ~3};
register = {data};
memory = {read<Long>(register)};
instructionTargetMemory(memory);
if((data & 3) == 0) write<Long>(register, read<Long>(register) + 1);
if((data & 3) == 1) write<Long>(register, read<Long>(register) + 2);
if((data & 3) == 2) write<Long>(register, read<Long>(register) + 4);
if((data & 3) == 3) Undefined;
return;
case 0xf6: case 0xf7:
//undefined
return;
return (void)Undefined;
case 0xf8: case 0xf9: case 0xfa: case 0xfb: case 0xfc: case 0xfd: case 0xfe: case 0xff:
return instructionSoftwareInterrupt(Immediate{data.bits(0,2)});
......@@ -214,38 +249,102 @@ auto TLCS900H::instruction() -> void {
}
template<typename Size>
auto TLCS900H::instructionRegister(Register input) -> void {
auto TLCS900H::instructionRegister(Register register) -> void {
auto data = fetch();
static const Register registers[] = {W, A, B, C, D, E, H, L};
Register register = registers[data.bits(0,2)];
switch(data) {
case 0x04: return instructionPush<Size>(register);
case 0x05: return instructionPop<Size>(register);
case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87:
return instructionAdd<Size>(register, input);
return instructionAdd<Size>(registerLookup<Size>(data), register);
case 0x90: case 0x91: case 0x92: case 0x93: case 0x94: case 0x95: case 0x96: case 0x97:
return instructionAddCarry<Size>(register, input);
return instructionAddCarry<Size>(registerLookup<Size>(data), register);
case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa4: case 0xa5: case 0xa6: case 0xa7:
return instructionSubtract<Size>(registerLookup<Size>(data), register);
case 0xb0: case 0xb1: case 0xb2: case 0xb3: case 0xb4: case 0xb5: case 0xb6: case 0xb7:
return instructionSubtractCarry<Size>(registerLookup<Size>(data), register);
case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7:
return instructionAnd<Size>(registerLookup<Size>(data), register);
case 0xc8: return instructionAdd<Size>(register, Immediate{fetch<Size>()});
case 0xc9: return instructionAddCarry<Size>(register, Immediate{fetch<Size>()});
case 0xca: return instructionSubtract<Size>(register, Immediate{fetch<Size>()});
case 0xcb: return instructionSubtractCarry<Size>(register, Immediate{fetch<Size>()});
case 0xcc: return instructionAnd<Size>(register, Immediate{fetch<Size>()});
case 0xcd: return instructionXor<Size>(register, Immediate{fetch<Size>()});
case 0xce: return instructionOr<Size>(register, Immediate{fetch<Size>()});
case 0xcf: return instructionCompare<Size>(register, Immediate{fetch<Size>()});
case 0xd0: case 0xd1: case 0xd2: case 0xd3: case 0xd4: case 0xd5: case 0xd6: case 0xd7:
return instructionXor<Size>(registerLookup<Size>(data), register);
case 0xd8: case 0xd9: case 0xda: case 0xdb: case 0xdc: case 0xdd: case 0xde: case 0xdf:
return instructionCompare<Size>(register, Immediate{data & 7});
case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4: case 0xe5: case 0xe6: case 0xe7:
return instructionOr<Size>(registerLookup<Size>(data), register);
case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7:
return instructionCompare<Size>(registerLookup<Size>(data), register);
}
}
template<typename Size>
auto TLCS900H::instructionSourceMemory(Memory input) -> void {
auto TLCS900H::instructionSourceMemory(Memory memory) -> void {
auto data = fetch();
static const Register registers[] = {W, A, B, C, D, E, H, L};
Register register = registers[data.bits(0,2)];
switch(data) {
case 0x04:
if constexpr(isLong<Size>()) return (void)Undefined;
return instructionPush<Size>(memory);
case 0x38:
if constexpr(isLong<Size>()) return (void)Undefined;
return instructionAdd<Size>(memory, Immediate{fetch<Size>()});
case 0x39:
if constexpr(isLong<Size>()) return (void)Undefined;
return instructionAddCarry<Size>(memory, Immediate{fetch<Size>()});
case 0x3a:
if constexpr(isLong<Size>()) return (void)Undefined;
return instructionSubtract<Size>(memory, Immediate{fetch<Size>()});
case 0x3b:
if constexpr(isLong<Size>()) return (void)Undefined;
return instructionSubtractCarry<Size>(memory, Immediate{fetch<Size>()});
case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87:
return instructionAdd<Size>(register, input);
return instructionAdd<Size>(registerLookup<Size>(data), memory);
case 0x88: case 0x89: case 0x8a: case 0x8b: case 0x8c: case 0x8d: case 0x8e: case 0x8f:
return instructionAdd<Size>(memory, registerLookup<Size>(data));
case 0x90: case 0x91: case 0x92: case 0x93: case 0x94: case 0x95: case 0x96: case 0x97:
return instructionAddCarry<Size>(register, input);
return instructionAddCarry<Size>(registerLookup<Size>(data), memory);
case 0x98: case 0x99: case 0x9a: case 0x9b: case 0x9c: case 0x9d: case 0x9e: case 0x9f:
return instructionAddCarry<Size>(memory, registerLookup<Size>(data));
case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa4: case 0xa5: case 0xa6: case 0xa7:
return instructionSubtract<Size>(registerLookup<Size>(data), memory);
case 0xa8: case 0xa9: case 0xaa: case 0xab: case 0xac: case 0xad: case 0xae: case 0xaf:
return instructionSubtract<Size>(memory, registerLookup<Size>(data));
case 0xb0: case 0xb1: case 0xb2: case 0xb3: case 0xb4: case 0xb5: case 0xb6: case 0xb7:
return instructionSubtractCarry<Size>(registerLookup<Size>(data), memory);
case 0xb8: case 0xb9: case 0xba: case 0xbb: case 0xbc: case 0xbd: case 0xbe: case 0xbf:
return instructionSubtractCarry<Size>(memory, registerLookup<Size>(data));
case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7:
return instructionAnd<Size>(registerLookup<Size>(data), memory);
case 0xc8: case 0xc9: case 0xca: case 0xcb: case 0xcc: case 0xcd: case 0xce: case 0xcf:
return instructionAnd<Size>(memory, registerLookup<Size>(data));
case 0xd0: case 0xd1: case 0xd2: case 0xd3: case 0xd4: case 0xd5: case 0xd6: case 0xd7:
return instructionXor<Size>(registerLookup<Size>(data), memory);
case 0xd8: case 0xd9: case 0xda: case 0xdb: case 0xdc: case 0xdd: case 0xde: case 0xdf:
return instructionXor<Size>(memory, registerLookup<Size>(data));
case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4: case 0xe5: case 0xe6: case 0xe7:
return instructionOr<Size>(registerLookup<Size>(data), memory);
case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef:
return instructionOr<Size>(memory, registerLookup<Size>(data));
case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7:
return instructionCompare<Size>(registerLookup<Size>(data), memory);
case 0xf8: case 0xf9: case 0xfa: case 0xfb: case 0xfc: case 0xfd: case 0xfe: case 0xff:
return instructionCompare<Size>(memory, registerLookup<Size>(data));
}
}
auto TLCS900H::instructionTargetMemory(Memory input) -> void {
auto TLCS900H::instructionTargetMemory(Memory memory) -> void {
auto data = fetch();
static const Register registers[] = {W, A, B, C, D, E, H, L};
Register register = registers[data.bits(0,2)];
switch(data) {
case 0x04: return instructionPop<Byte>(memory);
case 0x06: return instructionPop<Word>(memory);
}
}
#define read read<Size>
#define write write<Size>
#define push push<Size>
#define pop pop<Size>
#define algorithm(name, ...) algorithm##name<Size>(__VA_ARGS__)
template<typename Size, typename Target, typename Source>
auto TLCS900H::instructionAdd(Target target, Source source) -> void {
write<Size>(target, algorithmAdd<Size>(read<Size>(target), read<Size>(source)));
write(target, algorithm(Add, read(target), read(source)));
}
template<typename Size, typename Target, typename Source>
auto TLCS900H::instructionAddCarry(Target target, Source source) -> void {
write<Size>(target, algorithmAdd<Size>(read<Size>(target), read<Size>(source), CF));
write(target, algorithm(Add, read(target), read(source), CF));
}
template<typename Size, typename Target, typename Source>
auto TLCS900H::instructionAnd(Target target, Source source) -> void {
write(target, algorithm(And, read(target), read(source)));
}
template<typename Size, typename Target, typename Source>
auto TLCS900H::instructionCompare(Target target, Source source) -> void {
algorithm(Subtract, read(target), read(source));
}
auto TLCS900H::instructionComplementCarry() -> void {
......@@ -15,5 +31,41 @@ auto TLCS900H::instructionComplementCarry() -> void {
auto TLCS900H::instructionNoOperation() -> void {
}
template<typename Size, typename Target, typename Source>
auto TLCS900H::instructionOr(Target target, Source source) -> void {
write(target, algorithm(Or, read(target), read(source)));
}
template<typename Size, typename Target>
auto TLCS900H::instructionPop(Target target) -> void {
write(target, pop());
}
template<typename Size, typename Source>
auto TLCS900H::instructionPush(Source source) -> void {
push(read(source));
}
auto TLCS900H::instructionSoftwareInterrupt(Immediate interrupt) -> void {
}
template<typename Size, typename Target, typename Source>
auto TLCS900H::instructionSubtract(Target target, Source source) -> void {
write(target, algorithm(Subtract, read(target), read(source)));
}
template<typename Size, typename Target, typename Source>
auto TLCS900H::instructionSubtractCarry(Target target, Source source) -> void {
write(target, algorithm(Subtract, read(target), read(source), CF));
}
template<typename Size, typename Target, typename Source>
auto TLCS900H::instructionXor(Target target, Source source) -> void {
write(target, algorithm(Xor, read(target), read(source)));
}
#undef read
#undef write
#undef push
#undef pop
#undef algorithm
......@@ -10,16 +10,58 @@ template<> auto TLCS900H::fetch<uint16>() -> uint16 {
template<> auto TLCS900H::fetch<uint24>() -> uint24 {
uint24 data = fetch<uint8>();
data |= fetch<uint8>() << 8;
return data | fetch<uint8>() << 16;