Write the program without macros

Assignment Help Assembly Language
Reference no: EM133230238

Basic Assembly Language Programming

Create an A64 assembly language program that finds the maximum of y = -4x4 +301x2 + 56x - 103 in the range -10 ≤ x ≤ 10, by stepping through the range one by one in a loop and testing. Use only long integers for x, and do not factor the expression. Use the printf() function to display to the screen the values of x, y and the current maximum on each iteration of your loop.

You are to create 2 versions of your program:

Question 1. Write the program without macros (i.e. don't use m4), and use only the mul, add, and mov instructions to do your calculations. Use a pre-test loop, where the test is at the top of the loop.

Question 2. Optimize the above program by putting the loop test at the bottom of the loop (make sure it is still a pre-test loop), and by making use of the madd instruction. Also, add macros to the above program to make it more readable (use m4). In particular, provide macros for heavily used registers.

Running Your Program

To verify that your assembly language program works, run both versions under gdb, capturing output from each session using the script UNIX command. For version 1, single step through the program (use ni) for at least one iteration of your loop, displaying the instruction being executed (use display/i $pc). Also print out the contents of particular registers (use p) at key points in your program to show that it is working as expected. For version 2, set a breakpoint just after the place where the final result is calculated, and then print out the maximum. Do not single step through this version.

Other Requirements

Make sure your code is properly formatted into columns, is readable and fully documented, and includes identifying information at the top of each file. You must comment each line of assembly code. Your code should also be well designed: make sure it is well organized, clear, and concise.

New Skills Needed for this Assignment:

• Ability to work with basic arithmetic, loops, and if-else constructs in assembly
• Ability to print to standard output using the printf() function
• Ability to optimize assembly code by rearranging loops and using alternate instructions
• Ability to use macros in assembly code
• Ability to assemble programs using gcc and use m4 to process macros
• Ability to use gdb to debug and display assembly language programs

Reference no: EM133230238

Questions Cloud

Negotiation of trade agreement by canadian government : This assignment is based on what we've learned during the first three weeks of class. It will give you the opportunity to communicate about cultural intelligenc
Amendment prohibits government from establishing religion : Amendment prohibits the government from establishing religion, there is no prohibition on spending money to support religious life generally.
About technology as it relates to legal community : Why is it necessary for members of legal team to be able to communicate with those in support or user position about technology as it relates to legal community
Corrupt behavior with significant consequences : Detailed description of events that took place in Bangladesh as an example of corrupt behavior with significant consequences.
Write the program without macros : Computing Machinery - Write the program without macros (i.e. don't use m4), and use only the mul, add, and mov instructions to do your calculations
Why the catastrophe occurred-perspective of your role : How would you respond to the question of why the catastrophe occurred and how it might have been avoided from the perspective of your role?
Outside entertainer required to accept services : Is a person who hires an outside entertainer required to accept services of a substitute if it is impossible for the original party to perform?
Create virtual machines connected : Project Create a switch labelled WSS3-Proj-YOURFIRSTNAME-SW, on the Windows 10 Host machine (Please be sure to change "YOURFIRSTNAME" to your first name
Sustainable design in ferrero group supply chain : Is there explicit evidence of Sustainable Design in Ferrero Group supply chain? Which global industry codes of conduct are guiding Ferrero Group supply chain.

Reviews

len3230238

9/28/2022 12:28:35 AM

Create an A64 assembly language program that finds the maximum of y = -4x^4 +301x^2 + 56x -103in the range-10 =x = 10, by stepping through the range one by one in a loop and testing. Use only long integers for x, and do not factor the expression. Use the printf() function to display to the screen the values of x, y and the current maximum on each iteration of your loop.

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