Transcript Document

Assembly Language
Conditional Processing
Exercise 1







Write a program to check and show the
values of the Carry, Zero, and Sign flags
where indicated:
mov al, 00001111b
test al, 2 ; a. CF = ZF =
mov al, 6
cmp al, 5 ; b. CF = ZF =
mov al, 5
cmp al, 7 ; c. CF = ZF =
SF=
SF=
SF=
Exercise 2








Implement the following C code in
assembly language, and show the
result.
int array[] = {10,60,20,33,72,89,45,72,18};
int sample = 50;
int ArraySize = sizeof array /sizeof sample;
int index = 0;
int sum = 0;
while( index < ArraySize )
{





}
if (array[index] <= sample )
{
sum += array[index];
index++;
}



Due date: 95/11/3, 8:00 AM
ftp://[email protected]
Zip your files as
a09xxxxx_951102.zip

Example: Encrypt.asm
Exercise 3

Boolean Calculator






Create a program that functions as a
simple boolean calculator for 32-bit
integers. It should display a menu that
asks the user to make a selection from
the following list:
1. x AND y
2. x OR y
3. NOT x
4. x XOR y
5. Exit program



Implement the following procedures:
AND_op: Prompt the user for two
hexadecimal integers. AND them
together and display the result in
hexadecimal.
OR_op: Prompt the user for two
hexadecimal integers. OR them
together and display the result in
hexadecimal.



NOT_op: Prompt the user for a
hexadecimal integer. NOT the integer
and display the result in hexadecimal.
XOR_op: Prompt the user for two
hexadecimal integers. Exclusive-OR
them together and display the result in
hexadecimal.
Example: ch06_08.exe
Exercise 4


Implement the following FSM that
recognizes strings beginning with 'x',
followed by letters 'a'..'y', ending with 'z':
Example: Finite.asm
'a'..'y'
start
A
'x'
C
B
'z
'



Due date: 95/11/10, 8:00 AM
ftp://[email protected]
Zip your files as
a09xxxxx_951109.zip