Browse Source

Parse DefBreakPoint

This is very easy for now, as we don't support any sort of AML debugging.
This should actually do something if we want to.
Isaac Woods 4 years ago
parent
commit
e4b49be7be
2 changed files with 20 additions and 1 deletions
  1. 1 0
      aml/src/opcode.rs
  2. 19 1
      aml/src/type1.rs

+ 1 - 0
aml/src/opcode.rs

@@ -39,6 +39,7 @@ pub const DEF_IF_ELSE_OP: u8 = 0xa0;
 pub const DEF_ELSE_OP: u8 = 0xa1;
 pub const DEF_NOOP_OP: u8 = 0xa3;
 pub const DEF_RETURN_OP: u8 = 0xa4;
+pub const DEF_BREAKPOINT_OP: u8 = 0xcc;
 
 /*
  * Type 2 opcodes

+ 19 - 1
aml/src/type1.rs

@@ -17,7 +17,25 @@ where
      *                DefNotify | DefRelease | DefReset | DefReturn | DefSignal | DefSleep | DefStall |
      *                DefWhile
      */
-    comment_scope(DebugVerbosity::AllScopes, "Type1Opcode", choice!(def_if_else(), def_noop(), def_return()))
+    comment_scope(
+        DebugVerbosity::AllScopes,
+        "Type1Opcode",
+        choice!(def_breakpoint(), def_if_else(), def_noop(), def_return()),
+    )
+}
+
+fn def_breakpoint<'a, 'c>() -> impl Parser<'a, 'c, ()>
+where
+    'c: 'a,
+{
+    /*
+     * DefBreakPoint := 0xcc
+     * TODO: there is no debugger, so this doesn't do anything. If there was, this should stop execution and enter
+     * the AML debugger.
+     */
+    opcode(opcode::DEF_BREAKPOINT_OP)
+        .then(comment_scope(DebugVerbosity::AllScopes, "DefBreakPoint", id()))
+        .discard_result()
 }
 
 fn def_if_else<'a, 'c>() -> impl Parser<'a, 'c, ()>