Question
Hello. please I need help with the following question in Assembly Language. I need help, it is supposed to be in assembly language. I tried
Hello. please I need help with the following question in Assembly Language.
I need help, it is supposed to be in assembly language. I tried to do it but I had no luck. If someone is able to answer it can you please write the code and explain it. It will be great help thanks! The rest is below.
This is what I have so far but I am pretty sure it is completely wrong.
.ORIG x3100 LEA R0 , DAYS ADD R3 , R3 , x0 LOOP BRz DISPLAY ADD R0 , R0 , #10 ADD R3 , R3 , #-1 BR LOOP DISPLAY PUTS HALT .STRINGZ Sunday .STRINGZ Monday .STRINGZ T ue s da y .STRINGZ Wednesday .STRINGZ T h u r s d a y .STRINGZ F r i d a y .STRINGZ S a t u r d a y
HALT
.END
DAYS OF THE WEEK 3.1 Problem Statement Write a program in LC-3 assembly language that keeps prompting for an integer in the range 0-6, and each time it outputs the corresponding name of the day. If a key other than 'O' through 6' is pressed, the program exits. 3.1.1 Inputs At the prompt'Please enter number: ,', a key is pressed. 3.1.2 Outputs If the key pressed is '0' through '6', the corresponding name of the day of the week appears on the screen. Precisely, the correspondence is according to this table: Code Day 0 Sunday 1Monday 2Tuesday 3 Wednesday 4Thursday 5 Friday 6 Saturda When the day is displayed, the prompt 'Please enter number: appears again and the program expects another input. If any key other that '0 through 6' is pressed, the program exits. 3.2 The lab 3.2.1 Strings in LC-3 It will be necessary to define the prompt "Please enter number: " and the days of the week as strings in memory. All strings should terminate with the NUL character (ASCII 0). In LC-3 one character per memory location is stored. Each location is 16 bits wide. The 8 most significant bits are 0, while the 8 least significant bits hold the ASCII value of the character. Strings terminated with the NUL character can be conveniently defined using the directive .STRINGZ "ABC". where Revision: 1.6, August 4, 2005 DAYS OF THE WEEK 3.1 Problem Statement Write a program in LC-3 assembly language that keeps prompting for an integer in the range 0-6, and each time it outputs the corresponding name of the day. If a key other than 'O' through 6' is pressed, the program exits. 3.1.1 Inputs At the prompt'Please enter number: ,', a key is pressed. 3.1.2 Outputs If the key pressed is '0' through '6', the corresponding name of the day of the week appears on the screen. Precisely, the correspondence is according to this table: Code Day 0 Sunday 1Monday 2Tuesday 3 Wednesday 4Thursday 5 Friday 6 Saturda When the day is displayed, the prompt 'Please enter number: appears again and the program expects another input. If any key other that '0 through 6' is pressed, the program exits. 3.2 The lab 3.2.1 Strings in LC-3 It will be necessary to define the prompt "Please enter number: " and the days of the week as strings in memory. All strings should terminate with the NUL character (ASCII 0). In LC-3 one character per memory location is stored. Each location is 16 bits wide. The 8 most significant bits are 0, while the 8 least significant bits hold the ASCII value of the character. Strings terminated with the NUL character can be conveniently defined using the directive .STRINGZ "ABC". where Revision: 1.6, August 4, 2005
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started