[-] More question+mistake in PS 5
by ofirhau - Thursday, 28 April 2016 16:06:59
1. "Note that all operands are implicit, i.e. they are popped from the stack, and not specified in the command line. "-

I understand that we don't get the operands in the command line. We get them in run time.
But what do you mean by "popped from the stack"?  maybe you meant that the "popped" part relates to the number (or numbers, depends on operand) we pop from stack?

For example, if we got '+', we pop two top numbers of the stack, compute <number1>+<number2>, and push this result to the stack.
We don't pop '+' from the stack (as it seems from the line I quoted), we just pop the numbers...

2. calculator functions, as well as input and output functions, must be programmed as procedures (subroutines) ”-
You mean that we must define a function for each operand?
I.e., if we are at my_calc and want to perform '+' - we will call a function (with "call" command to assmebly function we implemented) that does that.
Is it ok to use jmp and labels instead of functions? we will get less coding in this way, and the program will do the same

3. I think you have a mistake at slide 26 at practical session 5. You wrote that 123456&1885=121004, but 123456&1885= 1004.
In the linked list you draw at the bottom of this slide, you indeed wrote 1004.
So am I right? the answer here is 1004?
[-] Re: More question+mistake in PS 5
by shaera - Friday, 29 April 2016 10:38:29
1. Only the arguments are saved in the stack.
2. You need to call via "call", and by the 'c convention'.
3. I will check it later, thanks.
Re: More question+mistake in PS 5
by ofirhau - Sunday, 1 May 2016 02:29:14
1. When you write "arguments"- you mean numbers?
2. What do you mean by 'c convention'?


[-] Re: More question+mistake in PS 5
by shimony - Tuesday, 3 May 2016 11:07:12
There seems to be some confusion about terminology here!

"+" is an OPERATOR, not an OPERAND.
OPERATORS are simply APPLIED IMMEDIATELY, and
NOT stored anywhere. That is the whole point of an RPN calculator!

There should be a function ("procedure") for each OPERATOR.
As this is ASSEMBLY LANGUAGE, the definition of a function is
less clear, but what is needed is some piece of code from which
you "ret"urn. That actually does not necessarily preclude using
a "jmp", but makes it a bit tricky if you do.

Slide 26: dunno, not mine...

Re: More question+mistake in PS 5
by sadetsky - Saturday, 7 May 2016 12:28:55
Slide 26: right , fixed, thanks