Presentation is loading. Please wait.

Presentation is loading. Please wait.

Conditional Processing

Similar presentations


Presentation on theme: "Conditional Processing"— Presentation transcript:

1 Conditional Processing
Assembly Language Conditional Processing

2 Exercise 1 Write a program to check and show the values of the Carry, Zero, and Sign flags where indicated: mov al, b test al, 2 ; a. CF = ZF = SF= mov al, 6 cmp al, 5 ; b. CF = ZF = SF= mov al, 5 cmp al, 7 ; c. CF = ZF = SF=

3 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++; }

4 Due date: 95/11/3, 8:00 AM Zip your files as a09xxxxx_ zip

5 Example: Encrypt.asm

6 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

7 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.

8 NOT_op: Prompt the user for a hexadecimal integer
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

9 Exercise 4 Implement the following FSM that recognizes strings beginning with 'x', followed by letters 'a'..'y', ending with 'z': Example: Finite.asm

10 Due date: 95/11/10, 8:00 AM Zip your files as a09xxxxx_ zip


Download ppt "Conditional Processing"

Similar presentations


Ads by Google