1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Knocks out some transfer operations.

I'm possibly only seven or eight away from being able to test with complete official-opcode-only 6502 code?
This commit is contained in:
Thomas Harte 2020-10-06 22:29:34 -04:00
parent e068cbc103
commit 93b0839036

View File

@ -51,7 +51,7 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
case OperationDecode: {
// A VERY TEMPORARY piece of logging.
printf("[%04x] %02x\n", pc_ - 1, instruction_buffer_.value);
printf("[%04x] %02x\n", pc_ - 2, instruction_buffer_.value); // pc_ - 1 would be correct but this matches a log I made of the 6502.
active_instruction_ = &instructions[instruction_buffer_.value];
const auto size_flag = mx_flags_[active_instruction_->size_field];
@ -306,6 +306,7 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
case OperationPerform:
switch(active_instruction_->operation) {
//
// Loads, stores and transfers (and NOP).
//
@ -330,11 +331,43 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
direct_ = ((instruction_buffer_.value) & 0xff) << 16;
break;
// The below attempts to obey the 8/16-bit mixed transfer rules
// as documented in https://softpixel.com/~cwright/sianse/docs/65816NFO.HTM
case TXS:
// TODO: does this transfer in full when in 8-bit index mode?
LD(s_, x_.full, x_masks_);
s_ = x_.full & x_masks_[1];
break;
case TSX:
LD(x_, s_.full, x_masks_);
break;
case TXY:
LD(x_, y_.full, x_masks_);
break;
case TYX:
LD(y_, x_.full, x_masks_);
break;
case TAX:
LD(x_, a_.full, x_masks_);
break;
case TAY:
LD(x_, a_.full, x_masks_);
break;
case TXA:
LD(a_, x_.full, m_masks_);
break;
case TYA:
LD(a_, y_.full, m_masks_);
break;
case STA:
data_buffer_.value = a_.full & m_masks_[1];
data_buffer_.size = 2 - m_flag();
@ -558,11 +591,11 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
// PHP, PHD, PHK,
// TRB, TSB,
// REP, SEP,
// TAX, TAY, TCD, TCS, TDC, TSC, TSX, TXA, TXS, TXY, TYA, TYX,
// XCE, XBA,
// STP, WAI,
// RTI, RTL,
// BRK,
// TCD, TCS, TDC, TSC
default:
assert(false);