【问题标题】:Marie simulator looping when not meant to after storing inputs玛丽模拟器在存储输入后不打算循环
【发布时间】:2016-04-19 03:24:29
【问题描述】:

我已经编写了这个非常基本的 Marie 代码,用于将两个数字 X 和 Y 相乘。我在没有前 6 行的情况下构建了它,并且只分配 X 和 Y 小数来测试程序,但我意识到我需要允许用户输入号码。现在,当我逐步执行或运行它时,它只要求输入,存储 X,要求输入,存储 Y,然后返回要求输入,即。 X 的输入。它会无限地这样做......什么?

Multiply_Subroutine, Dec 0
Input
Store X
Input
Store Y

multiply, Dec 0
Load Y
Skipcond 800
Jump end
Load temp
Add X
Store temp
Load Y
Subt One
Store Y
Skipcond 400
Jump multiply
Load temp
Store X
Output X
end, Halt



X, Dec 0
temp, Dec 0
Y, Dec 0
Null, Dec 0
One, Dec 1

【问题讨论】:

    标签: loops assembly calculator marie


    【解决方案1】:

    这是因为您的乘法子程序行名/变量在第 8 行时操作数为 0,它需要是 12 月 8 日才能工作:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-13
      相关资源
      最近更新 更多