Machine Instructions

There are several fields which may be present in an instruction. Additionally, there are a few easy-to-learn generalities which will make understanding what an instruction does much easier. Data definitions will not be covered here. There are many fields possibly present in an instruction.

The label is optional, but must be first. It is followed by a colon. It is used so the programmer can refer to the instruction symbolically. A label does not require an instruction.

Labels which are 'Public' become symbols at link time.

It defines what operation will be attempted, and therefore what operands need to be specified. Instructions have zero to three specified operands; many instructions also imply operands. The first operand is always the result, or target, of the operation.

An operand may be a value, a register, or storage. When the operand is a value, it is called 'immediate', because the operand is immediately available if the instruction has been fetched. When a register is named, it is the operand. If an expression is contained in brackets, it is evaluated and the result is used as a offset into some segment.

A storage operand is in some segment by default. Data references default to the data segment, or DS, unless (E)BP or (E)SP are present in the address expression. In this case, the default segment is the stack segment (SS). (E)IP is ALWAYS in the CODE segment (instructions). (E)SP is ALWAYS in the STACK segment (data). (E)BP is USUALLY in the STACK segment (data).

The default segment can usually be overridden by specifying the selector as part of the address, for example, DS:[BP+8].

You will come across helper words within operands, such as "byte", "word", and "dword" which are there to remind you of the size of the data item referenced. You will also come across the helper word "ptr", which is to remind you that the addressed data is in storage, and that the offset, in brackets, is a pointer to the data.

A comment is preceeded by a semicolon. Anything following is a comment. Comments are sparse in the output of the 'Unassemble' command.

The debug kernel will use a comment to identify a breakpoint.

Both the debug kernel and the dump formatter will supply a symbol anytime a number matches the symbol in an active file.


[Back: General Registers]
[Next: Typical Instructions]