[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] Ssystem() & Setexec()
Thomas Binder <gryf@hrzpub.tu-darmstadt.de> writes:
|> --TB36FDmn/VVEgNH/
|> Content-Type: text/plain; charset=us-ascii
|> Content-Transfer-Encoding: quoted-printable
|>
|> Hi!
|>
|> On Fri, May 21, 1999 at 01:14:21PM +0300, Thomas GOIRAND wrote:
|> > So, why did "ssystem()" was created if such function was in the
|> > system from TOS 1.0 ???
|>
|> Because with Setexc(), you can only access memory that is word-aligned.
|> Imagine you wanted to read _hz200, the 200Hz counter, which is located
|> at 0x4ba. Using Setexc(), you'd have to use two calls, one to read 0x4b8
|> and a second to read 0x4bc, and then combine the lower word of the first
|> call with the upper word of the second. But, you can't be sure that the
|> value you construct is correct, because between the two calls, the
|> counter may have passed a word boundary.
This can be solved by repeatedly reading until the value stabilizes.
Start with reading the lower word, then read the higer word, then read the
lower word again. If it didn't change, then you are sure that the high
word is correct. Otherwise read the high word again. If you know that
all this took less than 5ms, you can stop here, otherwise just repeat.
--
Andreas Schwab "And now for something
schwab@issan.cs.uni-dortmund.de completely different"
schwab@gnu.org