Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

FACULTY OF INFORMATION TECHNOLOGY

BACHELOR OF COMPUTER SCIENCE


SUPPLIMENTARY/SPECIAL EXAMINATION
ICS 3203 ASSEMBLY LANGUAGE PROGRAMMING
DATE: 1st August2022 TIME: 2 Hours
INSTRUCTIONS:
i. This paper contains FIVE questions.
ii. You are required to answer THREE questions, that is, QUESTION ONE which is
COMPULSORY and any other TWO questions.
iii. All questions carry equal marks i.e. 20 MARKS each.
QUESTION ONE (20 MARKS)

IoT puts assembly language back on the


charts
Richard Chirgwin Sun 10 Jul 2016 // 23:09 UTC

Let's do the time warp again: according to an outfit that tracks programming languages, the Internet
of Things is re-igniting demand for assembly language skills.
Software consultancy TIOBE's Programming Community Index has turned up the re-emergence
of assembly programming in its monthly index.
While the top-five are no surprise – Java, C, C++, Python and C# – the outfit's post expresses
surprise that something so difficult and arcane as assembly would make the index unless it was
driven by necessity.
Hence it tags the global movement to put chips in really stupid places just to boast that the device
is connected (and in the case of Dyson, to work out how best to extract hundreds of dollars from
suckers for a hair dryer).

a) Based on the above case, list and describe FIVE main differences between the X86 and the
ARM processors. (5 Marks)

b) Draw and describe the diagram representing a simplified processor logic of the ARM
processor. (4 marks)

1
c) Develop a 19-bit control word structure that can be used to manage the ARM processor.
(4 marks)

d) Assuming the ARM processor is to be used in a microwave oven, develop its instruction
set that can fit in this particular application. (4 marks)

e) Write a program to implement one of the most commonly used functions of the microwave
oven. (3 Marks)

QUESTION TWO (20 MARKS)


Suppose you have been selected to be the lead programmer and software design advisor in a team
contracted to develop a traffic light control system for a busy round about in a Kenyan City using
assembly language programming. The team has decided to build the system around 8086
microprocessor. Four sets of traffic lights each with red, yellow and green lights, are to be mounted
in East, North, West and South directions and be flashed accordingly with a delay of 10seconds to
control the traffic. Five situations are defined as follows: sit1=0011_0000_1100b, sit2
=1000_0110_0001b, sit3=0110_1001_1010b, sit4=0100_1101_0011b and all_red=
0010_0100_1001b. Take 10million microseconds=00989680H, the output port for driving the
traffic lights as Port 4 and the traffic lights display module is named “Traffic_Lights.exe”.
a) Identify three apparatus you will require to deliver the project and their uses.
(4 marks)

b) Give FOUR benefits of implementing the traffic lights control system in the City.
(4 marks)

c) Draw a flow chart to illustrate the steps followed by the program and explain the flow of
the algorithm. (2 marks)

d) Write 8086 Traffic Lights Control Assembly Program for the given case. Remember to
include comments and state any assumptions made. (10 marks)

QUESTION THREE (20 MARKS)


a) Using examples of your own, explain the following types of addressing modes supported
by the 8086 microprocessor. In the examples, use the CPU registers AX, BX, SI and DI
as may be applicable.

i. Register addressing mode


ii. Immediate
iii. Register indirect
iv. Base plus index
v. Implied addressing mode (10 Marks)

b) Describe the different types of data and instructions formats used with different
microprocessors. (10 Marks)

2
QUESTION FOUR (20 MARKS)
a) State the contents of the accumulator and the C flag when the following instruction is
executed.

MOV AX, B7H


OR AX, AX
RLC AX,1 (2 Marks)

b) Write a program to perform the following;


Load 1234H in register pair DE
Add 2567H to DE contents
Load register BX with 30H
Load register CX with 39H
Subtract 30H from 39H
Stop (4 Marks)

c) In the process of ISA design, there are three important types of instructions to be
considered, list and briefly describe them. (4 Marks)

d) Briefly describe the 8086-instruction set indicating the differences between it and the
current microprocessors. (6 Marks)

e) Write a program to perform square and cube of a number. (4 Marks)

QUESTION FIVE (20 MARKS)


a) The following is a sample assembly language program. Re-write the program and insert
comments to explain what each line achieves. (8 Marks)
data DB 45
op1 DB 6
start:
MOV DL, 0H
MOV CL, op1
MOV AL, data
step:
CMP AL, op1
JC label1
SUB AL, op1 ;
INC DL
JMP step
label1:
MOV AH, DL

b) Differentiate between RISC and CISC and how they are related to assembly language
programming. (4 Marks)

3
c) Write an assembly program to multiply a decimal number by 8 using the shift instruction.
(4 Marks)

You might also like