i don't understand why the idiomatic way to software debounce on the game boy is to read the address like 6 times in a row and store it in the same register

like surely

ld  a,[$ff00]
ld a,[$ff00]
ld a,[$ff00]
ld a,[$ff00]
ld a,[$ff00]
ld a,[$ff00] ; wait a few cycles

and

nop
nop
nop
nop
nop
ld a,[$ff00] ; wait a few cycles

are the same?

i do not get it

@aescling when you press a button, almost always, you're literally causing two pieces of metal to touch each other. that's how pretty much all buttons work, it's how most switches work, etc etc

the problem is that when they touch they, well, bounce

so if you're reading the output really quickly it'll look like ...00000000110100101001011111111...

debouncing is taking that signal and turning it into a clean 0000011111

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.