mirror of
https://github.com/soconnor0919/eceg431.git
synced 2025-12-12 07:04:43 -05:00
project08 template files
This commit is contained in:
18
08/FunctionCalls/FibonacciElement/Sys.vm
Normal file
18
08/FunctionCalls/FibonacciElement/Sys.vm
Normal file
@@ -0,0 +1,18 @@
|
||||
// This file is part of www.nand2tetris.org
|
||||
// and the book "The Elements of Computing Systems"
|
||||
// by Nisan and Schocken, MIT Press.
|
||||
// File name: projects/8/FunctionCalls/FibonacciElement/Sys.vm
|
||||
|
||||
// Containts one function: Sys.init.
|
||||
|
||||
// Pushes a constant n onto the stack, and calls the Main.fibonacii
|
||||
// function, which computes the n'th element of the Fibonacci series.
|
||||
// Note that by convention, the Sys.init function is called "automatically"
|
||||
// by the bootstrap code generated by the VM translator.
|
||||
function Sys.init 0
|
||||
// Computes fibonacci(4)
|
||||
push constant 4
|
||||
// Calls the function, informing that one argument was pushed onto the stack
|
||||
call Main.fibonacci 1
|
||||
label END
|
||||
goto END // loops infinitely
|
||||
Reference in New Issue
Block a user