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. An example: Assume, _hz200 currently is 0xffff. You first read 0x4b8 and get 0x0 for the lower word. Then you read 0x4bc, but in the meantime _hz200 has increased to 0x10000, so you get 0x0 for the upper word, too. Combine the two to get the wrong result 0x0 for _hz200. Reading 0x4bc first won't make things better, just that the wrong result may now be 0x1ffff for _hz200 ... Besides, Ssystem() is not just capable of accessing system variables (btw, the design for reading them is broken, as there's no way for you to decide whether the return value -36 for a long is the actual contents or just the error value "Access denied"), but also has opcodes to get the the MiNT version number, manipulate the caches, and many more. Ciao Thomas -- Thomas Binder (Gryf @ IRCNet) gryf@hrzpub.tu-darmstadt.de PGP-key available on request! binder@rbg.informatik.tu-darmstadt.de Vote against SPAM: http://www.politik-digital.de/spam/
Attachment:
pgpcXMhbggzyd.pgp
Description: PGP signature