Okay, this is a weird story:
Christmas 2003: I started coding the main scroll&play routines, I encountered a bug. When clearing pages 195-199 (PMbase1) the atari locked up (PAL mode). Then I changed it to 196-199 (4 pages instead of 5). The lockup didn't occur anymore.
There was a second area that needed to be cleared: pages 204-207 (PMbase2), so I wrote another clearing routine. Now the atari in NTSC mode locks up. How is this possible????
lda #0 ;value to be stored in memory
ldy #204 ;starting page
ldx #4 ;number of pages
Well. I tried many different things: Firstly clearing 3 pages (204-206) and in another version clearing pages (205-207) (with my clear-page subroutine: x-register denotes number of pages!!!): so if you clear 3 pages nothing goes wrong, and it doesn't matter which pages are cleared.
weird isn't it!!
then I just thought that maybe a zeropage register ("z_dest" as postindexed indirect,y instruction) was used twice (f.e. by a DLI or VBI routine, so things will interfere). The fillmem routine makes use of a zeropage pointer for writing 0's into locations.
this wasn't the case, but when I turned off all interrupts, the problem was solved....hmmmm :!:
Now this is the explanation, and it has nothing to do with PAL/NTSC-compatibility:
The ingame screen is divided in 2 parts: playing field and status window. A Displaylist Interrupt is triggered between them that changes fontpage and setcolors. The DLI however makes use of the x-register !!!! (pagecounter of fillmem routine) and will take the value zero when the DLI is executed:
WELL: beginners mistake #1: I didn't save x to the stack, as you should always do in interrupts, so after the DLI was executed, a zero was returned to x, which results in 256 pages to be cleared: THE WHOLE atari memory: 64 kbytes
Now I did insert the save x (txa pha) and load x (lda tax) and the problem is solved:
BUT, we've got just one question left: why on NTSC and not on PAL:
well, the clearing of the memory always starts at an exact timing and clearing 4 pages takes more cpu time than clearing 3 pages so: while a PAL frame is longer than an NTSC frame, we can clear exactly 4 pages in a PAL frame, and exactly 3 pages in an NTSC frame BEFORE the conflicting DLI occurs (the clearing process is clearly done in less than a frame). That explains why I couldn't clear 5 pages in PAL mode, but just 4.
I thought there was some kind of ghost hiding inside my atari, but now this clears things up, and after all I understand what went wrong.
....but now it should work