1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-10-04 23:17:01 +00:00

Name flags, remove closing underscores on exposed data fields.

This commit is contained in:
Thomas Harte
2022-05-12 08:19:41 -04:00
parent bd61c72007
commit f3c1b1f052
4 changed files with 253 additions and 238 deletions

View File

@@ -43,7 +43,7 @@ void Executor<model, BusHandler>::reset_processor() {
template <Model model, typename BusHandler>
template <typename IntT>
IntT Executor<model, BusHandler>::read(uint32_t address, bool is_from_pc) {
const auto code = FunctionCode((status_.is_supervisor_ << 2) | 1 << int(is_from_pc));
const auto code = FunctionCode((status_.is_supervisor << 2) | 1 << int(is_from_pc));
if(model == Model::M68000 && sizeof(IntT) > 1 && address & 1) {
throw AccessException(code, address, Exception::AddressError | (int(is_from_pc) << 3) | (1 << 4));
}
@@ -55,7 +55,7 @@ IntT Executor<model, BusHandler>::read(uint32_t address, bool is_from_pc) {
template <Model model, typename BusHandler>
template <typename IntT>
void Executor<model, BusHandler>::write(uint32_t address, IntT value) {
const auto code = FunctionCode((status_.is_supervisor_ << 2) | 1);
const auto code = FunctionCode((status_.is_supervisor << 2) | 1);
if(model == Model::M68000 && sizeof(IntT) > 1 && address & 1) {
throw AccessException(code, address, Exception::AddressError);
}
@@ -240,8 +240,8 @@ void Executor<model, BusHandler>::run_for_instructions(int count) {
// Grab the status to store, then switch into supervisor mode.
const uint16_t status = status_.status();
status_.is_supervisor_ = 1;
status_.trace_flag_ = 0;
status_.is_supervisor = 1;
status_.trace_flag = 0;
did_update_status();
// Push status and the program counter at instruction start.
@@ -271,14 +271,14 @@ void Executor<model, BusHandler>::run(int &count) {
// Capture the trace bit, indicating whether to trace
// after this instruction.
const auto should_trace = status_.trace_flag_;
const auto should_trace = status_.trace_flag;
// Read the next instruction.
instruction_address_ = program_counter_.l;
instruction_opcode_ = read_pc<uint16_t>();
const Preinstruction instruction = decoder_.decode(instruction_opcode_);
if(!status_.is_supervisor_ && instruction.requires_supervisor()) {
if(!status_.is_supervisor && instruction.requires_supervisor()) {
raise_exception(Exception::PrivilegeViolation);
continue;
}
@@ -369,7 +369,7 @@ typename Executor<model, BusHandler>::Registers Executor<model, BusHandler>::get
result.status = status_.status();
result.program_counter = program_counter_.l;
stack_pointers_[status_.is_supervisor_] = sp;
stack_pointers_[status_.is_supervisor] = sp;
result.user_stack_pointer = stack_pointers_[0].l;
result.supervisor_stack_pointer = stack_pointers_[1].l;
@@ -389,7 +389,7 @@ void Executor<model, BusHandler>::set_state(const Registers &state) {
stack_pointers_[0].l = state.user_stack_pointer;
stack_pointers_[1].l = state.supervisor_stack_pointer;
sp = stack_pointers_[status_.is_supervisor_];
sp = stack_pointers_[status_.is_supervisor];
}
// MARK: - Flow Control.
@@ -402,8 +402,8 @@ void Executor<model, BusHandler>::raise_exception(int index) {
// Grab the status to store, then switch into supervisor mode
// and disable tracing.
const uint16_t status = status_.status();
status_.is_supervisor_ = 1;
status_.trace_flag_ = 0;
status_.is_supervisor = 1;
status_.trace_flag = 0;
did_update_status();
// Push status and the program counter at instruction start.
@@ -419,8 +419,8 @@ template <Model model, typename BusHandler>
void Executor<model, BusHandler>::did_update_status() {
// Shuffle the stack pointers.
stack_pointers_[active_stack_pointer_] = sp;
sp = stack_pointers_[status_.is_supervisor_];
active_stack_pointer_ = status_.is_supervisor_;
sp = stack_pointers_[status_.is_supervisor];
active_stack_pointer_ = status_.is_supervisor;
}
template <Model model, typename BusHandler>
@@ -518,9 +518,9 @@ void Executor<model, BusHandler>::tas(Preinstruction instruction, uint32_t addre
Dn(instruction.reg<0>()).b = uint8_t(address | 0x80);
}
status_.overflow_flag_ = status_.carry_flag_ = 0;
status_.zero_result_ = value;
status_.negative_flag_ = value & 0x80;
status_.overflow_flag = status_.carry_flag = 0;
status_.zero_result = value;
status_.negative_flag = value & 0x80;
}
template <Model model, typename BusHandler>