What really @value means?

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

What really @value means?

sk
Hello world,
in unit 4.3 from 7:24 min (video) with @21  two things happen. 1. A register is set to 21. 2. MEM[21] becomes the selected RAM register.(In case of A-Instruction).

From 13:58 min
 @58
D-1;JEQ

// if (D-1 == 0) jump to execute the instruction stored in ROM[58]

Is it not a double meanning? Or I think of the Meannings are true.

Best regards
Reply | Threaded
Open this post in threaded view
|

Re: What really @value means?

cadet1620
Administrator
Only one thing directly happens when an @21 instruction executes: the A register is set to 21.
The value in the A register has two side-effects.

One side-effect is that when an instruction uses the M "register" it accesses RAM using the address in the A register.  For example @21 followed by D=M will read RAM[21] into the D register. This side-effect is what is being referred to as "the selected RAM register".

The other side-effect is that any instruction that jumps will use the address in the A register as the destination address for the jump.  For example @21 followed by 0;JMP will cause the next instruction to be read from ROM[21].

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

Re: What really @value means?

sk
Thanks! Convenient enough.