Need help in reading the C instruction specification

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

Need help in reading the C instruction specification

lightning_missile
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Need help in reading the C instruction specification

rleininger
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Need help in reading the C instruction specification

lightning_missile
The snip you posted is totally unreadable. Perhaps this is an image?
Reply | Threaded
Open this post in threaded view
|

Re: Need help in reading the C instruction specification

rleininger
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Need help in reading the C instruction specification

lightning_missile
I am unable to read the png file you posted because I am using a screen reader (https://www.nvaccess.org/), and screen readers cannot read images.

Looking at the wikipedia table now, this seems unusual
Reply | Threaded
Open this post in threaded view
|

Re: Need help in reading the C instruction specification

rleininger
I apologize for not understanding what you were telling me.  I have learned and important lesson today.

The Hack assembly language can interpret how it uses the 6-bit instruction code based on the value of the instruction bit designated "a".  The are 18 basic C-instructions.  For some of these, the ALU requires no operands.  For some instructions, a single operand is required.  For example, negating an integer value. For some, two operands are needed.  Example, adding two numbers.

Where one operand is required, there are three possibilities:  the operand is the value contained in the D register or the operand is the value contained in the A register or the operand in the value contained the the RAM location whose address is the value contained in the A register.  In Hack mnemonic code, this last case is denoted by pseudo-register M.

The bit value of "a" tells the CPU whether to use the A register value or the value denoted by pseudo-register M as a operand in a computation.  If "a" equals zero, the value in A register is used.  If "a" equals 1, the value references by M is used.

If no operand is required by the ALU to perform a computation, the "a" bit is set to zero.  Three machine language instructions require no operand.

For instructions that require only one operand, the machine code bit patterns are different for using D register or using either A register or M.  In this case the "a" bit determined which as previously described.

When two operands are used, on of these is always the D register.  The other is determined by the "a" bit.

For example, to add two integers, the machine code bit pattern is zero-zero-zero-zero-one-zero.  If the "a" bit is zero, the ALU emits the sum of D register and A register.  If the "a" bit is one, the ALU emits the sum of the D register and the M pseudo-register.

If this last part seems to work, let me know and I'll convert the whole table this way.