Fields

A field corresponds to a certain number of bits of a machine instruction. The first field of an instruction stores the opcode of the instruction. The remaining fields include the operands of the instruction. There can also be 0-bit fields, which just correspond to punctuation in the instructional format.

Parameters:

Examples:


Figure 23. The dialog for editing the fields of machine instructions.

Consider the fields shown in Figure 23 above. Assume that the "reg" field has a set of three values associated with it: A=2, B=3, and C=4. Also, assume that the three punctuation characters '[' and ']' and ',' are individual character tokens (see the discussion of tokens for information on setting the token usage of punctuation characters). Now consider two machine instructions with names "foo" and "bar" with opcodes 0 and 1 and the following respective formats:

    op reg, reg un6
    op un6 delta[reg]
These instructions can be called in assembly language as shown in these examples:
    foo B C
    foo B, C
    bar -2[A]
and will be assembled into the following bits (with spaces inserted to indicate the separate fields):
    0000 011 100 000101
    0000 011 100 000101
    0001 000101 110 010

Note that the delta value of -2 is converted to binary using 3-bit 2's complement notation.

If the three punctuation characters '[', ']', and ',' are not individual tokens and instead form parts of symbols, then you need to separate them from neighboring characters in instruction calls to avoid ambiguity or incorrect parsing. For example, you would need to write

    foo B C
    foo B , C
    bar -2[ A ]

Notes: