ICS 3203 - Assembly Language Programming - January 2022
ICS 3203 - Assembly Language Programming - January 2022
1
"It's kind of weird, my day job is writing high-level code in a Clojure Web app, but I'm drawn to
low-level languages, e.g. I like writing C code in my free time," reads the post from "sdegutis."
"Lately I've been really interested in learning assembly. (And from the posts on HN lately, it seems
I'm not the only one.)"
Assembly was also in the news recently when the "Original Apollo 11 Guidance Computer (AGC)
source code for the command and lunar modules" -- written in assembly -- was posted to GitHub.
While assembly cracked the top 10, Objective-C fell out, as it continues to be supplanted by Swift
as Apple's official go-to programming language for iOS apps.
Other index movements of note include big jumps for Tcl, CFML (ColdFusion) and Maple, though
they remained far down the list.
a) With reference to the above cases, briefly discuss whether the author is right in his
statement. (4 marks)
b) List describe any four types of sensors that can be used with an 8086 processor based
microcontroller according to the above case. (4 marks)
c) Based on the above case develop a proposal on an IoT microcontroller based idea which
the education and health sectors can embrace to help with the implementation of the
containment measures and reduce infection rate in the current technology era.
(6 marks)
d) Assuming the output in the system above is a motor to be controlled by the four sensors,
implement it in hardware and software form (using 8086 assembly language) explaining
what it possibly does. (6 marks)
b) Develop a 20-bit control word structure that can be used to manage the AVR processor.
(4 marks)
d) Based on the instruction set in d) above, write a program to implement one of the most
commonly used functions of the washing machine. (4 Marks)
2
QUESTION THREE (20 MARKS)
a) Identify and describe the system represented by Fig. Q3a. (4 marks)
START
Delay 10sec
Red
Delay 10sec
Delay 10sec
Amber
Delay 10sec
Green
NO Program
Closed?
YES
END
Fig. Q3a
b) Write 8086 Assembly Program for the system in a) above. Remember to include comments
and state any assumptions made. (10 marks)
c) With appropriate examples, explain how the ‘for loop’ can be implemented in the 8086
assembly language programming. (6 marks)
3
; Load the 16-bit data 008EH to register AX
; Initialize count register CX to 8-bit value of 05H
; Transfer content of register AX to SI
; Transfer content of register BX to DI
; Transfer content of register CX to BP
; end of file
d) The following is a sample assembly language program. Re-write the program together with
a loop and insert comments to explain what each line achieves. (6 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
HLT
b) Write an 8086 assembly program to divide a decimal number by 8 using the shift
instruction. (2 Marks)
d) Fig. Q5 d) shows a section of Intel 8086 microprocessor architecture. Discuss how it may
be useful in assembly language program required to add two 16 bit numbers 2345H and
8888H and store the result in memory. Assume that the two numbers are also stored in
memory. State any other assumptions made. (10 Marks)
4
Fig.Q5 d) 8086 Architecture