-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsei.rs
More file actions
31 lines (27 loc) · 704 Bytes
/
sei.rs
File metadata and controls
31 lines (27 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::{cpu::CPU, ins::Instruction, mem::Addr};
use crate::Byte;
/// Set Interrupt Disable - Set the interrupt disable flag to one.
pub struct SEI(pub Addr);
impl SEI {
fn set_flags(cpu: &mut CPU) {
cpu.flags.c = true;
}
}
impl Instruction for SEI {
fn execute(&self, cpu: &mut CPU) {
match self {
// 1B, 2C
SEI(Addr::Implicit) => {
Self::set_flags(cpu);
cpu.pc += 1;
},
_ => panic!("Operation not supported!")
}
}
fn code(&self) -> Byte {
match self {
SEI(Addr::Implicit) => 0x78,
_ => panic!("Operation not supported!")
}
}
}