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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: I wrote a website in 6502 assembly

20 点作者 mdwelsh大约 4 年前

1 comment

Tepix大约 4 年前
Neat. The main source code file appears to be <a href="https:&#x2F;&#x2F;github.com&#x2F;mdwelsh&#x2F;mdwos&#x2F;blob&#x2F;main&#x2F;mdwos&#x2F;mdwos.s" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mdwelsh&#x2F;mdwos&#x2F;blob&#x2F;main&#x2F;mdwos&#x2F;mdwos.s</a><p>in particular i was curious to see how the emulated Apple II managed to open links:<p><pre><code> OPENLINK = $C06C ; MDWOS special ;; doopenlink ;; ;; Open a web page link. This is done by triggering a hack in the appleiijs ;; emulator that I added, which pulls the URL out of the memory address pointed ;; to by OPENLINKURL,OPENLINKURL2. doopenlink: ; On entry, the return address-1 is on the stack. ; This will be the first byte of the URL we want to open. ; So, we read that 16-bit address off the stack and store ; it in OPENLINKURL &#x2F; OPENLINKURL+1. PLA STA OPENLINKURL STA PRINTPTR PLA STA OPENLINKURL2 STA PRINTPTR+1 ; Before we open the link, we need to advance the return address ; to the end of the URL string. LDY #0 @skipurlloop: ; We inc here because the address we pulled off the stack was ; the return address-1. INC PRINTPTR BNE @noc3 ; If no carry INC PRINTPTR+1 @noc3: ; Load the next character LDA (PRINTPTR),Y ; If null, stop skipping. BEQ @skipurlend JMP @skipurlloop @skipurlend: ; Now, we take the current pointer into the string we were skipping ; and push it back on the stack as the return address. ; This will resume execution after the string. LDA PRINTPTR+1 PHA LDA PRINTPTR PHA ; Finally, jump to the link. ; Obviously this won&#x27;t work on a non-MDWOS enabled machine. LDA OPENLINK RTS</code></pre>