Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nand 2 tetris ASM "Expression Expected"

I am currently trying to finish off the project found in Chapter 4 of the Nand to Tetris course (Fill.asm). However, Assembler is giving me the following error:

"In line 3, Expression Expected"

I'm not sure what I'm doing wrong... but below is the snippet of code I have:

@i
M=1
@sum
M=8192
(END)
@END
0,JMP

Can anyone tell me why I'm getting this error on Line 3 (@sum)?

like image 944
user1867675 Avatar asked Oct 27 '25 08:10

user1867675


1 Answers

I don't know why an error is showing up on line 3, but you can't directly set a value to a memory address on line 4. You can force a "1" out of the ALU like on line 2, but there is no way of forcing an "8192" out of it without first inputting it. You must first assign the value of "8192" to the A-register, then store the A-register to the D-register, then select the memory address, then store the D-register there.

like image 194
Hobadee Avatar answered Oct 28 '25 22:10

Hobadee