Professional Documents
Culture Documents
CSC Ass
CSC Ass
(b)
(i) Four problems of machine language leading to the development of assembly language are:
1. Difficulty in programming and understanding.
2. Lack of portability.
3. Error-prone due to binary representation.
4. Tedious and time-consuming programming process.
(ii) Three major types of language translator in computing are:
1. Assemblers: Translate assembly language code to machine language.
2. Compilers: Translate high-level language code to machine language.
3. Interpreters: Execute high-level language code directly without translation.
. (a)
. (i) Registers in the Central Processing Unit (CPU) are small, fast storage locations within
the CPU used to store data temporarily during processing.
. (ii) Functions of five important registers in the CPU:
. 1. Instruction Pointer (IP): Stores the address of the next instruction to be executed.
. 2. Accumulator (AX): Stores the results of arithmetic and logic operations.
. 3. Base Pointer (BP): Used for referencing parameters and local variables in procedures.
. 4. Stack Pointer (SP): Points to the top of the stack and is used for managing function calls
and local variables.
. 5. Status Register (FLAGS): Stores status information such as carry, zero, sign flags, etc.
(b)
1
2
. (i) Differences between Complex Instruction Set Computer (CISC) and Reduced Instruction
1
1
Set Computer (RISC):
. 1. CISC: Emphasizes complex instructions that can perform multiple low-level operations in
1
0
a single instruction.
. RISC: Emphasizes a simpler instruction set with fewer instructions, each performing a
single operation.
. 2. CISC typically has variable-length instructions.
. RISC typically has fixed-length instructions.
. 3. CISC often has microcode control.
. RISC uses hardwired control.
. 4. CISC instructions may have different execution times.
. RISC instructions are uniform in execution time.
. 5. CISC tends to have more addressing modes.
. RISC tends to have fewer addressing modes.
. (ii) Two types of primary memory are:
. 1. Random Access Memory (RAM): Volatile memory used for temporary storage of data
and program instructions.
. 2. Read-Only Memory (ROM): Non-volatile memory that stores firmware instructions and
data that do not change during normal operation.
3. (a)
(i) 32 bits contain 4 nibbles.
(ii) 64 bits contain 8 bytes.
(iii) 1 gigabyte is equal to 1024 megabytes, so 1 gigabyte is equal to 1024 * 1024 kilobytes,
which is 1048576 kilobytes.
(iv) With 16 address lines, the computer can access \(2^{16}\) memory locations, which is 64K
(kilobytes) of memory.
(v) 24 kilobytes is equal to \(24 \times 1024\) bytes, which is 24576 bytes.
(vi) Intel data representation format is based on little endian.
(vii) The 2's complement of 1001010 is 0110110.
(viii) The 2's complement of 6A3D1 is 9592F.
(b)
(i) Given DS = 3499H and offset = 2500H:
(i) The physical address = DS:offset = 3499H:2500H = 5999H.
(ii) The logical address of the data being fetched = offset = 2500H.
(iii) The lower range of the data segment = DS = 3499H.
(iv) The upper range of the data segment = DS + segment size - 1 = 3499H + 64KB - 1 =
3499H + FFFFH = 12498H.
4. (a)
(i) A system bus is a communication system that transfers data between components inside a
computer or between computers.
(ii) Address bus is unidirectional while data bus is bidirectional.
(iii) Pipelining is a technique used in CPU design to improve performance by allowing multiple
instructions to be processed simultaneously in different stages of execution.
(b)
(i) Three features of 8086 microprocessor that were improvements over 8080/8085
microprocessor are:
1. 16-bit architecture instead of 8-bit.
2. Increased memory addressing capability.
3. Support for segmented memory model.
(ii) The major difference between 8088 and 8086 microprocessors is the data bus width. 8088
has an 8-bit data bus while 8086 has a 16-bit data bus.
(iii) The 8088 microprocessor has the larger queue, with a queue size of 4 bytes.
6. (a) Reasons why each of the following instructions cannot be coded in 8088/86 assembly
language:
(i) MOV CS, 23AB: The `CS` (Code Segment) register cannot be directly loaded with an
immediate value. It is typically set by the system during initialization.
(ii) MOV BL, AX: The destination register (`BL`) is 8-bit, while the source register (`AX`) is 16-
bit. Direct copying from a 16-bit register to an 8-bit register is not allowed without explicitly
specifying the high or low byte.
(iii) MOV AL, 3CB5: The immediate value 3CB5 is 16 bits, but the destination register (`AL`) is
only 8 bits. Directly loading a 16-bit value into an 8-bit register is not possible.
(iv) MOV AX, 36DE5: The immediate value 36DE5 is 20 bits, which exceeds the size of the 16-
bit AX register. The 8088/86 architecture does not support immediate values of more than 16
bits.
(b)
(i) Assembly language instructions to add the values 16H and ABH and place the result in
register AX:
```
MOV AX, 16H
ADD AX, ABH
```
(ii) If AX = 24F6H and the instruction "MOV [1450], AX" were executed:
The contents of memory locations at offsets 1450 and 1451 would be 24F6H (in little-endian
format).
7. (a)
(i) A stack is a data structure in computer systems used to store temporary data and manage
function calls and returns. It is needed to efficiently manage memory allocation and deallocation
during program execution.
(ii) When data is pushed onto the stack, the stack pointer is decremented, but when data is
popped off the stack, the stack pointer is incremented.
(iii) Contents of the stack as each instruction is executed:
```
PUSH AX: SP = 1234, [1234] = 24B6
PUSH BX: SP = 1232, [1232] = 85C2
PUSH DX: SP = 1230, [1230] = 5F93
```
(b) Status of the CF, PF, AF, ZF, and SF bits of the flag register for the given operations:
(i) For the operation MOV BH, 38H; ADD BH, 2FH:
CF = 0, PF = 0, AF = 0, ZF = 0, SF = 0.
(ii) For the operation MOV BX, 94C2H; ADD BX, 323EH:
CF = 1, PF = 0, AF = 0, ZF = 0, SF = 1.
9. Conversions:
(i) 6DF₁₆ to decimal = 2783.
(ii) 0.375₁₀ to binary = 0.011₁₀.
(iii) 111010₁₀ to decimal = 58.
(iv) 438₁₀ to binary = 110110₁₀.
(v) 36₁₀ to binary = 100100₁₀.
(vi) 110011.11₂ to decimal = 51.75.
(vii) A6₁₆ to binary = 10100110₂.
(viii) 16₁₀ to decimal = 22.
(ix) 1474₁₀ to hexadecimal = 5C2₁₆.
(x) 11010011₂ to hexadecimal = D3₁₆.
(xi) 58₁₀ to hexadecimal = 3A₁₆.
(xii) 42₁₀ to binary = 101010₂.
(xiii) 0.5625₁₀ to binary = 0.1001₁₀.
(xiv) 111011.10₂ to decimal = 59.75.
(xv) FEC₁₆ to decimal = 4076.
10. (a) Physical address of the memory location and its contents after the execution of the given
instructions:
Assuming DS = 1512H:
MOV AL, 99H → No memory change.
MOV [3518], AL → Physical address: DS * 16 + 3518 = 1512H * 16 + 3518 = 241F8H. Contents:
99H.
(b) (i) Difference between ADD AX, BX and ADD AX, [BX]:
ADD AX, BX performs addition of the contents of BX register to AX register.
ADD AX, [BX] performs addition of the contents of the memory location addressed by BX
to AX.
11. (a) Physical memory location where AX is stored for each instruction:
(i) MOV [BP] + 12, AX: Physical address = SS * 16 + (BP + 12) = 2000H * 16 + (7814H + 12) =
24012H.
(ii) MOV [SI] + 10, AX: Physical address = DS * 16 + (SI + 10) = 4500H * 16 + (1486H + 10) =
703A6H.
(iii) MOV [BX] + 20, AX: Physical address = DS * 16 + (BX + 20) = 4500H * 16 + (2100H + 20) =
84820H.