CSC 205 (Assembly Language Programming) Assignment
CSC 205 (Assembly Language Programming) Assignment
ii) - Label
- opcode
- operands
- comments
iii) 1. Efficiency: Assembly language allows for fine-grained control over the
hardware, enabling programmers to write highly optimized code. It allows direct
access to registers, memory, and other low-level operations, resulting in faster
and more efficient execution.
3. Size and Speed: Assembly language programs tend to be smaller and faster
compared to programs written in higher-level languages. Since assembly
language instructions directly map to machine instructions, there is no overhead
of interpretation or translation, resulting in compact and efficient code.
5. Memory Data register(MDR): it holds the actual data being read from or
written to memory.
ii) 1. Random Access Memory (RAM): RAM is a type of primary memory that
provides temporary storage for data that the CPU needs to access quickly. It is
volatile memory, meaning its contents are lost when the power is turned off.
3a i) 8 nibbles
ii) 8 bytes
iii) 1,024 kilobytes
iv) 65,536 bytes or 64 kilobytes
v) 24,576 bytes
vi) little
vii) 0110110
viii) 9593
ii) the logical address of the data being fetched would be 2500H.
biii) The 8086 has a larger queue. The 8086 microprocessor has a queue size of
6, while the 8080 microprocessor does not have a built-in queue.
6a i) MOV CS, 23AB: In the 8088/86 assembly language, the MOV instruction
cannot be used to directly load a value into the CS (Code Segment) register. The
CS register is automatically set by the processor and cannot be modified directly.
(ii) MOV BL, AX: The MOV instruction in 8088/86 assembly language can only
move data between registers of the same size. The AX register is a 16-bit register,
while the BL register is an 8-bit register. Therefore, direct copying from AX to BL
is not possible.
(iii) MOV AL, 3CB5: The MOV instruction in 8088/86 assembly language can
only move immediate values that fit within the size of the destination register. In
this case, the immediate value 3CB5 is 16 bits, but the AL register is an 8-bit
register. Therefore, it is not possible to directly move this immediate value into AL.
(iv) MOV AX, 36DE5: The MOV instruction in 8088/86 assembly language can
only move immediate values that fit within the size of the destination register. In
this case, the immediate value 36DE5 is 20 bits, but the AX register is a 16-bit
register. Therefore, it is not possible to directly move this immediate value into
AX.
b i) To add the values 16H and ABH and store the result in register AX, you can
use the following assembly language instructions:
MOV AX, 16H
ADD AX, ABH
This will load the value 16H into AX and then add the value ABH to it.
(ii) If AX = 24F6H and the instruction "MOV [1450], AX" is executed, the contents
of the memory locations at offsets 1450 and 1451 will be:
The value in AX is stored in memory in little-endian format, so the lower byte (F6H)
is stored at offset 1450 and the higher byte (24H) is stored at offset 1451.
(iii) Assuming DS = 1120, SI = 2498, and AX = 17FE, the execution of the
instruction "MOV [SI], AX" will store the contents of AX (17FE) in the memory
location pointed to by SI (2498). Therefore, the contents of the memory location
at offset 2498 will be:
PUSH BX:
- SP = 1232
- Contents of memory at SP: C2H
- Contents of memory at SP-1: 85H
PUSH DX:
- SP = 1230
- Contents of memory at SP: 93H
- Contents of memory at SP-1: 5FH
(b) i) -9
ii) 6
iii) 16
iv) -6
8a) i) Carry flag (CF): This flag is set when an arithmetic operation generates a
carry or borrow. It is used for multi-byte arithmetic and bitwise operations.
(ii) Parity flag (PF): This flag indicates the parity (even or odd) of the least
significant byte of the result. It is used for error detection and data integrity checks.
(iii) Auxiliary Carry flag (AF): This flag is used for binary-coded decimal (BCD)
arithmetic operations.
(iv) Zero flag (ZF): This flag is set when the result of an operation is zero. It is
used for conditional jumps and comparisons.
- CF: Set if the result of the addition generates a carry, otherwise cleared
- PF: Set if the lower 8 bits of the result have an even number of set bits,
otherwise cleared
- AF: Set if the addition generates a carry from bit 3 to bit 4, otherwise cleared
- ZF: Set if the result is zero, otherwise cleared
- SF: Set if the result is negative (MSB is 1), otherwise cleared
9 i) 175910
ii) 0.0112
iii) 23410
iv) 1101101102
v) 1001002
vi) 51.7510
vii) 1010011000112
viii) 2210
ix) 5BA16
x) 1A916
xi) 3D16
xii) 1010102
xiii) 0.1001001012
xiv) 59.62510
xv) 6514810
Therefore, the physical address of the memory location is 18638H, and it's content
are 99H
bi) 1. ADD AX, BX: This instruction adds the contents of the BX register to the
AX register and stores the result in the AX register.
2. ADD AX, [BX]: This instruction adds the value at the memory location pointed
to by the Bx register to the Ax register and stores the result in the Ax register.
11a Given:
DS = 4500H
SS = 2000H
BX = 2100H
SI = 1486H
BP = 7814H
AX = 2512H
Therefore, the exact physical memory locations where AX is stored in each of the
instructions are:
(i) MOV [BP] + 12, AX: 52826H
(ii) MOV [SI] + 10, AX: 46496H
(iii) MOV [BX] + 20, AX: 47120H