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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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