silverdr_at_inet.com.pl
Date: 2005-10-04 00:49:15
On 2005-10-03, at 19:53, Spiro Trikaliotis wrote: > > > The port A if the VIA ($1801) has a "handshaked mode", that is, if you > read $1801, it shows the last contents of it when a specific line > (would > have to look it up) was set/reset, or that line was last read. For > details, you would need to look up a 6522 data sheet. Hm, shall have to check this. > > BTW: An unbuffered access to port A is available at $180F. > That's another interesting thing. You mean the status of the port bits on $1801 is a kind of "latched" one and the same bits are real- time accessible at $180f? I only looked up the 1541 mappings and don't recall noticing any description of that. One more reason to look-up the datasheet. > > Now, the first EOR $1801 reads the last content AND clears the buffer > for the next value. Clears the "latch" you mean? > This way, the next LDA $1801 clears A, ?? > but performs the handshake for > the C64 side to input the next data. The handshake seems to be done explicitly over the DATA line here, isn't it so? > While the floppy perform the BVC *, > the C64 has enough time to put the next value into the port which is > read by the 1541 via the EOR $1801 again. The weak point for me here is the LDA $1801. It happens immediately after sending the handshake, for which the 64 waits. What is then being read? Since 1541 is faster than the 64, chances are that the port is being read before 64 puts the next value on the port, am I right? Race condition comes to mind... > > Of course, this can be used in another way, too. The C64 does not need > to specifically write 0 into the buffer. The important thing is > that the > C64 has enough time between the LDA $1801 and the EOR $1801 to change > the value Yes - that's what I am suspecting that the timing might be enough here but just don't feel like understanding completely how it is done. > - and it will, depending on how the VIA is programmed (have a > look at the contents of $180C) - generate handshakes on CA2, which the > C64 can recognize. Good to learn something new every day :-) Actually I didn't know about the more advanced features of the VIA chip. In this case though I don't think those are used. > > Because there is some time in between the two commands, which > leaves the > C64 enough time to alter the value. Yes. The problem was twofold though. 1. I was expecting regular bytes here rather then EORed ones (after deeper digging I realised that I was looking at the wrong part of 64s code). 2. I didn't see the clear handshake or something to make me sure what's being read off the port with LDA. Oh, and 3. WTH so, rather than some clear LDA:STA as it does when transferring the other way. > > To be more precise, you would have to show us the C64 side. LFE48: LDY #$00 TYA LFE4B: EOR ($5D),Y wait_for_DATA_HI_FE4D: BIT $DD00 BPL wait_for_DATA_HI_FE4D STA $DD01 INY EOR ($5D),Y wait_for_DATA_LO_FE58: BIT $DD00 BMI wait_for_DATA_LO_FE58 STA $DD01 ; put byte on the USER PORT INY BNE LFE4B So now I found that it also does the EORing. This at least makes some sense in terms how come it actually works at all. But still don't fully understand "how", and completely don't understand "why". Might have something to do with the 6522 peculiarities but will have to look for the datasheet to check what's more in there. -- I have no special talents. I am only passionately curious. - Albert Einstein Message was sent through the cbm-hackers mailing list
Archive generated by hypermail pre-2.1.8.