From ed5e3453b0d6789711824a7b8588131a63227c1f Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Sun, 12 May 2024 04:38:02 +0200 Subject: [PATCH] assembler: add call_symobl() --- src/assembler.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/assembler.rs b/src/assembler.rs index 4e1f560..3664a0e 100644 --- a/src/assembler.rs +++ b/src/assembler.rs @@ -96,6 +96,18 @@ impl Assembler { self } + pub fn call_symbol(mut self, addr: LinkAddr) -> Assembler { + self.words.push( AssemblyWord::inst(VM_Instruction::Call) ); + self.words.push( AssemblyWord::Symbol(addr) ); + self + } + + pub fn ref_symbol(mut self, addr: LinkAddr) -> Assembler { + self.words.push( AssemblyWord::inst(VM_Instruction::Lit) ); + self.words.push( AssemblyWord::Symbol(addr) ); + self + } + pub fn call(mut self, s: &str) -> Assembler { self.words.push( AssemblyWord::inst(VM_Instruction::Call) ); self.words.push( AssemblyWord::symbol(s) );