http://www.newton-inc.com/dev/techinfo/qa/qa.htm
ExtractByte
or ExtractWord
or possibly ExtractLong
to get the bytes out in integer form, then do something with them. However, keep in mind that NewtonScript integers are only 30 bits wide, whereas the serial number is 64 bits wide, so you'll never be able to put all the information contained in the serial number into a single integer. (3 integers would be required.)SetClass
to change it's class to 'real
, which would effectively "cast" the 8-byte object to a real number. This is a bad idea, because real numbers are interpreted using bitfields with special meanings, and it's possible for two real numbers to have different binary representations and still evaluate as equal using the '=' operator. (Any two not-a-number values will do this.)StrHexDump
is the best way to format the serial number object for humans to read. If you want to break it up to make it more easily readable, you could do something like this: local s := StrHexDump(call ROM_GetSerialNumber with (), 2); StrReplace(s, " ", "-", 3);
Which produces this string (on my unit): "0000-0000-0154-8423 "
Please note that the serial number provided by the chip does NOT match the serial number that Apple Computer and other Newton device manufacturers may put on the outside of the case. When supporting a device, Apple and its licensees will most likely request the user-visible serial number, typically found on a sticker on the case. Please be sure that you present data from the internal chip-based serial number in such a way as to ensure the user will not be confused. (This is the reason the chip-based serial number is not displayed by any software built into the device.)