Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Assembly Expert

Assignment 1:

Create a project called Practice 13. Copy the code you created for Lab 11. In lab 11 you created code to process an array and to show the stack. To show the stack, you created a procedure called ShowStack or ShowParams. This procedure was called immediately after the beginning of the program procedures to show the stack.

In this practice assignment you will add a macro, mDumpMem, a memory dump, which you will find in your textbook section 10.2.5. For this macro you have to provide the address where the memory dump starts, item count, and the type of each element. Therefore, in effect, it does the same thing as your ShowStack procedure only that it will print the values differently on the console.

When you bring mDumpMem into your code it is better to place it into a procedure. Here is how to do it:

You already have a procedure in your code, ShowParams (or ShowStack). You pass to this procedure the number of parameters you need to display. Create another procedure called ShowParams2 (or ShowStack2) for lack of other name. Pass to this procedure the same number of params you need to display. Inside this procedure use mDumpMem to display the stack. Here is an example:

ShowParams2 PROC, numParams:DWORD

mov edx,offset str3 ; print a message to screen

call WriteString
...
mDumpMem , ,
...
ret
ShowParams2 ENDP
Place ShowParams2 immediately after ShowParams, as in this example of PrintArray:
PrintArray PROC, arrayLength:DWORD, arrayType:DWORD, arrayAddress:DWORD
mov edx, OFFSET prompt4 ; print a message to screen
call WriteString
INVOKE ShowParams, 8
INVOKE ShowParams2, 8
...
ret
PrintArray ENDP

This procedure, ShowParams2, is a wrapper around mDumpMem and will create the same stack arrangement as ShowParams does. It will show the same values, except one. Explain in a comment near mDumpMem, in your code, why that parameter is different.

Here is how the console should look for this practice after adding mDumpMem after each ShowStack.

Assignment 2:

Create a macro named mWriteInt that writes a signed integer to standard output by calling the WriteInt procedure. The argument passed to the macro can be a byte, word, or double word. Use conditional operators in the macro so it adapts to the size of the argument.

Write a macro named mSwap32 that receives two 32-bit memory operands. The macro should swap the two operands.

To test your macros, write code for the following program:

• Invoke a procedure called InputArray to fill an integer array that is 10 elements long.
• Invoke a procedure called ReverseArray to reverse the array elements. Inside this procedure call mSwap32 to swap the array elements.
• Invoke a procedure called PrintArray to print the array after the elements were reversed. Use mWriteInt to print the elements to screen. This will show that your mWriteInt macro can handle 32-bit variables.
• Invoke a procedure called InputCharArray to fill a character array that is 10 elements long.
• Invoke a procedure called PrintCharArray to print the character array. Use the same mWriteInt to print the elements to screen. This will show that your mWriteInt macro can handle 8-bit variables.

Requirements:

InputArray

When you invoke InputArray, send to the procedure the following argument list: the array length, type and address. Use only these variables to input the values into the array. Use indirect addressing. Statements like mov myArray[esi],eax are not allowed.

ReverseArray

When you invoke ReverseArray, send to the procedure the following argument list: the array length, size, type and address. Use only these variables to reverse the array. Use indirect addressing and mSwap32 macro to reverse the array.

PrintArray

When you invoke PrintArray, send to the procedure the following argument list: the array length, type and address. Use only these variables to print the array and the mWriteInt macro.

InputCharArray

When you invoke InputCharArray, send to the procedure the following argument list: the array length, type and address. Use only these variables to input the values into the array. Use indirect addressing.

PrintCharArray

When you invoke PrintCharArray, send to the procedure the following argument list: the array length, type and address. Use only these variables to print the decimal values of the array characters, and use the same mWriteInt macro.

Assembly, Programming

  • Category:- Assembly
  • Reference No.:- M91258010
  • Price:- $240

Guranteed 48 Hours Delivery, In Price:- $240

Have any Question?


Related Questions in Assembly

Task 1using masm sdk write an assembly language program

TASK 1 Using MASM SDK, write an assembly language program which converts an integer inputted via the console to binary. Your program should be well commented and well formatted. TASK 2 Using MASM SDK, write an assembly l ...

Question a sequence string of one-byte ascii characters is

Question : A sequence (string) of one-byte ASCII characters is stored at memory location $600 onward. A second sequence of equal length is stored at memory location $700 onward. Each sequence ends with the character $0 ( ...

Really need to find a correct answer to this questionwrite

Really need to find a correct answer to this question: Write a MIPS assembly program that can search for a number that is entered by a user in an array with 20 integer number. Make sure it also prints the index of the ar ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As