180k views
3 votes
Use Marie to Write a Program that performs:

result = x + y - z

Where x = 10, y = 20, and z = 5. Each of these variables need to be declared as decmial values stored in the memory.

The result variable also needs to be stored in the memory and printed out on the display before terminating the program.

Steps:

- Load the value of X to AC

- Add the value of Y to the AC

- Subtract the value of Z

- Store the result

- Ouput to the screen

- halt to terminate your program

-Declare the variables

X as a Decimal with a value of 10

Y as a Decimal with a value of 20

Z as a Decimal with a value of 5

Result as a Decimal with a value of 0

User Mazorati
by
8.3k points

1 Answer

6 votes

Here's a program written in the Marie assembly language that performs the given calculation and stores the result in memory before printing it out on the display:

ORG 100

Load X ; Load the value of X into the AC

Add Y ; Add the value of Y to the AC

Subt Z ; Subtract the value of Z from the AC

Store Result ; Store the result in memory

Output ; Output the result on the display

Halt ; Terminate the program

X, DEC 10

Y, DEC 20

Z, DEC 5

Result, DEC 0

END

Please note that this is a simplified representation of the program using the Marie assembly language syntax. The actual implementation may vary depending on the specific assembler or simulator you are using. Make sure to consult the documentation of the tool you are using to run the program for any adjustments required.

User Vadimk
by
8.5k points

Related questions