Question: Question:You are to design, write, test, and debug a MARIE assembly language program that inputs a sequence of characters from the set A - Z
Question:You are to design, write, test, and debug a MARIE assembly language program that inputs a
sequence of characters from the set AZ capital letters only stores each character in
memory after it is transformed by the trivial ROT cipher, and then, after character input
completes, outputs the transformed characters.
ORG Start the program at location hexadecimal
Input characters, transform, and store in memory until is input
Load Start Initialize character pointer to start of block
Store Ptr
Input loop
InputLoop, Input Input a character
Store InVal Store input character in InVal
Load InVal Load InVal into AC
Subt ChPe Compare with the period character
Skipcond If input character is skip the next instruction
Jump InputDone If it's a period, jump to InputDone
Jns ROT Transform the character using ROT subroutine
StoreI Ptr Store the transformed character in memory
Load Ptr Load the pointer into AC
Add One Increment the pointer
Store Ptr Store the updated pointer
Jump InputLoop Continue the input loop
Input complete, now output the transformed characters
InputDone, Load Start Initialize character pointer to start of block
Store Ptr
Output loop
OutputLoop, LoadI Ptr Load the character from memory
Add ChPe Compare with the period character
Skipcond If character is skip the next instruction
Jump OutputDone If it's a period, jump to OutputDone
Output Output the transformed character
Load Ptr Load the pointer into AC
Add One Increment the pointer
Store Ptr Store the updated pointer
Jump OutputLoop Continue the output loop
OutputDone, Halt
Rotate subroutine: Apply ROT to input character in location InVal and return in AC
ROT Load InVal Get character
Add Val Add
Store Hold Save it
Subt ChZ Check if modulo adjust is needed past Z
Skipcond Adjust needed if past Z skip next instruction
Jump NoAdj
Add ChA Add A back to difference to perform modulo
Add One Add to perform correct modulo operation
NoAdj, Load Hold No adjust needed, get result
Done, JumpI ROT Return with result in AC
Constants the program should not write to these locations
ChA, HEX Constant value A for modulo adjust in subroutine
ChZ HEX A Constant value Z for modulo check in subroutine
ChPe, HEX E Constant period character that marks end of input
Val DEC Constant rotate value of for subroutine
One, HEX Constant value
Start, HEX Constant address for start of character block
Data area these locations are for reading and writing
InVal, HEX Reserved for subroutine input value
Hold, HEX Reserved for temporary variable for subroutine
Ptr HEX Reserved for character pointer
This code is not working.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
