TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: I wrote a website in 6502 assembly

20 pointsby mdwelshabout 4 years ago

1 comment

Tepixabout 4 years ago
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>