3 ms·
Show HN: I wrote a website in 6502 assembly
- Tepix 5y agoNeat. The main source code file appears to be https://github.com/mdwelsh/mdwos/blob/main/mdwos/mdwos.s https://github.com/mdwelsh/mdwos/blob/main/mdwos/mdwos.s in particular i was curious to see how the emulated Apple II managed to open links: 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 / 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't work on a non-MDWOS enabled machine. LDA OPENLINK RTS
- ehsanullaho743 5y agogood