Hacker News new | past | comments | ask | show | jobs | submit login
The BASIC Engine (basicengine.org)
328 points by fcambus on Aug 2, 2018 | hide | past | favorite | 98 comments



Two types of minimal computing - don't get them confused:

There's "pack as much power as you possibly can into a minimal computer" - that's raspberry pi.

There also "drive tiny, minimal CPUs to do amazing things at the edge of their specifications cause it's cool and fun" type minimal computing - that is this device.

People who don't understand the distinction will always say "Huh? Why is this interesting? I don't get it.... a raspberry pi is the same size and more powerful."

If you really want to be knocked out, see how the ESP8266 CPU in this device is able to generate a wireless NTSC video signal with zero extra components https://www.youtube.com/watch?v=SSiRkpgwVKY and then the next level Charles Lohr takes it to color https://www.youtube.com/watch?v=bcez5pcp55w

Put another way, the ESP8266, with nothing more than a wire connected to it, is able to generate a broadcast TV signals and display 3D graphics on that broadcast TV signal.

The ESP8266 was also tested by Charles Lohr to have a wireless CPU to CPU range of 1 kilometer https://www.youtube.com/watch?v=ekSsi83-x8M


I hate when interesting stuff like this is stuck in a video. Fortunately it's only 3 minutes long, and by judicious skipping I found his github: https://github.com/cnlohr/channel3

Short answer: the internal I2S peripheral will let you output at 80MHz (!), which can be used to generate by PWM the NTSC 315.0/88.0 MHz chroma frequency.

"This is basically a 1-bit dithering DAC, operating at a frequency below the nyquist, trying to encode luma and color at the same time. Don't be surprised that the quality's terrible."


I was a bit ho hum at

> is able to generate a wireless NTSC video signal

But then I read

> is able to generate a broadcast TV signals

and I read it again.

Are you telling me this will actually produce a RF signal that could be picked up by a 80s era portable television?

That is indeed amazing and I actually wouldn't have thought it possible with a digital device.

EDIT - Having just watched that video I can say that is truly amazing. That has made me so happy.


If you liked that then you'll love the work that bitluni is doing with the ESP32 chip - the big brother of the ESP8266

AM Radio Transmitter on ESP32 https://www.youtube.com/watch?v=lRXHd3HNzEo

And then a series of videos in which he turns a $5 ESP32 into a games console with composite video and audio

part 1: esp32 composite video

https://www.youtube.com/watch?v=5t1_XNc3vNw&t=4s

part 2: esp32 composite video PLUS audio

https://www.youtube.com/watch?v=MOoKQnWF4OY&t=2s

part 3: esp32 composite video PLUS audio PLUS color

https://www.youtube.com/watch?v=-JXuwwXQh8c

part 4: writing a console game for it all

https://www.youtube.com/watch?v=ssrotAyU61I&t=2519s


When I first saw the video by Charles Lohr (a certified genius IMO) I had to spend several minutes trying to get my head around what he had done.

Using the DAC he bit bangs a signal at just the right frequency to match NTSC channel 3 which gets picked up as a TV/radio signal by the TV and displays it. Charles ensures the bits that generate the radio signal match the requirements of the NTSC spec.

Then he displays 3d graphics over that NTSC broadcast signal. Then he adds NTSC color.

That is software defined broadcast television. Mind. Blown.

I started collecting old TV's being dumped out the front of houses for hard waste collection after I saw that video, so I could give it a try.

And the esp8266 CPU costs about $4


It's not precisely broadcast, it's in the "baseband" region and would require modulation up to RF frequency to actually transmit over a distance.

See earlier work by Fabrice Bellard: https://bellard.org/dvbt/ (arguably more impressive signal processing, but requires a graphics card's high-speed DAC)


> and would require modulation up to RF

Can you elaborate? Seems to me it's working without any additional analogue circuitry ...


No, you're right and I'd got my frequency bands wrong, was thinking of 698-806 MHz. 61.5MHz is the broadcast RF band for channel 3, not the baseband.

(I've probably spent too much time around modern radio systems and just casually assumed that 61MHz was too low to be useful, oops)


30 to 300MHz still has the ITU designation of "very high frequency". I know that these days all the sexy stuff is microwave, but the EM spectrum is useful all the way down to DC. The cave radio system used in the rescue of the Wild Boars operates down at 87 kiloHertz. Surface-to-submarine radio systems all operate below 30kHz.


Slightly related: FM transmitter with literally only 3 components: http://spritesmods.com/?art=avrfmtx&page=2


This is the best, most concise explanation of the key EE trade-offs in this kind of stuff I've read - optimizing around different corners of the performance envelope.

I'm not sure I'd want one of these, but I am happy it exists.


Awesome, the Z-Code Infocom game interpreter is derived from the one I wrote/maintained back in the mid 1990s! :)



That’s me, indeed. I haven’t touched the site in forever. Should probably move it to github.


and compile it to webassembly? :)


After the Microsoft buyout everyone is scrambling. Although the side effect of it still being there is that it's still there.

They got bought out a few years ago, and everyone responsible for the adware crap was terminated.


This is super cool - especially note the history = https://basicengine.org/history.html


I thought about it. So what if I’ll present the BASIC Engine to the public, and some kid comes along and says, "WTF, one GPIO? My dad’s Arduino Uno has more than that!" And instead of joining the peaceful forces of the BASIC Salvation Army, she walks by, straight into the arms of a recruiter for a military equipment manufacturer, spending her life developing drones that kill innocent people in Central Asia. Would I be able to live with myself after that?

I suspect the author is only partially joking here. Having worked with kids on robotics projects, and seeing the near-total apathy/ignorance to the countless atrocities being committed by the US government on behalf of its citizens, I can only wonder how much harm is being done by well-meaning people.


This line cracked me up:

"An STM32F411 might be capable of handling all the I/O and computing on a single buttcheek..."


This comment threw me off for a bit. I was reading a math article before running into this page and kept on thinking what this ^ equation meant :-/


that was fascinating


This is really cool, I especially like how commodity most of the parts are.

The 8-bit micro era, for me, was where personal computing really began. Suddenly the market gave people access to computers at an affordable price that empowered them to create their own tools[0] with BASIC, which they often booted directly into. They were simple systems that didn't try to manage your life for you, or act like you didn't really own them, or give you the safety scissors version of computing. That sort of experience is sadly quite lacking today.

And this thing is significantly more powerful than most of those systems, but still acts like one of them. I think it's great.

[0] And play games. Don't discount the value of that, many a child convinced their parent to buy them a computer so they could play games and ended up teaching themselves to program because it was empowering and they could create their own games.


Just curious, what other era would even be a candidate?


Ham radio in the first quarter of the 20th century, when people built their own transmitters and receivers, winding their own coils and making high voltage caps out of sheets of glass. Often the station was in a “shack” in the back yard, because the open cell battery fumes and the noise and ozone of the spark gap caused an eviction from the house.

Hams have continued this experimentation to the present day. The community was in danger of aging out, but recently there’s been a connection with the maker community via WiFi technology, digital tech and sdr.

Happily, hams are finally getting away from Windows and are embracing FOSS.

For example, it’s not too difficult to homebrew a tripod mounted uhf system and antenna which, when set down outside, will orient itself and track a given satellite (itself built by hams) and initiate communications through it. You can’t buy something like that commercially.


Just prior to that, when people literally built their own computer from a microprocessor, sram, and other miscellaneous chips and electronics. Sometimes from a kit. That was pretty personal.

Alternatively the later 80s when IBM PC clones flooded the market and DOS and Macintosh ownership started to really take off.


For anyone interested in building one, one of our user's published the project as a complete kit including PCBs, parts and stencil. See https://aisler.net/p/HVNNCYON

Disclaimer, co-founder of aisler here but not affiliate with the BASIC engine project


I'm fairly good with a soldering iron, but there's several SMD parts there, that would probably test me a bit. If this was really to appeal to low-end hobbyists, it'd all be through-hole parts.

High end hobbyists are already building their own single board computers based on their own designs.


Is there a way to browse available projects on your site? I'm interested in taking a look around, I love to build weird things :)


That's very helpful, thank you!


Seems closer to an Intel i386 in specs, no? To think this is now retailing for 10 euros ;)

In any case, an entire generation of game developers back in the day cut their teeth on BASIC. And many of the fundamentals of arcade era game design can still be gleaned from those ancient manuals ;)

Vintage BASIC

http://www.vintage-basic.net/games.html

More BASIC Computer Games

https://archive.org/details/More_BASIC_Computer_Games_1980_C...


Here are some more, there is a nice archive for 8 bit Atari.

https://www.atariarchives.org/


That list is missing one of the formative books of my youth: Dr. Wacko Presents Atari Basic and the Wiz-Bang Miracle Machine

https://archive.org/details/ataribooks-dr-c-wacko-presents-a...


Yay for Atari basic!


I still have my copy of More BASIC Computer Games. Hunt the Wumpus!

I also still have a copy of the Liverpool Software Gazette which had "Stargate: A 3D Planetarium", (from around 1980).

Massive listings, and you not only had to fix typos, you also had to convert between different versions of BASIC.


I think I have a few LSG issues. I wonder if I should scan them and put them up on the web somewhere.


I think that would be a great idea. I am going to have to rummage around in my loft to find some of these old magazines later.


> I also still have a copy of the Liverpool Software Gazette which had "Stargate: A 3D Planetarium", (from around 1980).

Tidying up and I just found it. It's May 1980. I was sure I had lots of them but only found three (Nov. 1979, May 1980, Feb./Apr. 1981). Also found my Leasco Basic manual from 1969.

I'll put the LSGs up on kwhitefoot.neocities.org over the next few weeks. Might even try to see if any of programs can be made to work.


And Sinclair’s BASIC for the ZX-80. Remember, that hardware used the Z80 RAM refresh circuitry to drive the video output. All the user computing was done during the vertical retrace interval! The technique derived from Don Lancaster’s Video Toaster. Check out Lancaster’s wicki page.


This was the archive I raided for source code when I wrote my BASIC interpreter in Java (http://www.vintage-basic.net/games.html)


If you're interested in it, you may want to check Duinomite: https://www.olimex.com/Products/Duino/Duinomite/

The disadvantage of using VGA is that if you actually want to use it for showing your kids how much fun we had once then, they might not be able to appreciate it when you connect the device to a large screen - it doesn't look too nice and a CIRCLE draws a (jagged) ellipse...


That reminds me of Maximite (http://geoffg.net/Maximite_Story.html) which has similarities to the BASIC Engine.


Duinomite is actually based on Maximite.

As for the Maximite story, I love the grandmother bit ("This program was originally begun in 1982 by my grandmother, Mrs Verda Spell of Beaumont, TX...") I was so curious I actually found the author of the original interpreter and he explained it to me that, alas, it was only a joke.


This project is just fantastic for me and for the coding club sessions I organize.

I just have to figure out how to use the usb keyboard mentioned in the optionnal component and find screens able to show a PAL or NTSC signal.

It is a great and wonderful job, million thanks


I've read about old books for programming a BBC Micro with BASIC, where the games were in books written as code you would have to type in yourself. This book in particular caught my attention: http://www.acornelectron.co.uk/eug/revs/collins/Bbc_Micro_Wa...

I feel like the answer is obvious but I'm going to ask anyway: if I were to take the programs from one of these books and code it into this machine, is it likely to work?


That was truly a golden age for computing in my biased opinion.

Anyhow, you're question. Unfortunately no. You'll find that some parts of the program will work fine but Microsoft BASIC (which is what the Commodores ran and what this seems loosely based on) weren't entirely compatible with BBC BASIC.

BASIC in the 80s was a bit like Javascript in the 00s in that every browser did things did things subtly differently.

As an aside, I was playing on my BBC Micro last night. :)


The series of Input magazines always had their listing for all major 8 bit platforms.

https://en.wikipedia.org/wiki/Input_(magazine)

They did not do things subtly differently, rather completely different, depending on the model.


It depends on what you're wanting to do. The core BASIC dialects were only subtly different however the hardware wasn't and it was the interfacing with the hardware where BASIC used to vary the most. This might take up a large chunk of your code (since back in those days you wrote the game engines etc as part of the game) but it's still only a relatively small subset of the BASIC language once you factor in syntax, operators, keywords, etc. To that end you could in fact write a text adventure game in BASIC that would run on multiple different platforms without modification (and I done just that in the past). But it would be the BASIC equivalent of a Bourne Shell (.sh) script.


In case anyone's interested, you can download many issues of Input magazine from archive.org:

https://archive.org/details/inputmagazine


> BASIC in the 80s was a bit like Javascript in the 00s in that every browser did things did things subtly differently.

That leads to the obvious question whether there are there more modernized BASICs out there now. Is there a standardized ES6 equivalent, perhaps? ;)


There are a lot of BASIC languages these days, all subtly different (or radically, if you count VB.Net). BASIC variations were often quite married to their purpose, whether that was programming for a specific model of 8-bit micro, or being embedded in WYSIWYG GUI design tool.

As mentioned by someone else, QBasic is still around, and there's also Gambas (which is as close to old-school VB as one can get on Linux) if you're looking to play with something.


Sadly the ECMA standard for BASIC never really got adopted by anyone (and is now pretty outdated style anyway).

MS Basic kiiinda became as close to a defacto standard as can be described, just because it was the most common and commonly imitated.

In terms of a modern standard, there's quite a few modern BASICs, but the same kind of applies: Microsoft kinda leads the field. Many of the surviving projects are either directly or indirectly based off of QuickBasic and Visual Basic, or at least heavily inspired by them.


From what I've seen there is 2 dialects of BASIC still in "common" use:

* FreeBASIC

* QBasic64 (an unofficial continuation of MS QBasic)

There is of course also VBScript / VBA and VB.NET but I think it's a bit a stretch to put them in the same bracket (particularly with VB.NET). It is a little like calling C# a dialect of C.


Not at all standardized, but VB.net is a modern basic with all the bells and whistles of c#.

In terms of experience though it's nothing like the basic on these machines. Shell scripting with curses is probably the closest modern equivalent.


Thanks for the answer. I bought the book anyway because reading the listings may still prove useful, even if the code doesn't translate. But it's good to know.


> I've read about old books for programming a BBC Micro with BASIC

Few have managed to make me feel as old with as few words.

While as others have pointed out the specific BASIC programs are likely to diverge in various ways. That said, they're likely to have enough similarities that there are decent chances you can type in quite a few things and mentally translate "as you go".


Not unless the program happens to use the common subset between the two BASIC dialects, which probably rules out any graphics and sound. A text adventure game, maybe.


Sorry I really don't get this. Basic is a fun way to get started but why not simply run it on a Raspberry Pi Zero W?


1. Choose what sort of Raspberry Pi you want. Choose carefully because even if this doesn’t matter, you think it matters.

2. Buy that thing and wait for it to be delivered

3. Decide what Linux distributation you want. Choose carefully because even if this doesn’t matter, you think it matters.

4. Download the Linux distribution. Make sure that you don’t accidentally download one for the wrong architecture...

5. Somehow work out what to do with a .iso

6. Start installing Linux distribution (may need to set up network)

7. Decide on programming language. Choose carefully because even if this doesn’t matter, you think it matters.

8. Decide what you want to do

9. Part of what you want to do is hard/not supported/you don’t know the “right way”. Figure out how to get round this (if possible)

10. ???

11. Congratulations. You have now started.


I see where you're coming from, but these are gross exaggerations in the vein of infomercials depicting performing mundane tasks without their product as nearly impossible.

First, the software could be packaged as an OS image for the pi itself, eliminating a fair chunk of your list, but second, the alternative presented on this page is to assemble the hardware from a list that includes resistors.

Surely if you can manage that, you can wrangle an iso.


There are a whole heap of gotchas that don't seem like a big deal if you're a savvy adult programmer, but are showstoppers if you're eleven years old and just getting into proper computing.

The Raspberry Pi is a very useful thing, but Eben Upton will freely admit that it was the wrong solution for the intended audience. It's just too complex and too brittle to work as a "modern BBC micro" for educational use. The lessons learned from RPi led to the BBC micro:bit, a much simpler Cortex M0 development board that has been a roaring success in British schools.

https://en.wikipedia.org/wiki/Micro_Bit

The BASIC Engine isn't a suitable educational tool as-is, but it could become very useful if it's offered as a commercial product with HDMI or VGA output.


Ordered a RPi Zero W from Adafruit on a Saturday, got it on a Wednesday. Took about two hours to get through a headless install of Raspbian [1], most of which was fighting with my Mac's Disk Utility.

Not knocking the BASIC Engine, I think it's cool as heck, just pointing out that getting started on RPi is not really as painful as it once was. You can even purchase an SD card preloaded with Raspbian!

1. https://learn.adafruit.com/raspberry-pi-zero-creation/overvi...


A bit OT, but if your hassle with disk utility was related to imaging your card, I'd recommend https://etcher.io/ . It's an unbelievably simple and friendly tool.


I see where you're coming from, but let's be honest, that's still way faster and easier than the BASIC Engine, unless the author offers a way to order pre-built sets.


Or you could buy one of the kits that has everything you need, including a copy of Rasbian on the included uSD card.


> Binaries are available on Github in the firmware repository. They can be uploaded to the system via the serial port, using esptool

Good luck flashing the firmware on this thing over a serial port. I'd much rather emulate the platform on a pi, so that I can repurpose the device for something more useful when I realize how big of a waste of time it is to use BASIC for new projects. Source: I use BASIC at work and it sucks butt.


There are a lot of guides to this, and one click Windows install tools for images etc. It's kind of the point of the Pi.


RPi is not something comparable to this.

PocketCHIP is: https://www.kickstarter.com/projects/1598272670/chip-the-wor...

It's sad that it's not easily available any more. It's open schematics, though, so you can also build it yourself, given enough skill and determination.


PocketCHIP is a great deal more, since it also includes the screen, no?


They also had the $9 bare-bones version, more comparable to the machine form the article.


That's just CHIP itself. PocketCHIP was specifically CHIP + screen/keyboard/controller enclosure + PICO-8 software.

(I have both.)


Note he actually made a point of making it (mostly) compatible with a RasPi Model 3 enclosure. Note that this has very different design choices compared to a RasPi, probably most notably the PS/2 and RCA connectors, which suggest the idea to being able to use it with older TVs or the like. As a "learning platform for underprivileged children" it's highly likely that things like RCA video and PS/2 keyboards are incredibly easy to pick up today incredibly cheaply: Everyone wants to get rid of them.


PS/2 keyboards/mice might be harder to find than you'd think. New ones are hard to find and while there are literally millions of old ones sitting around disused, their very lack of value means that the secondary market is not strong. Not many people want to bother listing a $2 used keyboard on eBay.

I'm a tech guy and could scrounge up a dozen old keyboards in a few minutes, but someone who is just starting out probably won't have a collection of old hardware to pull from.


Early USB keyboards tended to support PS/2 with a passive adapter. Probably less common nowadays.


Finding TVs that will still take composite or component is getting harder. And even if they take it, they usually only take it in at a very specific scan rate and resolution, and it usually looks like garbage.

VGA is getting even worse.


I'm not sure where you're from, but I don't know anyone who doesn't have literally dozens of VGA monitors they can't figure out how to get rid of. Even modern this-year Dell monitors still come with VGA, and I've never even seen a modern TV without RCA plugs.

Is their a Goodwill or Salvation Army store around you? Check it out, see what their electronics section looks like. That's the target market.


Many modern monitors might have VGA still, (none I've seen recently do) but almost all lack the ability to handle the 15khz horizontal that much vintage computer tech uses.


Well, I have a couple with defunct fluorescent backlights :-/

My biggest mistake was letting my wife talk me into tossing my green crt monitor for my Apple ][ Z-80 CP/M card.


Goodwills where I live don't sell CRT's anymore.

The only place to get used non-HDMI displays is at garage sales, Goodwill's auction site, or fleaBay.


> CRT's

True, VGA being an analog interface was perfect for CRT-based monitors. Many modern LCD monitors still have it, not sure about the image quality though.


VGA is still pretty adequate. The main limitation is that if you hook up a VGA monitor, you can't watch most proprietary video, whether it be disc or streaming, because they need a more sophisticated connector for their DRM schemes. VGA cables have no real difficulty with 1080p or some even higher resolutions.


Lots of modern TVs have composite video ports on the back.


Read my comment -- they have composite that works only for 480p/i @ 30khz. So won't work for lots of things (like old 8-bit computers, etc.)


The irony is that the very, very early prototypes of the Pi were a lot more like this, built around an Atmel microcontroller; it was eventually decided that HDMI and a browser were too important to do without.



I wonder if the 5-bit audio output in this device would be good enough for some old-school speech synthesis. To go really old-school, maybe something like the Echo synthesizer [1], which I have fond memories of using on an Apple IIe at school in the late 80s and early 90s.

[1]: http://www.festvox.org/history/klatt/part29.au


> Wavetable synthesizer

They really mean sample-based:

https://en.wikipedia.org/wiki/Wavetable_synthesis#Confusion_...


So, it doesn’t have a Korg Wavestation built in? :-)

Check out something like Korg iWAVESTATION or u-he Zebralette for something like wavetable (soft) synths, vs merely 1 or 2 layers of PCM samples possibly with an envelope generator to fade between layers.


Very cool. I especially like the video encoder in the static ram chip. That is a neat hack. I've got a simple HDMI interface in an FPGA that does something similar but it is 10x the cost.

I expect to see a lot of these sorts of systems in the coming months/years.


While on the subject, handheld Arduino console: https://gamebuino.com

Has anyone here tried it? I’m thinking of getting one.


I have a Meta and program little games for it in C. It's a lot of fun to code for, especially if you like optimizing your code and pushing what you can achieve within the system's limits. A lot of what you learn doing this applies to general programming too (reworking calculations to avoid expensive operations, judicious use of memory, etc.), which is a nice bonus.


That’s the idea :)


The assembly video (https://basicengine.org/hardware.html#_assembly) is really neat. I like how he made the SMT ICs easier to test by bringing out all the pins to nearby pads. That lets you easily test for bridges and good connections at the cost of board space.


I have played with a similar BASIC board [1] - it is indeed a lot of fun and (unlike RPi) brings back the feel of first personal computers. One can easily teach a kid programming using such a thing.

[1] http://geoffg.net/maximite.html


I didn't realize it at the time, but I first learned to program using BASIC on the TI-85. BASIC might be a poor language for learning computer science concepts (or so I've heard others opine), but I haven't encountered a language that was as approachable and intuitive.


Very nice, maybe there could be some inline Assembly as well, BBC Basic style.

In any case very well done!


Sweet! It's like a fantasy console, but in real life.


will they make an esp32 basicstation ? :D


Basic the language is nostalgic but not exactly great.

I hope Lua might be eventually added.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: