THE UNIVERSITY OF ZAMBIA
SCHOOL OF ENGINEERING
DEPARTMENT OF ELECTRICAL AND ELECTRONICS
ASSIGNMENT 2
NAME: BANDA DENNIS
COMPUTER NUMBER: 2021471080
COURSE: EEE 3132
ATTENTION: DR PHIRI
1.
MOV AX, 2000H
MOV DS, AX
MOV AL, [0500H]
ADD AL, [0600H]
MOV [0700H], AL
HLT
2.
1) Immediate Addressing - Operand is part of the instruction. e.g. MOV AX, 1234H
2) Register Addressing - Operand is a register. e.g. MOV AX, BX
3) Direct Addressing - Memory address is given directly. e.g. MOV AL, [1234H]
4) Register Indirect Addressing- Address is in a register (BX, BP, etc). e.g. MOV AL, [BX]
5) Indexed Addressing - Uses SI or DI as index. e.g. MOV AL, [SI]
6) Base + Index Addressing - Combines base and index. e.g. MOV AL, [BX + SI]
7) Relative Addressing - Used in jumps (offset from IP). e.g. JMP LABEL
8) Based Indexed + Displacement- Base + Index + Offset. e.g. MOV AL, [BX + SI +10H]
3.
1) Data Transfer Instructions - MOV, PUSH, POP
2) Arithmetic Instructions - ADD, SUB, MUL, DIV
3) Bit Manipulation Instructions - AND, OR, XOR, NOT
4) String Instructions - MOVS, CMPS, SCAS
5) Control Transfer Instructions - JMP, CALL, RET, LOOP
6) Processor Control - HLT, NOP, WAIT, STC
7) Logical Instructions - TEST, CMP
8) Flag Manipulation - STC, CLC, CMC
4.
Writing low-level code using mnemonics that correspond to machine instructions.
It allows direct control of hardware and is specific to the processor architecture.
5.
Physical Address = (SS × 10H) + SP
6.
Macros are code templates that are expanded during assembly.
They simplify repetitive tasks and are inlined, unlike procedures.
7.
MOV BX, 1234H ; Load BX with initial value
INC BX ; Increment BX without affecting AX
8.
Using the macro multiple times will cause label redefinition errors
because the assembler sees the same label multiple times.
9.
MOV AL, 5AH ; Load 8-bit constant into AL
MOV AX, 5A5AH ; Load 16-bit constant into AX
10.
PROC marks the beginning of a procedure.
ENDP marks the end of the procedure.
MyProc PROC
MyProc ENDP
11. Based Indexed with Displacement Addressing Mode.
12.
Type 0 - Divide Error
Type 1 - Single Step
Type 2 - NMI (Non-Maskable Interrupt)
Type 3 - Breakpoint
Type 4 - Overflow
Type 5-255 - Software/User-defined interrupts
13.
Physical Address = (4000H × 10H) + 43A2H = 443A2H
Maximum size of data segment = 64 KB (0000H to FFFFH)
14.
Physical Address = (1085H × 10H) + 4537H = 10850H + 4537H = 14D87H
15.
INT 3 ; This is a software breakpoint interrupt (Type 3).
; Useful for halting program during debugging.