LC3Tools Uden navn.asm 1 .ORIG X3000 2 readS LEA RO, prompt PUTS 234567 AND RO, RO, #0 ; Read first digit 8 GETC 9 OUT 10 11 12 13 14 15 16 17 18 19 20 21 22 23 LD R1, ASCII_OFFSET ADD RO, RO, R1 ADD RO, RO, #-48 ADD RO, RO, RO ; Read second digit GETC OUT LD R1, ASCII_OFFSET ADD R2, RO, R1 ADD R2, R2, #-48 ADD RO, RO, R2 RET 24 prompt .STRINGZ "Input a 2 25 ASCII_OFFSET .FILL XFFD0 ; Load effective address of prompt message ; Display prompt message ; Clear RO to store the result ; Read first digit ; Echo first digit ; Load ASCII offset to subtract from digit character ;Convert digit character to integer ; Convert ASCII digit to integer ; Shift to left to make room for second digit ; Read second digit ; Echo second digit ; Load ASCII offset to subtract from digit character ; Convert digit character to integer ;Convert ASCII digit to integer ; Combine first and second digit ; Return from function digit decimal number: " ; ASCII offset to convert digit character to integer 26 . END /Users/omar/Desktop/Uden navn.asm:13:21: error: cannot encode as 5-bit 2's complement number ADD RO, RO, #48 ^~~ /Users/omar/Desktop/Uden navn.asm:21:21: error: cannot encode as 5-bit 2's complement number ADD R2, R2, #48 ^~~

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

Could someone help me modify this code so it dosn't give me the errors it gives. I want a code that is modified so i just can take it, put it inside lc3 so that it works. would be really appreciated. (errors can be seen in the attached picture.

 

Here is also the code so you can easily modify it and send it back to me as text:

.ORIG x3000
readS  LEA R0, prompt       ; Load effective address of prompt message
       PUTS                 ; Display prompt message

       AND R0, R0, #0       ; Clear R0 to store the result

       ; Read first digit
       GETC                 ; Read first digit
       OUT                  ; Echo first digit
       LD R1, ASCII_OFFSET  ; Load ASCII offset to subtract from digit character
       ADD R0, R0, R1       ; Convert digit character to integer
       ADD R0, R0, #-48     ; Convert ASCII digit to integer
       ADD R0, R0, R0       ; Shift to left to make room for second digit

       ; Read second digit
       GETC                 ; Read second digit
       OUT                  ; Echo second digit
       LD R1, ASCII_OFFSET  ; Load ASCII offset to subtract from digit character
       ADD R2, R0, R1       ; Convert digit character to integer
       ADD R2, R2, #-48     ; Convert ASCII digit to integer
       ADD R0, R0, R2       ; Combine first and second digit

       RET                  ; Return from function
prompt .STRINGZ "Input a 2 digit decimal number: "
ASCII_OFFSET .FILL xFFD0    ; ASCII offset to convert digit character to integer
.END

LC3Tools
Uden navn.asm
1 .ORIG X3000
2 readS LEA RO, prompt
PUTS
234567
AND RO, RO, #0
; Read first digit
8
GETC
9
OUT
10
11
12
13
14
15
16
17
18
19
20
21
22
23
LD R1, ASCII_OFFSET
ADD RO, RO, R1
ADD RO, RO, #-48
ADD RO, RO, RO
; Read second digit
GETC
OUT
LD R1, ASCII_OFFSET
ADD R2, RO, R1
ADD R2, R2, #-48
ADD RO, RO, R2
RET
24 prompt .STRINGZ "Input a 2
25
ASCII_OFFSET .FILL XFFD0
; Load effective address of prompt message
; Display prompt message
; Clear RO to store the result
; Read first digit
; Echo first digit
; Load ASCII offset to subtract from digit character
;Convert digit character to integer
; Convert ASCII digit to integer
; Shift to left to make room for second digit
; Read second digit
; Echo second digit
; Load ASCII offset to subtract from digit character
; Convert digit character to integer
;Convert ASCII digit to integer
; Combine first and second digit
; Return from function
digit decimal number:
"
; ASCII offset to convert digit character to integer
26
. END
/Users/omar/Desktop/Uden navn.asm:13:21: error: cannot encode as 5-bit 2's complement number
ADD RO, RO, #48
^~~
/Users/omar/Desktop/Uden navn.asm:21:21: error: cannot encode as 5-bit 2's complement number
ADD R2, R2, #48
^~~
Transcribed Image Text:LC3Tools Uden navn.asm 1 .ORIG X3000 2 readS LEA RO, prompt PUTS 234567 AND RO, RO, #0 ; Read first digit 8 GETC 9 OUT 10 11 12 13 14 15 16 17 18 19 20 21 22 23 LD R1, ASCII_OFFSET ADD RO, RO, R1 ADD RO, RO, #-48 ADD RO, RO, RO ; Read second digit GETC OUT LD R1, ASCII_OFFSET ADD R2, RO, R1 ADD R2, R2, #-48 ADD RO, RO, R2 RET 24 prompt .STRINGZ "Input a 2 25 ASCII_OFFSET .FILL XFFD0 ; Load effective address of prompt message ; Display prompt message ; Clear RO to store the result ; Read first digit ; Echo first digit ; Load ASCII offset to subtract from digit character ;Convert digit character to integer ; Convert ASCII digit to integer ; Shift to left to make room for second digit ; Read second digit ; Echo second digit ; Load ASCII offset to subtract from digit character ; Convert digit character to integer ;Convert ASCII digit to integer ; Combine first and second digit ; Return from function digit decimal number: " ; ASCII offset to convert digit character to integer 26 . END /Users/omar/Desktop/Uden navn.asm:13:21: error: cannot encode as 5-bit 2's complement number ADD RO, RO, #48 ^~~ /Users/omar/Desktop/Uden navn.asm:21:21: error: cannot encode as 5-bit 2's complement number ADD R2, R2, #48 ^~~
Expert Solution
steps

Step by step

Solved in 1 steps

Blurred answer
Similar questions
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