Assembly Language Program
Assembly Language Program
Assembly Language Program
2. List and describe addressing modes types with 1 example for each type.
A. Immediate Addressing:
B. Direct Addressing:
C. Register Addressing:
E. Indexed Addressing:
G. Auto-Increment/Decrement Addressing:
H. Implicit Addressing:
I. Relative Addressing:
* Purpose: Move data between registers, memory locations, and I/O ports.
* Examples:
- MOV AX, BX (moves the value in register BX to register AX)
- MOV [1000h], CX (moves the value in register CX to memory address
1000h)
- IN AL, 60h (reads a byte from I/O port 60h into register AL)
- OUT 40h, DX (sends a byte from register DX to I/O port 40h)
Arithmetic Instructions:
Logical Instructions:
Additional Insights:
Shift Instructions:
* Move bits to the left or right within a register or memory location.
* Types:
- Logical Shifts:
* Bits shifted out are discarded.
* Bits shifted in are zeros.
* Used for unsigned numbers.
- Arithmetic Shifts:
* Bits shifted out are discarded.
* Bits shifted in are copies of the original sign bit.
* Preserves the sign of signed numbers.
Rotate Instructions:
Examples:
Logical Shift Left (LSL):
DS= 2102h
Offset= 481
Logical Address= 2102:481
Physical Address= 2180h
_
DS:
Value: Unknown
Reason: The code doesn't explicitly set the DS register. Its value depends on
previous instructions or assembly context.
Offset:
In MOV [0018h], 0005h: 0018h (decimal 24)
In MOV AX, [BX+022h]: 022h (decimal 34)
Logical Addresses:
MOV [0018h], 0005h: Depends on DS value. If DS were 1000h, it would be
1000:0018h.
MOV AX, [BX+022h]: Depends on DS and BX values. If DS were 1000h, BX
were 0010h, it would be 1000:0032h.
Physical Addresses:
Cannot be determined without knowing DS
DS:
- Value: Unknown (not explicitly set in the code)
- For this analysis, let's assume DS = 1000h (hypothetical)
Offsets:
- MOV [0022h], 0100h: Offset is 0022h (decimal 34).
- MOV SI, 0013h: No memory access, so no offset.
- MOV AX, [SI + 012h]: Offset is 025h (calculated as 013h + 012h).
Logical Addresses:
- MOV [0022h], 0100h: 1000:0022h
- MOV AX, [SI + 012h]: 1000:0025h
Physical Addresses:
- MOV [0022h], 0100h: 10220h (calculated as 1000h * 10h + 0022h)
- MOV AX, [SI + 012h]: 10250h (calculated as 1000h * 10h + 0025h)
DS:
- Value: Unknown (not explicitly set in the code)
- For this analysis, let's assume DS = 1000h (hypothetical)
Offsets:
- MOV [0033h], 0110h: Offset is 0033h.
- MOV SI, 0011h: No memory access, so no offset.
- MOV BX, 0013h: No memory access, so no offset.
- MOV AX, [BX + SI + 012h]: Offset is 036h (calculated as 0013h + 0011h +
012h).
Logical Addresses:
- MOV [0033h], 0110h: 1000:0033h
- MOV AX, [BX + SI + 012h]: 1000:0036h
Physical Addresses:
- MOV [0033h], 0110h: 10330h (calculated as 1000h * 10h + 0033h)
- MOV AX, [BX + SI + 012h]: 10360h (calculated as 1000h * 10h + 0036h)