and/neg operations
Posted by ngdrummer on Mar 14, 2014; 12:28am
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/and-neg-operations-tp4027912.html
So I'm working on my VM translator for project 7, and getting through the SimpleAdd was a breeze, but now that I'm trying the stack test, I'm running into an interesting error. I'm getting an error from the CPU Emulator saying "In line 274, Expression Expected", so I did some digging.
In the StackTest.vm, the following lines occur:
push constant 57
push constant 31
push constant 53
add
push constant 112
sub
neg
and
but doesnt neg just give the negative value of the current constant? or am I misunderstanding what neg really means? I'm confused because and seems like an operation that can only be executed on true or false, as I have it set up to give, however, with non 0 or -1 constants, how does and work?
Thanks