The Microsoft Environment

Week – 3 Assignment
August 15, 2019
Week 4 Discussion 2
August 19, 2019

The Microsoft Environment

These must be completed in the Microsoft environment. Only need to submit the ASM file.

Simple Addition (1)

Write a program that clears the screen, locates the cursor near the middle of the screen, prompts the user for two integers, adds the integers, and displays their sum.

Simple Addition (2)

Use the solution program from the preceding exercise as a starting point. Let this new program repeat the same steps three times, using a loop. Clear the screen after each loop iteration

Filling an Array

Create a procedure that fills an array of doublewords with N random integers, making sure the values fall within the range j…k, inclusive. When calling the procedure, pass a pointer to the array that will hold the data, pass N, and pass the values of j and k. Preserve all register values between calls to the procedure. Write a test program that calls the procedure twice, using different values for j and k. Verify your results using a debugger.

College Registration

Using the College Registration example below as a starting point, do the following:

• Recode the logic using CMP and conditional jump instructions (instead of the .IF and .ELSEIF directives).

• Perform range checking on the credits value; it cannot be less than 1 or greater than 30. If an invalid entry is discovered, display an appropriate error message.

• Prompt the user for the grade average and credits values.

• Display a message that shows the outcome of the evaluation, such as “The student can register” or “The student cannot register”. (The Irvine32 library is required for this solution program.)

Boolean Calculator (1)

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

When the user makes a choice, call a procedure that displays the name of the operation about to be performed. You must implement this procedure using the Table-Driven Selection technique, shown in Section 6.5.4. (below)

.data

CaseTable BYTE ‘A’ ; lookup value

DWORD Process_A ; address of procedure

BYTE ‘B’

DWORD Process_B

(etc.)

(You will implement the operations in Exercise 6.) (The Irvine32 library is required for this solution program.)

Boolean Calculator

Continue the solution program from Boolean Calculator (1) by implementing 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. (The Irvine32 library is required for this solution program.)

Encryption Using Rotate Operations

Write a procedure that performs simple encryption by rotating each plaintext byte a varying number of positions in different directions. For example, in the following array that represents the encryption key, a negative value indicates a rotation to the left and a positive value indicates a rotation to the right. The integer in each position indicates the magnitude of the rotation:

key BYTE -2, 4, 1, 0, -3, 5, 2, -4, -4, 6

Your procedure should loop through a plaintext message and align the key to the first 10 bytes of the message. Rotate each plaintext byte by the amount indicated by its matching key array value. Then, align the key to the next 10 bytes of the message and repeat the process. Write a program that tests your encryption procedure by calling it twice, with different data sets.

Prime Numbers

Write a program that generates all prime numbers between 2 and 1000, using the Sieve of Eratosthenes method. You can find many articles that describe the method for finding primes in this manner on the Internet. Display all the prime values.

Bitwise Multiplication

Write a procedure named BitwiseMultiply that multiplies any unsigned 32-bit integer by EAX, using only shifting and addition. Pass the integer to the procedure in the EBX register, and return the product in the EAX register. Write a short test program that calls the procedure and displays the product. (We will assume that the product is never larger than 32 bits.) This is a fairly challenging program to write. One possible approach is to use a loop to shift the multiplier to the right, keeping track of the number of shifts that occur before the Carry flag is set. The resulting shift count can then be applied to the SHL instruction, using the multiplicand as the destination operand. Then, the same process must be repeated until you find the last 1 bit in the multiplier.

FindLargest Procedure

Create a procedure named FindLargest that receives two parameters: a pointer to a signed doubleword array, and a count of the array’s length. The procedure must return the value of the largest array member in EAX. Use the PROC directive with a parameter list when declaring the procedure. Preserve all registers (except EAX) that are modified by the procedure. Write a test program that calls FindLargest and passes three different arrays of different lengths. Be sure to include negative values in your arrays. Create a PROTO declaration for FindLargest.

Chess Board

Write a program that draws an 8 8 chess board, with alternating gray and white squares. You can use the SetTextColor and Gotoxy procedures from the Irvine32 library. Avoid the use of global variables, and use declared parameters in all procedures. Use short procedures that are focused on a single task

FindThrees Procedure

Create a procedure named FindThrees that returns 1 if an array has three consecutive values of 3 somewhere in the array. Otherwise, return 0. The procedure’s input parameter list contains a pointer to the array and the array’s size. Use the PROC directive with a parameter list when declaring the procedure. Preserve all registers (except EAX) that are modified by the procedure. Write a test program that calls FindThrees several times with different arrays.


 

smilesmilePLACE THIS ORDER OR A SIMILAR ORDER WITH USA CUSTOM WRITINGS TODAY AND GET AN AMAZING DISCOUNT

order custom essay paper

Leave a Reply

Your email address will not be published. Required fields are marked *