Assembly Language Conditional Processing Exercise 1 Write a
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, 00001111 b 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=
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 Array. Size = sizeof array /sizeof sample; int index = 0; int sum = 0; while( index < Array. Size ) { l l l } if (array[index] <= sample ) { sum += array[index]; index++; }
Due date: 95/11/3, 8: 00 AM ¡ ftp: //eec 751@ftp. csie. nuk. edu. tw ¡ Zip your files as a 09 xxxxx_951102. zip ¡
¡ Example: Encrypt. asm
Exercise 3 ¡ Boolean Calculator l l l 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
l l l 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.
l l l 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: ch 06_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
Due date: 95/11/10, 8: 00 AM ¡ ftp: //eec 751@ftp. csie. nuk. edu. tw ¡ Zip your files as a 09 xxxxx_951109. zip ¡
- Slides: 10