A 6502, In The Shell

Originalartikel

Backup

<html> <p>Shell scripting is an often forgotten programming environment, relegated to simple automation tasks and little else. In fact, it&#8217;s possible to achieve much more complex tasks in the shell. As an example, here&#8217;s [calebccf] with an emulated 6502 system in a <a href=„https://codeberg.org/calebccff/6502.sh“ target=„_blank“>busybox ash shell script</a>.</p><p>What&#8217;s in the emulator? A simple 6502 system with RAM, ROM, and an emulated serial port on STDIO. It comes with the wozmon Apple 1 monitor and BASIC, making for a very mid-1970s experience. There&#8217;s even a built-in monitor and debugger, which from our memories of debugging hand-assembled 8-bit code back in the day, should be extremely useful.</p><p>Although the default machine has a generous 32k of RAM and 16k ROM, you can easily adjust these limits by editing machine.sh. In addition, you can get a log of execution via a socket if you like. Don&#8217;t expect it to run too fast, and we did have to adjust the #! line to get it to run on our system (we pointed it to bash, but your results may vary).</p><p>What you use this for is up to you, but we&#8217;re sure you&#8217;ll all agree it&#8217;s an impressive feat in the shell. It&#8217;s <a href=„https://hackaday.com/2018/08/02/shell-script-synthesizer-knocks-your-sox-off/“>not the first time we&#8217;ve seen some impressive feats there, though</a>. Our <a href=„https://hackaday.com/2025/03/13/linux-fu-use-the-source-command-luke/“>Linux Fu column</a> does a lot with the shell if you want further inspiration.</p> </html>