Next time you should tell which line is causing the error. I am guessing it is the loop
instruction, because that only exists with a 8 bit offset. Due to optimization reasons, it's it's recommended to avoid using it anyway, and that will solve your jump range problem too. So, just replace it with a dec ecx; jnz top
.
You could also optimize your checks, but that's another story.