Hex$: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
m (1 revision)
(No difference)

Revision as of 14:11, 15 January 2012

 Hex$(A$)

The Hex$ internal function returns the string represented by A$, where A$ is in hexadecimal notation.

Comments and Examples

This function is frequently used to send a group of special characters to a printer.

00010 PRINT #255,USING 20: HEX$("1B51")
00020 FORM C 2,SKIP 0

Line 10 sends Esc and Q (ASCII values 1B and 51 in hexadecimal) to the printer. The SKIP 0 in line 20 makes sure that the printer stays on the same line (no line feed is added to the PRINT statement).

An additional common use of HEX$ is to activate printer translation as specified by PRINTER specifications in BRConfig.sys file. PRINTER specifications provide a way to minimize hardware differences between printers, usually without any program changes. All printer translations must begin with ASCII character 2B in hexadecimal notation, i.e., HEX$("2B"). There are more complex rules for valid values of the second character, but 00 will always work. Thus, many programs include HEX$("2B00") to begin printer translation. For more information, see the PRINTER specification in the BRConfig.sys chapter.

Related Functions

Inverse of UnHex$