Files
eceg431/08/ProgramFlow/FibonacciSeries/FibonacciSeries.tst

29 lines
960 B
Scilab

// 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/ProgramFlow/FibonacciSeries/FibonacciSeries.tst
// Tests FibonacciSeries.asm on the CPU emulator.
// Before executing the code, initializes the stack pointer
// and the base addresses of the local and argument segments,
// and sets argument[0] and argument [1].
load FibonacciSeries.asm,
output-file FibonacciSeries.out,
compare-to FibonacciSeries.cmp,
set RAM[0] 256, // SP
set RAM[1] 300, // LCL
set RAM[2] 400, // ARG
set RAM[400] 6, // argument[0], n
set RAM[401] 3000, // argument[1], base address of the generated series
repeat 1100 {
ticktock;
}
// Outputs the series of values generated and written by the code.
output-list RAM[3000]%D1.6.2 RAM[3001]%D1.6.2 RAM[3002]%D1.6.2
RAM[3003]%D1.6.2 RAM[3004]%D1.6.2 RAM[3005]%D1.6.2;
output;