Design a program that uses looping to display the odd numbers counting from 5 to
ID: 3887816 • Letter: D
Question
Design a program that uses looping to display the odd numbers counting from 5 to 17 using the LMC / TLC instruction set. The program must halt after displaying 17. Write and turn in as the answer to this part the pseudo-code for your solution.
NEED THIS PART, the above is provided to help with this: Write your program using the LMC / TLC instruction mnemonics, assemble it using the TLC assembler, and test it on the virtual machine. Make corrections as necessary. When your program has been tested and works, copy the assembly listing from the right hand panel of the assembly tab into your homework. The assembly listing is the only thing you turn in for this part of the work. Note: "Copy the assembly listing" means copy the assembly listing using the copy/paste function of your operating system. A screen shot will not do.Like the pseudo-code, your program must use a loop. A list of OUT instructions will not do.
Explanation / Answer
This can be done using the LMC/TLC instruction set.
The pesudo code will be:
Start
Initialize count = 5
check if count <18
if yes then display count and increment count value by 1
if no then exit the code.
Program using instrcution mnemonics will be
LDA FIVE
STA COUNT
OUT
FIRSTLOOP LDA COUNT
ADD ONE
OUT
STA COUNT
SUB TWELVE
BRP SECONDLOOP
BRA FIRSTLOOP
SECONDLOOP HLT
FIVE DAT 005
SEVENTEEN DAT 017
COUNT DAT
Here we are loading a value of 5 in the register using LDA and incrementing the counter with 1 to count from 5.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.