SourcePoint AMD Help

Table of Contents

base

Display or change the default number base.

Syntax

base [= {expr | bin | oct | dec | hex}]

Where:

expr

specifies a number or an expression that evaluates to one of the number base prefixes {2, 8, 10 or 16}. If any other value is entered, an error message is displayed. The default is 16 for hexadecimal.

bin

sets the default number base to binary.

oct

sets the default number base to octal.

dec

sets the default number base to decimal.

hex

sets the default number base to hexadecimal.

Discussion

Use the base control variable to display or change the default number base in the command interpreter. All input is interpreted according to the current base except in the presence of a base suffix or prefix. All numeric output displays in the current base except for some special cases (e.g., real numbers always display in decimal). If you enter the base control variable without options, the current value displays.

You can also use base as an expression within other commands and as a variable (e.g., variable = base). The base control variable is type ord2.

The override prefixes and suffixes are shown in the following table.

Prefix

Base

Suffix

0y

Binary

y

0o

Octal

q,o

0n

Decimal

n,t

0x

Hexadecimal

h

Note: Use a base suffix when setting the base to ensure correct results. For example, base = 10 will not change the base to decimal if the current base is hexadecimal. ย Use base = 10t instead.

Example 1

To display the current number base:

Command input:

base

Result:

0010H

Example 2

To set the current number base to decimal:

Command input:

base = 10t

base

Result:

10T

Example 3

To set the current number base to hexadecimal:

Command input:

base = hex

base

Result:

0010H

Example 4

To save and then restore the current display base:

Command input:

define ord2 svBase = base
base = oct
base

Result:

000010O

Command input:

base = svBase
base

Result:

0010H

Related Topics: