Skip to content

Commit

Permalink
Remove macro
Browse files Browse the repository at this point in the history
  • Loading branch information
takatori committed Feb 15, 2017
1 parent dd704de commit e408ec5
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,29 +173,6 @@ pub fn near_jump(emu: &mut Emulator) {
}


macro_rules! define_jx {

($flag:ident, $is_flag:ident) => (

pub fn j$flag(emu: &mut Emulator) {
let diff: i32 = $is_flag(emu) ? emu.get_sign_code8(1) : 0;
emu.eip += (diff + 2);
}

pub fn jn$flag(emu: &mut Emulator) {
let diff: i32 = $is_flag(emu) ? 0 : emu.get_sign_code8(1);
emu.eip += (diff + 2);
}
)

}

define_jx!(c, is_carry);
define_jx!(z, is_zero);
define_jx!(s, is_sign);
define_jx!(o, is_overflow);


pub fn jl(emu: &mut Emulator) {
let diff: i8 = if is_sign(emu) != is_overflow(emu) { emu.get_sign_code8(1) } else { 0 };
emu.eip += (diff + 2);
Expand Down

0 comments on commit e408ec5

Please sign in to comment.