0

Ball In A Box Productions
; *** Iterate through all combinations of a fixed ; *** number of bits in reverse order bitOdom2 proc STDCALL bitCount:DWORD, highBit:DWORD sub edx,edx ; zero to bit pattern mov eax,bitCount ; number of bits in pattern bts edx,eax ; set the nth bit on dec edx ; number of required bits on next: sub ecx,ecx ; zero a back counter mov ebx,highBit ; number of bits in pattern lp00: inc ecx ; increment the back counter bsr eax,edx ; bit search right je noBits ; no bits left btr edx,eax ; reset the left most bit inc eax ; point to next bit left dec ebx ; reduce the highest bit position cmp ebx,eax ; compare current high to bit pos jc lp00 ; loop if bit outside range lp01: bts edx,eax ; set one bit on in new position inc eax ; next hightest bit position loop lp01 ; dec back count, loop if not zero ; *** odometer values incremented and correct nop ; action to be taken jmp next ; loop and get next bit pattern noBits: ret bitOdom2 endppseudocode