2016-03-16 25 views
0

我目前正在研究MARIE SIMULATOR,我試圖獲得三位輸入的小數,並將它們全部相乘。我將我的代碼保存爲.mas並嘗試進行組裝。它說我有1個錯誤,但大會上市完全是空的!我發現,當我從中刪除Jump OP時,代碼彙編並運行,但我需要跳轉才能得到正確的答案。我看到的每一處跳躍都是按照我的意思寫的,所以我不知道我是否錯了,如果我的模擬器被竊聽或者是什麼。我的MARIE Sim Jump功能無法正常工作

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 
+0

你有'循環'標籤定義兩次?這是允許的嗎? – Jester

回答

0

所以我才意識到,我不能有兩個「圈」 S在節目中,因爲它不會承認它跳轉到。我命名第二個Loop2,它工作。我得到了錯誤的答案,但多數民衆贊成什麼都不會解決