Menu

[Solved]Copy Paste Asm File Info Answer Given Asm Program Repeat String Input User Enters String 3 Q37256217

You can just copy and paste the ASM file info as youranswer.

Objective Complete the given skeleton asm code to store and display a string. Problem Statement We are now familiar with the

LC3 Simulator File About Controls Next Step Continue Stop Suspended list x3000 Breakpoint set at x3014 Hit breakpoint at x300

GIVEN .ASM

;
;   Program to repeat a string.
; Input: User enters a string, up to 30 characters
; Output: We store the string in memory and display it
;
;Date:
;Author:
;WIT COMP1200

.ORIG x3000 ;Add a line here to start your program at addressx3000

;***************************************
;Part I: Initialize
;***************************************
;We allocated memory for the string already.
   LEA r1,   str1   ; addr of arrayto store string
   ;Why are we using LEA here and not LD or LDI?

   AND r3, r3, #0   ; to store the size ofthe string/array
   AND r2, r2, #0
   ;Prompt user to enter the string
   LEA r0, prompt1
   ;PUTS writes a string of ASCII characters to theconsole display
   ;from the address specified in R0.
   ;Writing terminates with the occurrence of x0000
   PUTS

   ;***************************************
   ;Part II: Read / Store the string
   ;***************************************
   ;
   ; Start reading characters
   ;
;GETC is same as TRAP x20: Reads a char and stores its ASCII codein R0
loop   GETC          ; Read a character.
;ASCII for newline/carriage return is LF and it is stored at#10
;________ ;Add a line here to check if the new char is a carriagereturn.
   BRZ done
   out          ; echocharacter
   STR r0, r1, #0
   ADD r1, r1, #1       ;advance ptr to array
;________ ;Add a line here to increment size of the array
   LD r6, EOL
   ADD r4, r3, r6      ; check if wereached max length
   BRN loop

   ;***************************************
   ;Part III: Display the string
   ;***************************************
done   ;________ ;Add a line here to append NULL at theend of string
;Keep the label done. What is the ASCII char for NULL?
;Why are we adding NULL to the end of our string?
   ;________ ;Add a line here to add a carriage return toyour string/array
   out
   LEA r0, str1
   PUTS
   HALT

prompt1   .STRINGZ “Enter a string of 30 characters orless. “
str1   .BLKW 30 ; Allocate memory for chars to bestored
EOL   .fill    #-29 ; Limit of chars
   .end

Objective Complete the given skeleton asm code to store and display a string. Problem Statement We are now familiar with the LC-3 simulator and can assemble and execute our own asm code. For this assignment, you are to develop a LC-3 assembly program to read a string provided by the user, store it in memory and redisplay it on the screen. A skeleton code is provided to you. The code is missing some lines, which are indicated by the following syntax: Add a line here to For instance, the first code you have to add asks: Add a line here to start your program at address x3000 You should replace this comment with the appropriate asm instruction, so that your program originates at memory address x3000 Two references you might find useful for this lab are the ASCII table’ and the LC-3 instructions guide (on Blackboard). The expected program output is shown below Submission This is a programming assignment that is due on Th, 3/29 by 10:00 am. You have to submit three files to BB (1) flowchart for the algorithm, illustrating each register and its meaning (25%) (2) your .asm file (50%) and (3) a screen capture showing the output of your program (%25). The flowchart can be hand-drawn or scanned. If you want to use a phone to take a pic of your flow chart, do so at your own risk. If the picture is not professional looking, you will lose points. You can use an app such as “Office Lens” to “scan” your hand-drawn image with your phone. LC3 Simulator File About Controls Next Step Continue Stop Suspended list x3000 Breakpoint set at x3014 Hit breakpoint at x3000 Hit breakpoint at x3014 Registers Memory RO x303F R1 X304C R2 x0000 R3 x000D R4 XFFFO R5 x0000 R6 xFFE3 R7 x3014 PC x3014 MPR xOFF8 PSR x8001 CC P Address Value x0000 FILL x0000 XE23E LEARİ, strl X56E0 AND R3, R3, #0 x54A0 AND R2, R2, #0 xE011 LEA RO, promptl | XF022 TRAP #34 F020 TRAP #32 x1A36 ADD R5, R0, #-10 x0407 BRz done XF021 TRAP #33 x7040 ISTR RO, R1, #0 x1261 ADD R1,R1, #1 XİGEI ADD R3, R3, #1 x2CS0 LD R6, EOL x18C6 X0DF6 BRnz loop x5020 AND RO, R0, #0 x102A ADD R0,ROL#10 Instruction 1x2FFF x3000 x3001 x3002 x3003 x3004 Devices x3005 loop x3006 x3007 x3008 x3009 x300A x300B 1x300C X300D ADD R4,R3, R6 x300E Ox300F done x3010 다3011 x3012 x3013 x3014 xE02C LEA RO, str1 XF022 TRAP #34 XF025 TRAP #37 x0045FILL x0045 x006EFILL x006E x0074FILL x0074 x006 5-1. FILL XO065 x0072 FILL x0072 x0020 FILL x0020 x0061 FILL x0061 し183 015 prompt! x3016 □x3017 x3018 x3019 □X301A x301B Enter a string of 30 characters or less. I miss Java! I miss Java! Show transcribed image text Objective Complete the given skeleton asm code to store and display a string. Problem Statement We are now familiar with the LC-3 simulator and can assemble and execute our own asm code. For this assignment, you are to develop a LC-3 assembly program to read a string provided by the user, store it in memory and redisplay it on the screen. A skeleton code is provided to you. The code is missing some lines, which are indicated by the following syntax: Add a line here to For instance, the first code you have to add asks: Add a line here to start your program at address x3000 You should replace this comment with the appropriate asm instruction, so that your program originates at memory address x3000 Two references you might find useful for this lab are the ASCII table’ and the LC-3 instructions guide (on Blackboard). The expected program output is shown below Submission This is a programming assignment that is due on Th, 3/29 by 10:00 am. You have to submit three files to BB (1) flowchart for the algorithm, illustrating each register and its meaning (25%) (2) your .asm file (50%) and (3) a screen capture showing the output of your program (%25). The flowchart can be hand-drawn or scanned. If you want to use a phone to take a pic of your flow chart, do so at your own risk. If the picture is not professional looking, you will lose points. You can use an app such as “Office Lens” to “scan” your hand-drawn image with your phone.
LC3 Simulator File About Controls Next Step Continue Stop Suspended list x3000 Breakpoint set at x3014 Hit breakpoint at x3000 Hit breakpoint at x3014 Registers Memory RO x303F R1 X304C R2 x0000 R3 x000D R4 XFFFO R5 x0000 R6 xFFE3 R7 x3014 PC x3014 MPR xOFF8 PSR x8001 CC P Address Value x0000 FILL x0000 XE23E LEARİ, strl X56E0 AND R3, R3, #0 x54A0 AND R2, R2, #0 xE011 LEA RO, promptl | XF022 TRAP #34 F020 TRAP #32 x1A36 ADD R5, R0, #-10 x0407 BRz done XF021 TRAP #33 x7040 ISTR RO, R1, #0 x1261 ADD R1,R1, #1 XİGEI ADD R3, R3, #1 x2CS0 LD R6, EOL x18C6 X0DF6 BRnz loop x5020 AND RO, R0, #0 x102A ADD R0,ROL#10 Instruction 1x2FFF x3000 x3001 x3002 x3003 x3004 Devices x3005 loop x3006 x3007 x3008 x3009 x300A x300B 1x300C X300D ADD R4,R3, R6 x300E Ox300F done x3010 다3011 x3012 x3013 x3014 xE02C LEA RO, str1 XF022 TRAP #34 XF025 TRAP #37 x0045FILL x0045 x006EFILL x006E x0074FILL x0074 x006 5-1. FILL XO065 x0072 FILL x0072 x0020 FILL x0020 x0061 FILL x0061 し183 015 prompt! x3016 □x3017 x3018 x3019 □X301A x301B Enter a string of 30 characters or less. I miss Java! I miss Java!

Expert Answer


Answer to You can just copy and paste the ASM file info as your answer. GIVEN .ASM ; ; Program to repeat a string. ; Input: User e… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *