Parameters and to allocate local variables

Assignment Help Basic Computer Science
Reference no: EM13936847

The aim of this practical is to make you more familiar with calling sequences which use the stack both to pass parameters and to allocate local variables. Calling sequences are very important, as is stack management.

You must understand this material if you intend to study future Computer Science courses such as Computer Architecture, or Language Translators. You will be constructing your program from multiple source files that must be linked together with some library modules we provide. This will give you experience in seeing how the process of linking works.

1.2 Overview of the assignment
This practical consists of writing recursive functions to create and traverse a binary search tree. You should put the functions in the file tree.dls You will write the functions in assembly code, and combine them with other functions that are provided.

All functions must be relocatable and use .import and .export directives to permit linking. Use four segment names in your program: Code, for instructions; Constant, for any constant data; Heap, for data allocated from the heap; and Stack, for the stack, which will hold all variables. You will not need a Data segment.

1.3 Starting files
The startup files for this assignment are available in the prac4supp directory. The files provided are:
• tree.dls - A skeleton of the file to contain your binary search tree functions;
• divide.dls - file containing divide functions;
• dsim.cfg - A DLX simulator configuration file;
• init.dls - A file containing stack initialisation code;
• input1 - A sample input file;
• input2 - A sample input file;
• io.dls - A file containing the keyboard and display I/O routines;
• main.dls - A file containing the main program;
• heap.dls -A file containing the heapGet function;
• output1 - The program output corresponding to input1;
• output2 - The program output corresponding to input2;
• readdata.dls - A file containing the readData function; and
• strings.dls - A file containing some string handling routines;

11.4 Operation of the program

The main program is already complete, and does not need to be changed. It reads the numeric from the terminal device, by calling readData. The readData function expects lines of text that contain one or two integer values separated by a comma. It stores the data it reads into an array that was passed to readData as a parameter. A line may have additional space characters before and/or after each number. Here are some example lines of input:

123,456 two numbers: 123 and 456
4 , 6 two numbers: 4 and 6
1,2,3,4 two numbers: 1 and 2 (third and subsequent numbers ignored)
1 2 3,4 one number: 1 (missing comma)

The main then repeatedly calls tInsert, to isnert data into the tree. On each call it passes one of the numbers that was stored in the array by readData. main then calls tP rint to print out the structure of the tree. (If all is well, the data will appear in increasing order.)
main then calls tRev, which reverses the tree, so that the largest number in the tree is on the left, and the smallest number on the right.
Finally, main again calls tP rint to print out the structure of the tree. (If all is well, the data will now appear in decreasing sorted order.)

Reference no: EM13936847

Questions Cloud

Write a program using a function and a switch statement : Write a program using a function and a switch statement. The user should be prompted to enter a number in main. The function is called and the number entered is passed to the function. This function parameter will then be used in a switch to disco..
Software tools for managing and analyzing qualitative data : Craft a 3- page paper and 5 references in which you do the following: Compare and contrast software tools for managing and analyzing qualitative data
Design your own test program to test the modification. : Add method Modify(int id, char*, char*, float, char*) to modify the id's record. If such id not exist, add it as a new record into the list
Ethical and consumer behaviour issues : Identify any ethical and consumer behaviour issues you feel are not currently being adequately addressed (or are ineffectively addressed) by the current campaign.
Parameters and to allocate local variables : The aim of this practical is to make you more familiar with calling sequences which use the stack both to pass parameters and to allocate local variables. Calling sequences are very important, as is stack management.
State the marketing objectives : Objectives: What does your campaign seek to achieve? Clearly state the marketing objective(s), keeping in mind that your campaign must have a measurable impact and drive a return on investment. Use various key performance indicators (KPIs) to eval..
What is the size of the hash table : What is the size of the hash table?What are hFint256() (16) and hFint256() (257)?
What is under armour doing to make brand personally relevant : 1. What is Under Armour doing to make its brand personally relevant, surprising, and easy to process?
Prepare summary journal entries for april : Prepare summary journal entries for April (without disposing of under- or overallocated conversion costs). Assume no direct materials variances.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Calculate the program average using the formula

Program average = total program points / maximum program points possible * 100. If no programs have been turned in at this point of the semester, set the program average to 0.0.

  Networks, collaboration and sustainability

Continue to store the same postings made to the blog each week, as defined in Assessment Item 1 previously.There are two topics for each week. I put the following topics in each work. For 1 topic it is 150 word each and one refernce for each topic.

  Apply the tools and techniques in research and analysis

Project objective: 1.Apply the tools and techniques in research and analysis required to evaluate computer and information science products. 2.Describe how pipelining and superscalar processing improve the speed at which a computer program is execute..

  Explain can capabilities protect against all trojan horses

Can capabilities protect against all Trojan horses? Either show that they can or describe a Trojan horse process that C-Lists cannot protect against.

  What is difference between the memory bus and the pci bus

What is the difference between the memory bus and the PCI bus? Most 32-bit buses permit 16-bit reads and writes. Is there any ambiguity about where to place the data? Discuss.

  Procedure for checking suitcases for secret compartments

You are responsible for checking suitcases for secret compartments in which bulky items like jewelry might be hidden. Explain procedure you would follow to check for these compartments.

  What power of h is the error proportional to

Find the values of A and B such that error is minimized. What power of h is the error proportional to? Use this formula to find d/dx sin(x) at x = pi/3. Tabulate errors for different values of h.

  Describe any generalization/specialization relationships

Describe any generalization/specialization relationships

  Harnessing information management,data, and infrastructure

Harnessing Information Management, the Data, and Infrastructure.Ascertain the importance of information management for the company or industry that you have chosen.Analyze the fundamental impact of IT architecture or enterprise architecture on inform..

  Why we need preprocessing of data

Why we need preprocessing of data? Explain major four data preprocessing techniques?

  Winter and spring and displays the total

Write a visual logic program for an application that allows a user to enter the cost of home maintenance in each of the four seasons summer, fall, winter and spring and displays the total.

  The it manager for the only print shop in a small town in id

The IT manager for the only print shop in a small town in Idaho. The shop is connected to the internet by satellite link. Orders are received via the internet as well as by walk-ins with portable storage drives or smart phones that can transfer files..

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