On Sun, Mar 6, 2016 at 2:17 PM, Brian Walenz <thebri at gmail.com> wrote:
http://www.dbit.com/putr/putr.asm has the following:
;
; RX01 interleave routine.
;
; bp logical device rec
; ch cylinder (0-75.)
; cl logical sector (0-25.)
;
; On return:
; ch cylinder (1-76.)
; cl sector (1-26.)
;
; From RT-11 V04 DY.MAC:
;
; ISEC=(ISEC-1)*2
; IF(ISEC.GE.26) ISEC=ISEC-25
; ISEC=MOD(ISEC+ITRK*6,26)+1
; ITRK=ITRK+1
;
There is also yet another implementation of this in the 2.11BSD source
code file src\sys\pdpstand\rx.c
/*
* rxfactr -- calculates the physical sector and physical
* track on the disk for a given logical sector.
* call:
* rxfactr(logical_sector,&p_sector,&p_track);
* the logical sector number (0 - 2001) is converted
* to a physical sector number (1 - 26) and a physical
* track number (0 - 76).
* the logical sectors specify physical sectors that
* are interleaved with a factor of 2. thus the sectors
* are read in the following order for increasing
* logical sector numbers (1,3, ... 23,25,2,4, ... 24,26)
* There is also a 6 sector slew between tracks.
* Logical sectors start at track 1, sector 1; go to
* track 76 and then to track 0. Thus, for example, unix block number
* 498 starts at track 0, sector 25 and runs thru track 0, sector 2
* (or 6 depending on density).
*/
static
rxfactr(sectr, psectr, ptrck)
register int sectr;
int *psectr, *ptrck;
{
register int p1, p2;
p1 = sectr / 26;
p2 = sectr % 26;
/* 2 to 1 interleave */
p2 = (2 * p2 + (p2 >= 13 ? 1 : 0)) % 26;
/* 6 sector per track slew */
*psectr = 1 + (p2 + 6 * p1) % 26;
if (++p1 >= 77)
p1 = 0;
*ptrck = p1;
}