Answered step by step
Verified Expert Solution
Question
1 Approved Answer
My MARIE Simulator wont terminate when period is entered. For the life of me I dont know where I am going wrong on this. The
My MARIE Simulator wont terminate when period is entered. For the life of me I dont know where I am going wrong on this. The assignment is to create a assembly language program that can do the following: "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".
Here is the code I currently have so far:
Starting Code: Initialization
ORG
Initialize Ptr pointer
Load Start
Store Ptr
Main Program
MainLoop, Input Input a character
Store InVal Store input in InVal
Load InVal Load input value to AC
Subt ChPer Check if input is a period
Skipcond If AC input is jump to OutputStart
Jns ROT Call ROT subroutine to transform the character
StoreI Ptr Store the transformed character in memory
Load Ptr Load pointer address
Add One Increment pointer
Store Ptr Store updated pointer
Jump MainLoop Repeat the input loop
Output Phase
OutputStart, Load Start Initialize pointer to the start of stored characters
Store Ptr
OutputLoop, LoadI Ptr Load the character from memory
Subt ChPer Check if the character is
Skipcond If AC character is jump to EndProgram
Output Output the character
Load Ptr Load pointer address
Add One Increment pointer
Store Ptr Store updated pointer
Jump OutputLoop Repeat the output loop
EndProgram, Halt End the program
Starting Code: ROT Subroutine
ROT HEX
Load InVal
Add Val
Store Hold
Subt ChZ
Skipcond
Jump NoAdj
Add ChA
Jump Done
NoAdj, Load Hold
Done, JumpI ROT
Starting Code: Constants, Data Area
Constants the program should not write to these locations
ChA, HEX Constant value A
ChZ HEX A Constant value Z
ChPer, HEX E Constant period char
Val DEC Constant ROT value
One, HEX Constant value
Start, HEX Constant address for starting memory location
Data area these locations are for reading and writing
InVal, HEX Subroutine input value
Hold, HEX Temporary variable
Ptr HEX Character pointer
Whenever I enter a period and get to the SKIPCOND step it correctly identifies the value is zero but still takes it as input instead of moving to the output phase. Any help in figuring out where my issue lies would be greatly appreciated.
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