6502cloud

Bringing the 80's to the cloud

Have you ever wanted to process your data in 6502 assembly? Well now you can.

In the beginning...

Once upon a time, the 6502 CPU ruled the world. Atari 2600, Atari 400, Atari 800, PET, Vic-20, Commodore 64, Apple II and even the NES were all driven by the 6502 processor by MOS. We've since moved on. Alpha, Pentium, PowerPC, ARM, and so on. Now cloud computing has come around. Cloud computing is just "Someone else's computer." Why shouldn't that computer be a 6502 based one? Or to bring an old Slashdot joke, why not a Beowolf cluster of 6502's?

What do we have here?

We have a AWS Lambda function, fronted by an API Gateway. The Lambda runs a 6502 emulated, with memory loaded from the caller. It then starts executing from a specified address, and when it times out, or hits a BRK op-code. It will then return the specified section of memory.

Why?!

Because I can. Because we can. Imagine a Beowolf cluster of 6502's. Distributed 6502 processing. Cloud 6502. 6502 WEBSCALE!

Future

Right now, there is is no kernel. Just a CPU. I'd like to eventually have routines that can access other resources. Storing results in S3, accessing other REST API's, and so on.

Contact

Should you have any questions, you can email me. Or get me on reddit, u/6502cloud.

How to use it

To use the 6502cloud, you need to set a JSON formatted POST request to the API. The API's url is
https://api.6502cloud.com/v1/6502cloud

Memory format

Memory is base64 encoded. For example: If you take the first program from easy6502, assemble it, and then dump it, you'll end up with:
a9 01 8d 00 02 a9 05 8d 01 02 a9 08 8d 02 02
. Turn that into a python string, and then use base64.encode to encode it:
#!/usr/bin/env python

import base64

data="\xa9\x01\x8d\x00\x02\xa9\x05\x8d\x01\x02\xa9\x08\x8d\x02\x02"

print base64.standard_b64encode(data)
You can decode result similarly, with
base64.b64decode(data)

Sample python

#!/usr/bin/env python

import requests
import json

url="https://api.6502cloud.com/v1/6502cloud"

reqdata = {
        "input" : [
            {
                "start_address" : "c000",
                "data" : "qQGNAAKpBY0BAqkIjQICAA==",
            }
        ],
        "output" : {
            "start_address" : "0200",
            "end_address" : "02ff",
        },
        "execute_address" : "c000",
}
resp = requests.post(url, json.dumps(reqdata))
print  resp.content

Sample Javascript

The source of this webpage contains an example of how to call the 6502cloud.

Test!