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

Content

Here's a preview of my next video! This one's an intro to interrupts and the difference between how the IRQ line and NMI line work on the 6502.

As always, any feedback is appreciated. I'm planning to release this on Saturday.

Thanks again for your support

-Ben

Files

Previews only

Hardware interrupts

More on the 6502 computer: 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, Alexander Wendland, Andrew Vauter, Anson VanDoren, Anthanasius, Armin Brauns, bapu, Ben Dyson, Ben Kamens, Ben Williams, Bill Cooksey, Binh Tran, Bouke Groenescheij, Bradley Pirtle, Bryan Brickman, Carlos Ambrozak, Christopher Blackmon, Daniel Jeppsson, Daniel Sackett, Daniel Tang, Dave Burley, Dave Walter, David Brown, David Clark, David House, David Sastre Medina, David Turnbull, David Turner, Dean Winger, Dmitry Guyvoronsky, Dušan Dželebdžić, Dzevad Trumic, Emilio Mendoza, Eric Brummer, Eric Busalacchi, Eric Dynowski, Eric Twilegar, Erik Broeders, Eugene Bulkin, fxshlein, George Miroshnykov, Harry McDow, HaykH, Hidde de Jong, Ian Tait, Ingo Eble, Ivan Sorokin, Jason DeStefano, Jason Specland, JavaXP, Jay Binks, Jayne Gabriele, Jeremy A., Jim Kelly, Jim Knowler, Jim Van Meggelen, Joe OConnor, Joe Pregracke, Joel Jakobsson, Joel Messerli, Joel Miller, Johannes Lundberg, John Fenwick, John Meade, Jon Dugan, Joseph Locke, Joshua King, Kefen, Kenneth Christensen, Kent Collins, Koreo, Lambda GPU Workstations, Larry, Lucas Nestor, Lukasz Pacholik, Maksym Zavershynskyi, Marcus Classon, Martin Roth, Mats Fredriksson, Matt Alexander, Matthäus Pawelczyk, melvin2001, Michael Burke, Michael Garland, Michael Tedder, Michael Timbrook, Miguel Ríos, Mikel Lindsaar, Nicholas Counts, Nicholas Moresco, Örn Arnarson, Paul Pluzhnikov, Paul Randal, Pete Dietl, Philip Hofstetter, Randy True, Ric King, Richard Wells, Rob Bruno, Robert Diaz, sam raza, Sam Rose, SonOfSofaman, Stefan Nesinger, Stefanus Du Toit, Stephen Kelley, Stephen Riley, Stephen Smithstone, Steve Jones, Steve Gorman, Steven Pequeno, TheWebMachine, Tom Burns, Vlad Goran, Vladimir Kanazir, Warren Miller, xisente, Yusuke Saito

Comments

Anonymous

This just made my day.

Anonymous

I was kind of hoping that you would show (with your arduino bus analyzer or whatever else) how the processor completes the instruction, saves state and jumps to appropriate vector. This could really help people realize that interrupts aren't instantaneous - they have some latency. Still it's an amazing video, as always!

Anonymous

Secret for the game is get the timing right and let go when the 16 bytes overflows.

Jim Kelly

Another nice video. I like the explanation of the differences between the NMI and the IRQB. I am very interested to see how you handle the interrupt through the 6522 in your next video. Is it worth mentioning the importance of saving any registers you use in your interrupt routines on the stack? The following site was a great resource for me prior to your video and the author stresses pushing/pulling the registers to the stack. http://www.6502.org/tutorials/interrupts.html

Anonymous

My first pre release peek!

Anonymous

There is no notation card added to the video at ~21:09 when you reference the debouncing circuit in the clock module.

Anonymous

I see you removed the jump to loop but never re-added it when you moved the loop label to the top. I thought that is why it didn't work the first time you pushed the button. Nice video, Thank you. Edit: I realized that there is still the beq loop

Phil Dennis

You mention disabling interrupts while the processor is doing critical tasks. I think a great example to give from this video itself would be disabling interrupts while reading from the 2 byte counter - otherwise there is a possibility of printing a bad value if the interrupt occurs between reading the low and high bytes - the value read could be off by 255 - e.g $00ff incremented to $0100 while being read, resulting in a read value of $01ff instead of $00ff or $0100. This type of issue can result in hard-to-diagnose problems with more complex interrupt code so I suggest worth calling out when first introducing the concept of interrupts. There’s actually a similar issue with the nmi since as you mention an nmi can occur before the code for the previous one has finished executing.

Phil Dennis

Single stepping with the Arduino connected would also be a way to demonstrate the timing issue I mentioned in my comment below - reading a bad counter value by triggering the interrupt after reading the low byte when the counter value is $00ff.

Anonymous

I really like the fact that you explain it "bottom-up". The correct way of doing things doesn't appear magically to the viewer, you intentionally make the same mistakes as they would so you can show them the process of understanding every step, such as with the button at 11:09. Great video as always !

Leon

good point, how about disabling the interrupt on the falling edge and enabling it on the rising? :D

Phil Dennis

@Leon disabling interrupts based on the clock transition would not help because the CPU takes several cycles to execute one instruction, never mind the several instructions to read the two bytes of counter. The thing to do is add an sei instruction before the lda counter instruction to disable interrupts before reading the counter low byte, and add a cli instruction to reenable interrupts after reading counter + 1. That way the interrupt handler cannot run and modify the counter bytes while they are being read. The ability to use sei/cli to control access to data shared between the interrupt handler and the main program is another reason to prefer regular interrupts over the non maskable interrupts.

Cecil Meeks

I love your videos. I would also love to see you do one on adding serial to the computer. The 65C51 is still produced today. However, it does have a hardware bug that is documented over at the 6502 forums. However, it's unlikely the bug would be relevant for a simple circuit. I built a 6551 serial card (no "C") for my SBC. It uses the old Rockwell version from the 80's that doesn't have the bug. Anyway...long story short....please do one on serial. :-D

Anonymous

Absolutely love your videos from prior series. But the 6502 series hits my interests so spot-on. Thank you, Ben. Also, just as a side, in the previous videos, you began to speak a little fast. I can understand that there was a lot of material to cover. But I like that you’ve slowed down the pace a tad. And yes, a piece about using the 6522 will be awesome.

Silviu T

Very nice explanations. But in this particular case (triggering IRQ with the push of a button) there is a simple way to reduce the time that the IRQ is asserted with a few logic gates - I'm sure you know what I'm talking about. The magic of XOR (or XNOR). :) https://i.stack.imgur.com/rMfYj.png

Jim Kelly

YES!!! I just bought the WDC 6551 chip too and a USB to serial converter.

George Foot

The BBC Micro stored two independent copies of its "time" value for this reason, to avoid needing to disable interrupts every time it was read. The last-updated one is live and all code reads from that. If an interrupt occurs it updates the other one, then marks it live. So long as you don't get two interrupts before you're done reading, this is safe.

Anonymous

Is 31 a contender for the world record?