The NesDev page about the standard controller states this:
This means that when the first bit of $4016 is is set, it will keep reloading the "A" button state from the controller, right? When the first bit becomes 0 after having written 1, the state of the "A" button can be read by reading the first bit. After reading this first bit, I can read it again to get the next button. The thing is, why do I have to write 1, then 0, and only then can I read the button states? What's the significance of these first 2 writes? I mean if A is 1 in the first place, why doesn't it keep reloading the "A" button state in bit 1 of $16?
EDIT: The quote is kind of messed up, but it's supposed to point to the S, not to the 7th bit.
Quote:
Input ($4016 write)
7 bit 0
---- ----
xxxx xxxS
|
+- Controller shift register strobe
While S (strobe) is high, the shift registers in the controllers are continuously reloaded from the button states, and reading $4016/$4017 will keep returning the current state of the first button (A). Once S goes low, this reloading will stop. Hence a 1/0 write sequence is required to get the button states, after which the buttons can be read back one at a time.
(Note that bits 2-0 of $4016/write are stored in internal latches in the 2A03/07.)
7 bit 0
---- ----
xxxx xxxS
|
+- Controller shift register strobe
While S (strobe) is high, the shift registers in the controllers are continuously reloaded from the button states, and reading $4016/$4017 will keep returning the current state of the first button (A). Once S goes low, this reloading will stop. Hence a 1/0 write sequence is required to get the button states, after which the buttons can be read back one at a time.
(Note that bits 2-0 of $4016/write are stored in internal latches in the 2A03/07.)
This means that when the first bit of $4016 is is set, it will keep reloading the "A" button state from the controller, right? When the first bit becomes 0 after having written 1, the state of the "A" button can be read by reading the first bit. After reading this first bit, I can read it again to get the next button. The thing is, why do I have to write 1, then 0, and only then can I read the button states? What's the significance of these first 2 writes? I mean if A is 1 in the first place, why doesn't it keep reloading the "A" button state in bit 1 of $16?
EDIT: The quote is kind of messed up, but it's supposed to point to the S, not to the 7th bit.