Question: We are working on a project in the LC3 where we have to create a madlib that reads user input for the following madlib MadLib:
We are working on a project in the LC3 where we have to create a madlib that reads user input for the following madlib
MadLib:
OFFICER: Sir do you realize how fast you were [verb ending in ing]?
DRIVER: No, how fast was I [verb ending in ing]?
OFFICER: You were going fifty [plural noun] an hour in a 25 [noun] zone.
DRIVER: Im sorry. Im nervous. Im taking my [noun] to the hospital. She cut off her [noun].
OFFICER: You also went through a red [noun] and failed to stop at a/an [noun] sign. May I see your drivers [noun]?
DRIVER: Yes... Oh my! I left it in my pair of [plural noun]. You see, after my wifes accident she was in great [plural noun], and I wanted to get her to the [noun] as [adverb] as possible.
OFFICER: Your wife? I dont [verb] your wife.
DRIVER: She is right there in the back [noun]. (Turns) Oh, my! Would you believe I left her at [verb]
the program needs to take input store it and return it later and print the finished madlib to the screen and needs to be 200 lines of code.
so far this is what we have we also had the idea to use a word counter in order to keep track of the variables we were inputting
;Group: Emily Mattson, Kristen Allred, Cory Windham, Brittner
;Class: 2810 Section: 001
;Assignment: Final Project
;Date: 4/00/18
.ORIG X3000
; Register Usage
; R4 - address of the users input
; R5 - counter
LEA R0 class ;load string class to R0
PUTS ;prints string class to console
LEA R0 group ;load string name to R0
PUTS ;prints string name to console
LEA R0 project ;load string project to R0
PUTS ;prints string project to console
STARTPROGRAM LEA R0 start ;load string start to R0 (welcoming statement)
PUTS ;prints string start to console
AND R0, 0 ;clearing R0
BRnp PROMPT ; branch if r0 != 0
LEA R0 verb1 ;load string verb1 into R0
PUTS ;print sting verb1 to user
LEA R0 STOREUSERINPUT
AND R0, 0 ;clearing R0
BRnp PROMPT ; branch if r0 != 0
LEA R0 verb2 ;load string verb2 into R0
PUTS
LEA R0 STOREUSERINPUT
AND R0, 0
BRnp PROMPT ; branch if r0 != 0
LEA R0 pNoun1
PUTS
LEA R0 STOREUSERINPUT
AND R0, 0
LEA R0 noun1
PUTS
LEA R0 STOREUSERINPUT
AND R0, 0
LEA R0 noun2
PUTS
LEA R0 STOREUSERINPUT
AND R0, 0
LEA R0 noun3
PUTS
LEA R0 STOREUSERINPUT
AND R0, 0
LEA R0 noun4
PUTS
LEA R0 STOREUSERINPUT
AND R0, 0
LEA R0 noun5
PUTS
LEA R0 STOREUSERINPUT
AND R0, 0
LEA R0 pNoun
PUTS
LEA R0 STOREUSERINPUT
AND R0, 0
LEA R0 pNoun3
PUTS
LEA R0 STOREUSERINPUT
AND R0, 0
LEA R0 pNoun4
PUTS
LEA R0 STOREUSERINPUT
AND R0, 0
LEA R0 noun6
PUTS
LEA R0 STOREUSERINPUT
AND R0, 0
LEA R0 Adverb1
PUTS
LEA R0 STOREUSERINPUT
AND R0, 0
LEA R0 noun7
PUTS
LEA R0 STOREUSERINPUT
AND R0, 0
LEA R0 noun8
PUTS
LEA R0 STOREUSERINPUT
AND R0, 0
LEA R0 verb3
PUTS
LEA R0 STOREUSERINPUT
AND R0, 0
LD R3, EXITPROGRAM ;load exitprogram (-27) into R3 and store
ADD R2, R3, R2 ;add R2 to R3 store in R2
BRz EXIT ;check. if zero jump to EXIT label
ADD R2, R1, #0 ;reset R2
STOREUSERINPUT GETC ;get character
LD R4, LOC ;load R4 location
AND R5, 0 ;CLEAR COUNTER
STR R0, R4, R5 ;store
ADD R5, 1 ;Increment counter
BRnzp STOREUSERSINPUT
;RECALL LDR REMEMBER TO INCREMENT
;printing user input.
PRINTINPUT AND R5, 0 ;clear counter
LDR R0, R4, R5 ;Load
ADD R5, 1 ;Increment counter
EXIT LEA R0 outputFinished ;load string outputFinished into R0
PUTS ;print to console
BRnzp MYEND ;negitive, zero, positive go to label myend
MYEND HALT ;halt processor
EXITPROGRAM .FILL #-27
class .STRINGZ "CS2810-004 "
group .STRINGZ "Emily Mattson, Kristen Allred, Cory Windham, Brittner "
project .STRINGZ "Final Project "
start .STRINGZ "Welcoming to the game Mad Libs! Please enter the following information (Press [ENTER] when finished to move on to next prompt): \t[ESC] to exit progam "
verb1 .STRINGZ "Enter a verb ending in "ing": "
verb2 .STRINGZ " Enter a verb ending in "ing": "
pNoun1 .STRINGZ " Enter a plural noun: "
noun1 .STRINGZ " Enter a noun: "
noun2 .STRINGZ " Enter a noun: "
noun3 .STRINGZ " Enter a noun: "
noun4 .STRINGZ " Enter a noun: "
noun5 .STRINGZ " Enter a noun: "
pNoun2 .STRINGZ " Enter a plural noun: "
pNoun3 .STRINGZ " Enter a plural noun: "
pNoun4 .STRINGZ " Enter a plural noun: "
noun6 .STRINGZ " Enter a noun: "
Adverb1 .STRINGZ " Enter an adverb: "
noun7 .STRINGZ " Enter a noun: "
noun8 .STRINGZ " Enter a noun: "
verb3 .STRINGZ " Enter a verb: "
outputfinished .STRINGZ " Thank you for playing Mad Libs. Have a nice day!"
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
