SWP in ALU
jdryg opened this issue · comments
Jim Drygiannakis commented
Check if it's possible to implement the SWP instruction in a single cycle inside the ALU.
Jim Drygiannakis commented
As mentioned by @holmak in #1 SWP can be implemented inside the register file.
For SWP, instead of actually moving values between the ACC and BAK registers, you can just toggle a single flip-flop. Then, any time ACC is read, the state of that flip-flop determines which of the two registers is currently ACC. This is how the Z80 implements its swap instructions, EX and EXX.