Sure! The short form of the explanation is something like this: C64 #1 is put into a polling wait loop, which is just waiting for the other C64 to set the CLK bit. When that bit is set, it just starts playing. The tunes running on each computer are assumed to run in the same speed, so this is really just starting them at the same time. It is not actively listening for more sync signals after the initial start. Both C64s sends sync singnals every time a new sequence/pattern is started though, so it is possible for any C64 to re-sync at a new pattern start at any time.
So.. to elaborate a bit. That wait loop in C64 #1 just looks like this:
- bit $dc01 ;Check STOP-key, in order not to get locked in the polling loop
bpl .stopwait
bit $dd00 ;Wait until CLK bit is set..
bvs -
Before that $dd00 is set like this in C64 #1:
lda $dd00
ora #%00100000 ;Set DATA bit (makes it 0 on the other side)
sta $dd00
C64 #2 sets the CLK bit like this to make C64 #1 start playing:
;Send sync signal
lda $dd00
bmi .nosyncrequest
.syncrequest: ;Reply by setting CLK bit
ora #%00010000 ;Set CLK bit (makes CLK 0 on the other side)
sta $dd00
;Some delay to allow the other C64 to react
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
lda #%11000111 ;=199 - back to normal
sta $dd00 ;Back to normal...
.nosyncrequest:
That delay is probably just quite arbitrary. I don't think I did any careful calculations to figure out how many nops were enough.
So this is really quite simple. The longer version of the explanation would also involve explanation of some other features that surrounds this stuff. There is some code that actively prevents the other C64 from sending sync signals when the other has gone into the disk menu, and things like that, which means that there are also some other things going on. Don't hesitate to send me a PM in case you want me to elaborate on this.