Question: Write a MARIE assembly language program that calculates and displays the perimeter or the area of a rectangle, given the length of each side, depending

Write a MARIE assembly language program that calculates and displays the perimeter or the area of a rectangle, given the length of each side, depending on the users input.

The user should be prompted to enter the length of each of the sides; once these values have been read by the program, provide the user with the options to select which calculation to perform on the rectangle, and prompt them to enter one of the options.

I HAVE WRITTEN THE CODE BELOW BUT CANNOT FIGURE OUT WHY IT IS NOT CALCULATING AREA PLEASE HELP!!!!!!!

CLEAR

input /user input first integer

Store length

input /user input second value

Store width

input /user input A or P

Store letter

Subt A

Skipcond 400 // will skip instruction that follows if the AC is less than 0

jump loop2

Jns prod

Load Sum

Store answer

Output

Halt

prod, Dec 0

Load width

Store Ctr

Clear

Store Sum

Loop, Load Sum

Add length

Store Sum

Load Ctr

Subt One

Store Ctr

Skipcond 400 /If control variable <0 skip next instruction

Jump Loop / go to loop

Load Sum

JumpI prod

// perimiter

loop2, load length

add length

store lengthlength

load width

add width

store widthwidth

add lengthlength

store perimeter

output perimeter

halt

Next, Hex 0

length, Dec 0

width, Dec 0

letter, Dec 0

Sum, Dec 0

Ctr, Hex 0

One, Dec 1

Num, Dec 0

answer, Dec 0

A, Dec 10

B, Dec 11

lengthlength, Dec 0

widthwidth, Dec 0

perimeter, Dec 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!