6502 Retrocomputing Goes To The Cloud

In what may be the strangest retrocomputing project we’ve seen lately, you can now access a virtual 6502 via Amazon’s Lambda computing service. We don’t mean there’s a web page with a simulated CPU on it. That’s old hat. This is a web service that takes a block of memory, executes 6502 code that it finds in it, and then returns a block of memory after a BRK opcode or a time out.

You format your request as a JSON-formatted POST request, so anything that can do an HTTP post can probably access it. If you aren’t feeling like writing your own client, the main page has a form you can fill out with some sample values. Just be aware that the memory going in and out is base 64 encoded, so you aren’t going to see instantly gratifying results.

You may not be familiar with Amazon Lambda. It is the logical extension of the Amazon cloud services. Time was that you paid to have a server in a data center. The original Amazon cloud services let you spin up a virtual server that could come into existence when needed. You could also duplicate them, shut them down, and so on. However, Lambda is even one step further. You don’t have a server. You just have a service. When someone makes a request, the Amazon servers handle it. They also handle plenty of other services for other people.

There’s some amount of free service, but eventually, they start charging you for every 100 ms of execution you use. We don’t know how long the average 6502 program runs.

Is it practical? We can’t think of why, but we’ve never let that stop us from liking something before. Just to test it, we put the example code into an online base64 decoder and wound up with this:

a9 01 8d 00 02 a9 05 8d 01 02 a9 08 8d 02 02

Then we went over to an online 6502 disassembler and got:

* = C000
C000 A9 01 LDA #$01
C002 8D 00 02 STA $0200
C005 A9 05 LDA #$05
C007 8D 01 02 STA $0201
C00A A9 08 LDA #$08
C00C 8D 02 02 STA $0202
C00F .END

We then ran the 6502cloud CPU and decoded the resulting memory output to (with a bunch of trailing zeros omitted):

01 05 08 00 00 00 00 00

So for the example, at least, it seems to work.

We’ve covered giant 6502s and small 6502 systems. We have even seen that 6502 code lives inside Linux. But this is the first time we can remember seeing a disembodied CPU accessible by remote access in the cloud.

40 thoughts on “6502 Retrocomputing Goes To The Cloud

    1. <hipster&rt;I used 6502’s before they were cloud based, meh….</hipster&rt; Seriously get over yourself. This is impressive, and I doubt you have ever done anything this cool.

      1. Exactly. I’m not convinced at all by the supposed ‘uber coolness’ of all this ‘cloud’ rubbish. its just a marketing gimmick. why send something halfway round the world for another computer to execute when you could just do it on your own computer? I can see the point of using services like amazon lambda when you don’t have enough power at home, sure, but emulating a 6502? Do it on your own computer. You can even get a real 6502 and do it for real.

    1. Hey I gotta VIC-20 in a box somewhere. Last time I tried the rf modulator did not work so well.
      I gotta dig it out and give it another go. Maybe give it a multitasking OS…

    2. I don’t have a lawn at the moment, and I think I eventually tossed my IBM 360 Assembler green card rather than keeping it around in some desk drawer never to be looked at again, but most of the assembler I’ve written was for 360/370, or Knuth’s ugly MIX. I might have done a bit of PDP-11 (don’t really remember.)

      The last time I actually used assembler was for optimizing some 68010 code – I didn’t actually write it in assembler, just wrote it in C, looked at the assembler output, and tweaked the C code until the stuff I wanted to be done in 32-bit precision stayed in registers and didn’t get stored in 16-bit ints.

  1. use a ~500 dollar computer to send information over 100 thousand dollars worth of Internet infrastructure, to a ten thousand dollar server, to replicate the results from a seven dollar chip.

    GENIUS.

  2. Meh, why not emulate it on your own machine? It’s going to be faster than waiting for your request to percolate through the Internet, then the server^h^h^hcloud’s job queue, then get sent back.

    There is literally no point to this. I suppose somebody wrote the emulator “because they can”. Using it to advertise Amazon’s service, which I was already aware of, and if I wasn’t a quick Google search for “cloud behemoth” would’ve turned up; is lame and worthless.

    The latency means that there will never be any use for this. Any machine capable of interfacing with the Internet would be able to emulate a 6502 locally. You could say, “Ah! A Spectrum rigged up to the Internet through an Ethernet adaptor”, but the adaptor has more than enough brains in there, and certainly costs more, than either a 6502 or a cheap ARM with enough power to emulate one.

    Utterly pointless. And fuck all this “cloud” nonsense. Big companies are DESPERATE to rent out ordinary computing to us, making them landlords (a parasite class) rather than selling products.

    For people who occasionally need supercomputing time, it makes sense (although there’s no need for this “cloud” layer nonsense). For the masses, no.

  3. It looks like most of you don’t understand the differences between the early 2000s “cloud” and the current “cloud”. Almost like most of you don’t actually know what you’re bitching about.

    AWS is a distributed cloud platform. This means that Amazon has multiple zones (called AZ’s) scattered through the world. Each AZ has at least two dedicated DCs that will clone each other. The “cloud” part is the HA within an AZ. If once DC goes down within an AZ the other will attempt to pick up the slack and handle the requests.

    “But whut abut muh east coast outages?!?!” That’s because the original default AZ was always set as US-East-1 and not only is it the heaviest used, but also the oldest. Recently Amazon addressed this by automatically selecting the AZ that’s closest to your physical location and has encouraged users to host their applications in multiple AZs effectively providing a 100% always-on service.

    So at this point you’re probably wondering what does this have to do with the 6502? The 6502 emulation service is provided by AWS Lambda, a service that runs within a confined temporary container service. “WTF does that mean?” It means, you can handle billions of calls per second without the need to run a server constantly. Lambda runs on a call by call basis. If the container is already busy with a request, a new container will be created and so-forth until the request load is distributed evenly. Since a Lambda is free for the first 1 million calls per month, and are $0.20 per million after the fact, with the amount of money you use to purchase a physical 6502 (~$6) you could run 30 million calls AFTER your monthly 1 million free. Now keep in mind that’s an ongoing cost while the physical hardware is a one-time fee. But for someone who’s just getting into assembly, or an expert who’s just trying to debug some code it’s a great temporary replacement for the real-deal. Don’t like it? Don’t use it! In-fact don’t even take the cloud platform seriously, just means more jobs and more money for me.

    1. While I agree with your general comments about aws I can’t really see a practical value to this just like I said in the post. However, you never know where an idea like this might lead. Plus when does a project have to be useful? Do we really need half of the gadgets we build or buy? I think of this almost as software performance art. But maybe it will spur some ideas that are more useful.

    2. In reality what it has to do with the 6502 is that the 6502 is a famous chip, relatively easy to emulate, and will get people talking.

      I have no need or desire for the 6502 emulation service discussed here, but now I’ve heard of Amazon Lambda. Beyond running some sample code and going “neat”, I’ll probably never use the 6502 service. But, maybe, if I have a suitable project, I’ll look more into the tool that supports the service.

      The point of the 6502 service is to get sites like Hackaday to talk about Amazon’s real product, and it succeeded.

    1. +1

      It’s a hack, people. It doesn’t need to deliver commercial value. It doesn’t need to do anything more than be a “useless machine” that makes us look at it for the hack that it is.

  4. Creator here.

    A bunch of people are asking WHY? Well. Because I could. I was experimenting with AWS for some other projects, and figured this could be something funny to try out.

    I plan on adding an optional kernel that can also save data to s3, and the maybe some other services (calling itself?)..

    Some uses I can possibly think of: If you wanted to do some genetic growing of 6502 assembly applications. Could you do that on your local machine? I suppose you could, but with this, you could go to extremes, millions of 6502 cpus running in parallel.

    Anyways, this was mostly for fun and a learning experience. Have a laugh. I wonder what projects these naysayers have done where people have questioned “why”.

  5. Hii
    You can checkout thishttps://onlinebase64tools.org/base64-to-binary-converter for base64 to json,yaml,xml,csv,javascript,html,string,encoder,decoder,images.
    It’s free do checkout for more information.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.