HEX$

From C64-Wiki
Jump to navigationJump to search
BASIC keyword
Keyword: HEX$
Abbreviation: H Shift+E
Type: Function
Token code: UNK
Handling routine
in BASIC ROM:
UNK
List of all BASIC keywords


Remark: This article describes the BASIC function HEX$ in in Commodore BASIC V3.5 or higher.

Type: String Function 
General Programming-Syntax: HEX$(<numeric-expression>)

HEX$ can be used to convert a number to its hexadecimal equivalent.

HEX$(N) returns a 4 character string containing the hexadecimal representation of value N where N is 0 <= N <= 65535.

Examples[edit | edit source]

PRINT HEX$(0)

Returns "0000"

PRINT HEX$(65535)

Returns "FFFF"

PRINT HEX$(65536)

Displays "?ILLEGAL QUANTITY ERROR"

BASIC V2.0 (second release) Commands

ABS | AND | ASC | ATN | CHR$ | CLOSE | CLR | CMD | CONT | COS | DATA | DEF | DIM | END | EXP | FN | FOR | FRE | GET | GET# | GOSUB | GOTO | IF | INPUT | INPUT# | INT | LEFT$ | LEN | LET | LIST | LOAD | LOG | MID$ | NEW | NEXT | NOT | ON | OPEN | OR | PEEK | π | POKE | POS | PRINT | PRINT# | READ | REM | RESTORE | RETURN | RIGHT$ | RND | RUN | SAVE | SGN | SIN | SPC | SQR | STATUS/ST | STEP | STOP | STR$ | SYS | TAB | TAN | THEN | TIME/TI | TIME$/TI$ | TO | USR | VAL | VERIFY | WAIT