[OpenBIOS] MS word

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Mon Apr 30 14:23:12 CEST 2012

On 29/04/12 02:34, Tarl Neustaedter wrote:

>> The MS word is suppose to wait a specified amount of milliseconds
>> before allowing a program to continue. Yet when a simple line of code
>> like this is run: "1000 MS ." hi" ", the message is printed
>> immediately. This happens no matter how high the top value on the
>> stack is. Is this a bug or am I missing something?
> Looks like a bug. A common one, since there is no generally accepted way
> of measuring delay inside the Forth engine - we seem to always hand-code
> a platform-specific method in Openboot (these days we use the "stick"
> register to measure real time, and have a property to correlate the
> counter to real nanoseconds).
> We've several times had bugs where under some conditions, the
> measurement of real time differed from virtual time by orders of
> magnitude - both ways.

It's even worse than that in OpenBIOS:

0 value dummy-msecs

: get-msecs    ( -- n )
   dummy-msecs dup 1+ to dummy-msecs

: ms    ( n -- )
   get-msecs +
   begin dup get-msecs < until

Effectively we just increment the counter every time we call get-msecs, 
and then just exit after n iterations. If you want something near a 
concept of real time, I guess you'd have to implement get-msecs for your 
platform by reading a hardware counter/timer of some description.



More information about the OpenBIOS mailing list