Seyed Masoud Hosseini · Overview · Study log · Ideas · Transcript · RSS feed

Embedded Systems, 6502 breadboard computer · Lecture 23 of 29 · 14:23

Lecture 23: Running Apple 1 Software (Wozmon)

Running Apple 1 software on a breadboard computer (Wozmon) on YouTube

Study guide

What this lecture covers

The lecture adapts Wozmon, the tiny system monitor Steve Wozniak wrote for the original Apple 1, to run on the breadboard 6502 computer built throughout this series, using the serial interface completed in the previous videos instead of the Apple 1's keyboard and display. It shows what Wozmon actually lets you do: examine and write memory, manipulate I/O registers directly, and run programs without reprogramming the EEPROM.

By the end, you can explain how a program fitting in 256 bytes provides a usable command interface, how to read and modify memory through it, and how to patch a running program in place to fix a bug.

Key ideas

  • Wozmon's size: the entire monitor program, including reset and interrupt vectors, fits in exactly 256 bytes of ROM (248 bytes of actual code).
  • Porting to a different I/O: adapting Wozmon mainly meant replacing keyboard/display routines with serial input/output routines and updating key codes (backspace, escape, and so on) to match the new interface.
  • Memory examine syntax: typing an address shows its byte; address1.address2 shows a range, letting you inspect ROM, RAM, or memory-mapped I/O registers uniformly.
  • Memory write syntax: address:value writes a byte (or a space-separated sequence of values starting at that address) directly into memory.
  • I/O is just memory: because the 6522 VIA's registers are memory-mapped, Wozmon can read and set I/O pins (and drive an LCD) simply by examining or writing to their addresses, with no custom code needed.
  • Running arbitrary code: setting an address as current and typing R jumps to and executes whatever machine code is stored there, letting you load and run your own programs.
  • In-place patching: because a loaded program lives in RAM, you can find and overwrite a single incorrect byte and immediately rerun the fixed program, without reassembling or reburning an EEPROM.

Walkthrough

Apple 1 (0:00)

The lecture introduces the Apple 1 and its manual, which describes Wozmon as resident system monitor software for examining, debugging, and running programs, and notes the entire program is only 256 bytes.

Changes to make it work (2:06)

The lecture explains the modifications needed to run Wozmon on the breadboard computer: swapping keyboard/display I/O for the serial interface, updating key codes, and adjusting character input logic, while leaving most of the original logic unchanged and keeping the program within the same 256-byte ROM block.

What does Wozmon do? (3:13)

Using the reset button to enter Wozmon (shown by a backslash prompt), the lecture demonstrates examining individual addresses and ranges in ROM and RAM, including inspecting Wozmon's own input buffer variable to see typed characters stored as ASCII bytes, and writing single or multiple byte values to RAM.

Doing I/O (6:35)

Because the 6522 VIA's ports are memory-mapped, the lecture reads and writes I/O register addresses directly through Wozmon: toggling an input pin's voltage changes the value read at its address, setting the data direction register configures pins as outputs, and writing values controls an LED and sends LCD initialization commands, all without any custom program.

Running programs (8:36)

The lecture shows the R command jumping to and executing code at a chosen address, first re-running Wozmon itself, then manually entering the Apple 1 manual's sample test program byte by byte and running it to verify the system works, followed by assembling a larger "hello world" LCD program, formatting its machine code as Wozmon-compatible input, and loading and running it.

Writing assembly programs (10:44)

After running the assembled program and spotting a typo in its printed output, the lecture locates the single incorrect byte in memory, overwrites it with the correct ASCII value, and reruns the program to confirm the fix, demonstrating live debugging without reassembling or reprogramming the EEPROM.

Before you watch

  • The previous videos in this series on the 6551 UART serial interface, which Wozmon is adapted to use here.
  • Familiarity with the 6522 VIA's memory-mapped I/O registers and the LCD interface from earlier videos.
  • Basic hex and ASCII literacy for reading memory dumps.

Check your understanding

  1. Why was porting Wozmon mostly a matter of changing key codes and I/O routines rather than rewriting its core logic?
  2. How does Wozmon let you control the LCD or an LED without running any custom program?
  3. What makes it possible to fix a bug in a running program by editing a single memory byte instead of reassembling it?
  4. What does the R command actually do at the processor level when you tell Wozmon to run a program at a given address?

Chapters

From the YouTube description

More 6502: https://eater.net/6502

Support these videos on Patreon: https://www.patreon.com/beneater or https://eater.net/support for other ways to support.

0:00 Apple 1
2:06 Changes to make it work
3:13 What does Wozmon do?
6:35 Doing I/O
8:36 Running programs
10:44 Writing assembly programs
------------------

Social media:
Website: https://www.eater.net
Twitter: https://x.com/beneater
Patreon: https://patreon.com/beneater
Reddit: https://www.reddit.com/r/beneater

Special thanks to these supporters for making this video possible:
Adrien Friggeri, Aleksey Smolenchuk, Amit Bueno, An Dương, Anthony Weems, anula, Ben, Ben Cochran, Ben Williams, Bill Cooksey, Bill Watkins, Binh Tran, Богдан Федоров, Bradley Stach, Brian Haug, Burt Humburg, Carl Fooks, Carsten Schwender, Chai, Chris Anders, Chris Lajoie, Chris Sachs, criis, Cristi Cobzarenco, Daniel Pink, Daniel Tang, Daniel Zimmer, Dave Walter, David Clark, David Cox, David Dawkins, David House, David Klassen, David Sastre Medina, David Turner, Dean Bevan, Dean Winger, Deep Kalra, Dennis Henderson, Dennis Schubert, Dilip Gowda, Dirk Sperling, Dmitry Guyvoronsky, Dustin Campbell, Dzevad Trumic, Emilio Mendoza, Eric Dynowski, Erik Broeders, Erik Granlund, Ethan Sifferman, Eugene Bulkin, Evan Serrano, Evan Thayer, Eveli László, EvinSaysMarxWasRight!, Florian Bürgi, fxshlein, George Miroshnykov, ghostdunk, GusGold, Hailey, Hovis Biddle, Ingo Eble, Jacob Ford, James Beldock, James Capuder, Jared Dziedzic, Jason Bowen, Jason DeStefano, Jason Grim, Jason Thorpe, JavaXP, Jaxon Ketterman, jemmons, Jeremy Cole, Jesse Miller, Jim Kelly, Jim Knowler, Joe Beda, Joe Pregracke, Joe Rork, Joel, Joey Murphy, John Hamberger jn., John Henning, John Meade, Jon Dugan, Jonn Miller, Joseph Portaro, Justin Graziani, Kai Wells, Kefen, Ken Paul, Kennard Smith, Kenneth Christensen, Kyle Kellogg, Lambda GPU Workstations, László Bácsi, Lithou, Lukasz Pacholik, Marcos Fujisawa, Marcus Classon, Mariano Uvalle, Mark Day, Martin Noble, Mats Fredriksson, Matthew Clifford, melvin2001, Michael Koreshkov, MICHAEL SLASS, Michael Tedder, Michael Timbrook, Michael Weitman, Miguel Ríos, mikebad, Mikel Lindsaar, Miles Macchiaroli, Muqeet Mujahid, NacOJerk, Nate Welch, Nicholas Counts, Nicholas Moresco, Nick Chapman, Oli Homer, Olivier HUBER, Örn Arnarson, Paul Heller, Paul Pluzhnikov, Pete Dietl, Phil Dennis, Philip Hofstetter, ProgrammerDor, Ralph Irons, Randal Masutani, Randy True, raoulvp, real_huitz, ReJ aka Renaldas Zioma, Ric King, Rick Hennigan, Rob Bruno, Robert Diaz, Robert Evans, Robert Keown, Robey Pointer, Roland Munsil, Sagnik Bhattacharya, Sam Sturgis, Scott Gorlick, Scott Holmes, Sean Bright, Sean Patrick O’Brien, Sergey Kruk, Shane Mulcahy, SonOfSofaman, Spencer Ruport, Stefan Nesinger, Stephen Kovalcik, Stephen Riley, Steve Jones, TheWebMachine, Thomas Eriksen, Tim Oriol, Tim Sanders, Tim Walkowski, Tim Wheeler, Tom, Tom Smith, Tyler Latham, Usseod, Vincent Bernat, Warren Miller, Wim Coekaerts, Yee Lam Wan

← Lecture 22: Fixing a Hardware Bug in Software (65C51 UART) · Lecture 24: Adapting WozMon for the Breadboard 6502 →