emulator: a few fixes

- Do not allow setting thread enable mask for threads that don't exist
- Properly support more than 32 threads
mandelbrot: split threads by y instead of x