我正在编写一个程序来评估下面的语句,但是我必须使用堆栈组织的计算机来完成它。这意味着只有pop和push才能访问内存。
使用此程序作为我程序的示例时,如何执行此操作?:
Load A
Store Stack0
JnS Push
Load B
Store Stack0
JnS Push
JnS PopS
Load C
Store Stack0
JnS Push
Load D
Store Stack0
JnS Push
Load E
Store Stack0
JnS Push
JnS PopM
Load F
Store Stack0
JnS Push
JnS PopS
JnS PopM
JnS PopA
Load G
Store Stack0
JnS Push
Load H
Store Stack0
JnS Push
Load K
Store Stack0
JnS Push
JnS PopM
JnS PopA
JnS PopD
JnS Pop
Halt
Push, Hex 0
Load Stack4
Store Stack5
Load Stack3
Store Stack4
Load Stack2
Store Stack3
Load Stack1
Store Stack2
Load Stack0
Store Stack1
JumpI Push
Pop, Hex 0
Load Stack1
Store Stack0
Load Stack2
Store Stack1
Load Stack3
Store Stack2
Load Stack4
Store Stack3
Load Stack5
Store Stack4
Load Zero
Store Stack5
Load Stack0
JumpI Pop
PopA, Hex 0
JnS Pop
Add Stack1
Store Stack1
JumpI PopA
PopS, Hex 0
JnS Pop
Load Stack1
Subt Stack0
Store Stack1
JumpI PopS
PopM, Hex 0
JnS Pop
Store Calc1
Store Calc3
JnS Pop
Subt One
Store Calc2
Skipcond 400
JnS Mult
Store Stack0
JnS Push
JumpI PopM
Mult, Hex 0
LoopM, Load Calc3
Add Calc1
Store Calc3
Load Calc2
Subt One
Store Calc2
Skipcond 400
Jump LoopM
Load Calc3
JumpI Mult
PopD, Hex 0
JnS Pop
Store Calc2
Load Zero
Store Calc3
JnS Pop
Store Calc1
Load Calc2
Skipcond 400
JnS Divs
Store Stack0
Jns Push
JumpI PopD
Divs, Hex 0
LoopD, Load Calc1
Subt Calc2
Store Calc1
Load Calc3
Add One
Store Calc3
Load Calc1
Skipcond 800
Jump EndD
Jump LoopD
EndD, Load Calc3
JumpI Divs
One, Dec 1
Zero, Dec 0
Calc1, Dec 0
Calc2, Dec 0
Calc3, Dec 0
A, Dec 9
B, Dec 8
C, Dec 7
D, Dec 6
E, Dec 5
F, Dec 4
G, Dec 3
H, Dec 2
K, Dec 1
Stack0, Dec 0
Stack1, Dec 0
Stack2, Dec 0
Stack3, Dec 0
Stack4, Dec 0
Stack5, Dec 0
任何帮助将不胜感激。我是MARIE的新手,到目前为止一直没有得到任何帮助。谢谢! =)