Hardware interrupts
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
Comments (18)
Is 31 a contender for the world record?
never mind, I just got 15.
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
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.
I did notice that as well.
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
YES!!! I just bought the WDC 6551 chip too and a USB to serial converter.
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 !
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.
good point, how about disabling the interrupt on the falling edge and enabling it on the rising? :D
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
There is no notation card added to the video at ~21:09 when you reference the debouncing circuit in the clock module.
My first pre release peek!
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
Secret for the game is get the timing right and let go when the 16 bytes overflows.
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!
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.
This just made my day.
