Main Index Routine Index Memory Index
Previous Page Next Page
Routine $052A: Find DOS reference sector on current track
(integrity check; ~recalibrate head onto track before).
This routine searches for a sector with a relatively short data byte
sequence enclosed by very long SYNC marks (max $18 tries).
Routine $0733 finds the next following SYNC mark and measures it's length.
Then for each following byte-ready the value 6 is subtracted from the length.
If there are too many byte-readys it gets negative and the whole is tried
again with the next SYNC mark. If there is no SYNC mark for $18 times the
head gets repositioned onto the Track (max [$C6] times) and the routine
is restarted (with $18 tries again).
There's a very short Timer set while the byte-readys are "counted". The Timer
runs out when the head runs into a long SYNC mark so no more byte-readys
occur.
The sector that is searched for is the hidden sector that resides on all
Tracks. Register A has the measured "length" on jump to the $0764 routine
(measured SYNC length minus number of byte-readys times 6).
The $0764 routine sets [$11]:= (measured "length" - [$1D]), and puts the
the Key for the current Track into [$0E] (~number of $7Bs in extra sector;
from Track 36 Key Sector)
JSR from $055E, Jump from $054F:
052A: A9 18 LDA #$18
052C: 85 C5 STA $C5 ; $18 tries to find the short extra sector on current Track
Jump from $054A:
052E: A2 1D LDX #$1D ; start value for following SYNC length measurement
0530: 20 33 07 JSR $0733 ; Measure length of next following SYNC mark (in X). CF:=0, [$BD]=A:=6 if SYNC found.
0533: B0 17 BCS $054C ; branch if no SYNC found -> reposition head and try again
0535: 49 83 EOR #$83 ; (6 xor $83)= $85
0537: 38 SEC ; set error flag (will later be cleared if all ok)
0538: 8D 05 1C STA $1C05 ; set Timer [$1C05]:=$85
053B: 8A TXA
Jump from $0541, $0546:
053C: AC 05 1C LDY $1C05
053F: 10 11 BPL $0552
0541: 50 F9 BVC $053C ; loop while no byte-ready
0543: E5 BD SBC $BD ; subtract [$BD]=6 for each byte-ready
0545: B8 CLV
0546: B0 F4 BCS $053C ; loop while A>=0
0548: C6 C5 DEC $C5
054A: D0 E2 BNE $052E ; branch to continue with next sector if still tries left
JSR from $041D, Jump from $0533:
054C: 20 04 06 JSR $0604 ; Recalibrate head onto Track
054F: 90 D9 BCC $052A ; branch if tries left ([$C6]>0) -> full restart with next sector
0551: 60 RTS ; error, no tries left
Jump from $053F:
0552: 88 DEY
0553: 84 17 STY $17
0555: 4C 64 07 JMP $0764
Previous Page / Next Page