ESP8266 Home Computer Hides Unexpected Gems

With a BASIC interpreter and free run throughout their hardware, home computers like the ZX Spectrum and Commodore 64 used to be a pervasive way to light that hacker fire. With the advent of cheap single board computers like the Raspberry Pi, devices purpose built to emulate these classic systems have become fairly commonplace. [uli] built a device in this vein called the BASIC Engine which is driven by a microcontroller and a handful of hardware peripherals. Like other examples it can be attached to a keyboard, programmed in a BASIC, play video and sound, etc. But digging into the BASIC Engine reveals that it’s similarity to other devices is only skin deep.

The current version of the BASIC Engine (“rev2”) lives in a Raspberry Pi 3 case for convenience. It has RCA connectors for NTSC or PAL video output and mono audio, plus a bank of headers to tap into GPIOs, connectors for a keyboard, and more. [uli] wanted to aim for extreme low cost so a relatively beefy board like a Raspberry Pi didn’t fit the bill, and we expect it was an enjoyable challenge. Instead its interpreter runs atop an ESP8266 but with the networking stack removed. [uli] was disheartened by how bloated even a “Hello world” program was and ripped it out, discovering that hidden beneath was a very powerful and disproportionately inexpensive general purpose microcontroller. The video is driven by a VS23S010, sold as a 1 Mbit parallel SRAM with a neat trick; it also includes a composite video controller!

The real treat here is [uli]’s history writeup of how the BASIC Engine came to be. We’d recommend brewing a cup of coffee and sitting down for a full read-through. The first version was inspired by the PlayPower project, which was repurposing clones of Nintendo’s Famicom (NES to Americans) game console to make low cost home computers, complete with keyboard and gamepad input. [uli] started out by building a custom cartridge for a particular Famicom clone that ran a BASIC interpreter but after showing it to disinterested adults the project was left fallow. Years later, [uli] was encouraged to pick up the project again, leading down a twisted rabbit hole to where we are today.

If you want to build a BASIC Engine for yourself, Gerbers and build instructions are available on the pages linked above.

Thanks for the tip [antibyte]!

71 thoughts on “ESP8266 Home Computer Hides Unexpected Gems

        1. D’oh, I only thought about VB after posting this. But I’ll use the opportunity to say:
          … as I said.
          ;-)

          FWIW, I am forced to work with VB at work sometimes, and I am firmly convinced that the people that thought Excel was the right tool for this particular job, had no clue about either Excel or the problem they were trying to solve. (Probably a case of “If your only tool is a hammer, every problem looks like a nail.”)
          But nothing lasts as long than a shitty makeshift “solution”, I guess.
          So, I know how you feel.

          1. My brother is an Excel/VB pro. He was forced into retirement to save his group money, only to have them hire him back as a “consultant”, because no one else in his group bothered to learn how to write an Excel macro in the past 15 years… He often offered to show anyone how he did something…
            It would be a case of either him doing it in a minute or two each time he was asked to “make/fix something”, with which he offered to show them how to do that particular task in ~15 minutes, so they could do it themselves. But they all turned him down every time for various “reasons”.
            He was a Lotus 1-2-3 guru before they shoved Excel down his throat.

          2. My brother did write a lot of macros for his cow-orkers to use, but every iteration of Excel (2000, 2003, etc.) would break a lot of the existing ones, and he’d have to re-do them.

        2. I learned to program using BASIC on an Altair. I wrote a ton of stuff in VB 6 back in the day. When VB.net came along, I wasn’t programming (kids got in the way). Now, I can’t imagine using any version of Basic – if I need something like it, I’d use Python.

          1. Javascript is a lovely language hobbled by a piss-poor execution environment (browsers) and the insanity of “truthiness” where the equality operator is not transitive. Stay away from mucking about with the DOM, take a little care with your types and religiously use === and !==, you’ll have a good time.

    1. Basic is a great langugage.
      Easy to read and learn.

      Pity I cant use it at the moment since i’m so snowed in on C/C++.

      It will nerver die.
      The purpose of a good language.

    2. > It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.
      –Edsger W. Dijkstra

      1. just goes to show he really doesn’t know everything.

        if you really believe you can’t write good programs in BASIC then you just aren’t a very good programmer.

        1. Meh. Or maybe you forgot how the ugliness of a BASIC program tends to quadratically increase with every added line? :P

          It’s nice for learning some of the concepts of a computer. But if you don’t leave BASIC behind, you will never build any large programs. Unless, maybe if you’re ‘rainman’. :P

          1. Still use VB6 … there has been nothing … i have not been able to achieve (other than make it run on a mobile 😊 ) using VB6.

            those who say Basic Creates bad programmers do not actually know VB6 or even VBnet

    3. Typically language snob comment.

      BASIC is probably the easiest language to get kids started with programming, without a lot of abstraction layers, or a huge framework with lots of dependencies, mumbo-jumbo classes etc, ending up in a 5MB “Hello world”.

      Basic can be implemented extremely simple, eg. like the Olimex DuinoMite-Mini, which is ready to connect to a VGA monitor, a keyboard, and one can start playing, eg. in few instruction turn on and of leds etc.

      And it get the user (kid) much closer to the metal, as it is not a wire disappearing into a big black box, or the internet, but a real device lying in front of one.

      Later on, when the kid has a feeling of what’s up and down and having the basic idea of what programming is as a concept, then it can move on to other languages – instead of starting breaking the neck with case sensitive, odd commands, program a rubber band, dependant of a browser, horrible JavaScript.

      This is a rather old article, but not much have actually changed, so it is still valid:

      https://web.archive.org/web/20120710060613/http://www.salon.com/2006/09/14/basic_2/

    4. I spend my childhood writing BASIC and now I write “proper” programming languages for money. I see the shit that passes for educational programming environments these days (your options are Scratch or Python? Please) and I wonder where we’ll get a generation of programmers from.

  1. That VLSI Solution VS23S010 chip is the weirdest thing I’ve heard of for a minute. Are there other bizarre chips like that floating around? Was it originally a video controller and then they decided to start selling it as external ram that just happened to have video stuff built in?

    1. From the developer of the chip:

      And at a meeting, our CEO asked if we had any other ideas for the product. And so I said that if we just add a couple of counters inside, we could make a pattern generator that could be useful for “various purposes”. He said that should be ok, if indeed it was “just a couple of counters” and didn’t make the chip a testing nightmare.
      …​
      I actually came to the lab during the weekend and wrote the configuration for a minimalistic NTSC modulator on that tiny CPLD. When our CEO saw it, he asked if we could fit it inside our IC. And I said, sure, its something like 10 to 20 flip-flops. But with a little more, we could make it much better. He asked how much better, and I said full color (my demo had 14 colors – sync level, burst level and 14 indexed colors formed with VHDL combinatorial logic statements). Of course we would need to put a DAC inside, but no problem, our company is expert with DACs.

      Source : https://basicengine.org/history.html

    2. I just read the datasheets on the VS23S010D-L
      Chip Summary – http://www.vlsi.fi/en/products/vs23s010.html

      The interfacing requirements are in the Data Sheet –
      [PDF] http://www.vlsi.fi/fileadmin/datasheets/vs23s010.pdf
      and the nitty gritty of video generation are in the Guide –
      [PDF] http://www.vlsi.fi/fileadmin/manuals_guides/vs23guide.pdf

      It’s quite an incredible and versatile chip – perfect in many ways for retro style PAL/NTSC generation for retro computers.

      There are some limitations though.

      The chip has only one DAC so the output is limited to composite output. Though you can use a number of them to generate RGB. There is also an upgraded version that has 4 DACs but it is a tiny BGA.

      The biggest limitation is that you must use SPI to configure the chip. You can also read/write SRAM via SPI so you can use SPI ‘only’ if you want. That makes it perfect for a modern micro-controller that has SPI.

      You can also read/write the SRAM via a parallel bus. So it’s needs some support to work with older retro CPUs that don’t have SPI. At the price that it is it would be worth including an AVR like the Arduino atMEGA328P-pu to help the retro CPU interface to the VS23S010D-L.

      The video generation is extremely versatile (in the GUIDE). Any imaginable video output layout any color depth are possible within the limitation of 128kB which is more than enough for a retro computer. The maximum color depth is 16 bit and there are ways to use color and brightness pallets.

      It supports hardware scrolling and has a high speed block copy function that can be used for easy and fast software sprites. You could choose a resolution that leaves SRAM left over and store characters or sprites/tiles higher up in SRAM.

      It supports sequential read and write operation to speed up data transfer.

      If you know your HDL then you could use a very small CPLD to interface from the CPU parallel bus to the VS23S010D-L SPI. Then it would be only one port and not take up any significant CPU addressing space.

      It supports 18 video standards including VGA 640×480 8 color, PAL 128 color, NTSC 512 color, QVGA 320×240 8192 color.

      It would also make a perfect Arduino “video shield”. It would probably perform well enough right from the Arduino IDE’s sketch language.

      Just right for an AVR retro environment or even a retro emulator.

      It would be great if someone made a breakout for this chip to run it in SPI mode.

  2. BASIC needs to die. it’s slooow, just like C/C++ and ASSembly. Java is where it’s at. With just a few Gb of libraries and a few Gb of RAM, and as little as 4 cores, “hello world” compiles and runs in just a few minutes. It would be even faster if we had java running inside a java cpu, running a OS made in java, but nothing is perfect.

  3. “[uli] was disheartened by how bloated even a “Hello world” program was and ripped it out, discovering that hidden beneath was a very powerful and disproportionately inexpensive general purpose microcontroller.”

    I infer from this sentence that “Hello world” was in the firmware. In reviewing the datasheet to erase “Hello World,” uli discovered the micro? Was that your intent. If not it appears to be two different sentences smashed together.

    1. The ESP8266 (and ESP32 from what I’ve seen) dev environment includes everything that ‘might’ be needed. So even for a simple “hello world”, you get the whole networking stack etc in your binary. Which means it takes ages to compile, and ages to download, and (seemingly) you also need to call a bunch of functions from your simple code just to keep the networking stack (which you don’t care about…) happy. And regardless, it’s still sitting there chewing up processor time.

  4. There is absolutely nothing wrong with basic. Compiled quality source is just as fast as any other compiled code. There is, however, no shortage of bad coders and bad implementations. I have seen as much junk java code as I have basic. I actively program both.

    1. Amen to this ^^^ !

      I write code mostly in C++, but occasionally write simple BASIC programs to solve equations (especially when doing analog designs and don’t feel like booting up my PC to run simulations).

      But then again, I’m something of an old-timer (58 years young), and I remember using assembly language and a look-up table of op-codes, and then hard-coding microcontrollers one byte at a time; BASIC was/is a massive improvement, and still has its place. Now if I can only remember where I put my slide-rule!

  5. Congrats to [uli] for this very well documented project and its well told and informative story. And for once, provided links to the required components suppliers can give an idea of the REAL amount of money needed to build the board, which is infinitely more honest than the much systematic misleading clickbait’s approach like “$2 this” or “$4 that” :(

    That said, while we could do without, the project story still focus a lot about its (presumably) low-cost, Sure, if you’re an electronic hobbyists already equipped for SMD soldering, you’d need around $100 of components and PCBs from China to make 10 boards with connectors, which is competitive with the $15 RPi Zero (not the bullshit price) and the likes, for a non-commercial-DIY small batch.

    But for a single unit, the quantity-orders needed, while very cheap per parts, would easily be $30 + 14€ at the very minimum to get just one VS23S010 delivered (the “RAMDAC” specialized IC that brings the video capability), so the words “he wanted extreme low cost so a relatively beefy board like a Raspberry Pi didn’t fit the bill” from the Hackaday article (since the project’s author never made such an assertion) just don’t seem to fit the bill for the “people too poor to get a Raspberry Pi” you probably had in mind either… but otherwise, thanks for this report.

    1. $15 Raspberry pi zero? I am lucky and can get it for that price (plus sales tax) at Microcenter. How do you get to $15 dollars? Is it that bad? I am legitimately curious.

      1. I don’t know, that was the minimum price with sipping I could find last year (imported from UK, I’m in Europe), it’s more about the fact that it is limited to one unit per order, so you can’t get several and save on shipping price, Usually you have to pay 5 times the shipping if you want 5.
        Though you can still purchase something else with it, like accessories, that’s the incentive for the sellers in a marketing strategy of the Raspberry Foundation to keep this highly symbolic price entry,I suppose.

        I just checked and the price is better now, starting from $5 for the version 1, then your mileage may vary with taxes, import and delivery fees… This site could help you track the availability and offers : http://www.thepilocator.com

  6. It makes my heart sing to see people using the ESP8266 for just the processor. What a nice, cheap little 32 bit RISC processor. It can kick some butt, but few people realize the possibilities. Nicely enough, this person did!

    1. Same here, curently working on a similar esp8266 thing, I could totally benefit of the I/O and RAM galore of its successor, but I like that chip and its story, it’s a classic now, and actually, I realized that trying to do a lot with less is more challenging and stimulating to me.

      Constraints are generally good for creativity and sometimes can push you to think “out of the box” and even escape the ESP32 hype, for a change :)

  7. Does anyone have any interest in splitting the shipping cost (to the US) to order some VS23S010D-L chips from VLSI? This does seem to be the biggest (cost) hurdle in building the BASIC Engine. The shipping cost seems to be about $40, regardless of how many chips you order from them. If interested, email me at dvanaria@gmail.com

        1. OK, I went looking for them.

          I have 7 chips marked VS23S010D and not “VS23S010D-L” as you refer to. I can’t find any package marking specification for these chips. I am left to assume that the “-L” is an order code for “tray” and “-S” is an order code for “tube” rather than being an actual package marking.

          I can spare two or three.

          They are LQFP-48 @ 0.4mm.

          Postage from here is AUD$3 for a letter and AUD$17 for a parcel with 6 working day transit.

          The chips probably wont make it there by themselves in an envelope.

          I have breakouts that are about an inch square that I can put them on for protection –
          https://images-na.ssl-images-amazon.com/images/I/71OCMuiK4%2BL._SL1000_.jpg

Leave a Reply to Doc OctCancel 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.