seems to be a difference between AM=M-1 followed by D=M and simply AMD=M-1

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

seems to be a difference between AM=M-1 followed by D=M and simply AMD=M-1

moobles
This post was updated on .
AM=M-1
D=M

is behaving differently than

AMD=M-1

don't see how they should differ....
this is my popper-maker:

[REDACTED]

if i replace
AM=M-1
D=M

with AMD=M-1

it pops the stack pointer value instead of the value at the address....
Any thoughts?
Reply | Threaded
Open this post in threaded view
|

Re: seems to be a difference between AM=M-1 followed by D=M and simply AMD=M-1

moobles
oh wait  i might get it...  is it because AMD=M-1 assigns A before updating M whereas AM=M-1 puts M at new value before the D=M?  

this stuff is confusing :(
Reply | Threaded
Open this post in threaded view
|

Re: seems to be a difference between AM=M-1 followed by D=M and simply AMD=M-1

cadet1620
Administrator
moobles wrote
AM=M-1
D=M

is behaving differently than

AMD=M-1
moobles wrote
oh wait  i might get it...  is it because AMD=M-1 assigns A before updating M whereas AM=M-1 puts M at new value before the D=M?  

this stuff is confusing :(
Yes that's correct. (Both your explanation, and that it can be confusing!)

[Please edit you post to remove the implementation of pop_to(). We want students to work out their own "pop" code.]

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: seems to be a difference between AM=M-1 followed by D=M and simply AMD=M-1

moobles
Duly edited...