Understanding the Assembler Implementation

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

Understanding the Assembler Implementation

Jorge Bendahan
Hi, I'm making the hack assembler implementation in C Sharp and I'm trying to understand the C-instrution -> dest=comp;jump

//Either the dest or jump fields may be ommited.
// If dest is empty, the "=" is omitted;
// If jump is empty the ";" is omitted.

I'm failing to see in what cases you can code a full dest=comp;jump instruction. I'm just familiar with the following:

Ex 1. D=M (Where D is the "DEST" part of the instruction and M is "COMP" and there is no "JUMP")
Ex 2 D;JGT (where D is "COMP" and JGT is "JUMP" and there is no "DEST")

Can you write something like D=M;JGT?


Reply | Threaded
Open this post in threaded view
|

Re: Understanding the Assembler Implementation

cadet1620
Administrator
Can you write something like D=M;JGT?
Yes, D=M;JGT is legal, but not too useful.  RAM[A] is copied to D and if RAM[A] >= 0, A is loaded into the PC.

More useful might be:
    @LOOP
    D=D-1;JGT

--Mark