BasicTest

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

BasicTest

ngdrummer
Alright, so I'm having problems with this one because there is a pop to local 0 before local is initiated with any base value, so it ends up popping the 10 from the stack onto RAM[0] since local has zero, plus 0 from pop local 0. I did notice that all pops to local are pop local 0 in this test.

Are we to assume that local only ever stores values in the local register (i.e. RAM[1]) and do not act as though they say in the book, when it says that all calls to local, argument, this, that are supposed to use the base value + whatever integer on top as the memory address?

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: BasicTest

cadet1620
Administrator
ngdrummer wrote
Alright, so I'm having problems with this one because there is a pop to local 0 before local is initiated with any base value, so it ends up popping the 10 from the stack onto RAM[0] since local has zero, plus 0 from pop local 0. I did notice that all pops to local are pop local 0 in this test.
You must run your generated code using BasicTest.tst.  Before running your code, BasicTest.tst does:
set RAM[0] 256,
set RAM[1] 300,
set RAM[2] 400,
set RAM[3] 3000,
set RAM[4] 3010,
so that all the segment pointers have values.
Are we to assume that local only ever stores values in the local register (i.e. RAM[1]) and do not act as though they say in the book, when it says that all calls to local, argument, this, that are supposed to use the base value + whatever integer on top as the memory address?
local works as described in the book.  "local n" refers to RAM[RAM[1]+n].

--Mark