我目前正在研究 MARIE SIMULATOR,我正在尝试获取三个输入的小数,然后将它们全部相乘。我将我的代码保存为 .mas 并尝试组装它。它说我有 1 个错误,但组装清单完全是空的!我发现当我从中删除 Jump OP 时代码会组装并运行,但是,我需要 Jump 才能得到正确的答案。我所看到的每一个地方都写着我有它的跳转,所以我不知道我是否错了,如果我的 Sim 被窃听还是什么。
ORG 100 /Starting point // Gustavo Brandao. No Partners
Input /Request user input for first number
Store NumA /Store the number
Output /Display number to screen
Input /Request user for a second number
Store NumB /Store number
Output /Display number
Input /Request user for third number
Store NumC /Show number
Output /Display number
Loop, Load NumA /Load the first number, will also loop from here
Add Sum /Add with zero and location which will save the sum
Store Sum /Store the sum
Load NumB /Load the second number for the skip condition control
Subt One /decrement the number
Store NumB /Store the number. when 0, code will skip the jump
Skipcond 000 /Skip when the second number reaches zero
Jump Loop /Used to repeat addition until second number reaches zero
Load Sum
Store NumA /Storing sum in NumA slot to make code easier to read
Loop, Load NumA /Loading the previous sum
Add FSum /Adding previous sum to zero and final sum location
Store FSum /Storing final sum
Load NumC /Second skip condition control
Subt One /decrememting number
Store NumC /Storing skip condition
Skipcond 000 /When the third inputed number is zero, loop will end
Jump Loop /Loops back to second part of code
Load FSum /load the final sum for output
Output /Display final sum
HALT
NumA, Dec 0 /First number; Will be overwritten with input
NumB, Dec 0 /Second number
NumC, Dec 0 /Third number
Sum, Dec 0 /Stores the sum for the first multiplication process
FSum, Dec 0 /Stores sum for the second multiplication process
One, Dec 1 /Used to decrement values