Question: I need help with my MARIE Program as I cannot get it to output the correct output, the following are the requirements of my program:

I need help with my MARIE Program as I cannot get it to output the correct output, the following are the requirements of my program:

1) First, I need to allow the program to receive input from a User, in the form of an ASCII character. And once the user inputs an ASCII character of ".", the input loop would terminate.

2) Second, the user inputted into the program and stored in memory has to be transformed via the Rotate 13 subroutine cipher. I am having an issue with how to correctly call this subroutine in my program.

3) Third, once the subroutine has been called, it will take the user ASCII input and transform each letter by rotating it 13 spaces to the right. I am not sure if I correctly coded it, as I think the subroutine does not exit. If someone could look at that it would be great!

4) Fourth, after the ROT13 or Rotate 13 cipher loop has completed, it will then output the transformed characters. I need help with how to use the Index to go through the characters one by one.

Here is my code so far:

ORG 100 / Start the program at location 100 hexadecimal Load Start / Initialize the start of the character block

InVal, Input Load Index Store Ptr / Stores user input character value in AC Load Ptr / Loads user input back into AC Subt ChPe / Subtract ASCII Period from value in AC SkipCond 400 / When AC = 0 or when a Period is inputted, halt Jump InVal / When SkipCond is false, jump back to InVal to grab and store next inputted character Halt

Load Ptr / Put user input in AC Store InVal / Store value to be transformed into InVal Jns ROT13 / Jump to the ROT13 subroutine / Upon return, the transformed character is in AC ROT13, HEX 0 Load InVal / Get character Add Val13 / Add 13 Store Hold / Save it Subt ChZ / Check if modulo adjust is needed (past 'Z') Skipcond 800 / No adjust needed if past 'Z' Jump NoAdj Add ChA / Add 'A' back to difference to perform modulo Jump Done / Result is in AC

NoAdj, Load Hold / No adjust needed, get result

Done, JumpI ROT13 / Return with result in AC

OCycle, LoadI Hold / Load whatever value at address Hold Subt ChPe / Subtract ASCII Period value from value of Hold Skipcond 400 / If ASCII Period entered halt program Jump Cont Halt Cont, LoadI Hold Load Ptr Output Load Ptr Add One Store Ptr Jump Ocycle / ----- / Constants (the program should not write to these locations) / ----- ChA HEX 0041 / Constant value 'A' for modulo adjust in subroutine, Index 0 ChZ HEX 005A / Constant value 'Z' for modulo check in subroutine, Index 25 ChPe HEX 002E / Constant period character that marks end of input, Index 26

Val13, DEC 13 / Constant rotate value of 13 for subroutine One, HEX 1 / Constant value 1 or value to increment pointer Start, HEX 200 / Constant address for start of character block

/ ----- / Data area (these locations are for reading and writing) / ----- InVal, HEX 0 / Reserved for subroutine input value Hold, HEX 0 / Reserved for temporary variable for subroutine Ptr, HEX 0 / Reserved for character pointer Index, HEX 200

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!