
Spotted another bug: 'old loader' option is ignored if combined with F16 speed. Will be corrected.
I'm not going to hurry as all this needs testing and double check before release.
Code: Select all
0103 6 20 62 01 JSR $0162 Read a byte, waiting for value $24 to start
0106 C9 24 CMP #$24 is it $24? (no bit sync, the signal begins with several stop bits!)
0108 D0 F9 BNE -7 No, then loop waiting for $24 to start
Yes, that's one of the reasons it took me a while: after each break, it was taking me a while to recall everything.
Well I think it's here for historical reasons, my very starting point was the ROM loading code! I honestly think it's pointless now, just 3 samples gap and a starting bit would work I think. But you're right, these are Novalight encoded bytes and removing them saves something like... 0.003 seconds. Except to save room for the stack, and unless I found some significant new compression idea, they can remain here
Code: Select all
Reading data (normal byte)
0176 2 A9 FE LDA #$FE Set accumulator bits to 11111110 => after ROL, will always give C=1 (luckily avoids SEC
before BCS) except for the last which allows to exit => no need for a loop index.
0178 2/3 B0 FE BCS -2 infinite loop (wait for interrupt with a 3 cycles precision; will stack PC and P)
017A* 2 E0 96 CPX #$96 Length <= 5 samples, so C=1, else C=0 *** *** CHANGE HERE THRESHOLD 4/5 *** ***
017Cj 2/3 B0 06 BCS +6 jump if 3 or 4 samples (C=1)
017E 2 2A ROL A 1st bit: add C to A (here C=0 for 5 or 6 samples)
+ CPX 6/7 samples threshold
+ BCS+2 if it's a 6, jump; if it's a 7...
+ ASL add a 0 bit
+ ASL add a 0 bit
017F* 2 E0 7C CPX #$7C 2nd bit: test if length < 6 samples *** *** CHANGE HERE THRESHOLD 5/6 *** ***
0181j 3 4C 87 01 JMP $0187 go to the last ROL: add C to the byte (5 samples = read '01', 6 samples = read '00')
0184 2 2A ROL A 1st bit: add C to the byte (here, C=1 for 3 or 4 samples)
0185* 2 E0 A9 CPX #$A9 2nd bit: test si length < 4 samples *** *** CHANGE HERE THRESHOLD 3/4 *** ***
0187 2 2A ROL A and directly add it to the byte (3 samples ='11', 4 samples = '10')
0188j 2/3 B0 EE BCS -18 If c=1, loop; if 0: A has been filled => end of loop
PLP
BCC+2
018A 2 49 FF EOR #$FF invert decoded bits, as they were decoded inverted (to save time)
018C 6 60 RTS
Ok, I was optimistic: Zorgon only goes from 14.5 to 14.2 seconds.