I was wondering when someone would notice that you don't have to do something as complicated as an alternating sum. My implentation on the 6502 would look something like:
; number in NUM, number of bytes in X
DIV17Q CLC ; clear carry LOOP ADC NUM,X ; add with carry DEX BNE LOOP ADC #0 ; add in last carry STA TEMP ; store A in EOR instruction ROR ; rotate A 4 bits ROR ROR ROR TEMP EQU *+1 EOR #0 ; exclusive or doesn't care about carry AND #$0f ; isolate bottom 4 bits
; accumulator is zero and Z is set if NUM contains a multiple of 17
Scott