Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!ucbcad!ucbvax!CORY.BERKELEY.EDU!dillon From: dillon@CORY.BERKELEY.EDU (Matt Dillon) Newsgroups: comp.sys.m68k Subject: Re: Recent Motorola ad seen in Byte Message-ID: <8705031814.AA01450@cory.Berkeley.EDU> Date: Sun, 3-May-87 14:14:49 EDT Article-I.D.: cory.8705031814.AA01450 Posted: Sun May 3 14:14:49 1987 Date-Received: Sun, 3-May-87 20:18:57 EDT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 26 >>1. how would you code a string instruction like FFS (find first set bit) >> to fit in something like the 68010's single instruction looping >> feature/cache? > > moveq.l #31,D0 > move.l ea,D1 >loop asl.l #1,D1 > dbcs loop It also occurs to me that one could use a 256 byte lookup table and then make the string length arbitrary: move.l string_base,A0 move.l table_lookup_base,A1 clr.l D0 loop move.b (A0)+,D0 move.b 0(A1+D0.W),D1 beq loop (D1 contains bit number. If you want to stop at a \0, simply load table entry 0 with some illegal bit number like $FF) Although this does not use a DBcc, and takes about 270 bytes more memory, it is quite a bit faster than the DBcc since we are checking bits a byte at a time. -Matt