Z80 汇编程序/机器代码中的字节/字/地址是有符号的还是无符号的?
我正在为 Z80 二进制文件制作模拟器,但我无法确定所有整数数据类型是否都是有符号的或无符号的 来自手册或来自谷歌。那么寄存器 A
、B
...HL
、BC
等中的数字是否有符号?
另外,在机器代码中,指令后面的字节/字/地址是作为有符号参数还是无符号参数?
就像这些示例一样(来自 8080/Z80 指令集< /a>):
8080 Mnemonic Z80 Mnemonic Machine Code Operation
------------- ------------ ------------ ---------
MVI A,byte LD A,byte 3Ebyte A <- byte
LXI B,word LD BC,word 01word BC <- word
JMP address JP address C3address PC <- address
提前致谢。
I am making an emulator for Z80 binaries but I cannot find out whether all the integer data types are signed or unsigned from the manual or from google. So are the numbers from registers A
,B
...HL
,BC
etc signed or not?
Also, in machine code are the bytes/words/addresses which come after the instructions as arguments signed or unsigned?
Like in these examples (from 8080/Z80 Instruction Set):
8080 Mnemonic Z80 Mnemonic Machine Code Operation
------------- ------------ ------------ ---------
MVI A,byte LD A,byte 3Ebyte A <- byte
LXI B,word LD BC,word 01word BC <- word
JMP address JP address C3address PC <- address
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
AKAIK,汇编语言数据和传输指令不包含符号信息。数据和传输操作都仅定义数据大小。符号信息是某些指令的一部分,例如有符号/无符号乘法指令。因此,同一个寄存器可以由 imul 指令处理为有符号整数,由 mul 指令处理为无符号整数。
AKAIK, Assembly language data and transfer instructions don't contain sign information. Both data and transfer operations define only data size. Sign information is part of some instructions, like signed/unsigned multiplication instructions. So, the same register may be handled by imul instruction as signed integer, and by mul instruction as unsigned integer.
在许多机器上,有符号数和无符号数之间的唯一区别是执行大小比较的方式,以及将较短值转换为较长值的方式(请注意,许多处理器的乘法运算有效地将较短类型转换为较长类型,和除法本质上执行大小比较)。当执行除上述操作之外的任何类型的操作时,有符号和无符号操作数将以相同的方式精确(逐位)处理,因此无需区分它们。
On many machines, the only differences between signed and unsigned numbers are the way in which magnitude comparisons are performed, and the way in which shorter values are converted to longer ones (note that many processors' multiply operations effectively convert shorter types to longer ones, and division inherently performs magnitude comparisons). When performing any type of operation other than those above, signed and unsigned operands are treated precisely (bit-for-bit) the same way, so there's no need to distinguish them.
寄存器可以包含其中一个,并且大多数操作数同时计算两个答案,因为 Two's补充。然而,某些指令确实需要包含值是有符号还是无符号的信息。它们以两种形式存在,一种是签名的,一种是未签名的。不记得 Z80 是否有其中任何一个。
参见 (1.) 绝对地址是无符号的,相对地址(分支)是有符号的,以便能够向后跳转。
The registers can contain either, and most operands calculate both answers at the same time because of Two's complement. Some instructions do however need information whether the containing value is signed or unsigned. They exist in two forms, one for signed and one for unsigned. Can't remember whether Z80 has any of these.
See (1.) Absolute addresses are unsigned and relative addresses (branches) are signed, to be able to jump backwards.