Matrix Math on a Commodore 64
Matrix fundamentals from the ground up. Definitions, the operations that matter, plain Python, numpy for comparison, and a complete BASIC program on a real C64.
Recent content in 2^x bits on Imapenguin
Matrix fundamentals from the ground up. Definitions, the operations that matter, plain Python, numpy for comparison, and a complete BASIC program on a real C64.
Reservoir computing says don’t train the dynamics, just train the readout. I used the SID’s analog filter as the dynamics and one ridge regression as the readout. It’s not state of the art, but the chip earns its keep exactly where a linear model falls apart.
Eight CPUs from the 1970s and 1980s, sharing one 64K bus, an Apple-1 style monitor on the front, and a paper tape station. Open it in your browser and poke around.
Where the famous 43 quintillion comes from, why a C64 can’t print it the easy way, and a tiny multi-precision multiplier in BASIC that gets every digit right.
I picked up a boxed Timex Sinclair 2068 that wouldn’t boot. An oscilloscope, a BackBit tester, and a fresh Z80 later, it was running. Then I ported Charles Bond’s 1981 maze algorithm from the C64 to Sinclair BASIC.
The fruit fly has a brain structure that acts like a hash function. I built it in Python, matched the 2017 paper’s MNIST results against a classical baseline, then got the same algorithm running on a Commodore 64.
The Bombe needs a crib. What if you don’t have one? Index of coincidence measures how much an output looks like real language vs random noise. We use it to attack Enigma without any known plaintext.
John Wallis found an infinite product for pi in 1655. Multiply enough fractions together and pi falls out. We run it on the C64 in BASIC and assembly, watching it converge one digit at a time.
Ring settings multiply Enigma’s keyspace by 17,576. We add them to our C64 emulator, see why brute force alone can’t keep up, and set the stage for smarter attacks.
The Commodore 64 searches nearly six million Enigma M3 configurations to find the one that matches a known plaintext crib. First the concept, then BASIC, then 6502 assembly fast enough to crack it in about 22 minutes.
A working Enigma M3 emulator on the Commodore 64. First in BASIC for clarity, then in 6502 assembly for speed. Eight rotors with dual notches, plugboard, and the double-step anomaly, all on a 1 MHz machine.
Bringing 10PRINT to the Apple II with Applesoft BASIC and Lo-Res graphics, exploring both text-mode and graphical approaches to this iconic one-liner.
Why German cryptographers believed Enigma was unbreakable, and why Allied codebreakers ultimately proved them wrong.
Visualizing sorting algorithms in real-time on the Commodore 64 using PETSCII characters. Three classic algorithms rendered as animated bar charts in BASIC.
Vibe coding with AI feels productive until it isn’t. Dorothy Vaughan’s team didn’t just operate the IBM—they understood the math behind it. That’s why they succeeded. Here’s why first principles must come before AI assistance.
When IBM machines threatened to make her job obsolete, Dorothy Vaughan didn’t retreat—she learned FORTRAN and taught her entire team. Her story offers a blueprint for surviving technological change in any era.
Exploring three different maze generation algorithms on the Commodore 64: Depth-First Search, Randomized Prim’s, and the classic 1981 algorithm from Compute! magazine.
Implementing 16-bit unsigned AND operations in Commodore BASIC using two’s complement to work around the signed integer limitation.
Celebrating the gloriously absurd cover of ‘FORTH on the Atari’—possibly the greatest unintentionally funny book cover ever created.
Implementing 10PRINT on a KIM-1 clone (PAL-II) in both Microsoft BASIC and 6502 assembly, displaying the maze on the 7-segment LED display.
Running 10PRINT and 100 Doors on the Clockwork Pi PicoCalc, a retro-inspired Raspberry Pi Pico handheld running PicoMite BASIC.
A visual exploration of the classic 100 Doors programming problem implemented in PICO-8, featuring animated circles that show the door-toggling pattern in action. This version pays homage to the VIC-20 implementation while leveraging PICO-8’s built-in game loop for smooth animation and visual feedback. Complete with code explanations and comparison to the classic VIC-20 version.
Continuing the exploration of 10PRINT, we look at how to implement the 10 Print algorithm on the Pico-8 platform.
We draw some dragon curves with Logo on the Commodore 64 inspired by Jurassic Park
A head-to-head performance comparison of the classic 10PRINT maze algorithm implemented in Rust and C, with benchmarks measuring millions of iterations.
Exploring wAx, a native assembler for the VIC-20 that integrates with BASIC. Includes examples implementing 10PRINT and Fibonacci in assembly directly on the machine.
Implementing the classic 10PRINT maze algorithm on the HP-42s calculator using RPN programming. Works on SwissMicros DM42 and Free42 emulators too.
Solving the classic McNuggets Problem in Commodore BASIC: what’s the largest number of nuggets you can’t buy with 6, 9, and 20 packs?
Why your algorithm choice matters: comparing linear search O(n) vs binary search O(log n) with implementations in Commodore BASIC and Python.
Optimizing a simple counting loop on the 6502, progressing from slow BASIC to increasingly faster assembly implementations. A practical guide to 6502 optimization.
Building and verifying the Commodore 64 SID chip’s 23-bit LFSR in hardware on a breadboard and comparing the output against the actual SID chip.
An introduction to Linear Feedback Shift Registers: how they work, building one on a breadboard with shift registers and XOR gates, and implementing them in Python and Rust.
Commodore BASIC 2.0 
 A lot of fun with binary numbers can be had by printing them to the screen. This is a quick post to show how to do that with Commodore BASIC 2.0. This is a follow up to Quick Post: XOR in Commodore BASIC 2.0 . 
 We’ll be using both of these in upcoming posts, so it’s good to have them handy. 
 5 REM PRINT ALL 8 BIT NUMBERS IN BINARY 
 10 FOR N = 0…
Implementing 10PRINT on the TI-92 calculator using TI-BASIC. Also covers Python versions on the Numworks and TI-nspire calculators.
Understanding two’s complement: how computers represent negative numbers, why it simplifies hardware design, and how to work with signed integers in assembly and high-level languages.
Solving the classic N-Queens puzzle using backtracking. Covers both iterative and recursive approaches with implementations on the Commodore 64.
Implementing the Rail Fence Cipher on the Commodore 64 and TI 99/4A. A fun transposition cipher for secret messages with kids.
Drawing grids for screen layout planning on the Commodore 64 and VIC-20. Comparing BASIC, Simon’s BASIC, and Super Expander approaches.
Rockwell International was a powerhouse of the 1970s and 80s. 
 The Rockwell AIM 65 computer, also known as the Advanced Interactive Microcomputer 65, is an early microcomputer produced by Rockwell International in the late 1970s. It was essentially a development system, intended primarily for engineers, educators, and hobbyists, and was named for its built-in alphanumeric keyboard and LED…
Modern and retro mix 
 One of my favorite peices of retro clone hardware is Bob Corsham’s KIM-1 Clone. I’ve featured it many places like the 6502 speed series . 
 I have the latest model of this board, and he made an interesting design choice. It actually has an FTDI chip on board and you use that via USB to connect via a modern computer with an FTDI driver. This is very…
Driving LEDs from the VIC-20 and KIM-1 USR ports. Binary counting in the real world with vintage hardware.
Exploring the elegant maze generator from Compute! magazine (December 1981). A line-by-line breakdown of how this classic BASIC algorithm works.
Writing code to validate Pilish text—prose where word lengths match the digits of Pi. Implementations in Julia and Commodore BASIC.
Evaluating vintage computers for NaNoWriMo 2022: VIC-20, Plus/4, Commodore 64, and PET. Word processing on 8-bit machines with SpeedScript and other tools.
Adding integers with hundreds of digits using string manipulation in Commodore BASIC. When your numbers are too big for Wolfram Alpha.
Understanding the MOS paper tape format used by the KIM-1 and other 6502 systems. Breaking down the hex format line by line with checksum verification.
Optimizing 6502 memory transfers beyond the general-purpose approach. Testing on a 1MHz KIM-1 clone with precise timing measurements.
Testing real-world memory transfer speeds on 6502 machines. Inspired by Apple M2 marketing, let’s see what Commodore hardware can actually do.
Finding k-almost-primes using TinyBASIC on a KIM-1 clone. A look at the copyleft origins of TinyBASIC and Bill Gates’ infamous open letter.
Starting a year-long project to reverse engineer and create a drop-in FPGA replacement for the VIC-20’s 6560/6561 video chip.