1use crate::core::InterruptMode;
2use crate::core::instructions::InstructionExecutor;
3use crate::traits::BusInterface;
4
5pub(super) const fn nop() -> u32 {
6    4
7}
8
9impl<B: BusInterface> InstructionExecutor<'_, '_, B> {
10    pub(super) fn halt(&mut self) -> u32 {
11        self.cpu.registers.halted = true;
12
13        4
14    }
15
16    pub(super) fn di(&mut self) -> u32 {
17        self.cpu.registers.iff1 = false;
18        self.cpu.registers.iff2 = false;
19
20        4
21    }
22
23    pub(super) fn ei(&mut self) -> u32 {
24        self.cpu.registers.iff1 = true;
25        self.cpu.registers.iff2 = true;
26        self.cpu.registers.interrupt_delay = true;
27
28        4
29    }
30
31    pub(super) fn im(&mut self, mode: InterruptMode) -> u32 {
32        self.cpu.registers.interrupt_mode = mode;
33
34        8
35    }
36}