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 assembly language subroutine

Create a assembly language subroutine MULSUM that takes an array named A containing n bytes of positive numbers, and fills two arrays, array B containing n words and array C containing n long words

  Write a function in linux assembly

Write a function in Linux assembly

  Analog measurements

Prepare an assembly program for the correctly measures the wind direction

  Design a simple digital clock

Design a simple digital clock

  Write an assembly program

Prepare an Assembly program that reads in a number of cents.

  Write an assembly language program

Write an assembly language program for encrypting alphabates of a string

  Greatest common divisor of integers-masm assembly language

Must be done in MASM assembly language: Greatest common divisor of two integers is largest integer which will evenly divide both integers. GCD algorithm involves integer division in a loop.

  Write assembly program-find right admission price to movie

Write the Assembly program to find correct admission price to movie. Price of admission to a movie is $7 for kids (under 12) and $9 for adults.

  Create simple 8-bit alu using add-subtract-shift functions

Create a simple 8-bit ALU. Requirements:The eight functions that you will implement are: add, subtract, and, or, shift left logical, less than, shift right logical.

  Write assembly program print binary representation-integers

Write the assembly program called hw6_ex1, stored in file hw6_ex1.asm. This program must prompt user to enter signed 32-bit integer. Program must print out binary representation of the integer.

  Allot op-codes and add microcode to microprogram

Allot op-codes and add microcode to microprogram of Mic-1 to implement following instructions which are then included with IJVM instruction set.

  Write mips assembly program to read two non-negative numbers

Write MIPS assembly program to repeatedly read two non-negative integers and print integer product and quotient without using multiplication and division instructions.

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