logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Let FF6 hold LOADLOOP, FF7 hold ENDLOAD, FFS hold ADDLOOP and FF9 hold

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

3. Stack

* Let FF6 hold LOADLOOP, FF7 hold ENDLOAD, FFS hold ADDLOOP and FF9 hold

ENDLOOP. Assume ap starts from 0*

LOADLOOP:

LODL N5 // load m[sp+N5] into accumulator // 1000 1111 1111 1111

PUSH // decrement sp by 1; load accumulator into m[ep] // 1111 0100 0000 0000

INSP 5 // add 5 to ap// 1111 1100 0000 0101

SWAP // swap ac and ap// 1111 1010 0000 0000

JZER ENDLOAD // if ac = 0, all five numbers are now in stack // 0101 1111 1111 0111

SWAP // swap ac and ap back // 1111 1010 00000000

DESP 5 // subtract 5 from sp.// 1111 1110 0000 0101

JUMP LOADLOOP // repeat loop // 0110 1111 1111 0110

ENDLOAD:

SWAP // swap ac and ap back; ac = N1; a=0 // 1111 1010 0000 0000

DESP 5 // subtract 5 from sp; p=-5 // 1111 1110 0000 0101

LOCO 0 // load 0 into accumulator; ac=0 // 0111 0000 0000 0000

STOD SUM // store content of accumulator into SUM; SUM=0 // 0001 1111 1111 1010

JUMP ADDLOOP // ready to start adding numbers // 0110 1111 1111 1000

ADDLOOP:

POP // load m[ep] into accumulator; increment ap by 1 // 1111 0110 0000 0000 ADDD SUM // adds content of SUM to accumulator // 0010 1111 1111 1010

STOD SUM // store content of accumulator into SUM // 0001 1111 1111 1010

SWAP // swap ac and ap 1111 1010 0000 0000

JZER ENDLOOP // if ac = 0, then all five numbers have been summed // 0101 1111

1111 1001

SWAP // swap ac and ap back 1111 1010 0000 0000

JUMP ADDLOOP // repeat loop // 0110 1111 1111 1000

ENDLOOP:

SWAP // swap ac and ep back, ac=sum, &p=01111 1010 0000 0000

RETN// return; pc = m[0], p=1 // 1111 1000 0000 0000

 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

864 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

630 Answers

Hire Me
expert
Husnain SaeedComputer science

601 Answers

Hire Me
expert
Atharva PatilComputer science

510 Answers

Hire Me

Get Free Quote!

281 Experts Online