Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

After creating a new . mas file with the adjusted code that was suggested by the expert it appears the problem is still persisting when

After creating a new .mas file with the adjusted code that was suggested by the expert it appears the problem is still persisting when I run through test cases. However now it appears to move to the CheckROT13 loop which is an improvement from being stuck in the main loop I had previously.
Here is the code as it stands currently. The aim is to have the program move to output after a single period ('.') is entered.
/ 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
Jump CheckROT13
CheckROT13, 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
/ 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
/ Constants
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
InVal, HEX 0/ Subroutine input value
Hold, HEX 0/ Temporary variable
Ptr, HEX 0/ Character pointer

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

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions