-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclv.rs
More file actions
31 lines (27 loc) · 723 Bytes
/
clv.rs
File metadata and controls
31 lines (27 loc) · 723 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;
/// Clear Overflow Flag - Clears the Overflow flag of the Processor Status register.
pub struct CLV(pub Addr);
impl CLV {
fn set_flags(cpu: &mut CPU) {
cpu.flags.v = false;
}
}
impl Instruction for CLV {
fn execute(&self, cpu: &mut CPU) {
match self {
// 1B, 2C
CLV(Addr::Implicit) => {
Self::set_flags(cpu);
cpu.pc += 1;
},
_ => panic!("Operation not supported!")
}
}
fn code(&self) -> Byte {
match self {
CLV(Addr::Implicit) => 0xB8,
_ => panic!("Operation not supported!")
}
}
}