Question

Marie Assembly Language

Assembly (MARIE), how can I output my input variables on exit?

I am trying to compose an assembly (MARIE) program to output my input variables **on exit**. I am triggering an exit when . (period) is entered. I am transforming the input, and to later display the new value on exit.

Some context, FOO will return SBB when ran through Rot-13

However, my program is displaying the output on each iteration of my loop. I am instead wanting to not display anything, until . is entered and the program exits.

To further explain the current behavior and desired behavior, please entertain the following...


Current Behavior

- in F out S

- in O out B

- in O out B

- in . exits...

Desired Behavior

- in F *no output*

- in O *no output*

- in O *no output*

- in . out SBB, exits...


Here is my attempt thus far. It's my suspicion that I am calling output at the wrong time, but am unsure.

ORG     100  / Start the program at location 100 hexadecimal

/ Input

Load     Start  / Initialize character pointer to start of block

Store     Ptr

/ Program

Loop, Input / Take the input value

subt ChPe / subtract '.'(2E)

Skipcond 800 / AC will be 00, if the input is '.'

Jump Exit / if AC=0, exit the loop

Add ChPe / otherwise, add (2E) back to the difference

Store InVal / Store input value to be transformed into InVal

Jns ROT13 / Call the ROT13 subroutine

output

Jump Loop / repeat loop

Exit, Halt

/ Rotate-13 subroutine

ROT13, HEX 0

Load InVal / Get character

Add Val13 / Add 13

Store Hold / Save it in Hold

Subt ChZ / Check if modulo adjust is needed (past 'Z')

Skipcond 800 / No adjust needed if past 'Z'

Jump NoAdj / go to NoAdj

Add ChA / Add 'A' back to difference to perform modulo

subt One / subtract 1

Jump Done / Result is in AC

NoAdj, Load Hold / No adjust needed, get result

Done, JumpI ROT13 / Return result in AC

/ Constants

ChA,  HEX     0041 / Constant value 'A' for modulo adjust in subroutine

ChZ,  HEX     005A / Constant value 'Z' for modulo check in subroutine

ChPe,  HEX     2E / Constant period character that marks end of input

Val13,  DEC     13 / Constant rotate value of 13 for subroutine

One,  HEX     1 / Constant value 1

Start,  HEX     200 / Constant address for start of character block

/ Data

InVal,  HEX     0 / Reserved for subroutine input value

Hold,  HEX     0 / Reserved for temporary variable for subroutine

Ptr,  HEX     0 / Reserved for character pointer


0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 9 more requests to produce the answer.

1 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Marie Assembly Language
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Finish the MARIE assembly language code below to determine the largest integer, the smallest integer, and...

    Finish the MARIE assembly language code below to determine the largest integer, the smallest integer, and the sum of integers for a sequence of 5 signed integers. The program already calculates the largest integer, just need it to calculate the smallest integer and the sum of the integers. The 5 integers should first be entered by the user via the input device. Your program is then assembled and run to determine the largest integer, the smallest integer, and the sum...

  • Given the instruction set for MARIE: Write the assembly language equivalent for the machine i...

    Given the instruction set for MARIE: Write the assembly language equivalent for the machine instruction: 1011 000000001111. Instruction Instruction Instruction Opcode JnS X Instruction Halt Skipcond (00 for ACO, 01 for AC-0, 10 for AC0) Jump X Clear AddI X Jumpl X Opcodde Load X8 Store X9 Add X Subt X B Input Output Instruction Instruction Instruction Opcode JnS X Instruction Halt Skipcond (00 for ACO, 01 for AC-0, 10 for AC0) Jump X Clear AddI X Jumpl X Opcodde...

  • M.A.R.I.E assembly code for 7th value of Fibonacci sequence: Fib(1) = 1, Fib(2) = 1, Fib(n)...

    M.A.R.I.E assembly code for 7th value of Fibonacci sequence: Fib(1) = 1, Fib(2) = 1, Fib(n) = Fib(n-1) + Fib(n-2). The program calculates Fib(7). I have 4 errors in my code and cannot seem to find the solutions here is the code so far, ORG 100    Input    Store x    Input    Store y FOR_INIT, LOAD one STORE i FOR_COND, LOAD i SUBT seven SKIPCOND 800 JUMP FOR_BODY JUMP END_FOR FOR_BODY, LOAD x ADD y STORE z LOAD...

  • using mips for assembly language WPte a program that asks the user for 2 numbers. the program should then add the 2 numbers bit by bit, using boolean operators no arithmetic operations ex: add, ad...

    using mips for assembly language WPte a program that asks the user for 2 numbers. the program should then add the 2 numbers bit by bit, using boolean operators no arithmetic operations ex: add, addi, sub, mult, div or arrays are permitted in this project. forming a new variable (in a register) with the solution. That solution is to be output bit by bit using the function that was written in class do not use syscall with a value 10...

  • Consider the following C++ program. It reads a sequence of strings from the user and uses...

    Consider the following C++ program. It reads a sequence of strings from the user and uses "rot13" encryption to generate output strings. Rot13 is an example of the "Caesar cipher" developed 2000 years ago by the Romans. Each letter is rotated 13 places forward to encrypt or decrypt a message. For more information see the rot13 wiki page. #include <iostream> #include <string> using namespace std; char rot13(char ch) { if ((ch >= 'a') && (ch <= 'z')) return char((13 +...

  • Instructions: Consider the following C++ program. It reads a sequence of strings from the user and...

    Instructions: Consider the following C++ program. It reads a sequence of strings from the user and uses "rot13" encryption to generate output strings. Rot13 is an example of the "Caesar cipher" developed 2000 years ago by the Romans. Each letter is rotated 13 places forward to encrypt or decrypt a message. For more information see the rot13 wiki page. #include <iostream> #include <string> using namespace std; char rot13(char ch) { if ((ch >= 'a') && (ch <= 'z')) return char((13...

  • Please help me with the following C Programming project. I am providing the code I used...

    Please help me with the following C Programming project. I am providing the code I used which needs to be reworked to add the following requirements. Here is my code #include<stdio.h> char input; int main() { int i = 0; while (true){ scanf_s("%c", &input); if (input == 'X') break; printf("%c", input); } return 0; } Here are the requirements for the code plus and additional note what the code should have. Goals Understand the ASCII representation of character values. Understand...

  • X86 Assembly language lab: TITLE Lab 3: assembly language fundamentals               ;;;;; Q1: Don't...

    X86 Assembly language lab: TITLE Lab 3: assembly language fundamentals               ;;;;; Q1: Don't forget to document your program            ; Name:Yuyan Wang ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;; Answer each question below by writing code at the APPROPRIATE places in the file. ;;;;; Hint: the appropriate place is not always right below the question. ;;;;; Q2: Write the directive to bring in the IO library           ;;;;; Q3: Create a constant called MAX and initialize it to 150...

  • ASSEMBLY LANGUAGE Write a program using author's routine, WriteString, to print "Hello World". This routine will...

    ASSEMBLY LANGUAGE Write a program using author's routine, WriteString, to print "Hello World". This routine will output to the screen any character data pointed to by the EDX register. It will continue to print until it runs into the null character (zero). We need only to move the address into the EDX register and calll his routine. Lookup in the ASCII code chart the value reqresented by CR and LF. In the program I will define these values using the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT