Ok, I'm here again... always learning. I just want to share with you what I've seen so perhaps someone with more knowledfe could explain how to solve this problem.
I've not found the place where surface is partially updated, so I tried to understand what happens. I decided to write a green full rect in main surface after each SDL_Flip. This way I'm sure next SDL_Flip will had all surface changed (I've just found two SDL_surfaces: one for menu and another one for emulation called prSDLScreen). The result is this:
https://www.youtube.com/watch?v=2tFosSeI1R4Soooo... I'm missing something. Now I'm sure surface is fully updated (at least all pixels are green after SDL_Flip) so I'm pretty sure next SDL_Flip will draw entire frame. Then.. why it's flickering? Perhaps some part of code is writting directly to SDL_Surface memory and SDL didn't know? I decided to create a new surface called real_surface and change all SDL_Flip. Now code just flips this new real_surface. Prior to each SDL_Flip I blit prSDLScreen into real_surface and then flip real_surface. This way I'm sure code don't paints directly to screen memory... and it works.
But, I know this is not the solution. I can now compile with double buffer, but with this two surfaces... I'm doing a quad buffer or what? I've tried some games and framerate doesn't change so now I'm not sure even that I'm using double buffer or not (framerate is low)
I don't know if anyone more clever has already done all this and I'm wasting my time with all this stuff...
If you want to try it,I've uploaded OPK to
https://www.mediafire.com/?dckl5fz35t5581r (kick.rom expected at $HOME/.uae4all/roms directory)