File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ pub const DEF_BREAKPOINT_OP: u8 = 0xcc;
45
45
* Type 2 opcodes
46
46
*/
47
47
pub const DEF_STORE_OP : u8 = 0x70 ;
48
+ pub const DEF_ADD_OP : u8 = 0x72 ;
48
49
pub const DEF_SHIFT_LEFT : u8 = 0x79 ;
49
50
pub const DEF_SHIFT_RIGHT : u8 = 0x7a ;
50
51
pub const DEF_AND_OP : u8 = 0x7b ;
Original file line number Diff line number Diff line change 40
40
DebugVerbosity :: AllScopes ,
41
41
"Type2Opcode" ,
42
42
choice!(
43
+ def_add( ) ,
43
44
def_and( ) ,
44
45
def_buffer( ) ,
45
46
def_l_equal( ) ,
58
59
) )
59
60
}
60
61
62
+ pub fn def_add < ' a , ' c > ( ) -> impl Parser < ' a , ' c , AmlValue >
63
+ where
64
+ ' c : ' a ,
65
+ {
66
+ /*
67
+ * DefAdd := 0x72 Operand Operand Target
68
+ * Operand := TermArg => Integer
69
+ */
70
+ opcode ( opcode:: DEF_ADD_OP )
71
+ . then ( comment_scope (
72
+ DebugVerbosity :: AllScopes ,
73
+ "DefAdd" ,
74
+ term_arg ( ) . then ( term_arg ( ) ) . then ( target ( ) ) . map_with_context (
75
+ |( ( left_arg, right_arg) , target) , context| {
76
+ let left = try_with_context ! ( context, left_arg. as_integer( context) ) ;
77
+ let right = try_with_context ! ( context, right_arg. as_integer( context) ) ;
78
+ let result = AmlValue :: Integer ( left. wrapping_add ( right) ) ;
79
+
80
+ try_with_context ! ( context, context. store( target, result. clone( ) ) ) ;
81
+ ( Ok ( result) , context)
82
+ } ,
83
+ ) ,
84
+ ) )
85
+ . map ( |( ( ) , result) | Ok ( result) )
86
+ }
87
+
61
88
pub fn def_and < ' a , ' c > ( ) -> impl Parser < ' a , ' c , AmlValue >
62
89
where
63
90
' c : ' a ,
You can’t perform that action at this time.
0 commit comments