hintz@quando.quantum.de (Stefan Hintz) (07/20/90)
In article <2186@mcrware.UUCP> ric@mcrware.UUCP (Ric Yeates) writes: >Netlanders: > I have been doing some work lately with MIDI and have run across the >following strange behavior (not MIDI related). >Here is the code (please excuse the formatting [brevity]): >#include <osbind.h> >#include <stdio.h> >unsigned long tick; >gt() { tick = *(long *)0x4ba; } /* get tick counter */ >st() { *(long *)0x4ba = tick; } /* set tick counter */ >unsigned long get_tick() /* get the tick counter from system */ >{ > Supexec(gt); return tick; >} >set_tick(ticks) /* set the system tick counter */ >unsigned long ticks; >{ > tick = ticks; Supexec(st); >} >wait(sec) /* wait for <sec> seconds */ >float sec; >{ > long stop = (int)(sec * 200) + get_tick(); > while (get_tick() < stop); >} >main() >{ > register int i; > for (i = 0; i < 20; i++) { > wait(0.5); /* wait for half a second */ > set_tick((long)i); /* set the tick counter to some value */ > } >} > When I run this program, it seems to complete without a problem. >The next time I access the hard disk (from Laser C) my mouse pointer >turns into a "bee" and never comes back. The problem seems to also be >related to both calling wait and set_tick together (either alone will >not cause this). ... > Thanks for the consideration. > Ric Yeates. A friend of me discovered last week the same problem: "GEMDOS-File-Operations stop working, after setting the 200Hz-System-timer to an other value !" He uses Turbo C 2.0 and TOS 1.4 . I remember that Alan Pratt of ATARI, said something that nobody should change the 200Hz-System-timer, because the whole Atari-Operationsystem depends on it. In my opinion, there is no reason to set the System-timer to a special value. The only thing, i use it for, is : a. read the current value, b. calculate the value for some time later c. do something while the current value is less than the later value like in the above C-example, but whithout calling set_tick() I suppose the 200Hz is used by the TOS in the strange way it detects the mediachange, but i am not shure. Maybe the nice people at Atari should tell us something about that. Stefan Hintz, Dortmund, Germany (hintz@quando.quantum.de)