If ij then it is FindReg i Find least significant end of register i L3 Write 1 L Lto 2 1 ... (i-j) Find least significant end of register j Lto 2 1 L Move to actual bit :L0: `0 0 0 L 1; 0 1 1 L :L2:' Read bit to copy -- henceforth `carrying 0' L2 `0 0 1 R 1; 0 1 1 R :L3:' Check if this is the last bit -- to :L3: if so Rto 2 1 ... (i-j+1 times) Find mark left in register i Rto 2 1 Write 0 Write bit read from register j L :L1: Write 0 Erase old mark L4 Write 1 Leave a new one L Lto 2 1 ... (i-j+1) Find mark left in register j Lto 2 1 R Write 0 Erase it L Move to next bit to copy Goto :L0: and loop round :L2: Henceforth `carrying 1' L2 `0 0 1 R 1; 0 1 1 R :L5:' Rto 2 1 ... (i-j+1) Rto 2 1 Write 1 Write bit read L Goto :L1: and jump to common code :L3: Copy last bit which was a 0 Rto 2 1 ... (i-j+1 times) Find mark in register i Rto 2 1 :L4: Write 0 Write bit read to all high-order bits L Write 0 Erase mark -- on subsequent iterations this L2 will be 0 anyway, but that doesn't matter `0 0 0 L :L4:; 0 1 1 L :L7:' Loop round if not done :L5: Copy last bit which was a 1 Rto 2 1 ... (i-j+1 times) Rto 2 1 :L6: Write 1 Write bit read to all high-order bits L Write 0 L2 `0 0 0 L :L6:; 0 1 1 L 1' Loop round if not done :L7: FindStart Return to home position If ij then it is FindReg i Find the least significant end of register i L3 Write 1 Leave mark L Lto 2 1 ... (i-j times) Find the least significant end of register j Lto 2 1 L Move to actual bit :L0: `0 0 0 L 1; 0 1 1 L :L2:' Read bit -- henceforth `carrying 0' L2 Write 1 Leave mark R Rto 2 1 ... (i-j+1 times) Find mark in register i Rto 2 1 Write 0 and write bit read L :L1: Write 0 Erase mark L4 Write 1 and leave a new one L2 `0 0 0 L 1; 0 1 1 R :L3:' If this is the last bit go to :L3: Lto 2 1 ... (i-j+1 times) Find mark in register j Lto 2 1 R Write 0 and erase it L Move to next bit to copy Goto :L0: and loop round :L2: Henceforth `carrying 1' L2 Write 1 R Rto 2 1 ... (i-j+1 times) Rto 2 1 Write 1 Write bit read L Goto :L1: Jump to common code :L3: R Write 0 Erase mark L Lto 2 1 ... (i-j+1 times) Find mark in register j Lto 2 1 R Write 0 Erase it L `0 0 0 R 1; 0 1 1 R :L4:' Read last bit to copy -- henceforth `carrying 0' Rto 2 1 ... (i-j times) Find most significant end of register i Rto 2 1 R Write 0 Write bit read Goto :L5: :L4: Henceforth `carrying 1' Rto 2 1 ... (i-j times) Rto 2 1 R Write 1 Write bit read :L5: FindStart Return to home position