Skip to content

Commit

Permalink
VM SP off by one
Browse files Browse the repository at this point in the history
SP should be 262, not 261, to agree with assembler version.
see PR.
  • Loading branch information
maueroats authored Dec 27, 2024
1 parent cd2963f commit 78d08a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions projects/src/project_08/22_fibonacci_element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const vm_tst = `// This file is part of www.nand2tetris.org
load,
compare-to FibonacciElement.cmp,
set sp 261,
set sp 262,
repeat 110 {
vmstep;
Expand Down Expand Up @@ -89,10 +89,10 @@ repeat 6000 {
// Outputs the stack pointer and the value at the stack's base.
// That's where the implementation should put the return value.
output-list RAM[0]%D1.6.1 RAM[261]%D1.6.1;
output-list RAM[0]%D1.6.1 RAM[262]%D1.6.1;
output;
`;

export const cmp = `| RAM[0] |RAM[261]|
| 262 | 3 |
export const cmp = `| RAM[0] |RAM[262]|
| 263 | 3 |
`;

0 comments on commit 78d08a4

Please sign in to comment.