Joefish wrote: ↑Tue Apr 17, 2018 4:36 pm
Interesting. But you mention the timing is critical to be sure of reading attribute bytes rather than pixel bytes, but don't explain what that timing depends on. I don't know, but here's a guess - are you relying on contention of the IN instruction itself?
If you’re referring to the +2A/+3 code, then the port itself doesn’t seem to be contended. The LD A,(NNNN) instruction is what affects the timing, as reading from a non-contended address will break the sync.
Joefish wrote: ↑Tue Apr 17, 2018 4:36 pm
Also, presumably you could plant the value '255' in contended memory, then read it back, and that value on the floating bus would let you detect the top-left of the screen whichever machine you were on?
Not quite. You see, it doesn’t make a difference whether you read or write it. Once it appears on the bus, the bus will latch it. Moreover, it doesn’t have to be 255; it can be any value that is different from what appears on the screen outside (ahem,
inside, rather) the border. Other than that, sure, there’s nothing stopping you from detecting the top of the screen using this method. (Of course, reading is faster, because you’d need to load A with a value before writing it to a memory address.)
I think I’ll include a more illustrative example—similar to the one I used in my test originally back in 2017. I intentionally filled the top two thirds of the screen with the bitmap pattern consisting of the same value as my attribute test byte. The entire loop, including the padding instruction, was meticulously crafted to avoid syncing to that bitmap pattern.