<!-- var kmNextPage = "a251_wp_characters.htm"; var kmPrevPage = "a251_wp_expressionsand ops.htm"; var kmNextPageTitle = "Characters"; var kmPrevPageTitle = "Expressions and Operators"; var kmBreadCrumbs = "<a href=\"default.htm\">Home</a> &raquo; <a href=\"a251_writeprograms.htm\">Writing Assembly Programs</a> &raquo; <a href=\"a251_wp_expressionsand ops.htm\">Expressions and Operators</a> &raquo; Numbers"; kmSetupPaging (); kmNavButtons(); //--> Numbers

Numbers may be specified in hexadecimal (base 16), decimal (base 10), octal (base 8), and binary (base 2). The default representation is decimal. A decimal, octal, or binary number's first character must always be a digit (0-9). Hexadecimal numbers whose first character is not a digit (0-9) must be prefixed with a zero ('0'). The following table illustrates various types of numbers:

Base Suffix Valid Characters Examples
Hexadecimal H,h 0-9, A-F, a-f 1234H 99H 123H 0A0F0H 0FFH
Decimal D,d 0-9 1234 65590D 20d 123
Octal O,o,Q,q 0-7 177O 7777o 25O 123o 177777O
Binary B,b 0-1 1111B 10011111B 101010101B

Note

• Hexadecimal numbers may be written using C notation. For example, 0x12AB.
• Hexadecimal numbers must begin with a 0 if the first digit is A-F.
• The dollar sign character ('\$') may be used in numbers to make them more readable (as long it is not the first or last character). For example:
```1111\$0000\$1010\$0011B   - is equivalent to -   1111000010100011B
1\$2\$3\$4                - is equivalent to -   1234
```
Colon Notation for Numbers

The A251 assembler supports the notation page:number for specifying absolute addresses. Numbers specified with this notation receive the memory type EDATA when page is 0 or ECODE for all other pages. In this way, you can use such numbers for referencing any memory location. For example:

```ABSVAL1  EQU   0:20H       ; symbol to address location 20H
ABSVAL2  EQU   0:80H       ; symbol to address location 80H in EDATA space
PORT0    EQU   S:80H       ; symbol to SFR space 80H
ENTRY    EQU   10:2000H    ; entry point at location 102000H

MOV   WR0,ABSVAL1
MOV   R1,ABSVAL2
MOV   PORT0,R1
EJMP  ENTRY
MOV   S:80H,R1
EJMP  10:2000H
```

The colon notation is accepted in several A251 controls and is converted as described.

Number in Colon Notation Replaced With
VAL1 EQU 0:20H VAL1 EQU EDATA 20H
VAL2 EQU 0FF:1000H VAL2 EQU ECODE 0FF1000H
ORG 0FE:2000H ?modulename?number SEGMENT ECODE AT 0FE2000H RSEG ?modulename?number
ORG 0:400H ?modulename?number SEGMENT EDATA AT 400H RSEG ?modulename?number
CSEG AT 0FE:2000H ?modulename?number SEGMENT ECODE AT 0FE2000H RSEG ?modulename?number
BVAR1 BIT 0:20H.1 BVAR1 BIT 20H.1
BVAR1 BIT 0:30H.1 BVAR1 EQU EBIT 30H.1
PUSH.B #13 PUSH BYTE #13
PUSH.W #13 PUSH WORD #13

Note

• The colon notation is provided for source compatibility with other 251 macro assemblers. If you do not need to port your code to other assemblers, it is recommended that you use the replacement sequence in your assembler source file.

Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.