I want to stop multitasking and take over the machine to writte my own copper list and mess around with the data fetch registers and playfield pointers, modulo and ham and that type of stuff;) To prevent other tasks from interfering and screwing everything I read that I need to use the Exec forbid function. At the end of my prog I use permit func to restore multitasking.
What you really should do, is to install your custom input handler that eats all user input events, and then LoadView(NULL) + WaitTOF() + WaitTOF() to get rid of the system view. That way you have full multitasking system available, which has several benefits. You can use high priority (say 3 or 4) if you can't afford to lose CPU time.
When restoring you should poke back the graphics copperlist ptr and LoadView() + WaitTOF() + WaitTOF() the original view.
But...
Will this restore the register I been messing around with to their initial values?
No.
Many registers are writte only, so does this means that the OS stores a copy of their values somewhere?
OS knows how to write back sane values for most things, if you use proper startup. OS can't restore copper ptr however, or CIA register values. You should use ciaa and ciab resources to allocate these, if needed. Also OwnBlitter() + WaitBlit() before using blitter. When done, WaitBlit() + DisowbBlitter(). Audio channels should be allocated and released using audio.device if used.
If this doesn't restores the register values how can I do it?
What else should be done to restore the "initial" state?
Lots of stuff. You probably want to take a look at
DemoStartUp.lha. Even though this is a OS compatible startup code, it includes lots of useful stuff.
I'll look into my ASM source archive and see if I can come up with some example code.