从堆还是栈分配内存?

发布于 2025-01-06 00:08:01 字数 255 浏览 4 评论 0原文

我读到, 在8085中,处理器的起始地址是00000H。 然而, 在8086中,处理器的起始地址是FFFF0H

现在我还了解到内存的顶部是,而下面是堆栈。我现在很困惑的是在8085中,内存是否是从堆栈分配的,而在8086中是从堆分配的?

请帮我澄清这个概念。谢谢

I read that,
In 8085 the starting address of processor is 00000H.
Where as,
In 8086 the starting address of the processor is FFFF0H.

Now I have also learnt that the top portion of the memory is heap while below lies the stack. What I am confused now is whether in 8085, memory is allocated from stack whereas in 8086 from heap?

Please help me out to clear the concept. Thanks

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

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

发布评论

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

评论(2

影子是时光的心 2025-01-13 00:08:01

堆分配是比汇编语言更高级的概念(C、Java 等),在 808x 汇编语言中没有这样的东西。您不“分配”内存。

另一方面,堆栈是 808x 以及无数微处理器(和虚拟机)的原生概念,例如每次使用“CALL”时都会用到它(PC 被推入堆栈)。当您返回时,返回的 PC 地址将从堆栈中弹出。您也可以将寄存器/数据压入堆栈。

Heap allocation is a higher-level (C, java, etc) concept than assembly language, you don't have such thing in 808x assembly. You don't "allocate" memory.

On the other hand, the stack is a native concept of the 808x, as well as countless microprocessors (and virtual machines), it is used each time you use "CALL" for example (the PC is pushed onto the stack). When you RET, the return PC address is popped from the stack. And you can push registers / data onto the stack also.

年少掌心 2025-01-13 00:08:01

有关为什么 8085 的起始地址为 0000H(这是四个零,而不是五个,因为处理器仅支持 16 位地址)的讨论,请参阅 这个线程

至于堆栈的位置:通过修改SP,您可以将堆栈移动到您想要的任何位置,但由于它向下增长,因此将其移动到地址空间的最末尾是有意义的。

For a discussion about why the 8085's start address is 0000H (that's four zeros, not five since the processor only supports 16 bit addresses) see this thread.

As to the location of the stack: by modifying SP you can move the stack to wherever you want, but since it grows downward it simply makes sense to move it to the very end of the address space.

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