[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] High order bits



On Mon, May 01, 2000 at 03:23:36PM -0400, Bernie Cosell wrote:
> As an archaeological footnote to this, the DEC PDP-6 [later evolved to 
> the -10 and then the -20, DEC's line of (wonderful!) 36-bit computers] 
> had an opcode "JFFO" -- jump if find-first-one which would find you the 
> *highest*order* bit set in the word [falling through if the word was zero 
> and there was no bit to find]... can't remember what it did [it either 
> turned the bit off or gave you its bit-position or something when it DID 
> find a one-bit].

>From pdp-10.info:

--

JFFO    Jump if Find First One.  This is not actually a shift
        instruction, but it is a related sort of thing.  It counts the
        number of leading zeros in the contents of AC, and stores this
        number in AC+1.  (If AC contains zero, the number stored in
        AC+1 is zero, not 36).  The instruction also jumps to its
        effective address if C(AC) # 0 (in other words, if it
        succeeded in finding the first one bit).

Example:

;Suppose that each bit in accumlator 1 is a flag
;telling us that some sort of processing needs to be done.
;We would like to find out which flags are set
;and, for each one, do the processing.  But we don't want to
;waste a lot of time checking flags which are not set.

LOOP:   JFFO 1,[JRST @TABLE(2)]
        ...                     ;Here all flags are zero.

TABLE:  FOO                     ;FOO handles flag bit 0
        BAR                     ;BAR handles flag bit 1.
        ...                     ;Other addresses for the remaining
flags.

FOO:    ...                     ;Do the work.
        TLZ 1,400000            ;Clear flag bit 0
        JRST LOOP               ;Find the next flag which is set.

-- 

Adam Sampson
azz@gnu.org

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe