KIM-1

@kim-6502.bsky.social

The KIM-1 and classic 6502 related topics. Zero page FTW!

The SEC/SBC pair was subtraction on the 6502. SEC set the carry - meaning no borrow - then SBC subtracted with borrow. Forget SEC and your result was off by one in the other direction from the ADC mistake.

The Apple II disk controller used only eight chips. Wozniak replaced the typical 50-chip design with software running on the 6502. The CPU did the encoding, timing, and synchronization that other systems handled in hardware - he traded transistors for code and saved Apple a fortune.

Citadel 2 disassembly WIP. I think this 65c02 instruction only gets executed when the game is completed. It freezes the CPU when executed on a 6502! Maybe the author tested it on his BBC Master only? And nobody ever completed the game on a BBC Micro to discover this?

Bild

It's easy for a new 6502 programmer to forget that the I flag disables interrupts when set, and mistakenly think that SEI switches interrupts on, while CLI switches them off. Particularly if you've just been using an 8086 where CLI disables interrupts and STI enables them! The Z80 DI/EI is clearer.

The 6502 community published newsletters - 6502 User Notes, The KIM/6502 User Notes, and later COMPUTE! magazine. All hand-typed, mimeographed or offset-printed, mailed to subscribers. Social networking in the '70s meant a PO box and a stamp. And a LONG ping time.

SEI disabled interrupts. CLI re-enabled them. Between those two instructions you were invincible - nothing could interrupt your critical section. Forget to CLI afterward and your system went deaf to the outside world. Many a KIM-1 sat frozen because someone forgot one three-letter instruction.

The 6502 could address 64K of memory but had no memory management unit. If your program wrote to the wrong address, it could overwrite the operating system, the display, or its own code. There was no protected mode: Every program ran with root privileges whether it deserved them or not.

The KIM-1 had an expansion connector with the full address bus, data bus, and control signals broken out. It was designed to be the core of something larger. Most trainers were dead ends. The KIM-1 was a starting point with a 44-pin invitation to keep building.

If you go out of your way to program 6502 in the year of 2026 just for the heck of it I like you and I see you as the Real Programmer. Bonus points if you are younger than 30. In that case you are the kind of person who will save this god-forsaken Tech "industry".

6502 is the only time I ever enjoyed writing assembly. It's fun, and feels good in the brain. I feel seen by this post. I'm in my 40s tho. But I learned it in my 30s so I guess that's good right?

The 6502's ADC instruction always added with carry. There was no plain ADD. Forget to CLC first and your math was off by one. Every 6502 programmer has lost at least one evening to a missing CLC. The carry flag giveth and the carry flag taketh away.

The Tamagotchi ran a 6502 core. A virtual pet powered by the same instruction set as the Apple II. From Wozniak's garage to a plastic egg on a keychain. The 6502 never cared what you put it in.

Mike Naberezny maintains py65 - a 6502 simulator written in Python. Load a binary, set breakpoints, inspect memory, step through code. No hardware needed. Just pip install and you're running 6502 assembly on a modern laptop. The tools keep getting better even as the CPU stays the same.