1

Hi I'm new to Marie assembly language.

I'm trying to trim the white spaces at the end of a string. I have a print subroutine that stops printing once it reaches a 0 character so to trim the string at the ends I iterate to the end of the string, get the address of the last character and iterate backwards replacing any white spaces.

My problem is HOW to replace the white spaces because if I replace it in my trim string address I can't iterate backwards correctly? Because it loads value from address 0 instead? Any help will be appreciated.

StartRemoveSpace, LoadI TrimStringAddr //get last char that's not zero
              Subt Space
              Skipcond 400 //if its a space skip next line
              JumpI TrimString //terminate trimming
              Load CharacterReplace //replace with 0
              //Replace where??
              //Store TrimStringAddr
              Load TrimStringAddr
              Subt One // iterate backwards
              Store TrimStringAddr
              Jump StartRemoveSpace
Sook Lim
  • 541
  • 6
  • 28

0 Answers0