StuffHex
You can use theStuffHexprocedure to hardcode byte values into memory.
PROCEDURE StuffHex (thingPtr: Ptr; s: Str255);
thingPtr- A pointer to any data structure in memory. If
thingPtris an odd address, thenthingPtris 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,
StuffHexmay set bytes in the data structure pointed to bythingPtrto arbitrary values. If there are an odd number of characters in the string, the last character is ignored.DESCRIPTION
TheStuffHexprocedure 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
StuffHexprocedure sets the value of individual bytes, it does not move relocatable blocks. Thus, you can call it at interrupt time.SPECIAL CONSIDERATIONS
TheStuffHexprocedure does no range checking to ensure that bytes being set are within the bounds of a certain data structure. If you do not useStuffHexcarefully, you may change memory in the partition of your application or another application in unpredictable ways.SEE ALSO
For examples of the use of theStuffHexprocedure, see page 3-19.