微控制器8051:如何获取JB和JB的输入地址CJNE指令?

发布于 2024-08-09 00:20:56 字数 206 浏览 2 评论 0原文

我正在从头开始用 VHDL 实现整套 8051 指令。大多数事情都很顺利,但偶然发现了这两条说明:

JB bit,rel
00100000 bit_address rel_address

CJNE A,#data,rel
10110100 immediate_data rel_address

非常感谢任何帮助或提示。先感谢您!

I'm implementing whole set of 8051 instructions in VHDL from scratch. Most of things went well but stumbled on these 2 instructions:

JB bit,rel
00100000 bit_address rel_address

CJNE A,#data,rel
10110100 immediate_data rel_address

Any help or hint is greatly appreciated. Thank you in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

烏雲後面有陽光 2024-08-16 00:20:56

相对地址由程序员提供。这通常由汇编器根据标签计算得出。

您的 asm 文件将包含:

   ...asm code
   ...asm code
   JB some_bit, some_label
   ...more asm code
   ...more asm code
   ...more asm code
some_label:
   ...more asm code
   ...more asm code

汇编器将分析 JB 指令和标签之间的代码,并计算到达标签所需的偏移字节数,这是它提供给 JB 指令的数字。

这里对 8051 指令进行了很好的解释。

The relative address is supplied by the programmer. This is typically computed by the assembler from labels.

Your asm file will contain:

   ...asm code
   ...asm code
   JB some_bit, some_label
   ...more asm code
   ...more asm code
   ...more asm code
some_label:
   ...more asm code
   ...more asm code

The assembler will analyse the code between the JB instruction and the label and compute the number of bytes of offset needed to get to the label, this is the number it feeds to the JB instruction.

Here is a good explanation of the 8051 instructions.

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