mirror of
https://github.com/janet-lang/janet
synced 2025-01-12 00:20:26 +00:00
Fix assembly example
This commit is contained in:
parent
2891d2b260
commit
e33e182eb0
@ -1,10 +1,10 @@
|
||||
# Example of dst bytecode assembly
|
||||
|
||||
# Fibonacci sequence, implemented with naive recursion.
|
||||
(def fibasm (asm '{
|
||||
arity 1
|
||||
bytecode [
|
||||
(ltim 1 0 0x2) # $1 = $0 < 2
|
||||
(def fibasm
|
||||
(asm
|
||||
'{:arity 1
|
||||
:bytecode @[(ltim 1 0 0x2) # $1 = $0 < 2
|
||||
(jmpif 1 :done) # if ($1) goto :done
|
||||
(lds 1) # $1 = self
|
||||
(addim 0 0 -0x1) # $0 = $0 - 1
|
||||
@ -16,8 +16,7 @@
|
||||
(add 0 0 2) # $0 = $0 + $2 (integers)
|
||||
:done
|
||||
(ret 0) # return $0
|
||||
]
|
||||
}))
|
||||
]}))
|
||||
|
||||
# Test it
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user