Menu

[Solved]Language Assembly Using Lc 3 Change Result Stop Outputting Ascii Opcode Calculates Area Re Q37024231

Language is Assembly. Using LC-3

How do I change the result to stop outputting ASCII

This is opcode calculates the area of the rectangle with thewidth and length.

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

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

AND R3, R3,#0          ;r3stores the sum, set r3 to zero

AND R4, R4,#0          ;r4is the counter

LD R5, INVERSE_ASCII_OFFSET     ;inverseascii offset

LD R6, DECIMAL_OFFSET      ;decimal offset

;storing first input digits

LEA R0,REQUESTMESG1        ;loadthe address of the ‘REQUESTMESG1’ message string

PUTS                ;Printsthe message string

GETC                ;getthe first number

OUT             ;printthe first number

ADD R1, R0,#0          ;storeinput value(ascii) to r1

ADD R1, R1,R5          ;getreal value of r1

;storing second input digits

LEA R0,REQUESTMESG2        ;loadthe address of the ‘REQUESTMESG1’ message string

PUTS                ;Printsthe message string

GETC                ;getthe first number

OUT             ;printthe first number

ADD R2, R0,#0          ;storeinput value(ascii) to r2

ADD R2, R2,R5          ;getreal value of r2

;setting up for multiplication loop

ADD R4, R2,#0          ;fillcounter with multiplier

multiplication

ADD R3, R3,R1          ;addto sum

ADD R4, R4,#-1         ;decreasecounter by one

BRp multiplication      ;continueloop until multiplier is 0

LEA R0, EMPTY

PUTS

ADD R0, R3,R6          ;moveresult to r0

OUT             ;printresult

HALT

REQUESTMESG1        .STRINGZ”nnenter first number: “

REQUESTMESG2        .STRINGZ”nenter second number: “

EMPTY           .STRINGZ”n”

INVERSE_ASCII_OFFSET    .fill xFFD0 ; Negative ofx0030.

DECIMAL_OFFSET      .fill #48

.END

Expert Answer


Answer to Language is Assembly. Using LC-3 How do I change the result to stop outputting ASCII This is opcode calculates the area … . . .

OR


Leave a Reply

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