Write a program to solve a problem of stack

Assignment Help Basic Computer Science
Reference no: EM131209856

[M] Write an IA-32 program to solve Problem 2.22 in Chapter 2. Assume that the element to be pushed/popped is located in register EAX, and that register EBX serves as the stack pointer for the user stack.

Problem 2.22

[M] In addition to the processor stack, it may be convenient to use another stack in some programs. The second stack is usually allocated a fixed amount of space in the memory. In this case, it is important to avoid pushing an item onto the stack when the stack has reached its maximum size. Also, it is important to avoid attempting to pop an item off an empty stack, which could result from a programming error. Write two short RISC-style routines, called SAFEPUSH and SAFEPOP, for pushing onto and popping off this stack structure, while guarding against these two possible errors. Assume that the element to be pushed/popped is located in register R2, and that register R5 serves as the stack pointer for this user stack. The stack is full if its topmost element is stored in location TOP, and it is empty if the last element popped was stored in location BOTTOM. The routines should branch to FULLERROR and EMPTYERROR, respectively, if errors occur. All elements are of word size, and the stack grows toward lower-numbered address locations.

Reference no: EM131209856

Questions Cloud

Does frere bros have any remedy : During the first year of the agreement, Joe entered into a contract to star in a film being made by Pretty Pictures. Does Frère Bros have any remedy?
Propose a procedure for manipulating the two pointers : As data items are added to the queue, they are added at successively higher addresses until the end of the memory region is reached. What happens next, when a new item is to be added to the queue?
Eating half of the steak : Suppose you are on a date at Mastro's Steakhouse and order the 16oz New York Strip. After eating half of the steak, you feel full. Your date tells you that you should finish the steak since you have to pay for it regardless and should eat it while..
Describe the law and how you would address the issue : Using a minimum of three scholarly sources, compare and contrast the pros and cons of required professional qualifications for all medical examiners, regardless of where they work. Should a person who conducts an autopsy be required to be medicall..
Write a program to solve a problem of stack : [M] Write an IA-32 program to solve Problem 2.22 in Chapter 2. Assume that the element to be pushed/popped is located in register EAX, and that register EBX serves as the stack pointer for the user stack.
What is risk all business organisations strive : What is risk All business organisations strive to achieve specific goals, within the process businesses all take risks to determine outcomes - Legal and regulatory risk In the production of hospitality businesses we experience legal and regulatory..
Identify three to four companies for whom you want to work : Identify three to four companies for whom you want to work (your target market and how you can fulfill its needs/wants), and how you think your skill set will benefit them.
Sound environmental policy necessarily conflict : Do economic growth and sound environmental policy necessarily conflict?
Determine the capacitance of each capacitor : A 3-phase, 50 Hz, 400 V motor develops 100 H.P. (74·6 kW), the power factor being 0·75 lagging and efficiency 93%.- Determine the capacitance of each capacitor.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Recode the hotelroom class programming

Recode the HotelRoom class programming Problem 4, Section 10.3 as follows. Replace the string room number by a character array that stores a 3-character room number.

  What is a minimal set of functional dependencies

What is a minimal set of functional dependencies?

  Write a program and create a flow chart

The game of Nim. This is a well-known game with a number of variants. We will consider the following variants, which has an interesting winning strategy. Two players alternately take marbles from a pile.

  Review the wbs and gantt chart you created for tasks

Review the WBS and Gantt chart you created for Tasks Propose three to five additional activities that would help you estimate resources and durations. Write a one-page paper describing these new activities.

  Write a program that produces a list of nz notes and coins

Money dispenser calculatorWrite a program that produces a list of NZ notes and coins required to give change for a user-entered amount up to $1000.

  Specific potential malicious attacks or threats

The CIO has seen reports of malicious activity being on the rise and has become extremely concerned with the protection of the intellectual property and highly sensitive data maintained by your organization.

  Does its shortest edge have to belong to the mst

Does its shortest edge have to belong to the MST? Prove that it does or give a counterexample.

  How can you minimize the quantization error

How can you minimize the quantization error - Just a simple and quick answer and please no copy and paste.

  Write a programme that force the player-controlled class

write a programme that Force the player-controlled class Dog to fall asleep when its energy reaches 0, and once it wakes up, set its energy to 100.

  Calculate the accumulated value of the loan

Cody received a loan of $45,750, 4 years ago. The interest rate charged on the loan was 4.92% compounded quarterly for the first 6 months, 5.10% compounded semi-annually for the next 2 years, and 5.88% compounded monthly thereafter. a. Calculate t..

  Discuss ids and ips, a signature is a digital certificate

When discussing IDS and IPS, a signature is a digital certificate used to identify the author of a rule.

  Which of the indexes are dense, and which are not

Which of the indexes are dense, and which are not?

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