Menu

[Solved] Language Assembly Using Lc 3 Need Help Creating Opcode Calculates Area Rectangle Opcode Ca Q37200442

Language is Assembly. Using LC-3

Need help creating an opcode that calculates the area for arectangle.

This is opcode calculates the area of the rectangle with thewidth and length. Area of a rectangle” Write, compile and executean assembler program that prompts the user ( via the screen ) toenter the length and width of a rectangle ( via the keyboard )andprints the area to the screen.

———————————————–

The output should look like this:

Please enter the length: 4

Please enter the width: 5

the are of the object is: 20

———————————————–

Here is my opcode:

.ORIG x3000

LEA R1, RESULT

LD R1, num1

    LD R2, num2

    JSR     multi

    ST  R3, prod

    HALT

; Subroutine multi

; Multiply 2 positive numbers

; Parameters:

; In: R1, R2; Out: R3

multi   AND R3, R3, #0

    ADD R4, R1, #0

    BRz zero

loop    ADD     R3, R2,R3

    ADD R1, R1, #-1

    BRp loop

zero    RET

; Input data & result

num1    .FILL   x0006

num2    .FILL   x0003

prod    .BLKW   1

    .END

Expert Answer


Answer to Language is Assembly. Using LC-3 Need help creating an opcode that calculates the area for a rectangle. This is opcode c… . . .

OR


Leave a Reply

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