Anda di halaman 1dari 1

Addis Ababa University

Addis Ababa Institute of Technology


School of Electrical & Computer Engineering

ECEG- 4501 Microcomputers & Interfacing

Lab1: Programming the 8086 in Assembly Language

1. Control Structures: Decisions

Convert the following C statements to assembly language, where x and y are variables.

if (x <= y)
x = x +1;
else
y = y 1;

2. Control Structures: Loops

Convert the following C statements to assembly language, where x and y are variables.

y =1;
while (x>0)
{
y=y*x;
x--;
}

3. Procedures

Write a procedure named read that reads a character from a keyboard until a carriage return is
entered or the number of characters entered so far is five. Use INT 21h / ah = 1 to read a character
from keyboard. You can define procedures as follows:

read PROC
;your code here
ret
read ENDP

4. Consider a login system. Suppose you have a 5-character password stored in DS in memory.
Write a program that reads a 5-char password string from the keyboard port; compare the
string with the password in memory; prints access granted if correct or access denied
otherwise. Use the procedure you wrote above to read password from keyboard.

Use INT 21h/ah = 9to display a string

1|Page