Answered step by step
Verified Expert Solution
Link Copied!

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 A-Z (capital letters only), stores each character in memory after it is transformed by the trivial ROT13 cipher, and then, after character input completes, outputs the transformed characters".
Here is the code I currently have so far:
/ Starting Code: Initialization
ORG 100
/ 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 400/ If AC ==0(input is '.'), jump to OutputStart
Jns ROT13/ Call ROT13 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 400/ If AC ==0(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: ROT13 Subroutine
ROT13, HEX 0
Load InVal
Add Val13
Store Hold
Subt ChZ
Skipcond 800
Jump NoAdj
Add ChA
Jump Done
NoAdj, Load Hold
Done, JumpI ROT13
/ Starting Code: Constants, Data Area
/-----
/ Constants (the program should not write to these locations)
/-----
ChA, HEX 0041/ Constant value 'A'
ChZ, HEX 005A / Constant value 'Z'
ChPer, HEX 002E / Constant period char '.'
Val13, DEC 13/ Constant ROT13 value
One, HEX 1/ Constant value 1
Start, HEX 200/ Constant address for starting memory location
/-----
/ Data area (these locations are for reading and writing)
/-----
InVal, HEX 0/ Subroutine input value
Hold, HEX 0/ Temporary variable
Ptr, HEX 0/ Character pointer
Whenever I enter a period and get to the SKIPCOND 400 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions

Question

How we can improve our listening skills?

Answered: 1 week ago

Question

How do artifacts affect interaction between members of the team?

Answered: 1 week ago