Home Creators Posts Import Register Favorites Logout
haven't archived this post yet. have a subscription? use the importer!

Content

Well you asked for it. After my last video there was a lot of interest in delving deeper into the Wozmon code and explaining how it works. So here you go! I walk through the code line-by-line explaining how it works and some of the tricks Woz used to get it to fit in the 250-byte constraint.

As always, thanks for your continued support and let me know if you see any issues with this video before I release it publicly. I may also do a shorter followup video talking about some of the changes I made to get it to work on the breadboard 6502 with serial interface. This video was getting long enough and I thought it better to just have a video focused on Wozmon itself.

Thanks again!

-Ben

Files

Previews only

How Wozinak's code for the Apple 1 works

More 6502 stuff: https://eater.net/6502 Support these videos on Patreon: https://www.patreon.com/beneater or https://eater.net/support for other ways to support. ------------------ Social media: Website: https://www.eater.net Twitter: https://twitter.com/ben_eater 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, 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, Chaitanya Bhatt, 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, Gregory Burns, 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, Michael Cartwright, MICHAEL SLASS, Michael Tedder, Michael Timbrook, Michael Weitman, Miguel Ríos, mikebad, 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, Richard Wagoner, Rick Hennigan, Rob Bruno, Robert Brown, Robert Diaz, 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, sorek.uk, 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

Comments

bencodestx

I disagree. This is EXACTLY the content that will win YouTube!

Jason Clark

Great video! In an effort to learn both the 6502 and Swift, my current project is implementing a 6502 emulator in Swift, and I'm using Wozmon as my first "full program" test case. I think your prior video had a lot to do with my decision. Watching you demo and explain Wozmon has already helped me identify a few issues with my implementation of the 6502 and my "Apple1PIA" BusDevice that emulates the Apple I keyboard & screen interface. A couple of notes: * around 23:51, you say that BIT "sets the Minus flag", and write an M on the card. The 6502 docs call this the Negative flag, represented by N. Not a big deal (and perhaps more intuitive, given the BPL, BMI instructions) * In the same section, you mention that the comment seems to be wrong, and you couldn't find this referenced online. Earlier today, I found a similar issue in the ECHO section at the end of Wozmon, where both the code comment and the explanation of the hardward in the text disagree with the code, and I couldn't find any reference to it online. I posted that to the Retrocomputing StackExchange: https://retrocomputing.stackexchange.com/questions/27265/error-in-apple-i-manuals-wozmon-listing-or-hardware-description

Andy Buck

How does ASL of BA equal 7B? seems to me it should be 74.

Andres Plaza

Super entertaining and educational! Thanks for the deep dive. :-)

Jack Rubin

Also agree with your disagreement :>) - not sure what winning YouTube means, but Patreons and subscribers win for sure.

Jason Clark

Good point, looks like another error in the comments. For the purposes of the code, 74 and 7B are functionally equivalent, as both have bit 6 = 1, and so the BIT command will set V.

beneater

Fooled by the comment! You're right, it looks like another typo in the comments. But Jason is right, it's functionally the same.

beneater

If all of my Patreon support went away and I had to replace it with ad revenue, I'd need to make videos that consistently get 2-3M views in the first month. This is not the kind of video that will get 3M views, but I'm glad I got to make it anyway. And that's directly because of support on Patreon.

Frederik Holst

I'm rewriting WozMon for the Atari 8-Bit line for the ABBUC software contest over the last few months and therefore am really happy to see your videos about it here! Will link to them in my documentation. I stumbled across the BVC NOTSTOR comment as well, but couldn't believe that Woz made an error here, so thanks for confirming my assumption :)

Don Prefontaine

A thorough explanation - thank you. I'm sure a lot of ppl would be looking forward to you writing a more complete multi-function monitor that's not constrained to a 256-byte "block".

Mathijs

When examining 0200.027F, I see that all the bytes do not have the high bit set, and are just ASCII codes. Is this because the breadboard computer uses plain ASCII? Would running the original code would have produced 'B0 B2 B0 B0 AE B0 B2 B7' instead?

Jason Clark

After watching this again, I'm confused about one point. In the prior video, you demoed how Examining a range of addresses (e.g., 0.9) leaves the first address (0x0000) as the "active" address, so that running with "R" will run from that address. However, the Block Examine code increments XAML in order to print out consecutive memory locations, which means it's pointing at the wrong location when you "R"un the code, which executes "JMP(XAML)". What am I missing?

Jason Clark

On looking further, I think the manual is wrong here... after 0.A, XAML is 0x0A (and XAMH is still 0x00). If "R" jumps to that address (0x000A), it will try to execute the final byte of the entered program, which is 0x00, which is the BRK command. That should run the IRQ handler at 0xFFFE, which is... 0x0000 in Woz's ROM. So if I'm right, it's just a coincidence that R runs the program correctly in the previous video (which is also the example from the manual).

ast_rsk

I think at this point we need to somehow get Steve and Ben together on a call so Ben can do a quick code review and tell Steve he needs to fix the errors before the PR can be approved 😂 Great video! I'm so glad we got this kind of content.

Jason Thorpe

Thanks, Ben, this was a great deep-dive! I've had the privilege of writing plenty low-level OS code in assembly in my career, and I can assure your viewers that all of these tricks to make the code small and efficient are still in widespread use :-)

Jeff Jetton

Yeah, at first I though maybe Woz tried different characters for "store" before eventually settling on ":", and just never updated the comments, which might explain the other comment error too. But then I realized that 7B is impossible no matter what character you start with, since 7B is odd, and ASL will always result in an even number.

Jeff Jetton

Another neat and very "Woz" choice that I don't recall being mentioned in the video is that SETADR loop. My first instinct would probably be just a simple LDA L, STA STL, STA XAML followed by LDA H, STA STH, STA XAMH. But by going to the trouble of making it a loop (even though it only cycles twice), Woz shaved off three bytes: One with the loop itself compared to the unrolled version, and two more by getting a "free" zero in X which he uses later at XAMNXT. Brilliant!

Auctoris

Late to get to watch this as I've been away; but I really wanted to say that I thought this was a *fantastic* video. Content like that is exactly why I'm proud and happy to sponsor you here. Thankyou for making and sharing this.