1

嗨,我是 Marie 编程语言的新手,我有一个地址为 NameAddr 的字符串。

我的打印子例程在到达 0 字符时停止打印(标记字符串的结尾)。因此,为了修剪空格,我只需从最后一个字符的地址向后迭代,只要它是空格,我将其替换为0。

但是,我的 removeSpace 子例程没有终止,当我单步执行它时,在我传入最后一个字符的地址后,它没有正确更新 LastCharAddr?

//Remove spaces
LastCharAddr, HEX 0  
RemoveSpace, HEX  0
Space, DEC 32 //constant needed for subroutine
CharacterReplace, Hex 000 //constant for subroutine


StartRemoveSpace, LoadI LastCharAddr
                  Subt Space
                  Skipcond 400  //If its a space
                  JumpI RemoveSpace  //if not a space terminate
                  Load CharacterReplace  //replace with 0
                  Store LastCharAddr  //Replace
                  Load LastCharAddr
                  Subt One// iterate backwards
                  Store LastCharAddr
                  Jump StartRemoveSpace

任何帮助将不胜感激谢谢!

4

0 回答 0