Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, on code below I have an error on line 182. The error says, register expected at operand 1. I got this error on lc3

Hello, on code below I have an error on line 182. The error says, register expected at operand 1. I got this error on lc3 simulator. However I tried on this online lc3 website(https://wchargin.github.io/lc3web/#) and it works perfect. Can Someone explains why this happeneing? Below I will add my codes and two screenshoot so that you can understand.

Assembly code:

.ORIG x3000 ; [Start] Program ; num_X .FILL #0 num_Y .FILL #0 num_temp .FILL #0 ContProgram JSR ClearRegisters JSR ClearOutputArray AND R0, R0, #0 ST R0, num_R ; Get first number LEA R0, prompt1 PUTS JSR ReadInput LD R1, num_temp ST R1, num_X ; reset temp variable AND R0, R0, #0 ST R0, num_temp ; Get second number LEA R0, prompt2 PUTS JSR ReadInput LD R2, num_temp ST R2, num_Y AND R0, R0, #0 ST R0, num_temp ; prompt for operator LEA R0, prompt3 PUTS ; get operator GETC ; Character is stored in R0 OUT AND R6, R6, #0 LD R1, num_X LD R2, num_Y LEA R5, codesArray ; load codesArray address LDR R3, R5, #0 ; loads first symbol from R7 into R3 ADD R4, R0, R3 ; add contents of R0 (user input) and R3 BRz Addition LDR R3, R5, #1 ADD R4, R0, R3 BRz Subtract LDR R3, R5, #2 ADD R4, R0, R3 BRz Multiply LDR R3, R5, #3 ADD R4, R0, R3 BRz DivisionF OpComplete LEA R0, result1 PUTS ADD R6, R6, #0 Brn printNeg ST R6, num_R JSR DetermineSize JSR NumToASCII LEA R0, outputArray PUTS LEA R0, endStrg PUTS GETC OUT LD R5, minus30 ADD R0, R0, R5 Brz ContProgram ; End of program HALT num_R .FILL #0 prompt1 .STRINGZ " Input first number: " prompt2 .STRINGZ " Input second number: " prompt3 .STRINGZ " Input operation (+, -, *, /): " result1 .STRINGZ " Result = " endStrg .STRINGZ " Continue? Yes = 0, No = 1: " codesArray .FILL #-43 ; '+' .FILL #-45 ; '-' .FILL #-42 ; '*' .FILL #-47 ; '/' ;--------- Subroutines Start ---------; ; R1 R5 ADD R3, R3, #-1 ; decrement size of num ADD R5, R5, R3 ; R5

The screenshoot of errors and correct output from online version

image text in transcribed

image text in transcribed

I really need help with this. If anyone can help me I will be appreciated.

as lab9.asm ERROR (line 202): Register expected at operand 1 Errors encountered during assembly. Registers R1 x0000 Memory R6 x0000 R7 x3000 PC x3001 MPR?XOFF8 PSR x0001 CC P Address Value X6F61 LDR R7, R X6420 LDR R2, F x636F LDR R1, R x6465 LDR R2, R X7341 STR R1, R x7272 STR R1, R x6179 LDRRO, F BP x3001 x3002 x3003 X3004 x3005 x3006 x3007 R2 x0000 R3 x0000 R4 x0000 R5 x0000 Devices as lab9.asm ERROR (line 202): Register expected at operand 1 Errors encountered during assembly. Registers R1 x0000 Memory R6 x0000 R7 x3000 PC x3001 MPR?XOFF8 PSR x0001 CC P Address Value X6F61 LDR R7, R X6420 LDR R2, F x636F LDR R1, R x6465 LDR R2, R X7341 STR R1, R x7272 STR R1, R x6179 LDRRO, F BP x3001 x3002 x3003 X3004 x3005 x3006 x3007 R2 x0000 R3 x0000 R4 x0000 R5 x0000 Devices

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions