Question
I need some help with my MARIE Program as I cannot get it to output the correct output, the following are the requirements of my
I need some 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, as it is only taking in the last known value, the period.
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. It keeps getting stuck in the loop.
4) Fourth, after the ROT13 or Rotate 13 cipher loop has completed, it will then output the transformed characters.
Here is what I have so far:
ORG 100 / Start the program at location 100 hexadecimal
Load Start / Initialize character pointer to start of block UserI, Input Store Ptr Load Ptr Subt ChPe Skipcond 400 Jump UserI
LoadI Ptr / Put 'A' 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 Jump Done / Result is in AC
NoAdj, Load Hold Store Ptr
Done, JumpI ROT13 / Return with result in AC
OCycle, LoadI Ptr Store Ptr Subt ChPe Skipcond 400 Jump Cont Halt
Cont, 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 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 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started