Z80 汇编程序/机器代码中的字节/字/地址是有符号的还是无符号的?

发布于 2024-09-19 04:30:02 字数 786 浏览 12 评论 0原文

我正在为 Z80 二进制文件制作模拟器,但我无法确定所有整数数据类型是否都是有符号的或无符号的 来自手册或来自谷歌。那么寄存器 AB...HLBC 等中的数字是否有符号?

另外,在机器代码中,指令后面的字节/字/地址是作为有符号参数还是无符号参数?

就像这些示例一样(来自 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

女中豪杰 2024-09-26 04:30:08

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.

停顿的约定 2024-09-26 04:30:06

在许多机器上,有符号数和无符号数之间的唯一区别是执行大小比较的方式,以及将较短值转换为较长值的方式(请注意,许多处理器的乘法运算有效地将较短类型转换为较长类型,和除法本质上执行大小比较)。当执行除上述操作之外的任何类型的操作时,有符号和无符号操作数将以相同的方式精确(逐位)处理,因此无需区分它们。

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.

何其悲哀 2024-09-26 04:30:05
  1. 寄存器可以包含其中一个,并且大多数操作数同时计算两个答案,因为 Two's补充。然而,某些指令确实需要包含值是有符号还是无符号的信息。它们以两种形式存在,一种是签名的,一种是未签名的。不记得 Z80 是否有其中任何一个。

  2. 参见 (1.) 绝对地址是无符号的,相对地址(分支)是有符号的,以便能够向后跳转。

  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.

  2. See (1.) Absolute addresses are unsigned and relative addresses (branches) are signed, to be able to jump backwards.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文