// THIS FILE HAS BEEN GENERATED BY gen_write_cycle_query

use crate::instr::InstructionSequenceMode;
use crate::instr::InstructionSequenceMode::*;

/// Determines if the given instruction performs a memory write at the specified step.
///
/// # Arguments
///
/// * `instr` - The instruction being executed
/// * `step` - The current execution step of the instruction
///
/// # Returns
///
/// * `true` if the instruction performs a memory write at this step
/// * `false` otherwise
///
pub fn write_cycle_query(instr: InstructionSequenceMode, step: u8) -> bool {
    match (instr, step) {
        (FetchInstr, 0) => false,
        (Break, 0) => false,
        (Break, 1) => true,
        (Break, 2) => true,
        (Break, 3) => true,
        (Break, 4) => false,
        (Break, 5) => false,
        (StartIrq, 0) => false,
        (StartIrq, 1) => false,
        (StartIrq, 2) => true,
        (StartIrq, 3) => true,
        (StartIrq, 4) => true,
        (StartIrq, 5) => false,
        (StartIrq, 6) => false,
        (StartNmi, 0) => false,
        (StartNmi, 1) => false,
        (StartNmi, 2) => true,
        (StartNmi, 3) => true,
        (StartNmi, 4) => true,
        (StartNmi, 5) => false,
        (StartNmi, 6) => false,
        (Reset, 0) => false,
        (Reset, 1) => false,
        (Reset, 2) => false,
        (Reset, 3) => true,
        (Reset, 4) => false,
        (Reset, 5) => false,
        (ReturnInterrupt, 0) => false,
        (ReturnInterrupt, 1) => false,
        (ReturnInterrupt, 2) => false,
        (ReturnInterrupt, 3) => false,
        (ReturnInterrupt, 4) => false,
        (JumpSubroutine, 0) => false,
        (JumpSubroutine, 1) => false,
        (JumpSubroutine, 2) => true,
        (JumpSubroutine, 3) => true,
        (JumpSubroutine, 4) => false,
        (ReturnSubroutine, 0) => false,
        (ReturnSubroutine, 1) => false,
        (ReturnSubroutine, 2) => false,
        (ReturnSubroutine, 3) => false,
        (ReturnSubroutine, 4) => false,
        (Push, 0) => false,
        (Push, 1) => true,
        (Pull, 0) => false,
        (Pull, 1) => false,
        (Pull, 2) => false,
        (Implied, 0) => false,
        (Immediate, 0) => true,
        (AbsoluteJump, 0) => false,
        (AbsoluteJump, 1) => false,
        (Absolute, 0) => false,
        (Absolute, 1) => false,
        (Absolute, 2) => true,
        (AbsoluteReadModifyWrite, 0) => false,
        (AbsoluteReadModifyWrite, 1) => false,
        (AbsoluteReadModifyWrite, 2) => false,
        (AbsoluteReadModifyWrite, 3) => true,
        (AbsoluteReadModifyWrite, 4) => true,
        (ZeroPage, 0) => false,
        (ZeroPage, 1) => true,
        (ZeroPageReadModifyWrite, 0) => false,
        (ZeroPageReadModifyWrite, 1) => false,
        (ZeroPageReadModifyWrite, 2) => true,
        (ZeroPageReadModifyWrite, 3) => true,
        (ZeroPageIdx, 0) => false,
        (ZeroPageIdx, 1) => false,
        (ZeroPageIdx, 2) => true,
        (ZeroPageIdxReadModifyWrite, 0) => false,
        (ZeroPageIdxReadModifyWrite, 1) => false,
        (ZeroPageIdxReadModifyWrite, 2) => false,
        (ZeroPageIdxReadModifyWrite, 3) => true,
        (ZeroPageIdxReadModifyWrite, 4) => true,
        (AbsoluteIdxRead, 0) => false,
        (AbsoluteIdxRead, 1) => false,
        (AbsoluteIdxRead, 2) => true,
        (AbsoluteIdxReadModifyWrite, 0) => false,
        (AbsoluteIdxReadModifyWrite, 1) => false,
        (AbsoluteIdxReadModifyWrite, 2) => false,
        (AbsoluteIdxReadModifyWrite, 3) => false,
        (AbsoluteIdxReadModifyWrite, 4) => true,
        (AbsoluteIdxReadModifyWrite, 5) => true,
        (AbsoluteIdxWrite, 0) => false,
        (AbsoluteIdxWrite, 1) => false,
        (AbsoluteIdxWrite, 2) => false,
        (AbsoluteIdxWrite, 3) => true,
        (Relative, 0) => false,
        (Relative, 1) => false,
        (ZeroPageIdxIndirect, 0) => false,
        (ZeroPageIdxIndirect, 1) => false,
        (ZeroPageIdxIndirect, 2) => false,
        (ZeroPageIdxIndirect, 3) => false,
        (ZeroPageIdxIndirect, 4) => true,
        (ZeroPageIdxIndirectReadModifyWrite, 0) => false,
        (ZeroPageIdxIndirectReadModifyWrite, 1) => false,
        (ZeroPageIdxIndirectReadModifyWrite, 2) => false,
        (ZeroPageIdxIndirectReadModifyWrite, 3) => false,
        (ZeroPageIdxIndirectReadModifyWrite, 4) => false,
        (ZeroPageIdxIndirectReadModifyWrite, 5) => true,
        (ZeroPageIdxIndirectReadModifyWrite, 6) => true,
        (ZeroPageIndirectIdxRead, 0) => false,
        (ZeroPageIndirectIdxRead, 1) => false,
        (ZeroPageIndirectIdxRead, 2) => false,
        (ZeroPageIndirectIdxRead, 3) => true,
        (ZeroPageIndirectIdxReadModifyWrite, 0) => false,
        (ZeroPageIndirectIdxReadModifyWrite, 1) => false,
        (ZeroPageIndirectIdxReadModifyWrite, 2) => false,
        (ZeroPageIndirectIdxReadModifyWrite, 3) => false,
        (ZeroPageIndirectIdxReadModifyWrite, 4) => false,
        (ZeroPageIndirectIdxReadModifyWrite, 5) => true,
        (ZeroPageIndirectIdxReadModifyWrite, 6) => true,
        (ZeroPageIndirectIdxWrite, 0) => false,
        (ZeroPageIndirectIdxWrite, 1) => false,
        (ZeroPageIndirectIdxWrite, 2) => false,
        (ZeroPageIndirectIdxWrite, 3) => false,
        (ZeroPageIndirectIdxWrite, 4) => true,
        (AbsoluteIndirectJump, 0) => false,
        (AbsoluteIndirectJump, 1) => false,
        (AbsoluteIndirectJump, 2) => false,
        (AbsoluteIndirectJump, 3) => false,

        _ => unreachable!(),
    }
}
