From 7822c00e8689c99ded0a360026f4e7ace1f2c87f Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 16 Jul 2024 11:12:26 +0200 Subject: Add support for branching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a bare bones implementation of it, and there's a lot of nuance that it's being missed, but at least the fundamentals have been implemented already. Signed-off-by: Miquel Sabaté Solà --- lib/xixanta/src/instruction.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'lib/xixanta/src/instruction.rs') diff --git a/lib/xixanta/src/instruction.rs b/lib/xixanta/src/instruction.rs index 227a3e1..c635644 100644 --- a/lib/xixanta/src/instruction.rs +++ b/lib/xixanta/src/instruction.rs @@ -112,8 +112,10 @@ pub struct Instruction { pub left: Option, pub right: Option, pub mode: AddressingMode, - pub cycles: u8, - pub affected_on_page: bool, + pub cycles: u8, // NOTE: relative addressing makes this runtime-dependant (if branch is taken, then +1 cycle to the base cycle here). + pub affected_on_page: bool, // TODO: needed? + pub address: u16, + pub resolved: bool, } impl Instruction { @@ -128,6 +130,8 @@ impl Instruction { mode: AddressingMode::Unknown, cycles: 0, affected_on_page: false, + address: 0, + resolved: true, } } @@ -142,6 +146,8 @@ impl Instruction { mode: AddressingMode::Unknown, cycles: 0, affected_on_page: false, + address: 0, + resolved: true, } } } @@ -298,6 +304,11 @@ impl Encodable for Fill { } } +#[derive(Debug, Clone, PartialEq)] +pub struct Label { + pub value: String, +} + #[derive(Debug, Clone, PartialEq)] pub enum Node { Generic(Generic), @@ -305,6 +316,7 @@ pub enum Node { Scoped(Scoped), Literal(Literal), Fill(Fill), + Label(Label), } impl Node { -- cgit v1.2.3