IB Statements/decihex

From CometWiki

< IB Statements
Revision as of 10:55, 22 May 2009 by Badge (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

DECIHEX function

Syntax: DECIHEX(numeric-argument)

Discussion: The DECIHEX function converts the numeric-argument (up to length.precision of 10.0) into a 4-byte Intel hex formatted string.

Note: Intel-based systems store numeric data in "Intel hex format." Windows passes data in this format to Comet and expects the same in return. This function, along with the IHEXDEC function, provide a streamlined way to convert formats.

For example, consider the numeric value 6636321. The DECIHEX function converts this value to the equivalent Intel format, which is "@21436500@".


 Set TestHex$ = "@21436500@"  ! 0x00654321
 Set TestDec = 6636321
 Length 4 & Local Hex$
 Length 10.0 & Local Dec
 Print (Cs);(Et)
 Hex$ = TestHex$
 Dec = IHexDec(Hex$)
 If (Dec EQ TestDec)
 Print "IHexDec succeeded"
 Print "IHexDec failed"
 Hex$ = DecIHex(Dec)
 If (Hex$ EQ TestHex$)
 Print "DecIHex succeeded"
 Print "DecIHex failed"
Personal tools