gpt4 book ai didi

assembly - 在 mmix 交互模式下检查寄存器内容

转载 作者:行者123 更新时间:2023-12-02 19:18:36 27 4
gpt4 key购买 nike

我想知道如何在交互模式下使用 mmix 来在我要求查看寄存器的内容时​​显示它们。例如,我有一个简单的 mmix 程序:

% Compute D=4A-2B+16C
%LABEL OPCode Operands Comments
LOC Data_Segment
GREG @
A OCTA 3 Reserve an octabyte for A
B OCTA #10 Reserve an octabyte for B
C OCTA 2 Reserve an octabyte for C
D OCTA 0 Reserve an octabyte for D

LOC #100 start assembly instructions
Main LDO $0,A $0 contents of A
LDO $1,B $1 contents of B
LDO $2,C $2 contents of C
SL $0,$0,2 $0 = 4*$0
SL $1,$1,1 $1 = 2*$1
SL $2,$2,4 $2 = 16*$2
SUB $0,$0,$1 $0 < 4A-2B
ADD $0,$0,$2 $0 < 4A-2B+16C
STO $0,D store answer in D

我可以运行 mmix -i myprog.mmo 来获取输出:

mmix> 
(00000000000000fc: fb0000ff (UNSAVE)) #6000000000000088: rG=254, ..., rL=2
0 instructions, 0 mems, 0 oops; 0 good guesses, 0 bad
(now at location #0000000000000100)
mmix>
1. 0000000000000100: 8d00fe00 (LDOI) $0=l[0] = M8[#2000000000000000] = 3
1 instruction, 1 mem, 1 oop; 0 good guesses, 0 bad
(now at location #0000000000000104)
mmix>
1. 0000000000000104: 8d01fe08 (LDOI) $1=l[1] = M8[#2000000000000000+8] = 16
2 instructions, 2 mems, 2 oops; 0 good guesses, 0 bad
(now at location #0000000000000108)
mmix>
1. 0000000000000108: 8d02fe10 (LDOI) rL=3, $2=l[2] = M8[#2000000000000000+16] = 2
3 instructions, 3 mems, 3 oops; 0 good guesses, 0 bad
(now at location #000000000000010c)
mmix>
1. 000000000000010c: 39000002 (SLI) $0=l[0] = 3 << 2 = 12
4 instructions, 3 mems, 4 oops; 0 good guesses, 0 bad
(now at location #0000000000000110)
mmix>
1. 0000000000000110: 39010101 (SLI) $1=l[1] = 16 << 1 = 32
5 instructions, 3 mems, 5 oops; 0 good guesses, 0 bad
(now at location #0000000000000114)
mmix>
1. 0000000000000114: 39020204 (SLI) $2=l[2] = 2 << 4 = 32
6 instructions, 3 mems, 6 oops; 0 good guesses, 0 bad
(now at location #0000000000000118)
mmix>
1. 0000000000000118: 24000001 (SUB) $0=l[0] = 12 - 32 = -20
7 instructions, 3 mems, 7 oops; 0 good guesses, 0 bad
(now at location #000000000000011c)
mmix>
1. 000000000000011c: 20000002 (ADD) $0=l[0] = -20 + 32 = 12
8 instructions, 3 mems, 8 oops; 0 good guesses, 0 bad
(now at location #0000000000000120)
mmix>
1. 0000000000000120: ad00fe18 (STOI) M8[#2000000000000000+24] = 12
9 instructions, 4 mems, 9 oops; 0 good guesses, 0 bad
(now at location #0000000000000124)
mmix>
1. 0000000000000124: 00000000 (TRAP) Halt(0)
10 instructions, 4 mems, 14 oops; 0 good guesses, 0 bad
(halted at location #0000000000000124)
mmix>
10 instructions, 4 mems, 14 oops; 0 good guesses, 0 bad
(halted at location #0000000000000124)

这一切都很好。但是,如果我想在交互式运行过程中检查某个寄存器的内容,我需要做什么?另外,查看十六进制而不是十进制的内容怎么样?

最佳答案

感兴趣的人显然不多:),我要找的信息可以在 the MMIX documentation 找到。地点。然后查看第 3 页的 mmix-sim.pdf 文件。

特别是,要在模拟器中检查本地寄存器,请输入

l0

查看本地寄存器 $0 的十进制内容。如果您想将本地寄存器设置为某些内容,只需

l0=27.0

所以现在 $0 是 27.0 的 64 位浮点表示!如果你想查看十六进制,就这样做

l0#.

剩下的大家可以自行阅读。文档包括如何设置断点等

关于assembly - 在 mmix 交互模式下检查寄存器内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12833144/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com