Fill in the blanks with the appropriate addressing mode name
Solution
a) 80x1234 - indexed mode
&var - absolute mode
R10 - register mode
var(R10) - symbolic mode.
b) preprocessor macros are used to define symbolic constants. to define macros we can use #define.
#define MAX_STUDENTS_PER_CLASS 30
#define MAX_NAME_LENGTH 30
But a better way to create symbolic constants is through use of const variables:
const int maxStudentsPerClass { 30 };
const int maxNameLength { 30 };
They are usually defined at the beginning of the program. The symbolic constants may then appear later in the program in place of the numeric constants, character constants, etc., that the symbolic constants represent.
c) The MSP430G2553 cpu contains 16 16-bit registers, of which 4 are dedicated to special purposes: R0 is the program counter, R1 is the stack pointer, R2 is the status register, and R3 is a special register called the constant generator, providing access to 6 commonly used constant values without requiring an additional operand. R3 always reads as 0 and writes to it are ignored.
R4 through R15 are available for general purpose i.e 12 registers are for general purpose.
The status register is a special purpose register. In MSP430G2553 cpu R2 is considered as the status register.The status register is a hardware register that contains information about the state of the processor. Individual bits are implicitly or explicitly read and/or written by the machine code instructions executing on the processor. The status register lets an instruction take action contingent on the outcome of a previous instruction.
The program counter (PC), commonly called the instruction pointer (IP) is a processor register that indicates where a computer is in its program sequence.
It is one of the special purpose register which is incremented after fetching an instruction, and holds the memory address of the next instruction that would be executed. In a processor where the incrementation precedes the fetch, the PC points to the current instruction being executed.
