StuffHex
You can use theStuffHex
procedure to hardcode byte values into memory.
PROCEDURE StuffHex (thingPtr: Ptr; s: Str255);
thingPtr
- A pointer to any data structure in memory. If
thingPtr
is an odd address, thenthingPtr
is interpreted as pointing to the next word boundary.s
- A string of characters representing hexadecimal digits. Be sure that all characters in this string are hexadecimal digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F). Otherwise,
StuffHex
may set bytes in the data structure pointed to bythingPtr
to arbitrary values. If there are an odd number of characters in the string, the last character is ignored.DESCRIPTION
TheStuffHex
procedure sets bytes in memory beginning with that byte specified by the parameterthingPtr
. The total number of bytes set is equivalent tos[0] DIV 2
(that is, half the length of the string, ignoring the last character if the number of characters is odd).Each byte to be set corresponds to two characters in the string. These characters should represent hexadecimal digits. For example, the string
'D41A'
results in 2 bytes being set to the values $D4 and $1A, respectively.Although the
StuffHex
procedure sets the value of individual bytes, it does not move relocatable blocks. Thus, you can call it at interrupt time.SPECIAL CONSIDERATIONS
TheStuffHex
procedure does no range checking to ensure that bytes being set are within the bounds of a certain data structure. If you do not useStuffHex
carefully, you may change memory in the partition of your application or another application in unpredictable ways.SEE ALSO
For examples of the use of theStuffHex
procedure, see page 3-19.