We've met a lot of numbers in the previous examples. Technically speaking, these were numeric constants (constant because they don't change value like a variable might). They were all decimal numbers, but you can use hexadecimal and binary numbers as well. There's also a way of specifying a number using characters. To specify a hexadecimal number you use a $ before the digits (and after the optional minus sign - to represent a negative value). To specify a binary number you use a % instead.
Specifying numbers using characters is more complicated, because the base of this system is 256 (the base of decimal is ten, that of hexadecimal is 16 and that of binary is two).
The digits are enclosed in double-quotes (the " character), and there can be at most four digits.
Each digit is a character representing its ASCII value.
Therefore, the character A represents 65 and the character 0 (zero) represents 48.
This upshot of this is that character A has ASCII value
"A" in E, and
("0" * 256) + "z" = (48 * 256) + 122 = 12,410.
However, you probably don't need to worry about anything other than the single character case, which gives you the ASCII value of the character.
The following table shows the decimal value of several numeric constants. Notice that you can use upper- or lower-case letters for the hexadecimal constants. Obviously the case of characters is significant for character numbers.
Number Decimal value ---------------------- 21 21 -143 -143 $1a 26 -$B1 -177 %1110 14 -%1010 -10 "z" 122 "Je" 19,045 -"A" -65
Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.