aboutsummaryrefslogtreecommitdiff
path: root/lib/xixanta/src/instruction.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xixanta/src/instruction.rs')
-rw-r--r--lib/xixanta/src/instruction.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/xixanta/src/instruction.rs b/lib/xixanta/src/instruction.rs
index fac6d8e..227a3e1 100644
--- a/lib/xixanta/src/instruction.rs
+++ b/lib/xixanta/src/instruction.rs
@@ -268,10 +268,50 @@ impl Encodable for Literal {
}
}
+#[derive(Debug, Clone, Eq, Ord, PartialEq, PartialOrd)]
+pub struct Fill {
+ pub value: u8,
+}
+
+impl Encodable for Fill {
+ fn size(&self) -> u8 {
+ 1
+ }
+
+ fn to_hex(&self) -> Vec<String> {
+ let mut ret = vec![];
+ ret.push(format!("{:02X}", self.value));
+
+ ret
+ }
+
+ fn to_bytes(&self) -> [u8; 3] {
+ [self.value, 0, 0]
+ }
+
+ fn to_human(&self) -> String {
+ format!("${:02X}", self.value)
+ }
+
+ fn to_verbose(&self) -> String {
+ format!("{:#?}", self)
+ }
+}
+
#[derive(Debug, Clone, PartialEq)]
pub enum Node {
Generic(Generic),
Instruction(Instruction),
Scoped(Scoped),
Literal(Literal),
+ Fill(Fill),
+}
+
+impl Node {
+ pub fn is_encodeable(&self) -> bool {
+ matches!(
+ self,
+ &Node::Instruction(_) | &Node::Literal(_) | &Node::Fill(_)
+ )
+ }
}