OpenGL In 500 Lines (Sort Of…)

How difficult is OpenGL? How difficult can it be if you can build a basic renderer in 500 lines of code? That’s what [Dmitry] did as part of a series of tiny applications. The renderer is part of a course and the line limit is to allow students to build their own rendering software. [Dmitry] feels that you can’t write efficient code for things like OpenGL without understanding how they work first.

For educational purposes, the system uses few external dependencies. Students get a class that can work with TGA format files and a way to set the color of one pixel. The rest of the renderer is up to the student guided by nine lessons ranging from Bresenham’s algorithm to ambient occlusion. One of the last lessons switches gears to OpenGL so you can see how it all applies.

Continue reading “OpenGL In 500 Lines (Sort Of…)”

Commodore Inspired Watch Puts BASIC On Your Wrist

Ask a smart watch owner what their favorite wrist-mounted feature is, and they might say it’s having all their daily information available at a glance, or the ease with which they’re able to communicate with friends and family. If they don’t mention knocking out a few lines in their wearable BASIC interpreter, then you know you aren’t talking to [Nick Bild]. His “C64 Watch” firmware for the LILYGO T-Watch 2020 not only takes some visual inspiration from the Commodore 64, but also lets you relive those early computing glory days with a functional BASIC environment.

Originally [Nick] used a teeny tiny onscreen keyboard to tap out his BASIC programs, but finding the experience to be uncomfortably like torture, he switched over to using USB. Just plug the watch into your computer, open your favorite serial terminal, and you’ll have access to the customized version of TinyBasic Plus running on the watch. To make things  even easier, he’s looking at implementing a web-based terminal over WiFi so you don’t need to plug the watch in.

When you aren’t running BASIC you’ll be treated to a Commodore-themed watch face, complete with the classic READY. prompt. A small battery indicator is hidden up in the top-right corner, and tapping on the rainbow colored “C” will launch the menu. It’s pretty simplistic, but of course what else would you expect given the source material?

Looking ahead, [Nick] says he’d also like to implement a C64 emulator into the firmware so the watch could run original software. We’re a bit skeptical about how practical that would actually be, but we’ll reserve judgement until we see it in operation. He’s also hoping other Commodore aficionados will chime in with their own improvements and new features for the watch.

You might think that a Commodore 64 emulator on your wrist would be the most outlandish way to run your old games and software, but we’d say playing Turrican in a virtual reality microcosm of the 1980s takes the cake.

Continue reading “Commodore Inspired Watch Puts BASIC On Your Wrist”

E.T. Video Game Gets Re-Imagined In 10 Lines Of BASIC

Most people would recognize E.T. The Extra-Terrestrial for the Atari 2600 by its reputation as one of the worst video games of all time. We’ll have more to say about that in a moment, but E.T. was nevertheless chosen as the inspiration behind [Martin Fitzpatrick]’s re-imagining of the game in ten lines of BASIC code for a contest that encourages and celebrates games written in ten lines of BASIC, or less.

Ten lines of BASIC is a big limitation, even when getting clever by stacking multiple statements into a single line, so [Martin]’s game has a much narrower scope than the original Atari 2600 version. Still, the core elements are present: E.T. must find and gather all the parts of the phone in order to contact his ship, after which he must meet the ship in time to escape. All the while, FBI agents attempt to interfere. The game was written in SAM BASIC, used by the SAM Coupé, a British Z80-based home computer from the late 80s with an emulator available for download.

Now, for lovers of “um, actually” topics, do we have a treat for you! Let’s take this opportunity to review a few things about E.T. The Extra-Terrestrial. That it was a commercial flop is no doubt, but the game itself is often badly misunderstood. Way back in 2013 we covered an extraordinary effort to patch improvements into the binary for the 2600 game, and in the process there’s a compelling case made that the game was in many ways far ahead of its time, and actually quite significant in terms of game design. You can jump right in on an analysis of the hate the game receives, and while reading that it’s helpful to keep in mind that In 1982, many of its peers were games like Space Invaders, with self-evident gameplay that simply looped endlessly.

New HackadayU Classes: Antenna Basics, Raspberry Pi Pico, And Designing Complex Geometry

Get ’em while they’re hot: a new session of HackadayU just opened with classes from three fantastic instructors and seats are filling up fast.

Introduction to Antenna Basics — Instructor Karen Rucker teaches the fundamentals of antenna design as if it were your first year on-the-job. She’ll cover the common types of antenna designs and the fundamentals of radio frequency engineering that go into them. Begins Thursday, May 6th.

Raspberry Pi Pico and RP2040 – The Deep Dive — Instructor Uri Shaked guides the class through the internals of the RP2040 microcontroller, covering system architecture, hardware peripherals, and dipping into some ARM assembly language examples. Begins Wednesday, May 5th.

Designing with Complex Geometry — Instructor James McBennett helps you up your 3D modelling game with a course on using complex geometries in Grasshopper3D (part of Rhino3D). Dive into Non-uniform rational B-spline (NURBS) and go from simple shapes to incredibly complex objects with a bit of code. Begins Tuesday, May 4th.

Each course includes five weekly classes beginning in May. Being part of the live class via Zoom offers interactivity with the instructor and other attendees. All tickets are “pay-as-you-wish” with a $20 suggested donation; all proceeds go to socially conscious charities.

For the benefit of all, each class will be edited and published on Hackaday’s YouTube channel once this session has wrapped up. Check out our playlists for past HackadayU courses, or watch them all in one giant playlist.

You might also consider becoming an Engineering Liaison for HackadayU. These volunteers help keep the class humming along for the best experience for students and instructors alike. Liaison applications are now open.

Continue reading “New HackadayU Classes: Antenna Basics, Raspberry Pi Pico, And Designing Complex Geometry”

BASIC: Cross-Platform Software Hacking Then And Now

Surely BASIC is properly obsolete by now, right? Perhaps not. In addition to inspiring a large part of home computing today, BASIC is still very much alive today, even outside of retro computing.

There was a time, not even that long ago, when the lingua franca of the home computer world was BASIC. This wasn’t necessarily always the exact same BASIC; the commands and syntax differed between whatever BASIC dialect came with any given model of home computer (Commodore, Atari, Texas Instruments, Sinclair or any of the countless others). Fortunately most of these licensed or were derived from the most popular microcomputer implementation of BASIC: Microsoft BASIC.

BASIC has its roots in academics, where it was intended to be an easy to use programming language for every student, even those outside the traditional STEM fields. Taking its cues from popular 1960s languages like FORTRAN and ALGOL, it saw widespread use on time-sharing systems at schools, with even IBM joining the party in 1973 with VS-BASIC. When the 1970s saw the arrival of microcomputers, small and cheap enough to be bought by anyone and used at home, it seemed only natural that they too would run BASIC.

The advantage of having BASIC  integrated into these systems was obvious: not only were most people who bought such a home computer already familiar with BASIC, it allows programs to be run without first being compiled. This was good, because compiling a program takes a lot of RAM and storage, neither of which were plentiful in microcomputers. Instead of compiling BASIC source code, BASIC interpreters would interpret and run the code one line at a time, trading execution speed for flexibility and low resource use.

After turning on one’s microcomputer, the BASIC interpreter would usually be loaded straight from an onboard ROM in lieu of a full-blown operating system. In this interpreter shell, one could use the hardware, write and load BASIC programs and save them to tape or disk. Running existing BASIC code as well as compiled programs on one’s computer, or even typing them in from a listing in a magazine all belonged to the options. As BASIC implementations between different home computers were relatively consistent, this provided for a lot of portability.

That was then, and this is now. Are people actually still using the Basic language?

Continue reading “BASIC: Cross-Platform Software Hacking Then And Now”

Basic In 10 Lines Or Less

For the last 11 years [Gunnar Kanold] has run the annual BASIC 10 Liner contest, and the rules for the 2021 edition are now available. There are four categories and each category has specific definitions of what constitutes a line. All entries must run on an 8-bit computer system that can be emulated.

The first three categories are for games but differ in the line length allowed. You can elect to compete with 80 character lines, 120 character lines, or 256 character lines. There’s also a category for demos, tools, and other applications that must constrain lines to 256 characters.

Continue reading “Basic In 10 Lines Or Less”

Blue Pill Vs Black Pill: Transitioning From STM32F103 To STM32F411

For many years now, the so-called ‘Blue Pill’ STM32 MCU development board has been a staple in the hobbyist community. Finding its origins as an apparent Maple Mini clone, the diminutive board is easily to use in breadboard projects thanks to its dual rows of 0.1″ pin sockets. Best of all, it only costs a few bucks, even if you can only really buy it via sellers on AliExpress and EBay.

Starting last year, boards with a black soldermask and an STM32F4 Access (entry-level) series MCUs including the F401 and F411 began to appear. These boards with the nickname ‘Black Pill’ or ‘Black Pill 2’. F103 boards also existed with black soldermask for a while, so it’s confusing. The F4xx Black Pills are available via the same sources as the F103-based Blue Pill ones, for a similar price, but feature an MCU that’s considerably newer and more powerful. This raises the question of whether it makes sense at this point to switch to these new boards.

Our answer is yes, but it’s not entirely clearcut. The newer hardware is better for most purposes, really lacking only the F103’s dual ADCs. But hardware isn’t the only consideration; depending on one’s preferred framework, support may be lacking or incomplete. So let’s take a look at what it takes to switch. Continue reading “Blue Pill Vs Black Pill: Transitioning From STM32F103 To STM32F411”