Can you plese fic this error and and other errors in the code using the LC3 simulator Oh no! You've got an error in your assembly code: at line 5: expected GETC instruction to have exactly 0 operands, but found 2 .ORIG x3000 ; Define constants BLANK  .FILL x0020   ; Blank character GETC   .FILL x20B0   ; GETC trap code PUTS   .FILL x22A0   ; PUTS trap code HALT   .FILL x25C0   ; HALT trap code ; Define variables ARRAY  .BLKW #20     ; Array to store user inputs N      .FILL #0      ; Size of the array COUNT  .FILL #0      ; Loop counter INPUT  .FILL #0      ; User input ; Prompt message PROMPT .STRINGZ "Enter a number (0 to 9): " ; Start of program     LD R0, N              ; Load the size of the array into R0     ADD R0, R0, #-1       ; Subtract 1 from the size to use as a loop counter     ADD R0, R0, R0        ; Multiply the loop counter by 2 (each entry is 2 bytes) LOOP     LEA R1, PROMPT        ; Load the address of the prompt message into R1     PUTS                  ; Display the prompt message     TRAP GETC             ; Get a character from the user     OUT                   ; Echo the character     AND R2, R2, #0        ; Clear R2 (will store the converted number)     ADD R2, R2, R0        ; Convert ASCII digit to a number     ADD R2, R2, #-48      ; Subtract x0030 from the ASCII digit     LDR R3, ARRAY         ; Load the address of the array into R3     STR R2, R3, #0        ; Store the user input into the next available memory location of the array     ADD R3, R3, #2        ; Increment the array pointer by 2 bytes     ADD R0, R0, #-1       ; Decrement the loop counter     BRp LOOP              ; If the loop counter is positive, continue looping     HALT                  ; Halt the program ; End of program .END

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Can you plese fic this error and and other errors in the code using the LC3 simulator

Oh no! You've got an error in your assembly code:

  • at line 5: expected GETC instruction to have exactly 0 operands, but found 2

.ORIG x3000

; Define constants
BLANK  .FILL x0020   ; Blank character
GETC   .FILL x20B0   ; GETC trap code
PUTS   .FILL x22A0   ; PUTS trap code
HALT   .FILL x25C0   ; HALT trap code

; Define variables
ARRAY  .BLKW #20     ; Array to store user inputs
N      .FILL #0      ; Size of the array
COUNT  .FILL #0      ; Loop counter
INPUT  .FILL #0      ; User input

; Prompt message
PROMPT .STRINGZ "Enter a number (0 to 9): "

; Start of program
    LD R0, N              ; Load the size of the array into R0
    ADD R0, R0, #-1       ; Subtract 1 from the size to use as a loop counter
    ADD R0, R0, R0        ; Multiply the loop counter by 2 (each entry is 2 bytes)

LOOP
    LEA R1, PROMPT        ; Load the address of the prompt message into R1

    PUTS                  ; Display the prompt message

    TRAP GETC             ; Get a character from the user
    OUT                   ; Echo the character

    AND R2, R2, #0        ; Clear R2 (will store the converted number)

    ADD R2, R2, R0        ; Convert ASCII digit to a number
    ADD R2, R2, #-48      ; Subtract x0030 from the ASCII digit

    LDR R3, ARRAY         ; Load the address of the array into R3

    STR R2, R3, #0        ; Store the user input into the next available memory location of the array
    ADD R3, R3, #2        ; Increment the array pointer by 2 bytes

    ADD R0, R0, #-1       ; Decrement the loop counter
    BRp LOOP              ; If the loop counter is positive, continue looping

    HALT                  ; Halt the program

; End of program

.END

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Pipelining
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY