-
Tim Allen authored
byuu says: So I spent the better part of eight hours refactoring the TLCS900H core to be more flexible in light of new edge cases. I'm now including the size information inside of the types (eg Register<Byte>, Memory<Word>) rather than as parameters to the instruction handlers. This allows me to eg implement RETI without needing template arguments in all the instructions. pop(SR), pop(PC) can deduce how much to pop off of the stack. It's still highly templated, but not unrolling the 3-bit register indexes and instead going through the switch table to access registers is going to hurt the performance a good deal. A benefit of this is that Register{A} != Register{WA} != Register{XWA} anymore, despite them sharing IDs. I also renamed read/write to load/store for the CPU core, because implicit conversions are nasty. They all call the virtual read/write. I added more instructions, improved the memory addressing mode support, and some other things. I got rid of Byte, Word, Long because there's too many alternate sizes needed: int8, int16, uint24, etc. Ran into a really annoying C++ case ... struct TLCS900H { template<typename T> auto store(Register<T> target, T source) -> void; }; If you call store(Register<uint32>(x), uint16(y)); it errors out since the T types don't match. But you can't specialize it: template<typename T, typename U> auto store(Register<T>, U) -> void; template<typename U> auto TLCS900H::store<uint32, U>(Register<uint32>, U) -> void; Because somehow it's 2019 and we still can't do partial template specialization inside classes ... So as a result, I had to make T source be type uint32 even for Register<uint8> and Register<uint16>. Doesn't matter too much, just annoying.
41148b10