Below you will find pages that utilize the taxonomy term “Code”
Dragon Curves
10 PRINT in Rust vs C
wAx the VIC-20
Wax
Over the years, I’ve looked for an Assembler for the VIC-20. Sure, there are great cross-assemblers like Kick Assembler, but I wanted something that would run on the VIC-20 itself.
10 PRINT on the HP-42s
Over the years, I’ve been on a silly quest to do 10PRINT on as many things as I can. They end up on X, here, or sometimes both.
The McNuggets Problem
My son, now 25, was a McNuggets fan. Can you blame him? They’re delicious. He’s always been into numbers and puzzles, so I introduced him to the McNuggets problem when he was about 10.
Back to the basics with BASIC (and Python): Binary Search
Back to the basics with basic
Let’s say for a moment that we’ve got an ordered list of numbers.
Machine Language: Count Faster on 6502
I’ve done a lot of silly math, ciphers and asked a lot of my vintage hardware on this site over the years. But I’ve not talked a ton about optimizing code for faster results.
Visualize and verify the reverse engineered Commodore 64 SID LFSR
Recently, we looked at a simple LFSR and how it works.
A Gentle Introduction to LFSRs
What is an LFSR?
An LFSR is a Linear Feedback Shift Register. It’s a simple way of generating a sequence of numbers that look random.
Quick Post: Printing binary numbers in Commodore BASIC 2.0
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.
10 Print on the TI-92
The “famous” 10PRINT program on vintage computers was a delight for many in the 70s and 80s. It’s fun to port to other platforms and machines.
A gentle introduction to two's complement
I was recently on a video call with a friend, throwing around some ideas for a new product. I mentioned adding large signed numbers in assembly and using two’s complement. He asked me what two’s complement was. I was a little surprised that he didn’t know. He’s been a Java programmer for more than 30 years. Java and Python programmers (and others like gasp Commodore / MicroSoft BASIC) don’t have a native unsigned integer type. The language takes care of the details for you.
N-Queens problem
N-Queens Problem
The N-Queens problem is a classic in computer science. Place N queens on an NxN chessboard such that no queen can attack another queen.
Rail Fence Cipher on Commoodore 64 and TI 99/4A
I have a BUNCH of nieces and nephews. Over the years, doing some secret message passing with them around birthdays and holidays has been fun.
10 PRINT on the Rockwell AIM 65
Rockwell International was a powerhouse of the 1970s and 80s.
Building a software serial bridge
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.
Blinkenlights
In the world of tech, including vintage tech, the lure of the blinkenlight is strong.
40 years on, this is still the best maze algorithm
My friend Robin’s favorite demo is 10 print. And what’s not to love about 10 print? After all, there’s even a book about it.
Validating Pilish
Have you ever sat down at your old Olympia typewriter and felt compelled to write poetry in which each word is the same length as successive digits of Pi?
My mostly retro writing platform contenders in National Novel Writing Month for 2022 NaNoWriMo
I’ve participated in National Novel Writing Month for the last two years. While I don’t have aspirations of being a fiction author, I think there is a ton of value in writing 1500 words daily. Good writing or bad, 45000 words in a month is worth the effort.
Adding very large integers in 8 Bit BASIC
As we’ve discussed, large integer math is a pretty interesting problem, even for modern computers.
MOS paper tape format
I built the world’s worst paper tape reader some weeks ago. It works pretty okay on anything with a USR-style port like a KIM-1 clone or a VIC-20.
A little more speed from the 6502
Can we get a little more speed from a 6502 than we did last week? Almost certainly.
How fast can a 6502 transfer memory
The amazing Gregorio Naçu posted the article title graphic this week to bring attention to the venerable 6502 processor and poke fun at Apple’s M2 chip marketing slides. He’s doing probably the most ambitious single-person Commodore 64 project I know of and has a fantastic blog.
Almost primes with TinyBASIC on the KIM-1 clone: PAL-1
Bill Gates has been a controversial figure in the Computer World for 50 years now.
VIC’s Revenge, the drop-in replacement for the VIC-20 VIC chip Part 1: Introduction, design goals, and FAQs
I’m doing a year-long project to reverse engineer the output and functionality of a VIC-20’s video chip, and create a drop-in replacement. At the start of this project (a few days ago), I only actually know how to do a percentage of the things I’ll need to complete this project. Writing a long series on how things work as I learn will help the project along. Plus, maybe having all of this information in one place would be nice, right?
64 Bit Addition and Products on Commodore: The Wheat and Chessboard problem
Dealing with large numbers in computing has been an attractive problem area for a long time. Using an average calculator might lead you to believe that it’s too tricky for most applications.
Yet another version of the 100 door problem; this time, let's extend Commodore BASIC to add PRINT @, shall we?
I stumbled across a ZX Spectrum version of the 100 Door problem that got me thinking. Wouldn’t it be nice to have PRINT AT
in Commodore BASIC?
Fibonacci 1-10 on the KIM-1 (and clones)
Sometimes there’s an absolute joy in doing something the hard way to REALLY understand what’s happening.
The terrible random number generation in the Commodore 64 (and 128)
Quite a while ago, I started playing with random numbers on 8 Bit machines. I don’t think anyone is doing “serious” work on these machines, but playing with Ciphers and Crypto got me at least curious about how a Commodore 64 generates random numbers.
Simple splitting the screen with two colors on the Commodore 64
Someone asked me yesterday how to very simply split the Commodore 64 screen to display two solid colors.
A visual 100 Door Problem solution in Python
Last year, we did the 100 door problem on many platforms in BASIC and Assembly language.
Permutations of 1 to 9 in Python, BASIC, and 6502 Assembly
Someone asked me this week if I would help him with a graph theory problem on 8-Bit machines. The first task was to get all permutations of 1 to 9. Since the total permutations is 9! (362,880) I knew this would take a while.
Can you do Advent of Code on 8-Bit Machines?
There’s a wonderful yearly online event called Advent Of Code (#adventofcode). Each day there are two code challenges that follow a holiday narrative. Some of them are easy, and some of them are quite difficult.
Quick Tower of Hanoi with Sound on the Commodore 64
I LOVED Ayliean MacDonald’s Tower of Hanoi video on Numberphile this week. I wanted to try it with some “soothing” sounds from the 80s with the SID from a Commodore 64
Dice frequency
I’ve been obsessed with the Random number generator on the Commodore computers for a LONG time, and I’m not the only one who is, to be sure.
A week of diving a little deeper into my Atari 800XL
I’m a Commodore guy through and through. This isn’t tribalism, it’s what was in my room from 1983 to when I graduated High School in 1993.
Two weeks with a Coco 2 in September
In the inside baseball realm of vintage computer enthusiasts, a few hashtags have emerged to support one’s favorite retro computers.
Slot Game On Tandy TRS-80 Pocket Computer PC-4
One of my first ever real programs was a blackjack game I made in BASIC on a Sharp 9300 calculator to impress my Adv. Algebra teacher. I have seen the handwritten copy of this somewhere around here recently, but I’ll be darned if I can’t find it now.
Calculating Pi via the Gregory-Leibniz series in BASIC on the Tandy Color Computer 2
Back in March, we did a simple set of programs to brute force calculate Pi using a simple and well-known series. It works, even if it’s inefficient.
Just for fun, the 100 door problem on several different systems
What’s the 100 door problem?
It’s a just for fun problem in “beginning” math and computer courses. The idea is simple:
Running Commodore 64 BASIC Programs on a PET
The Commodore 64 and PET are fairly similar systems. Other than a few memory location differences, many BASIC programs written for the Commodore 64 that don’t use graphics can run on a PET.
The CERBERUS 2080
A few months ago, I stumbled on a project that really caught my attention. Mr. Bernardo Kastrup, aka TheByteAttic finished a video series on a computer he designed and built “by hand.”
Making and breaking Ciphers on the Commodore 64, er VIC-20 - Lagged Fibonacci Sequence and a little Monte Carlo while embracing contraints
We’re on ANOTHER random number generation technique today. Let’s work on the Lagged Fibonacci Sequence, a fun way to use the Fibonacci Sequence on itself to generate pseudo-random numbers.
Running the 8 Bit Show and Tell VIC-20 Super Expander Programming Challenge on the Commodore 64
One of my favorite videos on the whole internet lately is this hidden gem by Robin. In it, he executes a programming challenge he found on Twitter to draw a pattern without using IF statements.
Quick Post: Modulus in BASIC 2 without a cartridge
I posted this on Twitter a few weeks ago, but a young lady has been exploring programming in Python and also with Commodore BASIC which is pretty neato. She’s 11 and asked if there was a way to do modulo functions on Commodore BASIC because she’s using her Dad’s VIC-20 and Simon’s BASIC is obviously not available for the VIC-20.
Making and breaking Ciphers on the Commodore 64 Part 12 - Pontifex - Solitaire from Cryptonomicon
Cryptonomicon Pontifex/Solitaire
We’re back to my favorite book for another round. We’ve done quite a bit with Cryptonomicon so far. One of my favorite moments is when Enoch Root introduces a cipher that two prisoners used to communicate using just a humble playing card deck.
Making and breaking Ciphers on the Commodore 64 Part 11 - One time pads on a Commodore 64, probably a bad idea
A while ago, I explained in detail how to generate one time pad sheets and use them to encrypt and decrypt messages.
Making and breaking Ciphers on the Commodore 64 Part 10 - Finding hash collisions with a type in game from 1984
Hashes
We did an implementation of a once popular hashing function in Part 8 on RC4 without really going into why.
Making and Breaking Ciphers with Commodore 64 Part 9 - Finding Smallish Primes
Recap
So far we’ve
- Reversed a string
- Shifted bits left and right (mostly right)
- Brute forced a known simple cipher
- Channeled our inner John Connor by cracking ATM machines
- Searched through a large number looking for matches
- Learned how to use XOR to recover data
- Created a Linear Feedback Shift Register to generate better random numbers
- Implemented a “real” but outdated cipher: RC4
Disclaimer: I’m sure I’ll get an angry email from a mathematician about this, but we’re going for understanding here. No one expects to be looking for large primes on a Commodore 64. Calm down.
Quick Post: Slow text on the Commodore
An “almost teenager”, Josh, sent me an email yesterday asking how I do slow text on the Commodore. He is just starting assembly at 12 which is pretty impressive. He’s been using KickAssembler, but wants to try it “on hardware”.
Making and breaking Ciphers on the Commodore 64 Part 8 - RC4
Recap
So far in this 8 part series on doing weird things with Ciphers on old computers we’ve:
Making and breaking Ciphers on the Commodore 64 Part 7 - Pseudo Random with Linear Congruential Generators
So far in this 7 part (shocked I’ve made it through 7!) series on doing weird things with Ciphers on old computers we’ve:
Making and Breaking Ciphers with a Commodore 64 - Part 6: XOR is Magical - Data recovery
Review
So far we’ve:
- Reversed a string
- Shifted bits left and right (mostly right)
- Brute forced a known simple cipher
- Faked it, but then looking for a 4 digit known pin
- Searched through a large number looking for matches
We now have most of the basic skills in Assembly to start doing some real work. Let’s tackle what is arguably the most important of the bitwise operators for ciphers and encryption: The exclusive OR. (XOR/EOR)
Finding the Prodigal Easter Egg inside the Easter Egg on a Commodore 64
If you REALLY want to get into the weeds on how I figured out the Easter Egg(s) inside the Easter Egg on a 35 Year old album on a 35 year old computer then you’re in luck! This video is for you!
Quick post: Determining length in Commodore Assembly
A common task in our code is to determine the length of something. In this example, let’s check the length of a string like “are you keeping up?”
Benchmarking Retro Computers (mostly Commodore) with marginal methods
Just the BASICs, please
Our friend in retro @NoelsRetroLab has a simple BASIC benchmarking tool that’s fun to use to compare different basic systems execution speed.
Jiffies in Assembly
Many of you know that you can use a “Jiffy” on a Commodore as a measure of time. Sorta.
Making and Breaking Ciphers with a Commodore 64 - Part 5: Wargames
Let’s recap a little
So far we’ve:
- Reversed a string
- Shifted bits left and right (mostly right)
- Brute forced a known simple cipher
- Faked it, but then looking for a 4 digit known pin
What we need next in our toolbox is to be able to search through a large number of values to look for something. This will build on the previous skills and also reinforce working with tables and 24 bit math on an 8Bit Processor.
Calculating Pi via the Gregory-Leibniz series in BASIC on the VIC-20
It’s Pi day tomorrow, and you know what that means!
Quick Post: Commodore 64 Simple Addition Efficiency
There are many hacks you can do in Assembly language on the Commodore.
Making and Breaking Ciphers with a Commodore 64 - Part 3: The Caesar Cipher
Well here we are at part three and it’s a lot to pack into one page.
Making and Breaking Ciphers with Python, er Commodore- Part 2: The Shift Cipher
In Part 1 we did a simple reverse of a string. While simple, these software steps will help build the skills we need going forward in Assembly without feeling like I skipped right to a 300 line after doing a short one. One foot in front of the other and all that.
Making and Breaking Ciphers with Python, er, a Commodore- Part 1: The Reverse Cipher
Sometime during my weeklong exploration of SHA-256 on a Commodore realized that there was a whole world of exploration that could be explored. Just because a Computer system is old, doesn’t mean it’s not interesting or useful.
Getting started with Native Commodore 64 Assembly
Some time in the month of September 2020 I dug out the old Commodore 64 that my Dad bought for himself in 1983. It quickly migrated its way into my room and stayed there until 1993 when I joined the Navy. Someone in my family, probably Mom, carefully packed it back into its original box and put it into storage. Despite its many years of use/ abuse by a messy teenager, it’s in surprisingly good condition, 38 years later. (You’re old.) Back then, I had attempted some programming on it, but I had the patience and focus of your typical suburban kid. Over the years I’ve thought about the many hours I spent on that machine (remember when computers lasted more than a single year?) and as a seasoned developer I began looking at the computer and seeing more potential than I was able to realize as a kid. Modern software is very powerful. Unfortunately, if you program with it long enough, it stops feeling “real.” It’s like learning to fly on Microsoft Flight Simulator, versus taking private pilot lessons to actually control and fly a real aircraft. My experience with flying actual planes prepared me to recognize the distinction that afternoon in September when I pulled out my old machine. I had the idea that if I could get closer to the bites, I could become a better programmer. And if that didn’t work, I could at least have fun with it. (nostalgia is a hell of a drug.)
Switching to 64 bit Raspbian Linux is a snap
Have you been itching to do 64 Bit ARM assembly program like I have on your Raspberry Pi? I’ll bet you have.
Why does there have to be a why?
It was just a few months ago that I started to get back into 8-Bit computing. It started with Ben Eater’s Breadboard 6502 build. Something about his complete exploration of that build including single stepping the clock and watching the processor registers was really compelling to me.