luaur_code_gen/methods/
assembly_builder_x_64_jcc.rs1use crate::enums::condition_x_64::ConditionX64;
2use crate::records::assembly_builder_x_64::AssemblyBuilderX64;
3use crate::records::label::Label;
4
5impl AssemblyBuilderX64 {
6 pub fn jcc(&mut self, cond: ConditionX64, label: &mut Label) {
7 let cc = match cond {
8 ConditionX64::Overflow => 0x70,
9 ConditionX64::NoOverflow => 0x71,
10 ConditionX64::Carry => 0x72,
11 ConditionX64::NoCarry => 0x73,
12 ConditionX64::Below => 0x72,
13 ConditionX64::BelowEqual => 0x76,
14 ConditionX64::Above => 0x77,
15 ConditionX64::AboveEqual => 0x73,
16 ConditionX64::Equal => 0x74,
17 ConditionX64::Less => 0x7c,
18 ConditionX64::LessEqual => 0x7e,
19 ConditionX64::Greater => 0x7f,
20 ConditionX64::GreaterEqual => 0x7d,
21 ConditionX64::NotBelow => 0x73,
22 ConditionX64::NotBelowEqual => 0x77,
23 ConditionX64::NotAbove => 0x76,
24 ConditionX64::NotAboveEqual => 0x72,
25 ConditionX64::NotEqual => 0x75,
26 ConditionX64::NotLess => 0x7d,
27 ConditionX64::NotLessEqual => 0x7f,
28 ConditionX64::NotGreater => 0x7e,
29 ConditionX64::NotGreaterEqual => 0x7c,
30 ConditionX64::Zero => 0x74,
31 ConditionX64::NotZero => 0x75,
32 ConditionX64::Parity => 0x7a,
33 ConditionX64::NotParity => 0x7b,
34 ConditionX64::Count => 0x70,
35 };
36 let jcc_text = [
40 c"jo", c"jno", c"jc", c"jnc", c"jb", c"jbe", c"ja", c"jae", c"je", c"jl", c"jle",
41 c"jg", c"jge", c"jnb", c"jnbe", c"jna", c"jnae", c"jne", c"jnl", c"jnle", c"jng",
42 c"jnge", c"jz", c"jnz", c"jp", c"jnp",
43 ];
44 let name = jcc_text[cond as usize].as_ptr();
45
46 self.place_jcc(name, label, (cc & 0x0F) as u8);
50 }
51}