TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How does 6502 stack pointer store addr 0x10FF being an 8bit register

1 点作者 SairajK19超过 1 年前
Hello, I was working on emulating 6502 processor, I came to know that 6502 has a 8bit SP which starts from 0x0100 to 0x01FF. So how does it store 0x01FF which is over 8 bits.<p>Thankyou!

2 条评论

Someone超过 1 年前
There are only 256 different values for the stack pointer. That’s low enough to fit in a 8-bit register.<p>See it as a digital display with two hex digits and the value “0x01” painted in front of it:<p><pre><code> 0x0142 ^^ two hex digits: the value in the register ^^^^ painted on the front plate of the display </code></pre> The cpu, similarly, hard-wires those 8 bits (seven zeros and a single one) in front of the register value when accessing the stack.
评论 #38889256 未加载
pwg超过 1 年前
It does not store 01ff. It stores 00 to ff. The stack is always on page 1 (0x01..) and can not be moved elsewhere. The CPU hardware simply outputs 0x01 on the upper eight bits of the address bus while outputting the 8-bit stack pointer on the lower eight bits of the bus.
评论 #38889236 未加载