mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-02 02:49:28 +00:00
Completes M50740 instruction set.
This commit is contained in:
parent
3c887aff95
commit
0fafbf5092
@ -118,6 +118,13 @@ template <
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Indicates whether the processor is currently 'stopped', i.e. whether all attempts to run
|
||||||
|
should produce no activity. Some processors have such a state when waiting for
|
||||||
|
interrupts or for a reset.
|
||||||
|
*/
|
||||||
|
void set_is_stopped(bool) {}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Executes up to the next branch.
|
Executes up to the next branch.
|
||||||
*/
|
*/
|
||||||
|
@ -116,6 +116,15 @@ uint8_t Executor::flags() {
|
|||||||
carry_flag_;
|
carry_flag_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<bool is_brk> inline void Executor::perform_interrupt() {
|
||||||
|
// BRK has an unused operand.
|
||||||
|
++program_counter_;
|
||||||
|
push(uint8_t(program_counter_ >> 8));
|
||||||
|
push(uint8_t(program_counter_ & 0xff));
|
||||||
|
push(flags() | (is_brk ? 0x10 : 0x00));
|
||||||
|
set_program_counter(uint16_t(memory_[0x1ff4] | (memory_[0x1ff5] << 8)));
|
||||||
|
}
|
||||||
|
|
||||||
template <Operation operation, AddressingMode addressing_mode> void Executor::perform() {
|
template <Operation operation, AddressingMode addressing_mode> void Executor::perform() {
|
||||||
// Deal with all modes that don't access memory up here;
|
// Deal with all modes that don't access memory up here;
|
||||||
// those that access memory will go through a slightly longer
|
// those that access memory will go through a slightly longer
|
||||||
@ -336,6 +345,14 @@ template <Operation operation> void Executor::perform(uint8_t *operand [[maybe_u
|
|||||||
// after exiting from here.
|
// after exiting from here.
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case Operation::BRK:
|
||||||
|
perform_interrupt<true>();
|
||||||
|
--program_counter_; // To undo the unavoidable increment
|
||||||
|
// after exiting from here.
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Operation::STP: set_is_stopped(true); break;
|
||||||
|
|
||||||
case Operation::COM: set_nz(*operand ^= 0xff); break;
|
case Operation::COM: set_nz(*operand ^= 0xff); break;
|
||||||
|
|
||||||
case Operation::FST: case Operation::SLW: case Operation::NOP:
|
case Operation::FST: case Operation::SLW: case Operation::NOP:
|
||||||
@ -347,10 +364,6 @@ template <Operation operation> void Executor::perform(uint8_t *operand [[maybe_u
|
|||||||
case Operation::PLA: set_nz(a_ = pull()); break;
|
case Operation::PLA: set_nz(a_ = pull()); break;
|
||||||
case Operation::PLP: set_flags(pull()); break;
|
case Operation::PLP: set_flags(pull()); break;
|
||||||
|
|
||||||
// TODO:
|
|
||||||
//
|
|
||||||
// BRK, STP
|
|
||||||
|
|
||||||
case Operation::ASL:
|
case Operation::ASL:
|
||||||
carry_flag_ = *operand >> 7;
|
carry_flag_ = *operand >> 7;
|
||||||
*operand <<= 1;
|
*operand <<= 1;
|
||||||
|
@ -132,6 +132,7 @@ class Executor: public CachingExecutor {
|
|||||||
inline uint8_t pull();
|
inline uint8_t pull();
|
||||||
inline void set_flags(uint8_t);
|
inline void set_flags(uint8_t);
|
||||||
inline uint8_t flags();
|
inline uint8_t flags();
|
||||||
|
template<bool is_brk> inline void perform_interrupt();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user