On Dec 21, 2017, at 9:59 AM, Programmingkid programmingkidx@gmail.com wrote:
On Dec 21, 2017, at 9:36 AM, Jd Lyons lyons_dj@yahoo.com wrote:
I don’t know, this maybe an issue with the way we have defined “us”.
Looking through the SLOF code it seems they call it like this in the timebase.fs:
: tb@ ( -- tb ) BEGIN tbu@ tbl@ tbu@ rot over <> WHILE 2drop REPEAT 20 lshift swap ffffffff and or ;
: milliseconds ( -- ms ) tb@ d# 1000 * tb-frequency / ; : microseconds ( -- us ) tb@ d# 1000000 * tb-frequency / ;
: ms ( ms-to-wait -- ) milliseconds + BEGIN milliseconds over >= UNTIL drop ; : get-msecs ( -- n ) milliseconds ; : us ( us-to-wait -- ) microseconds + BEGIN microseconds over >= UNTIL drop ;
Not sure if I can port/hack this code over, the copier seems to have trouble with tbu@ tbl@?
The ms and get-msecs words don't appear to be implemented correctly on OpenBIOS. 10000 ms should pause OpenBIOS for 10 seconds. It does not.
I did find a function called udelay() in the drivers/timer.c file. Maybe I can implement the word us using udelay(). Then the ms word could be implemented using the us word.
See what you can do about : us, but we maybe running into an issue with Qemu/mac99. Every version of the Mac OS reports a different bus and cpu speed, so we maybe having trouble with the way the timebase is calculated in Qemu.
I imagine it is difficult to emulate a fixed frequency isolator, or I’m way off base and people should just ignore me;-)
Just spitballing, really.