-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsed.rs
More file actions
31 lines (27 loc) · 694 Bytes
/
sed.rs
File metadata and controls
31 lines (27 loc) · 694 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 Decimal Flag - Sets the deimal mode flag to one.
pub struct SED(pub Addr);
impl SED {
fn set_flags(cpu: &mut CPU) {
cpu.flags.d = true;
}
}
impl Instruction for SED {
fn execute(&self, cpu: &mut CPU) {
match self {
// 1B, 2C
SED(Addr::Implicit) => {
Self::set_flags(cpu);
cpu.pc += 1;
},
_ => panic!("Operation not supported!")
}
}
fn code(&self) -> Byte {
match self {
SED(Addr::Implicit) => 0xF8,
_ => panic!("Operation not supported!")
}
}
}