Please refer to the arrowed commented comments in the lines and try to understand, because i can't

Explanation would be welcomed

Code: Select all
If StartDrawing(ScreenOutput())
DrawText(200,300,"md = "+Str(md)+"; PMODE = "+Str(PMODE),$eeeeee,0)
StopDrawing()
EndIf
Code: Select all
!fistp dword[v_MustDelay];<- MustDelay=DispPeriod-(checkpoint2-checkpoint1)/SysFreq.
manu, my hero! big thanks, you have discover a bug in the snippetmanu wrote:I had a look at your code.
The problem is that in your inline assembly lineyou store 32bits at the address of your variable MustDelay which is only 8bits wide, which is why your variable PCODE (also 8bits) gets overwritten. When you make PCODE larger, it probably gets stored somewhere else so it isn't overwritten and the code seems to be fine.Code: Select all
!fistp dword[v_MustDelay];<- MustDelay=DispPeriod-(checkpoint2-checkpoint1)/SysFreq.
Change MustDelay.b to MustDelay.l and everything works as expected.
manu