Code: Select all
LOGOP <= ( DCBAXYS[SEL_A] & DCBAXYS[SEL_B] );
1. read A (src_reg)
2. read B (dst_reg)
3. write B (dst_reg)
cycles 1 and 3 are already needed for the regular TAB instruction, so you need to add a cycle in the middle. This is a new one, so it requires an update to the state machine, and it requires an extra MUX in the register file access so you can read from dst_reg. The alternative is to do this:
1. read A (src_reg), src_reg <= B
2. read B (src_reg)
3. write B (dst_reg)
This avoids the extra MUX, but requires an extra write to src_reg.
Anyway, this change is not as straightforward as earlier changes, since register/register operations aren't natural to the 6502. Maybe you should try to come up with something simpler to do first, to get some more experience.
A simpler, but quite powerful, extension to the opcode space is what I've mentioned earlier, which is to allow the source and destination Acc to be different. This does not allow Acc-Acc operations, but it does allow things like ADC A, #10 and store the result in B, with a full set of addressing modes and operands. All this requires is an extra 2 bits in the opcode to designate the destination register, and a few lines of Verilog.
