I've been fiddling with trying to write to the TMS9918 on the ssprite from Applesoft Basic. But for some reason it doesn't work correctly.

The ssprite board sits in slot 7, so it has the io addresses $C0Fx.

I set an address $C0F1 in the variable AD, then poke AD twice, which should set one of the TMS registers, but it doesn't, because it's reading from $C0F1 before it writes, which creates the side effect of resetting the TMS9918 address that it's going to write to. So it keeps thinking that it's getting the low byte of the address forever.

AD = 12*16*256+15*16+1:POKE AD,4:POKE AD, 128+7

(that should write 4 to the TMS9918 register 7, but it has no effect)

[Linked Image from i.imgur.com]

But doing the same thing from machine language doesn't introduce a read before the write.

CALL -151
4000: AD F1 C0 A9 F2 8D F1 C0 A9 87 8D F1 C0 60
which is just
LDA #$F2
LDA #$87

4000G to execute it, and it works.

[Linked Image from i.imgur.com]

This is totally baffling me.

Is there something about the way applesoft does a poke, using

STA ($50),y

that activates a read before the write?