Create a macro named mwriteint

Assignment Help Assembly Language
Reference no: EM13718617

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 <arg1>, <arg2>, <arg3>
...
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.

Reference no: EM13718617

Questions Cloud

What is chlorphyll a in spinach : What is chlorphyll a in spinach. What is chlorphyll b in spinach. What is pheophytin a in spinach
What types of isomerism are exhibited by the coordination : What types of isomerism are exhibited by the coordination complex. choose as many as needed from the list. A) [Cr(dppe)(NH3)2Br2] B) [Cr(ox)2(H2O)2]- C) PtBr2(PPh3)2
Create your own set of five personal guiding questions : Guiding Questions â€â€Å" Create your own set of five personal guiding questions for each of the Sternberg chapters (Nine, Ten, and Eleven) and five personal guiding question from Sowell Chapter Six. (When finished, you will have a t..
Two firms examined the same capital budgeting project : Two firms examined the same capital budgeting project which had an IRR of 19%. One firm accepted the project but the other rejected it. One of the firms must have made an incorrect decision.
Create a macro named mwriteint : 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..
Explain some proteins fall apart in cold temperature : Some proteins fall apart in cold temperature (cold denaturation). What does this tell you about how these proteins are held together. Answer must deal with the Delta H and Delta S of the protein.
What is the resulting concentration of hcl : If 3.00 L of 6.00M HCl is added to 2.00 L of 1.50M HCl, what is the resulting concentration? (Assume the final volume to be exactly 5L.
Calculate the number of molecules inside the cell : The concentration of a biomolecule inside a rod-shaped prokaryotic cell is 0.0053 M. Calculate the number of molecules inside the cell, which is 2.9um long and 1.4um in diameter.

Reviews

Write a Review

Assembly Language Questions & Answers

  Create a program that uses ia-32 assembly language

create a program that usesIA-32 assembly language. It converts integers in the array X to its hex string ad save its to array Y in the respictive locations.

  Write a mips assembly language program

Write a MIPS assembly language program that prompts for a user to enter a series of floating point numbers and calls read_float to read in numbers and store them in an array. Then the program should display the array content on the console window. Th..

  Assembly-language program

Write an assembly-language program to add each element of list1 to the corresponding element of list2 and store it in the same location of list2. Use a loop.

  Program in assebly language to solve first degree equations

Create the program on Assebly language which can solve First Degree Equations in form of Ax + B = 0. Coefficients of equation must be entered from keyboard.

  Program [hcs12 assembly language] to compute the average

Write a program [HCS12 assembly language] to compute the average of an array of N 8-bit numbers and store the result at $1000

  Prepare a assembly program to initialize the led outputs

Write a main.asm file in PSoC designer. Make sure to have the subsequent in place - Initialize the LED outputs to 0's and Set the corresponding bit in INT_MSK0 to 1.

  Decimal floating point number

What decimal floating point number does this IEEE 754 single precision number represent: 0x47C0_E6B7?

  Analog measurements

Prepare an assembly program for the correctly measures the wind direction

  Write a program that displays a single character

Description: Write a program that displays a single character at 100 random screen locations, with a delay factor of 100 milliseconds.Hint: set the console window screen height to 200 at runtime, and watch the scroll bar jump up and down.

  Use maries isa program a stack structure for unsigned

use maries isa program a stack structure for unsigned integers.stackyou should write three subroutines for the stack

  Marie program that will input a variable number

Develop a MARIE program that will input a variable number of user entered DECimal whole number grades, validating each one (0-100) in a subroutine

  Program that converts the temperature

Write a program that converts the temperature F in Farenheit to C in Celsius using C = (F-32)*5/9. For ease of programming you can display the result in fractions

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd