Quantcast
Channel: basic – Hackaday
Viewing all 91 articles
Browse latest View live

BASIC Interpreter Hidden in ESP32 Silicon

$
0
0

We’ve been keeping up with the ongoing software developed for the ESP32 WiFi chip, and that means a lot of flashing, hooking up random wires, and rebooting. Along the way, we stumbled on an Easter egg: the ESP32 processor has a built-in BASIC interpreter to fall back on.

That’s a cool little hack to find, but we couldn’t find some crucial functions that would have made it a lot more useful. Still, it’s great fun to play around in real-time with the chip. And you’ll absolutely get an LED blinking faster in ESP32 BASIC than you will on an Arduino!

Getting to BASIC

At first, we thought that the key to getting into the BASIC shell was simply blocking the onboard flash program ROM, because we discovered it by connecting to GPIO 12, labeled as the MOSI pin for “HSPI”. But a little verification with ‘scope and continuity tester verifies that no data is going across this pin at bootup, and the SPI lines for the flash aren’t even broken out from the module. It looks like whatever boot ROM the ESP32 has inside it is testing for a high voltage on GPIO 12. Don’t ask us.

Anyway, the short version of the story is: pull GPIO 12 high and hit reset. Connect to the ESP32 over serial, and hit enter to stop it from continually rebooting. Falling back to built-in command interpreter. Woot. Set your terminal program up to send only a linefeed at the end of each line and you’re off! Don’t have an ESP32 on hand to try this? I recorded a screencast of my adventures so at least you can join me for the ride.

Blinking an LED, BASIC Style

What’s the first thing you do when faced with a command prompt? Type “help”, right? Well, that works. The ESP32 comes back with “A very Basic ROM console. Available commands/functions:” and then lists out everything you need to get started. Now, our BASIC is a bit rusty, dating from the Tandy Color Computer days, but we quickly whipped up a few demos and frankly, we had a lot of fun.

>about
ESP32 ROM Basic (c) 2016 Espressif Shanghai
Derived from TinyBasic Plus by Mike Field and Scott Lawrence

Espressif was nice enough to add iodir and ioset commands to the BASIC, and they let you set the data direction of any pin (input or output) and either read or write to it. That means blinking LEDs is just a few words away.

> list

5 IODIR 32,1
10 FOR I = 1 TO 10
20 PRINT "Hello Hackaday!"
30 GOSUB 100
40 NEXT I
50 END
100 REM BLINK SUBROUTINE
110 IOSET 32,1
120 DELAY 200
130 IOSET 32,0
140 DELAY 100
150 RETURN
OK

> run
Hello Hackaday!

And there was looping and blinking. It’s easier than getting started with Arduino!

Mysteries and Missing

But that’s also about as far as we got. There is a print command, and an input command, but we couldn’t figure out how to handle strings, so we never got further than

10 PRINT "Enter your favorite number"
20 INPUT F
30 IF F = 42 GOTO 100
40 PRINT "Really? I prefer"
50 PRINT F+1
60 END
100 PRINT "That’s my favorite number too."
110 END

There’s an rseed command, and the help lists a rnd but it looks like a syntax error when we try to use it in a function. ioget, which should read the logic voltage on a pin, doesn’t seem to work either. Going down the list, we were bummed out to find that many of the functions that we’d like to teach a young child programming just weren’t there.

BASIC Without Peek and Poke?

We couldn’t get peek and poke working for the life of us. It appears that they weren’t implemented, which is a shame because those two commands are practically the best feature of BASIC for exploring around the insides of a new chip in real-time. While you don’t often have cause for twiddling individual bits inside your desktop computer, interactively flipping those little silicon switches is a fantastic tool when dealing with a microcontroller with memory-mapped hardware peripherals.

Peek and poke are the raison d’être for BASIC. Without them, it’s just a toy language.

Late Edit: [Sprite_tm] wrote in on the BASIC. I had it all wrong. Peek and poke work! I just didn’t guess the syntax correctly. Indeed, [Sprite_tm] confirms that they did make use of them during the initial chip check-out phase. How cool is that?

The following code enables GPIO 4 as output, turns it on and then off again, and then prints out the value of the GPIOs inputs in hex. We toggled input voltage on another GPIO and watched the bits bobble. The rest is a simple matter of software.

5 POKE &H3FF44020, 16
10 POKE &H3FF44004, 16
20 DELAY 200
20 POKE &H3FF44004, 0
30 DELAY 200
40 PHEX PEEK(&H3FF4403C)
50 GOTO 10

For what any of these numbers mean, see the memory map in the technical docs (PDF). Have fun!

These Are Not The Droids…

Anyway, the big news is that the Espressif team has gotten most of the Arduino core up and working, and we have a full review coming out soon. They’re also continuing to work like crazy on development of the C libraries that real programmers will use to run these chips, so it’s probably not a top priority for them to implement peek inside an Easter egg. But we had a fun afternoon dredging up BASIC skills.


Filed under: Hackaday Columns, Microcontrollers, slider

Crack Mike Tyson’s Punch Out Bang Bang Passwords

$
0
0

[Bisqwit] has feelings about games that use exclamation points in his idiosyncratic walkthrough of all the nuances of the passwords in the famous Punch Out Bang Bang.

As he states in his deeply weird (though in no way wrong) channel intro, when he’s not driving a bus or teaching Israeli dance, he works hard to understand the things around him. Naturally, a mysterious phone number shaped set of digits in a favorite game was a secret worth extracting.

The digits can represent every possible state in the game.  It uses a pretty simple decoding and encoding scheme, which he walks through. As he says, it all becomes clear when you can see the source code.

After working through all the quirks he is able to arbitrarily generate any state in the game and handle the exceptions (such as Nintendo USA’s phone number). You can see all his code here and try it out for yourself. Video after the break.

We’ve grown to respect [Bisqwit] as the explainer of all things console games. You will like his explanation of how to write a code emulator for an NES CPU.


Filed under: nintendo hacks

The BASIC Issue With Retro Computers

$
0
0

If you are interested in how a computer works at the hardware grass-roots level, past all the hardware and software abstractions intended to make them easier to use, you can sometimes find yourself frustrated in your investigations. Desktop and laptop computers are black boxes both physically and figuratively, and microcontrollers have retreated into their packages behind all the built-in peripherals that make them into systems-on-chips.

The RC2014 Z80 retro-computer we reviewed earlier this year.
The RC2014 Z80 retro-computer we reviewed earlier this year.

Maybe you’d like to return to a time when this was not the case. In the 8-bit era your computer had very accessible components, a microprocessor, RAM, ROM, and I/O chips all hanging from an exposed bus. If you wanted to find out how one of these computers worked, you could do so readily. If this is something you hanker for then happily there are still machines that will allow you to pursue these experiments in the form of retro computers for hobbyists. Most of the popular architectures from the 1970s and 1980s have been packaged up and made into kits, returning home computing to its 1970s roots. Breathe easy; you won’t have to deal with the toggle-switch programming unless you are really hard-core.

When you have built your retro computer the chances are you’ll turn it on and be faced with a BASIC interpreter prompt. This was the standard interface for home computers of the 8-bit era, one from which very few products deviated. If you were a teenager plugging your family’s first ever computer into the living-room TV then your first port of call after getting bored with the cassette of free educational games that came with it would have been to open the manual and immerse yourself in programming.

Every school had similar machines (at least, they did where this is being written), and a percentage of kids would have run with it and become BASIC wizards before moving seamlessly into machine code. If you have a software colleague in their 40s that’s probably where they started. Pity the youth of the 1990s for whom a home computer was more likely to be a Playstation, and school computing meant Microsoft Word.

The trouble is, in the several decades since, 8-bit BASIC skills have waned a little. Most people under 40 will have rarely if ever encountered it, and the generation who were there on the living room carpet with their Commodore 64s (or whatever) would probably not care to admit that this is the sum total of their remembered BASIC knowledge.
10 PRINT "Hello World"
20 GOTO 10

If you have built a retro-computer then clearly this is a listing whose appeal will quickly wane, so where can you brush up your 8-bit BASIC skills several decades after the demise of 8-bit home computers?

The SInclair ZX81 manual, as lovingly preserved online by World Of Spectrum.
The SInclair ZX81 manual, as lovingly preserved online by World Of Spectrum.

A good place to start would be a period manual for one of the popular machines of the day. Particularly if it’s a machine you once owned. These are all abandonware products, many of which were produced by now-defunct manufacturers, so you’ll have to use your favorite search engine. In this you are unlikely to be disappointed, for the global community of 8-bit enthusiasts have preserved the documentation that came with almost all machines of the day on multiple sites. It’s easy to be diverted into this particular world as you search.

These manuals usually have a step-by-step BASIC programming course, as well as an in-depth reference. They will often also have information on the architecture of the machine in question, and its memory layout. It’s worth reminding that each machine would have had its own BASIC dialect so there may be minor quirks peculiar to each one. But on the whole, outside some of the graphics and sound commands, they are fairly insignificant. It is after all as the name suggests, basic.

One thing worth commenting on is the iconography of these manuals, it’s striking with nearly four decades of hindsight that these were exciting and forward-looking products. Computers had not become boring yet, so their covers are full of gems of early-80s futuristic artwork. Our colleague [Joe Kim] is carrying on a rich tradition.

Usborne, you inspired a generation of future engineers.
Usborne, you inspired a generation of future engineers.

When 8-bit machines were current, it’s important to remember that for the vast majority of computer users there was no Internet. The WWW was but a gleam in [Tim Berners-Lee’s] eye, and vanishingly small numbers of parents would have bought their kids a modem, let alone allowed them to dial a BBS. Thus the chief source of technical information still came from printed books, and the publishing industry rose enthusiastically to the challenge with a raft of titles teaching every possible facet of the new technology, including plenty of BASIC manuals.

Just as with the computer manuals mentioned above, these can often be found online by those prepared to search for them. Better still in the case of the iconic computer books produced by the British children’s publisher Usborne, some of them can even be legitimately downloaded from the publisher’s website (scroll down past the current books for links). Nowadays their computing titles teach kids Scratch on their Raspberry Pi boards, however for the 1980s generation these were the 8-bit equivalent of holy texts. In no other era could a title like “Machine Code For Beginners” have been a children’s book.

BASIC listings and period adverts, Compute! magazine, Nov 1980.
BASIC listings and period adverts, Compute! magazine, Nov 1980.

There is a further period source of BASIC  programming information from the 8-bit era. Computer magazines didn’t come with a cover disc — or cassette — until later in the decade, so they had a distinctly low-tech approach to software distribution. They printed listings in the magazines, and enthusiasts would laboriously type them line by line into their machines. The print quality of listings reproduced in print from photocopies of dot-matrix printouts was frequently awful, so the chances are once you’d typed in the listing it wouldn’t run. It was an annoying experience, but one which taught software debugging at an early age.

Thanks to the Internet Archive we have a comprehensive set of period computer magazines freely available online, so finding listings is simply a case of selecting a title and browsing early 1980s issues. They often have a mix of code, from articles explaining algorithms to reader-contributed listings.  It’s easy yet again to get sidetracked into the world of period peripherals and first-look reviews of now-retro machines. The cover art is still futuristic in the same way as the programming manuals, it would be a few more years before pictures of grey-box PCs became the norm.

If you’ve managed to tear yourself away from a wallow in 8-bit nostalgia to get this far then we hope you’ve been inspired to try a little BASIC on your retro computer board. It’s a language that gets a bad press because it’s not exactly the most accomplished way to program a computer and it certainly isn’t the fastest, but it does have the advantage of being very accessible and quick to deliver tangible results. When your computer is as much a toy as the home computers of the 1980s were, tangible results are the feature that is most important.

[Header image: Sinclair ZX Spectrum keys with BASIC keywords: Bill Bertram CC-BY-SA 2.5, via Wikimedia Commons.]


Filed under: classic hacks, Featured, History

Building Your Bots The 1980s Way

$
0
0

There are many kits available to today’s hobbyists who wish to try their hand at producing simple computer-controlled robots. Small concoctions of servos and laser-cut acrylic, to which boards such as the Arduino, Raspberry Pi, or Beaglebone can easily be fitted.

In the 1980s though this was a market that was yet to be adequately served. The sheer size of the many 8-bit machines of the day meant they could not be incorporated in your robot, and interfacing to them was a bit more challenging than the easy-to-use GPIOs of their modern counterparts. Then the mechanical hardware of a small robot was something that had not been easily and cheaply packaged for the constructor, making building a physical robotic platform a significant task in itself.

[Jeffery Brace] and [Evan Koblentz] write for IEEE Spectrum about their work at New York City’s World Maker Faire back in October, making a pair of small robots using only components and computers available in the 1980s.

Charlie the robot
Charlie the robot

[Charlie] is a robot based on the Capsela construction system, a toy consisting of interlocking plastic spheres containing different functions of shafts, gears, and motors. There was a Robotic Workshop kit for Capsella that featured a Commodore 64 interface, and it is through this means that [Charlie]’s three motors are controlled. It includes a ROM that extends Commodore BASIC with extra commands, which allow the robot to be easily controlled.

Artie the robot, with Dacta box in foreground
Artie the robot, with Dacta box in foreground

Meanwhile [Artie] is a Lego robot, using the Dacta TC Logo, a kit sold for the educational market and available at the time with interfaces for the PC and the Apple II. They had a Dacta control box but not the Apple II card to go with it, so had to make do with a functional replica built on a prototyping card. As the name suggests, this was programmed using Logo, and came with the appropriate interpreter software.

Both robots are reported to have been a success in terms of working in the first place, then demonstrating the 1980s technology and providing entertainment and engagement with the faire’s visitors.

We have covered numerous Lego robots over the years, as a search of our site will confirm. But this is only the second time we’ve featured a Capsela project, the first being this Arduino rover from 2011. [Mike] mused why we don’t see Capsela more often, and the same sentiment is true today. Do you have a Capsela set gathering dust somewhere that could make a robotic project?

Via Hacker News.


Filed under: classic hacks, robots hacks

Portal Ported To the Apple II

$
0
0

[deater] readily admits they’re a little behind on what’s new in gaming – only having just gotten around to Valve’s 2007 release of Portal. It’s a popular game, but [deater] didn’t want anyone to miss out on the fun – so set about porting Portal to the Apple II.

The port uses the “hires” mode of the Apple II for the flashy graphics that were state of the art around 1980 or so. It’s not a copy of the full game – only the first and last levels, combined with Jonathan Coulton’s now-classic ending theme, Still Alive. As is to be expected, it’s not a wild, fast paced gaming experience, but a cool use of BASIC to put together a fun tribute to a popular franchise.

It’s a little different to the original – portals can be placed anywhere, for example – but it rings true to the original. Source code and a disk image is provided, so you can try it for yourself – even in this online emulator.

We’re looking forward to the sequel so we can use the post title “Portal 2 Ported To The Apple II, Too”, but until then, check out [deater]’s Apple II web server, also in Applesoft BASIC. Video after the break.


Filed under: classic hacks

ESP8266 BASIC Sets Up a Web Remote in No Time

$
0
0

One of the sticking points for us with our own Internet of Things is, ironically, the Internet part. We build hardware happily, but when it comes time to code up web frontends to drive it all, the thrill is gone and the project is only half-done.

Including some simple web-based scripting functionality along with the microcontroller basics is one of the cleverest tricks up ESP8266 BASIC’s sleeves. BASIC author [mmiscool] puts it to good use in this short demo: a complete learning IR remote control that’s driven through a web interface, written in just a few lines of BASIC.

Note that everything happens inside the ESP8266 here, from hosting the web page to interpreting and then blinking back out the IR LED codes to control the remote. This is a sophisticated “hello world”, the bare minimum to get you started. The interface could look slicker and the IR remote could increase its range with more current to the LED, but that would involve adding a transistor and some resistors, doubling the parts count.

For something like $10 in parts, though, this is a fun introduction to the ESP and BASIC. Other examples are simpler, but we think that this project has an awesome/effort ratio that’s hard to beat.


Filed under: wireless hacks

Flappy Bird is the New “Does it Run Doom?”

$
0
0

Back in 2014 [Johan] decided to celebrate BASIC’s 30 50 year anniversary by writing his own BASIC interpreter. Now, a few years later, he says he feels he has hit a certain milestone: he can play Flappy Bird, written in his own version of BASIC, running on his own home-built computer, the BASIC-1.

Inside the BASIC-1 is an Atmel XMega128A4, a keyboard from a broken Commodore 64, a joystick port, a serial to TV out adapter, and an SD card adapter for program storage. An attractively laser-cut enclosure with kerf bends houses the keyboard and hardware. The BASIC-1 boots into BASIC just like many of its home computer counterparts from the 80s.

There has been work done to create minimal BASIC computers before but it’s not every day that someone decides to write their own BASIC interpreter. Nor is it every day someone wires their own homebrew computer into an attractive wood panel enclosure. Both at once is great to see, but crowning it off by having it run a Flappy Bird clone written in BASIC on an amber screen is really something special.

For ages we’ve had two proofs of hacking proficiency — Hello World proves you can do the most basic with a system, and running Doom proves you have mastered hardware abstraction on a system. Over the past few years Flappy Bird has grown to fill a niche between the two on systems that don’t have the horsepower (or resolution) to run Doom but still beg for a skill indicator.


Filed under: computer hacks, Microcontrollers, slider

Usborne Release More 1980s Computer Books

$
0
0

Children of the 1980s who had an interest in technology were lucky indeed. As well as the first generations of home computers at their disposal they had the expectation to program them, something which the generation that followed had lost.

Traditional children’s publishers enthusiastically embraced the home computer boom, and probably for the only time in history there were books aimed at children covering subjects like machine code, or interfacing to microprocessors.

Kid's books were better when we were young! Usborne(Fair use)
Kid’s books were better when we were young! Usborne(Fair use)

If you are British, the most memorable of these books came from Usborne Publishing. Their format of colourful cartoons and easy to digest layout have made them something of a cult object among the now-grown-up generation who first received them, and Usborne themselves have cleverly exploited their heritage to promote their current offerings by releasing some of them as PDFs. And now, to promote their latest title, “Coding For Beginners Using Python”, they’ve released five more (scroll down to see). Titles are “Practice Your BASIC”, “Better BASIC”, “Computer Controlled Robots”, “Experiments With Your Computer”, and “Keyboards & Computer Music”, which join the fifteen they’ve already released.

Obviously they are heavily based around the microcomputers of the 1980s, but of course for most Hackaday readers that will be their chief attraction. Either way they’re an interesting read, and should you happen to have a few old micros lying around then maybe you could have a go at some of the projects.

If the BASIC listings are a little foreign to you, might we suggest some places to find BASIC information.


Filed under: classic hacks

Fixing Bugs In Ancient BASIC Games

$
0
0

Before everyone learned programming on Stack Exchange, things were much different. Computer magazines had BASIC programs in them, which readers would type out, line by line, and hit RUN. In theory, this is a terrible way to learn programming; it’s simply rote recitation without any insight into what the code is actually doing. Of course, copying and pasting from Stack Exchange is exactly the same thing, so maybe these magazines were ahead of the curve.

[0xA000] recently came across one of his old computer magazines containing the type-in listing for Blindganger, a game where you wander a maze blindly. When [0xA000] typed this game into his C64 back in 1988, the game didn’t work. Thirty years later, he decided to give it another go and ended up fixing bugs in an old computer game.

When [0xA000] typed this game into his computer back in 1988, the map just didn’t work, and the final screen revealed a maze where the walls were where they shouldn’t be. A quick Google turned up a disk image of the same game that had the same problem. This bug was obviously in the section of code that draws the map at the end of the game, so [0xA000] started looking there. The offending typo in the code was an $F4 instead of an $F5, or 244 instead of 255. This shifted the colors of the map by 11 positions, meaning the locations marked as visited in the final screen were wrong. Whether this bug cropped up in development or was just a simple typo when typesetting the magazine doesn’t really matter now; after 29 years, this bug is fixed.


Filed under: classic hacks

A Modern, Upgraded BASIC Stamp

$
0
0

Back in the Before Times, when microcontroller development required ultraviolet light, building anything was a pain. You probably had to burn a ROM onto a chip with a parallel programmer, there was no in-circuit programming, and who knows what would happen if you needed a serial port.

This changed in the early 90s with the introduction of the BASIC Stamp from Parallax. This was a simple microcontroller development board using Microchip PIC. With a little bit of clever firmware developed by Parallax, you could write code in BASIC, upload your code over a serial or parallel port (which every computer had), and blink a LED with just a few lines of code. All microcontroller development boards — including the Arduino — owe a debt to the BASIC Stamp. It is the grandfather to the Arduino, and it is very, very old.

Microchip didn’t update the BASIC Stamp, but that doesn’t mean someone else can’t handle that. [Bruce Eisenhard] is crowdfunding an improved, updated version of the famous 24-pin BASIC Stamp. It’s got modern parts, runs seven hundred times faster than the original, and is still chock full of BASIC interpretation.

This upgraded Stamp is built around NXP’s LPC11U3 micrcontroller, an ARM Cortex-M0 part with about a hundred times more Flash than the chip in the original Stamp. Programming is done through modern IDEs, and yes, there’s a USB port. This project is pin-compatible with the original BASIC Stamp, so if your microcontroller project from twenty years ago is dying, this is the replacement for you.

The BASIC Stamp was an awesome device for its time, even though it cost more than two hundred dollars in today’s money. [Bruce]’s campaign is offering one of these for $25, which is pretty reasonable for what it is.

 

QuickBASIC Lives On with QB64

$
0
0

When I got my first computer, a second hand 386 running MS-DOS 6.22, I didn’t have an Internet connection. But I did have QuickBASIC installed and a stack of programming magazines the local library was throwing out, so I had plenty to keep myself busy. At the time, I thought QuickBASIC was more or less indistinguishable from magic. I could write simple code and compile it into an .exe, put it on a floppy, and give it to somebody else to run on their own machine. It seemed too good to be true, how could this technology possibly be improved upon?

Of course, that was many years ago, and things are very different now. The programming languages du jour are worlds more capable than the plodding BASIC variants of the 80’s and 90’s. But still, when I found a floppy full of programs I wrote decades ago, I couldn’t help but wonder about getting them running again. With something like DOSBox I reasoned I should be able to install the QuickBASIC IDE and run them like I was back on my trusty 386.

Unfortunately, that was not to be. Maybe I’m just not well versed enough in DOSBox, but I couldn’t get the IDE to actually run any of the source code I pulled off the floppy. This was disappointing, but then it occured to me that modern BASIC interpreters are probably being developed in some corner of the Internet, and perhaps I could find a way to run my nearly 30 year old code without having to rely on 30 year old software to do it.

The QB64 Project

After searching around a bit, I found the very cool QB64 project (alternate site: QB64.org) This is an open source QuickBASIC development environment that is not only completely compatible with existing programs, but adds in functions and capabilities that were unthinkable back on my 386. Displaying a PNG, loading TTF fonts, or playing an MP3 in the background can be accomplished with just one or two commands.

Such things were possible with the original QuickBASIC, but existed more in the realm of tech demos than anything else. Oh the games I could have made back in the day with software like this! I had to be content with bleeps and bloops, and even that required you to figure out the timing for the tones yourself.

Even better, QB64 is cross-platform and supports compiling into native binaries for Linux, Windows, and Mac OS. That meant that not only could I run my old code within the IDE, but I could actually compile it into a binary for my Linux desktop. I don’t own a Windows computer anymore, but with WINE I was able to run the Windows version of QB64 and compile an .exe that I could give to my friends who are still living in the dark ages.

You can even use QB64 to compile QuickBasic code into an Android application, though there’s considerable hoops to jump through and it currently only works on Windows.

Conjuring Black Magic

This might be lost on those who never wrote BASIC code on a vintage machine, but the following code creates a 800×600 screen, puts a full screen PNG up, plays an MP3, and writes a message using a TrueType font.

' Init screen
SCREEN _NEWIMAGE(800, 600, 32)

' Load files
menubg& = _LOADIMAGE("splash.png")
menufont& = _LOADFONT("font.ttf", 30)
theme& = _SNDOPEN("theme.mp3", "SYNC,VOL")

' Set theme volume, start playing
_SNDVOL theme&, 0.3
_SNDPLAY theme&

' Load font
_FONT menufont&

' Show full screen image
_PUTIMAGE (0, 0), menubg&

' Say hello
PRINT "Hello Hackaday!"

As a comparison, this QuickBasic tool for simply displaying a JPEG image clocks in at 653 lines of code.

Revisiting a Project

In my edgy teenage days, I created a graphical version of the “Drugwars” style game. You moved a little stick man around a pixelated environment, buying and selling substances that I had heard about in movies but certainly had never seen in person. It was terrible. But it was part of my youth and I thought it would be fun to see if I could shoehorn in some modern flash using QB64.

As it turns out, transparent PNGs and the ability to display proper fonts makes things a lot easier. Being able to play music and ambient sound effects in the background makes even sloppily done games seem a lot better. The following screenshots are of the main menu of my little teenage crime fantasy, before and after the application of QB64. Note that the core source code itself is more or less the same, I’m just interleaving it with the ability to load and display external files.

Should You Be Using QuickBasic?

No, you definitely should not. I didn’t write this to try and convince anyone to jump on a programming language that peaked before many of our readers were even born. QuickBASIC is an antiquated language, stuck with outdated methods and limitations that are confounding to the modern programmer. But QB64 does do an excellent job of modernizing this classic language, if only to a relatively small degree in the grand scheme of things, for those of us who cut our teeth on it.

Being able to take a disk with BASIC code I wrote on a DOS 386 in the early 90’s and turn it into a Linux binary in 2018 is a pretty neat accomplishment, and I salute the QB64 development team for making it possible. I won’t be writing any new code in the language, and I don’t suggest you do either, but it was a lot of fun being able to revisit this period in my life and drag it kicking and screaming into the modern era.

DIY Coil Winding Machine Counts The Hacky Way

$
0
0

“Wait, was that 423 or 424?” When you’re stuck winding a transformer or coil that has more than a few hundred turns, you’re going to want to spend some time on a winding jig. This video, embedded below, displays a simple but sufficient machine — with a few twists.

The first elaboration is the addition of a shuttle that moves back and forth in sync with the main spindle to lay the windings down nice and smooth. Here, it’s tremendously simple — a piece of threaded rod and a set of interchangeable wheels that are driven by a big o-ring belt. We love the low-tech solution of simply adding a twist into the belt to swap directions. We would have way overthought the mechanism.

But then the hack is the digital counter made out of an old calculator. We’ve seen this before, of course, but here’s a great real-world application.

Thanks [Jānis] for the tip!

ESP8266 Home Computer Hides Unexpected Gems

$
0
0

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]!

It’s The Web, Basically

$
0
0

If you are of a certain age, you probably learned to program in Basic. Even if you aren’t, a lot of microcontroller hobbyists got started on the Basic Stamp, and there are plenty of other places where to venerable language still hides out. But if you want to write cool browser applications, you have to write JavaScript, right? Google will now let you code your web pages in Basic. Known as WWWBasic, this is — of course — a Javascript hack that you can load remotely into a web page and then have your page use Basic for customization. You can even import the thing into Node.js and use Basic inside your JavaScript, although it is hard to think of why you’d want to.

According to the project’s documentation — which is pretty sparse so far, we’re afraid — the Basic program is compiled into JavaScript on page load. There are a few examples, so you can generally pick up what’s available to use. There are graphics, the ability to read a keyboard key, and a way to handle the mouse.

If you were thinking about old-school games, so was Google, apparently. It would be fun to pull out some of the old books full of Basic games and get Star Trek, Wumpus, and all the other games of that era in the browser. However, it looks as though some things that would be difficult are yet to be implemented (for example, the INPUT statement). We suppose you could write your own quasi-input function using INKEY but that would be painful.

We couldn’t find any way for the Basic code to interact with the browser data directly which is a shame because that means your output is limited to a virtual Basic “screen.” It looks pretty good for graphics, but the text output looks like an old-school computer, which is charming but not terribly practical. Microsoft’s VBScript technology for example, can write into the page just like JavaScript does, and that would be nice to see in WWWBasic.

Is it practical? Probably not, but we enjoyed seeing our old friend Basic show up in the browser again. The fact that unlike VBScript it is sort of retro just made it that much more fun.

If you want a more traditional Basic experience, Quickbasic is still around. Or, if you want to stay in the browser, you can do that, too. Incidentally, no actual donkeys were harmed during the production of this post.

The Supercon Badge is a Freakin’ Computer

$
0
0

It hangs around your neck, comes with the cost of admission, and would blow away a desktop computer from the 1980’s. This is the Hackaday Superconference badge and you can get your hands on one for the price of admission to the ultimate hardware conference.

Everyone through the door gets one of these badges featuring a 320 x 240 color display, a full qwerty keyboard, and limitless hacking potential! The stock firmware runs a BASIC interpreter, the CP/M operating system, and includes games and Easter Eggs. It’s a giant playground, and we want to see what you can do with this custom hardware during the three days of Supercon. Get your ticket now, then join me after the break for a demo video and plenty more info.

This badge design by Voja Antonic was premiered at the Hackaday Belgrade conference in May and is seeing an encore performance for Supercon. It looks amazing, but what you don’t realize until you have it in your hands is how much fun it is to hammer out some BASIC code on the incredibly clicky keyboard. Check out this fun figure: we ordered over 30,000 momentary switches for the assembly of these badges!

Hardware Design and Hacking

The display on the badge is superb and provides plenty of room for highly readable text. Of course it’s full-color and begging for some great visualizations — demoscene anyone? The badge is being assembled by Macrofab, who have also donated a portion of the assembly cost. They use red PCBs for prototypes — you’re looking at #1 of 5 — but the final solder mask will be black. In the upper right you can see the white component with is an RGB LED controllable from inside the BASIC interpreter.

The hard work is happening on the back side of the badge. A PIC32MX370 microcontroller drives everything, with an SST26VF016BT flash chip for an additional 16 MB of storage — both of these chips were graciously donated for this project by Microchip.

Also on board is a speaker and amplifier circuit. That’s right, this badge plays music! You can code in BASIC or in C for three-voice audio.

New for Supercon is the hardware hacking breakout board. This attaches to the breakout header on the top of the badge and includes a hole for a bolt and nut. Shown here is the protoype, the final version will be black, and includes three footprints for “shitty add-ons“(SAO). If you want to make your own SAO to bring to Supercon, here’s the design spec.

The expansion header includes four GPIO pins that can be controlled from the BASIC Interpreter. There are pins for I2C and UART serial broken out. The header is also used to program the badge. If you have a PICKIT, please bring it along to Supercon. You should also bring a USB to serial cable if you have one. (Not like you were going to leave home without it, right?)

We saw all kinds of things connected to this header at Hackaday Belgrade. Before lunch there was a badge up on the WiFi network which you could log into and draw on the screen from your phone’s browser. There were badges communicating via long-range radio dongles. This  year we hope to see communications hacks and a lot of bling!

Firmware Hacking

The firmware is designed by Jaromir Sukuba and is still in progress for this year. He began with an existing tokenizer and fleshed out the core functionality before adding in hardware-specific functionality: playing music, controling the LED, controling GPIO, writing to the screen, PEEKing and POKEing RAM locations, and more. He also added the CP/M operating system and configured the flash chip to serve as disk space for it.

We suggest you begin thinking about hacks involving:

  • The BASIC language
  • Music (look for or arrange tracks that use up to 3 voices)
  • Writing code (or locating existing programs) for CP/M
  • Driving your external hardware hacks using GPIO, I2C, or serial

The most delightful badge hack we saw at the Belgrade conference in May was a two-badge game called “Shoot My Valentine“. Each player had a little ship pointed towards the other badge, when that badge fired the lasers, you saw them travel up off the top of the screen and appear on the other player’s badge. This is the sort of awesome creativity we hope to see this year. Can anyone come up with a 4-player game?

Don’t Miss Out!

Supercon will sell out and the only way you can guarantee you’ll get one of these badges is to grab a ticket and show up at the Hackaday Superconference! See you in November.


Supercon Badge Hardware Hacking: Here’s What to Bring

$
0
0

Hackaday Superconference is just a week away (precious few tickets remain), a celebration of all things Hackaday, which naturally includes creative projects making the most of their hardware. Every attendee gets a platform for hacking in the form of the conference badge.

To make the most of your badge hacking fun, plan ahead so you will have the extra components and the tools you need. At the most basic, bring along a serial to USB cable and a PIC programmer. These are common and if you don’t own them, ask around and you will likely be able to borrow them. Now is also the time to put in a parts order for any components you want to use but don’t have on hand!

The badge is hackable without any extras, but it’s designed for adding hardware and hacking the firmware. We’re excited to see what you can do with it. We gave an overview of this retro themed pocket computer a few days ago, today we’re inviting you to exploit its potential for your hardware hacks.

Expansion Header, Board, and Custom Firmware

With a full keyboard, LCD screen, audio speaker, and a BASIC programming environment on board, the badge will be a friendly on-ramp for curious beginners attending Supercon. And for our hardware hacking veterans, there’s a header for an expansion board: a gateway to endless possibilities. Serial communication is a good starting point to familiarize with badge expansion, and you should bring your own USB-to-serial adapter to follow our badge serial communications guide.

When you’re ready to venture beyond talking to your computer over a serial link, each badge also comes with this expansion board. It plugs into the badge and brings out all the pins for through-hole soldering plus some common surface-mount footprints (0805, SO-8, SO-16, TSSOP-16, SOT-23). And last but not least, it has three Shitty Add-On headers. Our badge hardware hacking reference guide will continue growing up to (and through) Supercon to help answer your questions.

The expansion pins can be controlled from badge BASIC. But if BASIC should prove limiting, the badge is ready for that, too. The heart of the badge is a PIC32-series processor donated by (along with the Flash chips) by Microchip The expansion header brings out all the pins necessary for in-circuit programming with a PIC programming tool. Microchip’s PICkit (3 or 4) are popular choices, but there are other options out there. And finally, a computer with the firmware development tools installed. Our C programming guide lists the required downloads and steps to install them.

The image above shows a red circuit board as this is one of the five prototypes. We’re using Macrofab as the contract manufacturer for this project (they graciously donated a portion of the assembly cost) and we just received word that the full production run of 500 badges with black solder mask has completed!

What Will You Make?

As fitting for the retro computing theme, most badge features in the default firmware (like Z80 emulation) are text-based. But the badge screen is not restricted to text! We’d love to see what can be done with its graphics capabilities. Maybe even in sync with music playing from the speaker?

Simple circuit: 595 shift register and eight LEDs

Another exciting frontier are multi-badge hacks. It is straightforward to connect two badges to each other over serial, so two-player BASIC gaming is begging to be written as soon as you turn on the badge. But how much further can this idea go? The serial pins can be employed to bridge to all sorts of wireless communications modules. Or perhaps we’ll witness a multi-badge serial protocol for a wired badge LAN?

And while we’ve got the serial port all set up and ready to go for everyone, with some additional work the PIC32 can also communicate over I2C or SPI opening up access to a huge range of electronics peripherals. Will someone attach a camera module to one-up last year’s camera badge? Add motor/servo controllers for badge-brained robots? The only limits are imagination, time, and 3 volt power from the pair of AA batteries.

Be Prepared, Adventure Awaits

So pack your USB serial adapter, your PICkit, and join us at Supercon! Badge pickup and work area opens Friday morning (November 2nd) at 9AM. While we will provide some components and of course basic tools like soldering irons, there will be a ton of people in line to use them. It’s best to bring whatever tools you can pack with you to best help realize your vision. During Sunday evening’s closing ceremony, you’re invited to show the entire conference what you’ve built.

Keep an eye on the badge project page for updates to reference material and join the chat rooms (there’s one for Supercon in general, and one specific to the badge) to connect with similar-minded hackers. You all have great ideas, let’s see them happen. It’s going to be a great adventure!

A Scratch-Built Forgotten Classic Of The Early PC Age

$
0
0

All the retrocomputer love for Commodore machines seems to fall on the C64 and Amiga, with a little sprinkling left over for the VIC-20. Those machines were truly wonderful, but what about the Commodore machine that paved their way? What about the machine that was one of the first to be gobbled up in the late 1970s by school districts eager to convert a broom closet into the new “computer lab”?

The PET 2001 might be a little hard to fall in love with given its all-in-one monitor, cassette recorder, and horrible chiclet keyboard, but some still hold a torch for it. [Glen] obviously felt strongly enough about the machine to build a PET from current production parts, and the results are pretty neat. When trying to recreate a 40-year old machine from scratch, some concessions must be made, of course. The case doesn’t attempt to replicate the all-in-one design, and the original keyboard was mercifully replaced by a standard PS/2 keyboard. But other than that the architecture is faithfully replicated using new production 65xx chips and 74HCT family logic chips. [Glen] had to jump through some hoops to get there, but as the video below shows, the finished machine plays a decent game of Space Invaders.

We’ve seen a PET brought back from the grave by FPGA and a C64 emulated on a Raspberry Pi, but going back to basics and building this from scratch was a fitting homage to an important machine in PC history.

Polish Retro Silicon Brings This Computer To Life

$
0
0

It is an easy trap for us to write only about what we know when covering a topic, thus missing an entire facet of our subject matter. Take retrocomputing for example; we might write about American or Western European machines because we grew up with them, while completely ignoring the hardware being produced on the other side of the Iron Curtain.  Thus it’s fascinating to see [Marek Więcek]’s project, a single board retrocomputer employing a Polish clone of the Intel 8080.

With greater detail on a Polish-language forum (Google Translate), he tells a story of being given an MCY7880 CPU for his collection, only to wonder whether it could be made into a machine in its own right. As a clone of the 8080 this also required equivalents of the Intel bus controller and clock generator chips, which we are guessing must be the UCY74S405 and UCY7404 that he’s also sourced for the project.

The build is completed in true retro style with a maze of point-to-point wiring on the reverse of a protoboard, and he’s put a TinyBASIC interpreter port and 8251 UART on board as well as an 8255 triple parallel I/O port for some GPIO action. We love this computer, and appreciate the light it shines on an obscure corner of microprocessor history.

If Eastern European retrocomputing is your thing, here at Hackaday we’re lucky enough to number among our colleagues someone who’s something of an authority on the matter. [Voja Antonic] has entertained us with the tale of how he designed the Galaksija, Yugoslavia’s first home computer. Sadly though he did not use a Polish 8080 in his design.

Review: IchigoJam Single Board Computer

$
0
0

It won’t replace your beloved Rasbperry Pi, but it’s worth saying hello to this “Strawberry Jam”, straight out of Japan. It’s an equally delicious way to get people interested in the basics of coding.

My hackerspace friend Jim is a lucky bloke, for last year he was able to take an extended holiday through a succession of East Asian countries. We were treated to online pictures of beautiful scenery and beaches, city lights, and of course exciting tech destinations such as hardware markets and hackerspaces. On his return he tossed a package on the table in front of me and said “Jenny, you might like to take a look at that, these are big in Japan!” Inside was an electronic kit and a few pieces of documentation, with Japanese text.

A Different Way To Get Kids Coding

The contents of the IchigoJam kit.
The contents of the IchigoJam kit.

What he’d given me was an IchigoJam (Best translation I’ve been given is “Strawberry Jam”), a small single-board computer aimed at young people. In the style of the 8-bit machines of the 1980s, it runs a comprehensive BASIC interpreter and plugs into a TV set, though it brings itself up-to-date with a USB-A socket for a keyboard. At its heart is an NXP LPC1114F102 ARM Cortex-M0 microcontroller with 32KB of Flash and 4KB of SRAM, and though the board Jim passed to me has a surface-mount example it’s clear that it was also designed for the now-obsolete DIP variant of the chip. If you were to think of this as an odd hybrid of a BASIC Stamp, a Raspberry Pi, and one of the smaller MBED boards, you probably wouldn’t be too far from the mark. What follows is my impression of it based on the information at hand. Sadly the IchigoJam website and forum seems only available to Japanese viewers and returns an error code from my European perspective.

Building the Kit Computer

Aside from the pre-installed SMD microcontroller, all the IchigoJam’s components are through-hole. The sockets are a micro-USB for power, a USB-A for keyboard, and a phono for video, otherwise aside from a few passives there is a crystal, a regulator, an LED and a power switch. There is also a small piezoelectric speaker, though this is intended to be plugged directly into the device’s I/O lines. Unexpectedly a DIP socket is included for the processor, no doubt a BoM hangover from the days when a DIP processor could be supplied (ARM DIP packages are no more). Seemingly this is used in the standard build as a carrier for a sticker bearing pin assignments. The English assembly instructions Jim had sourced with the kit were pretty sparse, but fortunately this is in no way a challenging kit to assemble. Resistor values are clearly marked upon the board, capacitors are easy enough to identify, and every other component has an obvious board outline into which it fits. It took me a leisurely quarter hour to build, achieving a tidy result. My tiny portable CRT TV is a UK-market  625-line model so wouldn’t sync to the IchigoJam’s monochrome 525-line video when I powered it up, but every flat-panel TV I tried it with had no problems. I was greeted with a copyright message and a BASIC interpreter prompt, the little board was working.

Some simple BASIC to get things started.
Some simple BASIC to get things started.

The sharp-eyed among you may have noticed that the LPC1114 has no USB capability, and this led to my being caught out when I first powered up my IchigoJam from a USB phone charger. The board only works with USB keyboards with PS/2 backward compatibility, on one hand a clever hack but something that is not always obvious by looking at a keyboard. After shuffling through my makerspace’s pile of spare ‘boards I was able to find one that worked, and set to with a bit of classic BASIC remembered from my youth. 10 PRINT "Hello World", 20 GOTO 10

A teenage me fresh from a Sinclair Spectrum would have gone straight for the IchigoJam’s graphics and sound capabilities, but of more use for Hackaday in 2019 was the LED keyword suggested as a hardware test by the documentation. In no time I was able to flash the onboard LED, and my IchigoJam hardware odyssey had begun.

Imagine Your 8-Bit Micro Had Come With Modern GPIOs

So the IchigoJam can do most of what I could do on my 8-bit home computer back in 1983. The question is then, what can it do that the Spectrum, Commodore 64 and their ilk couldn’t? The most obvious place to start would be with the board’s interface sockets, but before we go down that road it’s worth taking a diversion. A part of 8-bit computing that many people will remember was the use of audio cassettes to store software. The IchigoJam eschews that but doesn’t lack storage, instead it can store code in its internal Flash memory. It can store up to four programs on board, and there is reference to an external EEPROM board probably using the LPC1114’s I²C interface. The lack of ability to see the website means I can’t pursue the EEPROM board any further, but a guess is that it offers the facility to swap code between users.

The IchigoJam's supplied sticker has all the I/O pin assignments.
The IchigoJam’s supplied sticker has all the I/O pin assignments.

To those interfaces then. The IchigoJam sports three single-in-line 0.1″ pitch sockets, two of which replicate directly the pins of the LPC1114 and one of which provides I²C as well as 5V and 3.3V rails. Onboard are a single button and an LED each connected to their own GPIO lines. Four of the remaining GPIO lines are configured as inputs while six are outputs, and there are also a pair of lines configured as a serial port. All pin configurations are clearly marked upon the board, or with the pin assignment sticker if the builder has chosen to use it.

Programming these hardware functions is easy enough, through BASIC keywords for each one. For those of you who had to use PEEK and POKE to access hardware mapped to memory locations in the 8-bit days, this offers unheard-of convenience. LED and BTN are the “Hello World” of IchigoJam hardware because they require no extra wiring, but the rest of the lines are not left behind with both IN and OUT keywords. Analogue functions are not forgotten either, an ANA keyword reads voltages on input pins while PWM as its name suggests provides a PWM output capability. A bit of fun with some LEDs and wires confirmed the potential in these functions.

Then there is that I²C interface, something which I think sets this at the same table as some of the more accomplished boards. Suddenly we’ve moved on from having a fun retrocomputer or a board for kids with a few GPIOs, this interface opens up the IchigoJam to a huge range of devices and breakout boards through the simplest possible of programming. An I2CR and an I2CW command both allow any device to be read and commanded from within BASIC.

Buy One, If You Can Find One

The IchigoJam then is a very simple yet surprisingly capable board from Japan that obviously provides its intended purpose of giving Japanese kids a taste of coding. It’s never going to displace the boards you’re used to, but it should appeal to anyone who appreciates the old 8-bit BASIC machines. It will also have use for anyone who wants a simple but versatile easy-to-program microcontroller board. The use of analogue video and PS/2 capable USB keyboards indicates that it could perhaps use an update of some kind on those interfaces, but neither of those is an unsurmountable issue. I rather like it, and will be sorry when the time comes to hand the review model back to its owner.

Can it read the Hackaday Retro Edition? The MixJuice WiFi card, one of several add-ons for the board.
Can it read the Hackaday Retro Edition? The MixJuice WiFi card, one of several add-ons for the board.

At this point in a review I would normally suggest that you buy one, then give you a price and a local supplier, but sadly the IchigoJam does not seem to be available outside Japan. Happily though you can order one from the PCN, the Japanese equivalent to Code Club, for JPY1890, which comes to $17.38, or £13.25 without any postage or import duties added. They also carry some add-on boards, including multimedia and networking peripherals. Further searches reveal tantalising glimpses of an ecosystem, with a Javascript variant, a minimalist headless version, and a version designed to take an IoT module. For those of you wanting to try without waiting for a parcel from Japan there’s an online emulator into which you can type BASIC listings.

During the research for this article I happened to mention the IchigoJam on Twitter and was contacted by its originator, Taisuke Fukuno. He pointed me to his write-up of its appearance at Maker Faire Bay Area in 2017, but for now these remain Japanese market only products. There seems little prospect of them emerging in the American or European stores you’d expect  such as Adafruit or Pimoroni, and to me that’s a crying shame, because while it might lack the power of a Raspberry Pi or the versatility of an Arduino it’s still a pretty cool board. I appreciate only too well that the support liability for offering a kit internationally is a heavy one for a small company, so it’s possible we’ll never officially see it on our side of the planet. Still, if your travels take you to Japan try to pick one up. You won’t be disappointed.

Travelling The Oregon Trail With An Apple II Robot

$
0
0

For one reason or another, we’re going with a retro-futuristic 80s aesthetic in this case, [Mike] decided to turn an Apple IIe into a robot. If you have to ask why, you’ll never know, but this project does have some interesting things going for it. There’s a voice synthesizer, a brand spankin’ new power supply, and it rolls around on the floor thanks to Apple BASIC.

Since this is a mobile robot, there needs to be a power supply in there somewhere. The Apple II had a fantastic switching power supply, but it ran off mains voltage. To make this Apple run off a 14.8 V LiPO battery, [Mike] needed to re-engineer this power supply to give +5, +12, -5, and -12 Volts. The easiest is the positive voltage, and for that, he used a big ‘ol LM1084 linear regulator for the +5 V line. This outputs a ton of heat and probably isn’t the best solution, but it is a solution that works. The +12 line was again another linear regulator, an LM7812CV. Since this is dropping 14.8 V down to 12, the efficiency isn’t that bad, and since there’s no floppy drive it’s not pulling much current anyway. The negative voltages are a MAX764 / MAX765 inverting switching regulators. This completely replaces the original power supply in the Apple II, and is a decent reference design for anyone who wants to make a luggable Apple II laptop.

To move this thing around, the motors run on their own 11.1 V LiPO, with a bunch of Pololu gear tying everything together. The BASIC code was written on an emulator, transferred over with the Floppy Emu. Movement is controlled through the output pins on the joystick port, and there’s a text to speech module that was obviously needed and ties this project together wonderfully. You can check out the video demo of the build below.

Viewing all 91 articles
Browse latest View live