0

Ball In A Box Productions
; *** Iterate through all double word unique values ; *** in ascending order of any length (qty>range) ; *** buffer pre filled with 0 to qty-1 unqOdom proc STDCALL buff:DWORD,qty:DWORD,range:DWORD push edi ; push edi onto the stack mov edi,buff ; address of odomoeter values lp02: mov ecx,range ; highest element number +1 mov edx,qty ; number of digits in the odometer lp00: dec ecx ; max value for each element dec edx ; index to right most element js finish ; exit if odometer has expired inc dword ptr [edi+edx*4] ; increment the element cmp ecx,[edi+edx*4] ; compare element value to its max+1 jc lp00 ; loop if element expired mov eax,[edi+edx*4] ; get the last incremented element lp01: mov [edi+edx*4],eax ; store the value inc eax ; value one more than the preceeding inc edx ; next element to the right cmp edx,qty ; is this outside the array jne lp01 ; loop until end of array found ; *** odometer values incremented and correct nop ; action to be taken jmp lp02 ; loop and increment the odometer finish: pop edi ret unqOdom endppseudocode