!pr2
!lm12
!rm44


Another Tricky Way....Bruce Love
           Hamilton, New Zealand

Here is my effort to improve your version of turning an index into a mask.  It uses (shudder!) self-modifying code, but it is shorter and faster and I think easy to understand.

LOVE.VERSION
      AND #7
      EOR #7
      STA .1+1
      LDA #1
.1    BNE .1  (OFFSET FILLED IN)
      ASL
      ASL
      ASL
      ASL
      ASL
      ASL
      ASL
      RTS


And Still Another...David Eisler
             Littleton, Colorado

With reference to "Turn Index into a Mask" (AAL Sept 84), here is another tricky alternative.  It uses only the A-register, is only 16 bytes long, and takes 9 to 23 cycles.

EISLER.VERSION
      AND #7
      STA .1+1
      LDA #$80
.1    BNE .1  (OFFSET FILLED IN)
      LSR
      LSR
      LSR
      LSR
      LSR
      LSR
      LSR
      RTS
