Bit 0 of the value written to $4016 sets the strobe, which is connected to a shift register in both joypads. When the strobe is 1, reading from $4016 or $4017 always returns the status of the respective A button in bit 0. When the strobe is changed from 1 to 0, the current state of the buttons is latched into the shift registers of both joypads. Then, with the strobe left at 0, reading from $4016 and $4017 reads the low bit in the corresponding shift register and then clocks it right one bit.
An emulator could latch the current host keyboard/joystick state into a shift register when the strobe changed from 1 to 0. The following code demonstrates the behavior (for clarity is reads joypad #2):
Code:
lda #1 ; strobe = 1
sta $4016
lda $4017 ; bit 0 has A button status at this exact moment
lda $4017 ; bit 0 has A button status at this exact moment
; etc.
lda #0 ; change strobe to 0 and latch current buttons
sta $4016
lda $4017 ; bit 0 has A button status when it was latched
lda $4017 ; bit 0 has B button status when it was latched
; etc.
lda #0 ; strobe already 0, thus no effect on shift register
sta $4016
lda $4017 ; bit 0 has does *not* have A button status