diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-10-29 13:46:17 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-12-12 07:52:35 +0100 |
| commit | 116361d94073fb4628a5a4728a2a6acacefe606d (patch) | |
| tree | 6d85807e8534fdb1a93c6132047b7301e4e1e039 /lib/xixanta/src/node.rs | |
| parent | d492aa8271f9fb02351b1144733508194df67746 (diff) | |
| download | tools.nes-116361d94073fb4628a5a4728a2a6acacefe606d.tar.gz tools.nes-116361d94073fb4628a5a4728a2a6acacefe606d.zip | |
Initial support for branching
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'lib/xixanta/src/node.rs')
| -rw-r--r-- | lib/xixanta/src/node.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/xixanta/src/node.rs b/lib/xixanta/src/node.rs index f55ca11..a28d625 100644 --- a/lib/xixanta/src/node.rs +++ b/lib/xixanta/src/node.rs @@ -164,3 +164,17 @@ pub struct PNode { /// optional arguments. pub args: Option<Vec<PNode>>, } + +impl PNode { + pub fn is_branch(&self) -> bool { + if self.node_type != NodeType::Instruction { + return false; + } + + let opcode = self.value.value.to_lowercase(); + matches!( + opcode.as_str(), + "bcc" | "bcs" | "beq" | "bmi" | "bne" | "bpl" | "bvc" | "bvs" + ) + } +} |
