|
|
|
|
Back to dictionaryAn immediate value is a numerical quantity hard coded into the program. It can be in either hex, decimal, or binary. An example of each follows.
Decimal
| Code: | | ADD R1, R1, #1 ;decimal value |
Hexadecimal
| Code: | | ADD R1, R1, x1 ;hex value of 1 |
Binary
| Code: | | ADD R1, R1, b0001 ;binary value of 1 |
Immediate values are used in almost every type of calculation, from zeroing out a register (AND R1, R1, #0), testing a register (AND R1, R1, #-1) and incrementing registers (ADD R1, R1, #1), just to name a few.
In addition to being either decimal, hex, or binary, immediate values are a certain size. They are usually referred to as immX, where X is the number of bits that the immediate value is made of. For example, a imm9 value is 9 bits long, able to represent 2^9 (512) distinct numbers, or from -255 to 256.
Trying to put a number that cannot be represented in the number of bits for that immediate value is a compile error.
Find more about immediate value in these tutorials: Basic LC-3 Instructions Subtraction
|
|