ASSIGNMENT 02
DUE DATE: 22 July 2024
UNIQUE NUMBER: 791452
, QUESTION 1
Part (a)
Given the memory
1. LOAD IMMEDIATE 20
o This instruction loads the immediate value 20 directly into the
accumulator.
o Accumulator = 20
2. LOAD DIRECT 20
o This instruction loads the value from the memory address specified
directly (address 20) into the accumulator.
o Memory address 20 contains the value 30.
o Accumulator = 30
3. LOAD INDIRECT 20
o This instruction first retrieves the value stored at the memory address
specified (address 20), which is 30. This value is then used as the
address to load the final value into the accumulator.
o Memory address 20 contains the value 30.
o Memory address 30 contains the value 40.
o Accumulator = 40
Part (b)
Examples of Intel x86 instructions using various addressing modes:
1. Immediate Addressing
o The operand is specified explicitly in the instruction.
o Example: MOV AX, 5
▪ This moves the immediate value 5 into the AX register.
2. Direct Addressing
o The operand's address is given directly in the instruction.
o Example: MOV AX, [1234h]
▪ This moves the value at memory address 1234h into the AX
register.
3. Stack Addressing
o Operands are implied to be on the stack, typically using the stack
pointer.
o Example: PUSH AX
▪ This pushes the contents of the AX register onto the stack.
o Example: POP BX
▪ This pops the top value from the stack into the BX register.
4. Indexed Addressing
o The operand's address is determined by adding a constant value to the
contents of an index register.
o Example: MOV AX, [BX+SI]
▪ This moves the value from the address obtained by adding the
contents of BX and SI into the AX register.
5. Base-Addressing