Question

Consider a 9-story building with a basement. The first floor is given the number 1, the...

Consider a 9-story building with a basement. The first floor is given the number 1, the second is given the number 2 and so on. The basement is given the number 0. You will write a program in ASSEMBLY CODE to simulate an elevator operated throughout the whole building.

Write the following subroutines that will work with the main program.

DELAY: generates a software delay of 1 second. OPEN: displays a ‘Door open’ message on the screen after a delay of 1 second. CLOSE: displays a ‘Door close’ message on the screen after a delay of 1 second. UP: performs the following procedure: Displays a ‘Going UP’ message on the screen. Goes up one floor at a time (1 second delay between each floor), until the elevator reaches the destination. At each floor, prints that number (current floor number) on the screen. After the elevator reaches the destination floor, stores this number as the current floor number in memory. DOWN: performs the following procedure: Displays a ‘Going DOWN’ message on the screen. Goes down one floor at a time (1 second delay between each floor), until the elevator reaches the destination. At each floor, prints that number (current floor number) on the screen. After the elevator reaches the destination floor, stores this number as the current floor number in memory.

Basically, a number is inputted. You are currently on floor one. The number inputted is the floor you are heading to. After initializing your current floor (1), you call an open subroutine, and wait for the number to be inputted. Then the close subroutine is called. After this, depending on what floor number was picked, the UP or DOWN subroutine is called until the floor is reached, and the STAY function is called, once you reach the floor. The floor numbers print along with the going UP or going DOWN functions.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The below program produces a delay of 1 second. here the subrouting makes a delay of 1 microseconds.

it's called 4 times back to back and the entire cycle is repeated 250 times.

Hence the result is like as follows:

A delay of 4 times called x 1 microsecond x 250 = 1000 micro seconds.

ie, 1 second is produced.

Now go to the program code;

DELAY1: MOV R5, #250D

LABEL: ACALL DELAY

ACALL DELAY

ACALL DELAY

ACALL DELAY

DJNZ R5, LABEL

RET

DELAY: MOV R6, #250D

MOV R7, #250D

LOOP1: DJNZ R6, LOOP1

LOOP2: DJNZ R7, LOOP1

RET

NOTE

IN R5, THE DELAY CALLED 4TIMES BACK. ITS NOTED THAT IN R6 AND R7 THE ENTIRE CYCLE PROCESS IS SPECIFIED AS 250 TIMES (250D).

PLEASE LISTEN THE LOOP AS FOLLOWS:

DELAY: MOV R6, #250D

MOV R7, #250D

LABEL1: DJNZ R6, LABEL1

LABEL2: DJNZ R7, LABEL2

RET

Add a comment
Know the answer?
Add Answer to:
Consider a 9-story building with a basement. The first floor is given the number 1, the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Solve it for java Question Remember: You will need to read this assignment many times to...

    Solve it for java Question Remember: You will need to read this assignment many times to understand all the details of the you need to write. program Goal: The purp0se of this assignment is to write a Java program that models an elevator, where the elevator itself is a stack of people on the elevator and people wait in queues on each floor to get on the elevator. Scenario: A hospital in a block of old buildings has a nearly-antique...

  • Design an elevator control which takes floor number (0, 1, 2, and 3) as input and...

    Design an elevator control which takes floor number (0, 1, 2, and 3) as input and outputs the direction of movement of the elevator (up (1), down(0), stay (2)) and the number of floors to move. Floors: 0, 1, 2, 3 (Ground, First, Second, Third) Input: Press the floor to move to button (0, 1, 2, 3) . o Present State- Current Floor o Next State Next Floor i.e., floor to move to Outputl up/down/stay (1/0/2) Output2 Floors to move...

  • Assignment One program will be the update server and the other will be the update client....

    Assignment One program will be the update server and the other will be the update client. Here is how the two programs should interact with each other: Server 1. the server starts up and reads the version number in the data.bin file and stores it in memory. 2. The server binds to a port and awaits connections. Client 1. The client starts up and it will first read the version number found within it's own data.bin file. 2. The client...

  • 1. Private data fields: name (of String type, initialized to “Bob”), endurance (of int type, initialized to 4) and happiness (of int type, initialized to 3);

    Language: JAVAPart a: Write a class called Geniegotchi with:1. Private data fields: name (of String type, initialized to “Bob”), endurance (of int type, initialized to 4) and happiness (of int type, initialized to 3);2. Public methods:-void setName(String newName) : renames Genie with newName, printsnewName confirmation to screen;void setName(String newName) : renames Genie with newName, printsnewName confirmation to screen;- intgetEndurance() : returns current endurance;-intgetHappiness() : returns current happiness;-void feed() : this method increases current endurance by 1 if endurance is less...

  • GIVEN CODE- FILL IN THE BLANK! #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h>...

    GIVEN CODE- FILL IN THE BLANK! #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/wait.h> // Function ptototypes int readX(); void writeX(int); int main() /// chi read x ---> divi ---> write x into file ---> par read x --> sub--> write x into file---> chi read x-->etc {    int pid;           // pid: used to keep track of the child process    int x = 19530;       // x: our value as integer   ...

  • While reading the story, consider the culture (or sub culture) and related communication styles the story...

    While reading the story, consider the culture (or sub culture) and related communication styles the story reveals. Consider too, possibly, the values, behavioral norms, social practices, social artifacts, etc. After reading the story through the lens of this idea, please compose a full academic length (evidence-based 7 to 11 sentence long) paragraph which addresses the following prompt: What does the story reveal about the culture it portrays and/OR the communication styles the culture shares? In other words, what does the...

  • Python coding exercise: please include comments Goal #1: import financial data given into your pr...

    Python coding exercise: please include comments Goal #1: import financial data given into your program provided to you as a CSV formatted text file Use the following data for testing (the following is only a sample of the data; there are over 4000 rows of data): *Note: The data you will read in is linear by date (but, non-contiguous due to holidays and weekends,) reflecting a timeline of stock performance in chronological order; however your program should run through the...

  • A. After reading Mebane's story "The Back of the Bus": 1. How do paragraphs 1 &...

    A. After reading Mebane's story "The Back of the Bus": 1. How do paragraphs 1 & 2 introduce the story? 2. How does the author set historical context (cite specific example from the story). 3. How does the author set emotional context? (cite specific example from the story). MARY MEBANE THE BACK OF THE BUS Mary Mebane (1933-1992) was a member of the last generation of African Americans to endure legal segregation in the South. The daughter of a dirt...

  • C++ please Programming Assignment #6 Help Me Find The Secret Message Description: This assignment will require...

    C++ please Programming Assignment #6 Help Me Find The Secret Message Description: This assignment will require that you read in an encrypted message from a file, decode the message, and then output the message to a file. The encryption method being used on the file is called a shift cipher (Info Here). I will provide you with a sample encrypted message, the offset, and the decrypted message for testing. For this project I will provide you main.cpp, ShiftCipher.h, and ShiftCipher.cpp....

  • Help needed for Project procurement to answer Questions 1-10: Building Trust   Pauly Shore is a junior...

    Help needed for Project procurement to answer Questions 1-10: Building Trust   Pauly Shore is a junior procurement manager for the Goldwell Restaurant Group. He is responsible for the procurement of IT commodities for the data center. After months of negotiating with the three best and lowest-priced bidders for the computer paper contract, Pauly selected Frankie’s Paper Company.  Pauly’s decision was made after a round of golf at Frankie’s country club. On the eighteenth hole, Frankie extended his hand to Pauly and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT