In order for developers to be able to run code (to develop and debug the virtual machine, the scheduler, etc.), a small assembler was developed. This assembler translates a pseudo-assembly language into TONS bytecode, that can be executed by the TONS daemon.
A small program that calculates the n'th Fibonacci number, looks like:
;;
;; Fibonacci caluclator
;;
;; f(n) = f(n-1)+f(n-2) if n > 2
;; = n otherwise
;;
entry "fib"
decl integer, ; r0
integer, ; r1
integer, ; r2
integer ; r3
cmpgt r0, a0, 2
branch r0
move r1, a0
decr r1
call r2, "fib", r1
decr r1
call r3, "fib", r1
add r2, r3
return r2
else
return a0
end
end
This snippet should give you an idea about what the TASM language is
like. This is for developers only. It is possible to crash
the TONS daemon by writing malicious code, and the language is far
too inconvenient for any user to be troubled with.The TONS project is hosted by Skåne Sjælland Linux User Group.
This page was last modified by Kenneth Geisshirt March 28, 1999.