DEST instruction with A and M

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

DEST instruction with A and M

Glen Oakley
There are two DEST possibilities that contain both A and M (AM and AMD).  I have not seen either of these used before.  If someone were to specify one of these as a destination, would the value be stored in memory address A (BEFORE the calculation) or address A (AFTER the calculation)?  I'm not sure how to explain this better, so here is a sample of what I mean:

@14
DM=A // M[14] = 14, D = 14
AM=D-1 // A = 13, M[???] = 13
// is the value of M[14] still 14, or is it 13?
// is the value of M[13] what it was prior to the operation, or is it 13?
Reply | Threaded
Open this post in threaded view
|

Re: DEST instruction with A and M

cadet1620
Administrator
Glen Oakley wrote
There are two DEST possibilities that contain both A and M (AM and AMD).  I have not seen either of these used before.  If someone were to specify one of these as a destination, would the value be stored in memory address A (BEFORE the calculation) or address A (AFTER the calculation)?  I'm not sure how to explain this better, so here is a sample of what I mean:

@14
DM=A // M[14] = 14, D = 14
AM=D-1 // A = 13, M[???] = 13
// is the value of M[14] still 14, or is it 13?
// is the value of M[13] what it was prior to the operation, or is it 13?
M[14] = 13, M[13] unchanged.

See this post.

You'll find AM=M+1 and AM=M-1 quite useful in project 7.

There is a related thread, Question regarding PC and ARegister, that talks about what happens with an instruction like A=M;JMP.

--Mark