我學習裝配使用MARIE程序,但我無法弄清楚熱從書做這樣一個問題:MARIE除以一個數除以另一個數
除以一個數除以另一個數和存儲商和其餘的在兩個不同的存儲位置。
這就是我到目前爲止,我做錯了什麼?僅供參考,程序中沒有分割或乘法,因此我必須使用循環來完成,但我想我錯過了一些東西。
如果你想用反覆的減分的程序都可以在這裏http://computerscience.jbpub.com/ecoa/2e/downloads/MarieSim-v1.3.01.zip
ORG 100
Input /Enter a number
Store X /Saves the number
Input /Enter a number
Store Y /Saves the number
Load Zero /Move 0 into AC
Store Z /Set Z to 0
If, Load Z /Load Z
Skipcond 400 /If AC=0 (Z=0), skip the next instruction
Jump Endif /Jump to Endif if X is not greater than 1
Then, Load X
Subt Y /X - Y
Store X /X = X - Y
Endif, Load Z /Load Z into AC
Add One /Add 1 to Z
Store Z /Z = Z + 1
Output /Print to screen
Halt /Terminate program
X, Dec 0 /X has starting value
Y, Dec 0 /Y has starting value
Z, Dec 0
One, Dec 1 /Use as a constant
Zero, Dec 0 /Use as a constant
END
評論太多。 :P – cHao 2010-10-25 01:20:29
而你仍然點擊「添加評論」? :) – 2010-10-25 16:46:25