Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions aml/src/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ where
def_l_less(),
def_l_less_equal(),
def_l_not_equal(),
def_l_and(),
def_l_or(),
def_mid(),
def_object_type(),
Expand Down Expand Up @@ -305,6 +306,27 @@ where
.map(|((), result)| Ok(result))
}

fn def_l_and<'a, 'c>() -> impl Parser<'a, 'c, AmlValue>
where
'c: 'a,
{
/*
* DefLAnd := 0x90 Operand Operand
* Operand := TermArg => Integer
*/
opcode(opcode::DEF_L_AND_OP)
.then(comment_scope(
DebugVerbosity::AllScopes,
"DefLOr",
term_arg().then(term_arg()).map_with_context(|(left_arg, right_arg), context| {
let left = try_with_context!(context, left_arg.as_bool());
let right = try_with_context!(context, right_arg.as_bool());
(Ok(AmlValue::Boolean(left && right)), context)
}),
))
.map(|((), result)| Ok(result))
}

fn def_l_or<'a, 'c>() -> impl Parser<'a, 'c, AmlValue>
where
'c: 'a,
Expand Down
1 change: 1 addition & 0 deletions aml/src/opcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ pub const DEF_SHIFT_RIGHT: u8 = 0x7a;
pub const DEF_AND_OP: u8 = 0x7b;
pub const DEF_CONCAT_RES_OP: u8 = 0x84;
pub const DEF_OBJECT_TYPE_OP: u8 = 0x8e;
pub const DEF_L_AND_OP: u8 = 0x90;
pub const DEF_L_OR_OP: u8 = 0x91;
pub const DEF_L_NOT_OP: u8 = 0x92;
pub const DEF_L_EQUAL_OP: u8 = 0x93;
Expand Down