Interrupt handling

preview_player
Показать описание

------------------

Social media:

Special thanks to these supporters for making this video possible:
Рекомендации по теме
Комментарии
Автор

Interrupt Handling: how I responded to the notification for this video.

yadt
Автор

I just got a job at a major chipset and GPU manufacturer this week as a driver, BIOS and firmware developer. Thank you Benjamin, your videos have been a MAJOR inspiration to me!

Aeroshogun
Автор

35 years after me fiddling with the 6502 when it was hot and I in a tender age, Ben Eater makes the perfect tutorial how to do it right.

Breakfast_of_Champions
Автор

On button press, you could disable CA1 interrupts and instead enable a timer, then when the timer expires turn on CA1 interrupts again. That should succeed in debouncing without having to spin inside the interrupt handler, plus it would show off timer functionality.

AndyGoth
Автор

A idea I had to demonstrate the timer would be to move the debounce to the 6522.
1)Add code to see if the source is ca1 or timer. when ca1 do:
a)set the timer as the interrupt source
b)Clear ca1 as a interrupt handler
c)clear ca1's interrupt.

d)set a 500 ms timer.
When timer:
a)clear the timer as interrupt source
b)clear the timer interrupt
c)Enable ca1 as a interrupt source again.

Tomoyodaidoji
Автор

Another great video, huge thanks Ben. Just a heads up for others following along, at 20:05 you can use the *phx* and *phy* opcodes of the *65c02* to push the x and y registers to the stack directly. Similarly, you can pop them off with the *plx* and *ply* opcodes.

bberakable
Автор

So the TL;DR is basically:
*interrupt happens*
CPU: emergency meeting

louist
Автор

20:00: you say, you can't push X and Y registers to stack directly and have to use "TXA/ PHA" instead.
That's not correct for the WDC W65C02S, that you use in your projects. The W65C02S has opCodes for PHX, PHY, PHA and PHP.
For pushing the registers directly. And you can use PLX, PLY, PLA and PLP to pull the values from stack again.

DocCool
Автор

Love you man for doing this great series consistently over a long period. I'm so grateful to you

a_r_u_n
Автор

This videos are the best!!! Thanks for this content. I am currently finishing my physics major and this kind of content is the perfect addition to my theoretical knowledge. Sadly so many physicists disregard the importance of having at least some engineering knowledge, but I hope I can be a better professional thanks to the knowledge I aquire with your videos.

ozkroca
Автор

This should be as study in school, high school, this is very important information, a circuit board class is needed.

frankynakamoto
Автор

I was just thinking I could start working on your breadboard computer, and then you post. Thanks!

_Gecko
Автор

"When the button was DePressed" I feel sorry for that button now :(

Breaker
Автор

Your videos are a NMI. And worth it. Thanks for a GREAT video.

BigDaddy_MRI
Автор

Your videos are so clear and interesting that I am just binging on them. It is amazing. Minor nitpick on your aside on having multiple IRQ inputs. You mention at 23:25 that we could "AND them together in some way". I think you mean to OR them together. Unless you're building a system that is extremely discerning to inputs, of course :)

NicolaiDufva
Автор

For debouncing, I just add a small ceramic capacitor across the two leads of a (normally open) momentary push button. It works really well with arduino and AVR projects. It's a really simple analog solution to the problem.

BrainSlugs
Автор

Never clicked so fast on a video, it definitely interrupted me

thatredkite
Автор

You can go directly to the top of the file in Vim by pressing "gg" in normal mode.

MatthewHowle
Автор

Interesting. I didn’t know the 6502 automatically pushed the flags register onto the stack and pulled it from it. Coming from the Z80 background, I learned it the hard way a long time ago to push and pull the AF register (you can only push and pull sixteen-bit registers, so the flags register and the accumulator are pushed and pulled together). Pushing and pulling can be expensive, though, so there are much quicker EXchange instructions that switch between the two sets of registers in the Z80.

AstAMoore
Автор

Great video. A simple way to make a digital switch debouncer and not use an analog 555 timer with the capacitor and resistors is to use a push button switch that has both normally open (NO) and normally closed (NC) contacts. You feed that into 2 NAND gates with cross feedback to form a latch. The NO side of the switch goes to one NAND gate pin with a 10k pullup, and the NC side of the switch goes to a pin with another 10k pullup on the other NAND gate. That was a good idea to show how debounce can be done in software as well. Sometimes when I don't care how long the Interrupt Service Routine (ISR) is I just throw in a loop like you did.
Also, to the viewers: It is a good idea that when you first learn to code ISRs, to have a template that you can cut and paste from your "repertoire" code.
I suggest you learn how to save the ENTIRE state of the CPU on the Stack as you enter the ISR and pop it all off the Stack before you return from the ISR. This is handy when you will do context switching (like in multithreading) as you get more advanced. Coders sometimes forget to push the CPU Flags register on the Stack, do this first because many op codes do effect the flags and they too should be exactly as they were before the interrupt was handled (called). So having a full context save of the CPU is good to have at hand even if your ISR does not change everything in the CPU, but you can trim out what you don't need if you need to make your ISR as short (fast) as possible, but don't forget the save the Flags register on the Stack first in almost all cases.

paulromsky